On 1/3/22 8:56 AM, matheus.fe...@eldorado.org.br wrote:
From: Matheus Ferst <matheus.fe...@eldorado.org.br>
Handle POWERPC_EXCP_TRAP in cpu_loop to deliver SIGTRAP on tw[i]/td[i].
The si_code comes from do_program_check in the kernel source file
arch/powerpc/kernel/traps.c
Signed-off-by: Matheus Ferst <matheus.fe...@eldorado.org.br>
---
linux-user/ppc/cpu_loop.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/linux-user/ppc/cpu_loop.c b/linux-user/ppc/cpu_loop.c
index 30c82f2354..8fbaa772dc 100644
--- a/linux-user/ppc/cpu_loop.c
+++ b/linux-user/ppc/cpu_loop.c
@@ -242,7 +242,9 @@ void cpu_loop(CPUPPCState *env)
}
break;
case POWERPC_EXCP_TRAP:
- cpu_abort(cs, "Tried to call a TRAP\n");
+ info.si_signo = TARGET_SIGTRAP;
+ info.si_errno = 0;
+ info.si_code = TARGET_TRAP_BRKPT;
You're missing the address, which should be nip.
https://github.com/torvalds/linux/blob/master/arch/powerpc/kernel/traps.c#L1503
Please use force_sig_fault. (I have a pending patch set to convert all other instances;
hopefully that can be merged soon...)
r~