Deleted Added
sdiff udiff text old ( 12403:7be05f61abf3 ) new ( 12497:cbc435d1d7c0 )
full compact
1/*
2 * Copyright (c) 2010-2014, 2016-2018 ARM Limited
3 * Copyright (c) 2013 Advanced Micro Devices, Inc.
4 * All rights reserved
5 *
6 * The license below extends only to copyright in the software and shall
7 * not be construed as granting a license to any other intellectual
8 * property including but not limited to intellectual property relating
9 * to a hardware implementation of the functionality of the software
10 * licensed hereunder. You may use the software subject to the license

--- 881 unchanged lines hidden (view full) ---

892illegalExceptionReturn(ThreadContext *tc, CPSR cpsr, CPSR spsr)
893{
894 const OperatingMode mode = (OperatingMode) (uint8_t)spsr.mode;
895 if (badMode(mode))
896 return true;
897
898 const OperatingMode cur_mode = (OperatingMode) (uint8_t)cpsr.mode;
899 const ExceptionLevel target_el = opModeToEL(mode);
900
901 HCR hcr = ((HCR)tc->readMiscReg(MISCREG_HCR_EL2));
902 SCR scr = ((SCR)tc->readMiscReg(MISCREG_SCR_EL3));
903
904 if (target_el > opModeToEL(cur_mode))
905 return true;
906
907 if (!ArmSystem::haveEL(tc, target_el))
908 return true;
909
910 if (target_el == EL1 && ArmSystem::haveEL(tc, EL2) && scr.ns && hcr.tge)
911 return true;
912
913 if (target_el == EL2 && ArmSystem::haveEL(tc, EL3) && !scr.ns)
914 return true;
915
916 bool spsr_mode_is_aarch32 = (spsr.width == 1);
917 bool known, target_el_is_aarch32;
918 std::tie(known, target_el_is_aarch32) = ELUsingAArch32K(tc, target_el);
919 assert(known || (target_el == EL0 && ELIs64(tc, EL1)));
920
921 if (known && (spsr_mode_is_aarch32 != target_el_is_aarch32))
922 return true;
923
924 if (!spsr.width) {
925 // aarch64
926 if (!ArmSystem::highestELIs64(tc))
927 return true;
928 if (spsr & 0x2)
929 return true;
930 if (target_el == EL0 && spsr.sp)
931 return true;
932 } else {
933 // aarch32
934 return badMode32(mode);
935 }
936
937 return false;
938}
939
940CPSR
941ArmStaticInst::getPSTATEFromPSR(ThreadContext *tc, CPSR cpsr, CPSR spsr) const

--- 45 unchanged lines hidden ---