]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
target/hppa: Avoid accessing %gr0 when raising exception
authorHelge Deller <deller@gmx.de>
Wed, 3 Jan 2024 19:35:18 +0000 (20:35 +0100)
committerMichael Tokarev <mjt@tls.msk.ru>
Wed, 17 Jan 2024 07:32:47 +0000 (10:32 +0300)
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>
(cherry picked from commit 5915b67013eb8c3a84e3ef05e6ba4eae55ccd173)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
target/hppa/mem_helper.c

index 4c28c58ee909e17b515b2fde3c8859b48d33f99e..1387f4a64bd01a7aaf4a077855f3dea0f071b9de 100644 (file)
@@ -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;