qemu-ppc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/4] linux-user/ppc: Fix XER access in save/restore_user_regs


From: Matheus K. Ferst
Subject: Re: [PATCH 1/4] linux-user/ppc: Fix XER access in save/restore_user_regs
Date: Fri, 15 Oct 2021 11:54:55 -0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0

On 14/10/2021 20:43, Richard Henderson wrote:
[E-MAIL EXTERNO] Não clique em links ou abra anexos, a menos que você possa confirmar o remetente e saber que o conteúdo é seguro. Em caso de e-mail suspeito entre imediatamente em contato com o DTI.

On 10/14/21 3:32 PM, matheus.ferst@eldorado.org.br wrote:
From: Matheus Ferst <matheus.ferst@eldorado.org.br>

We should use cpu_read_xer/cpu_write_xer to save/restore the complete
register since some of its bits are in other fields of CPUPPCState. A
test is added to prevent future regressions.

Fixes: da91a00f191f ("target-ppc: Split out SO, OV, CA fields from XER")
Signed-off-by: Matheus Ferst <matheus.ferst@eldorado.org.br>
---
  linux-user/ppc/signal.c                     |  9 +++--
  tests/tcg/ppc64/Makefile.target             |  2 +
  tests/tcg/ppc64le/Makefile.target           |  2 +
  tests/tcg/ppc64le/signal_save_restore_xer.c | 42 +++++++++++++++++++++
  4 files changed, 52 insertions(+), 3 deletions(-)
  create mode 100644 tests/tcg/ppc64le/signal_save_restore_xer.c

The code is good so,
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

+    sigaction(SIGILL, &sa, NULL);
+
+    asm("mtspr 1, %1\n\t"
+        ".long 0x0\n\t"

While Appendix B does guarantee that "0" is and always will be an invalid instruction, I wonder if the test itself would be clearer (i.e. self-documenting the intent) using
SIGTRAP and "trap".


r~

It would be better, but cpu_loop is currently calling cpu_abort for POWERPC_EXCP_TRAP, so the test would fail. I'll see if I can fix that in another patch, and then we can change the test to use trap.

--
Matheus K. Ferst
Instituto de Pesquisas ELDORADO <http://www.eldorado.org.br/>
Analista de Software Júnior
Aviso Legal - Disclaimer <https://www.eldorado.org.br/disclaimer.html>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]