[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL v2 5/8] linux-user/microblaze: Handle privileged exception
From: |
Richard Henderson |
Subject: |
[PULL v2 5/8] linux-user/microblaze: Handle privileged exception |
Date: |
Tue, 21 Feb 2023 16:00:20 -1000 |
From: Ilya Leoshkevich <iii@linux.ibm.com>
Follow what kernel's full_exception() is doing.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Message-Id: <20230214140829.45392-4-iii@linux.ibm.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
linux-user/microblaze/cpu_loop.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/linux-user/microblaze/cpu_loop.c b/linux-user/microblaze/cpu_loop.c
index 5ccf9e942e..212e62d0a6 100644
--- a/linux-user/microblaze/cpu_loop.c
+++ b/linux-user/microblaze/cpu_loop.c
@@ -25,8 +25,8 @@
void cpu_loop(CPUMBState *env)
{
+ int trapnr, ret, si_code, sig;
CPUState *cs = env_cpu(env);
- int trapnr, ret, si_code;
while (1) {
cpu_exec_start(cs);
@@ -76,6 +76,7 @@ void cpu_loop(CPUMBState *env)
env->iflags &= ~(IMM_FLAG | D_FLAG);
switch (env->esr & 31) {
case ESR_EC_DIVZERO:
+ sig = TARGET_SIGFPE;
si_code = TARGET_FPE_INTDIV;
break;
case ESR_EC_FPU:
@@ -84,6 +85,7 @@ void cpu_loop(CPUMBState *env)
* if there's no recognized bit set. Possibly this
* implies that si_code is 0, but follow the structure.
*/
+ sig = TARGET_SIGFPE;
si_code = env->fsr;
if (si_code & FSR_IO) {
si_code = TARGET_FPE_FLTINV;
@@ -97,13 +99,17 @@ void cpu_loop(CPUMBState *env)
si_code = TARGET_FPE_FLTRES;
}
break;
+ case ESR_EC_PRIVINSN:
+ sig = SIGILL;
+ si_code = ILL_PRVOPC;
+ break;
default:
fprintf(stderr, "Unhandled hw-exception: 0x%x\n",
env->esr & ESR_EC_MASK);
cpu_dump_state(cs, stderr, 0);
exit(EXIT_FAILURE);
}
- force_sig_fault(TARGET_SIGFPE, si_code, env->pc);
+ force_sig_fault(sig, si_code, env->pc);
break;
case EXCP_DEBUG:
--
2.34.1
- [PULL v2 0/8] tcg patch queue, Richard Henderson, 2023/02/21
- [PULL v2 1/8] accel/tcg: Allow the second page of an instruction to be MMIO, Richard Henderson, 2023/02/21
- [PULL v2 2/8] linux-user/sparc: Raise SIGILL for all unhandled software traps, Richard Henderson, 2023/02/21
- [PULL v2 3/8] linux-user: Always exit from exclusive state in fork_end(), Richard Henderson, 2023/02/21
- [PULL v2 5/8] linux-user/microblaze: Handle privileged exception,
Richard Henderson <=
- [PULL v2 4/8] cpus: Make {start,end}_exclusive() recursive, Richard Henderson, 2023/02/21
- [PULL v2 6/8] target/microblaze: Add gdbstub xml, Richard Henderson, 2023/02/21
- [PULL v2 7/8] util/cacheflush: fix cache on windows-arm64, Richard Henderson, 2023/02/21
- [PULL v2 8/8] sysemu/os-win32: fix setjmp/longjmp on windows-arm64, Richard Henderson, 2023/02/21
- Re: [PULL v2 0/8] tcg patch queue, Peter Maydell, 2023/02/24