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: Richard Henderson
Subject: Re: [PATCH 1/4] linux-user/ppc: Fix XER access in save/restore_user_regs
Date: Thu, 14 Oct 2021 16:43:19 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0

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~



reply via email to

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