aboutsummaryrefslogtreecommitdiff
path: root/target/hppa/mem_helper.c
diff options
context:
space:
mode:
authorHelge Deller <deller@gmx.de>2024-01-03 20:35:18 +0100
committerHelge Deller <deller@gmx.de>2024-01-13 06:48:14 +0100
commit5915b67013eb8c3a84e3ef05e6ba4eae55ccd173 (patch)
tree0e7947ce9570777af2f28d431ceeca4fecffea7b /target/hppa/mem_helper.c
parented35afcb331a972210816435d6b1b5de17fc7d4f (diff)
downloadqemu-5915b67013eb8c3a84e3ef05e6ba4eae55ccd173.zip
qemu-5915b67013eb8c3a84e3ef05e6ba4eae55ccd173.tar.gz
qemu-5915b67013eb8c3a84e3ef05e6ba4eae55ccd173.tar.bz2
target/hppa: Avoid accessing %gr0 when raising exception
The value of unwind_breg may reference register %r0, but we need to avoid accessing gr0 directly and use the value 0 instead. At runtime I've seen unwind_breg being zero with the Linux kernel when rfi is used to jump to smp_callin(). Signed-off-by: Helge Deller <deller@gmx.de> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Tested-by: Bruno Haible <bruno@clisp.org>
Diffstat (limited to 'target/hppa/mem_helper.c')
-rw-r--r--target/hppa/mem_helper.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/target/hppa/mem_helper.c b/target/hppa/mem_helper.c
index 4c28c58..1387f4a 100644
--- a/target/hppa/mem_helper.c
+++ b/target/hppa/mem_helper.c
@@ -341,7 +341,7 @@ raise_exception_with_ior(CPUHPPAState *env, int excp, uintptr_t retaddr,
cpu_restore_state(cs, retaddr);
- b = env->gr[env->unwind_breg];
+ b = env->unwind_breg ? env->gr[env->unwind_breg] : 0;
b >>= (env->psw & PSW_W ? 62 : 30);
env->cr[CR_IOR] |= b << 62;