diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2011-01-14 20:39:18 +0100 |
---|---|---|
committer | Aurelien Jarno <aurelien@aurel32.net> | 2011-01-14 20:39:18 +0100 |
commit | 39ea3d4eaf1ff300ee55946108394729bc053dfa (patch) | |
tree | 4e0e7fa61544f4fbf38693ac0fa0cfd331caa007 /target-arm/helper.c | |
parent | 718269667ab60c878940ab7a4e3e0ef1e984d784 (diff) | |
download | qemu-39ea3d4eaf1ff300ee55946108394729bc053dfa.tar.gz qemu-39ea3d4eaf1ff300ee55946108394729bc053dfa.tar.bz2 qemu-39ea3d4eaf1ff300ee55946108394729bc053dfa.zip |
target-arm: Don't generate code specific to current CPU mode for SRS
When translating the SRS instruction, handle the "store registers
to stack of current mode" case in the helper function rather than
inline. This means the generated code does not make assumptions
about the current CPU mode which might not be valid when the TB
is executed later.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Diffstat (limited to 'target-arm/helper.c')
-rw-r--r-- | target-arm/helper.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/target-arm/helper.c b/target-arm/helper.c index 8186500e92..b562767279 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -1849,12 +1849,20 @@ bad_reg: void HELPER(set_r13_banked)(CPUState *env, uint32_t mode, uint32_t val) { - env->banked_r13[bank_number(mode)] = val; + if ((env->uncached_cpsr & CPSR_M) == mode) { + env->regs[13] = val; + } else { + env->banked_r13[bank_number(mode)] = val; + } } uint32_t HELPER(get_r13_banked)(CPUState *env, uint32_t mode) { - return env->banked_r13[bank_number(mode)]; + if ((env->uncached_cpsr & CPSR_M) == mode) { + return env->regs[13]; + } else { + return env->banked_r13[bank_number(mode)]; + } } uint32_t HELPER(v7m_mrs)(CPUState *env, uint32_t reg) |