unicorn/qemu/target/arm
Alexander Graf f2682ff309
target/arm: Allow Aarch32 exception return to switch from Mon->Hyp
In U-boot, we switch from S-SVC -> Mon -> Hyp mode when we want to
enter Hyp mode. The change into Hyp mode is done by doing an
exception return from Mon. This doesn't work with current QEMU.

The problem is that in bad_mode_switch() we refuse to allow
the change of mode.

Note that bad_mode_switch() is used to do validation for two situations:

(1) changes to mode by instructions writing to CPSR.M
(ie not exception take/return) -- this corresponds to the
Armv8 Arm ARM pseudocode Arch32.WriteModeByInstr
(2) changes to mode by exception return

Attempting to enter or leave Hyp mode via case (1) is forbidden in
v8 and UNPREDICTABLE in v7, and QEMU is correct to disallow it
there. However, we're already doing that check at the top of the
bad_mode_switch() function, so if that passes then we should allow
the case (2) exception return mode changes to switch into Hyp mode.

We want to test whether we're trying to return to the nonexistent
"secure Hyp" mode, so we need to look at arm_is_secure_below_el3()
rather than arm_is_secure(), since the latter is always true if
we're in Mon (EL3).

Backports commit 2d2a4549cc29850aab891495685a7b31f5254b12 from qemu
2019-01-22 15:09:30 -05:00
..
arm_ldst.h
arm-powerctl.c target-arm: powerctl: Enable HVC when starting CPUs to EL2 2018-10-23 12:53:40 -04:00
arm-powerctl.h
cpu64.c target/arm: Implement the ARMv8.1-LOR extension 2018-12-18 04:36:58 -05:00
cpu-qom.h target/arm: Add "-cpu max" support 2018-03-12 10:11:49 -04:00
cpu.c target/arm: Free name string in ARMCPRegInfo hashtable entries' 2018-12-18 05:09:59 -05:00
cpu.h target/arm: Convert ARM_TBFLAG_* to FIELDs 2019-01-13 19:21:18 -05:00
crypto_helper.c
helper-a64.c target/arm: Check HAVE_CMPXCHG128 at translate time 2018-10-23 15:29:46 -04:00
helper-a64.h target/arm: Implement FCMP for fp16 2018-05-15 22:24:39 -04:00
helper-sve.h target/arm: Rewrite vector gather first-fault loads 2018-10-08 14:15:15 -04:00
helper.c target/arm: Allow Aarch32 exception return to switch from Mon->Hyp 2019-01-22 15:09:30 -05:00
helper.h target/arm: Add v8M stack checks on ADD/SUB/MOV of SP 2018-10-08 14:15:15 -04:00
internals.h target/arm: Move id_aa64mmfr* to ARMISARegisters 2018-12-18 04:03:50 -05:00
iwmmxt_helper.c target/arm: Untabify iwmmxt_helper.c 2018-08-25 04:33:44 -04:00
kvm-consts.h
Makefile.objs target/arm: Implement SVE predicate test 2018-05-20 01:16:16 -04:00
neon_helper.c
op_addsub.h
op_helper.c target/arm: Use arm_hcr_el2_eff more places 2018-12-18 04:33:07 -05:00
psci.c
sve_helper.c sve_helper: Use the QEMU_FLATTEN macro instead of the compiler attribute directly 2018-10-23 13:05:02 -04:00
sve.decode target/arm: SVE brk[ab] merging does not have s bit 2019-01-13 19:39:34 -05:00
translate-a64.c target/arm: Convert ARM_TBFLAG_* to FIELDs 2019-01-13 19:21:18 -05:00
translate-a64.h arm: Take DisasContext as a parameter instead of TCGContext where applicable 2018-10-06 04:17:12 -04:00
translate-sve.c decodetree: Remove insn argument from trans_* expanders 2018-11-11 08:27:01 -05:00
translate.c target/arm: Emit barriers for A32/T32 load-acquire/store-release insns 2019-01-13 19:48:27 -05:00
translate.h target/arm: Use gvec for NEON_3R_VTST_VCEQ, NEON_3R_VCGT, NEON_3R_VCGE 2018-11-10 11:03:42 -05:00
unicorn_aarch64.c unicorn_aarch64: Use aa64_vfp_qreg instead of aa32_vfp_dreg 2018-09-03 07:47:40 +01:00
unicorn_arm.c unicorn_arm: Allow for read/write of UC_ARM_REG_FPSCR 2018-09-03 21:03:55 +01:00
unicorn.h
vec_helper.c target/arm: Implement SVE dot product (indexed) 2018-07-03 04:42:41 -04:00