unicorn/qemu/target-arm
Peter Maydell f2dcb81b27
Fix masking of PC lower bits when doing exception returns
In commit 9b6a3ea7a699594 store_reg() was changed to mask
both bits 0 and 1 of the new PC value when in ARM mode.
Unfortunately this broke the exception return code paths
when doing a return from ARM mode to Thumb mode: in some
of these we write a new CPSR including new Thumb mode
bit via gen_helper_cpsr_write_eret(), and then use store_reg()
to write the new PC. In this case if the new CPSR specified
Thumb mode then masking bit 1 of the PC is incorrect
(these code paths correspond to the v8 ARM ARM pseudocode
function AArch32.ExceptionReturn(), which always aligns the
new PC appropriately for the new instruction set state).

Instead of using store_reg() in exception-return code paths,
call a new store_pc_exc_ret() which stores the raw new PC
value to env->regs[15], and then mask it appropriately in
the subsequent helper_cpsr_write_eret() where the new
env->thumb state is available.

This fixes a bug introduced by 9b6a3ea7a699594 which caused
crashes/hangs or otherwise bad behaviour for Linux when
userspace was using Thumb.

Backports commit fb0e8e79a9d77ee240dbca036fa8698ce654e5d1 from qemu
2018-02-26 08:09:28 -05:00
..
arm_ldst.h cpu: move exec-all.h inclusion out of cpu.h 2018-02-24 02:39:08 -05:00
cpu64.c target-arm: Get rid of unused variable warnings 2018-02-23 12:43:09 -05:00
cpu-qom.h target-arm: make cpu-qom.h not target specific 2018-02-24 00:48:59 -05:00
cpu.c arm: add Cortex A7 CPU parameters 2018-02-26 03:44:24 -05:00
cpu.h target-arm: Infrastucture changes to enable handling of tagged address loading into PC 2018-02-26 07:58:17 -05:00
crypto_helper.c target-arm: Clean up includes 2018-02-17 21:09:32 -05:00
helper-a64.c softfloat: Implement run-time-configurable meaning of signaling NaN bit 2018-02-24 20:27:12 -05:00
helper-a64.h import 2015-08-21 15:04:50 +08:00
helper.c target-arm: Infrastucture changes to enable handling of tagged address loading into PC 2018-02-26 07:58:17 -05:00
helper.h target-arm: Implement MRS (banked) and MSR (banked) instructions 2018-02-21 21:50:42 -05:00
internals.h Fix confusing argument names in some common functions 2018-02-25 03:58:27 -05:00
iwmmxt_helper.c target-arm: Clean up includes 2018-02-17 21:09:32 -05:00
kvm-consts.h import 2015-08-21 15:04:50 +08:00
Makefile.objs delete sparc32_dma.h & arm-semi.c 2017-01-19 15:10:41 +08:00
neon_helper.c target-arm: Fix warn about implicit conversion 2018-02-25 22:44:43 -05:00
op_addsub.h import 2015-08-21 15:04:50 +08:00
op_helper.c Fix masking of PC lower bits when doing exception returns 2018-02-26 08:09:28 -05:00
psci.c Use #include "..." for our own headers, <...> for others 2018-02-25 04:10:33 -05:00
translate-a64.c target-arm: Comments added to identify cases in a switch 2018-02-26 08:05:49 -05:00
translate.c Fix masking of PC lower bits when doing exception returns 2018-02-26 08:09:28 -05:00
translate.h target-arm: Infrastucture changes to enable handling of tagged address loading into PC 2018-02-26 07:58:17 -05:00
unicorn_aarch64.c qemu-common: push cpu.h inclusion out of qemu-common.h 2018-02-24 01:50:56 -05:00
unicorn_arm.c qemu-common: push cpu.h inclusion out of qemu-common.h 2018-02-24 01:50:56 -05:00
unicorn.h arm64eb: add support for ARM64 big endian. 2017-04-24 23:30:01 +08:00