diff mbox series

[v2,1/2] linux-user/ppc: deliver SIGTRAP on POWERPC_EXCP_TRAP

Message ID 20220104210015.457468-2-matheus.ferst@eldorado.org.br (mailing list archive)
State New, archived
Headers show
Series linux-user/ppc: Deliver SIGTRAP on tw[i]/td[i] | expand

Commit Message

Matheus K. Ferst Jan. 4, 2022, 9 p.m. UTC
From: Matheus Ferst <matheus.ferst@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.ferst@eldorado.org.br>
---
 linux-user/ppc/cpu_loop.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Richard Henderson Jan. 4, 2022, 10:12 p.m. UTC | #1
On 1/4/22 1:00 PM, matheus.ferst@eldorado.org.br wrote:
> From: Matheus Ferst<matheus.ferst@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.ferst@eldorado.org.br>
> ---
>   linux-user/ppc/cpu_loop.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~
Cédric Le Goater Jan. 5, 2022, 6:46 a.m. UTC | #2
On 1/4/22 22:00, matheus.ferst@eldorado.org.br wrote:
> From: Matheus Ferst <matheus.ferst@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.ferst@eldorado.org.br>
> ---
>   linux-user/ppc/cpu_loop.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/linux-user/ppc/cpu_loop.c b/linux-user/ppc/cpu_loop.c
> index 46e6ffd6d3..6c99feb19b 100644
> --- a/linux-user/ppc/cpu_loop.c
> +++ b/linux-user/ppc/cpu_loop.c
> @@ -188,7 +188,8 @@ void cpu_loop(CPUPPCState *env)
>                   }
>                   break;
>               case POWERPC_EXCP_TRAP:
> -                cpu_abort(cs, "Tried to call a TRAP\n");
> +                si_signo = TARGET_SIGTRAP;
> +                si_code = TARGET_TRAP_BRKPT;

These lack 'info.'

Thanks,

C.

>                   break;
>               default:
>                   /* Should not happen ! */
>
Richard Henderson Jan. 5, 2022, 6:27 p.m. UTC | #3
On 1/4/22 2:12 PM, Richard Henderson wrote:
> On 1/4/22 1:00 PM, matheus.ferst@eldorado.org.br wrote:
>> From: Matheus Ferst<matheus.ferst@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.ferst@eldorado.org.br>
>> ---
>>   linux-user/ppc/cpu_loop.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/588


r~
Richard Henderson Jan. 5, 2022, 6:28 p.m. UTC | #4
On 1/4/22 10:46 PM, Cédric Le Goater wrote:
> On 1/4/22 22:00, matheus.ferst@eldorado.org.br wrote:
>> From: Matheus Ferst <matheus.ferst@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.ferst@eldorado.org.br>
>> ---
>>   linux-user/ppc/cpu_loop.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/linux-user/ppc/cpu_loop.c b/linux-user/ppc/cpu_loop.c
>> index 46e6ffd6d3..6c99feb19b 100644
>> --- a/linux-user/ppc/cpu_loop.c
>> +++ b/linux-user/ppc/cpu_loop.c
>> @@ -188,7 +188,8 @@ void cpu_loop(CPUPPCState *env)
>>                   }
>>                   break;
>>               case POWERPC_EXCP_TRAP:
>> -                cpu_abort(cs, "Tried to call a TRAP\n");
>> +                si_signo = TARGET_SIGTRAP;
>> +                si_code = TARGET_TRAP_BRKPT;
> 
> These lack 'info.'

You missed the Based-on in the cover-letter.


r~
diff mbox series

Patch

diff --git a/linux-user/ppc/cpu_loop.c b/linux-user/ppc/cpu_loop.c
index 46e6ffd6d3..6c99feb19b 100644
--- a/linux-user/ppc/cpu_loop.c
+++ b/linux-user/ppc/cpu_loop.c
@@ -188,7 +188,8 @@  void cpu_loop(CPUPPCState *env)
                 }
                 break;
             case POWERPC_EXCP_TRAP:
-                cpu_abort(cs, "Tried to call a TRAP\n");
+                si_signo = TARGET_SIGTRAP;
+                si_code = TARGET_TRAP_BRKPT;
                 break;
             default:
                 /* Should not happen ! */