[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 11/25] linux-user: Fix XER access in ppc version of elf_core_copy_
From: |
David Gibson |
Subject: |
[PULL 11/25] linux-user: Fix XER access in ppc version of elf_core_copy_regs |
Date: |
Thu, 21 Oct 2021 15:20:13 +1100 |
From: Matheus Ferst <matheus.ferst@eldorado.org.br>
env->xer doesn't hold some bits of XER, like OV and CA. To write the
complete register in the core dump we should read XER value with
cpu_read_xer.
Reported-by: Lucas Mateus Castro (alqotel) <lucas.araujo@eldorado.org.br>
Fixes: da91a00f191f ("target-ppc: Split out SO, OV, CA fields from XER")
Signed-off-by: Matheus Ferst <matheus.ferst@eldorado.org.br>
Message-Id: <20211014223234.127012-4-matheus.ferst@eldorado.org.br>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
linux-user/elfload.c | 2 +-
target/ppc/cpu.c | 2 +-
target/ppc/cpu.h | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 2404d482ba..eb32f3e2cb 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -901,7 +901,7 @@ static void elf_core_copy_regs(target_elf_gregset_t *regs,
const CPUPPCState *en
(*regs)[33] = tswapreg(env->msr);
(*regs)[35] = tswapreg(env->ctr);
(*regs)[36] = tswapreg(env->lr);
- (*regs)[37] = tswapreg(env->xer);
+ (*regs)[37] = tswapreg(cpu_read_xer(env));
for (i = 0; i < ARRAY_SIZE(env->crf); i++) {
ccr |= env->crf[i] << (32 - ((i + 1) * 4));
diff --git a/target/ppc/cpu.c b/target/ppc/cpu.c
index 7ad9bd6044..f933d9f2bd 100644
--- a/target/ppc/cpu.c
+++ b/target/ppc/cpu.c
@@ -27,7 +27,7 @@
#include "helper_regs.h"
#include "sysemu/tcg.h"
-target_ulong cpu_read_xer(CPUPPCState *env)
+target_ulong cpu_read_xer(const CPUPPCState *env)
{
if (is_isa300(env)) {
return env->xer | (env->so << XER_SO) |
diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
index baa4e7c34d..c6fc0043a9 100644
--- a/target/ppc/cpu.h
+++ b/target/ppc/cpu.h
@@ -2412,7 +2412,7 @@ enum {
/*****************************************************************************/
#define is_isa300(ctx) (!!(ctx->insns_flags2 & PPC2_ISA300))
-target_ulong cpu_read_xer(CPUPPCState *env);
+target_ulong cpu_read_xer(const CPUPPCState *env);
void cpu_write_xer(CPUPPCState *env, target_ulong xer);
/*
--
2.31.1
- [PULL 06/25] spapr/xive: Use xive_esb_rw() to trigger interrupts, (continued)
- [PULL 06/25] spapr/xive: Use xive_esb_rw() to trigger interrupts, David Gibson, 2021/10/21
- [PULL 07/25] hw/ppc: Fix iothread locking in the 405 code, David Gibson, 2021/10/21
- [PULL 04/25] target/ppc: Fix the test raising the decrementer exception, David Gibson, 2021/10/21
- [PULL 17/25] ppc/pegasos2: Add constants for PCI config addresses, David Gibson, 2021/10/21
- [PULL 15/25] ppc/pegasos2: Implement get-time-of-day RTAS function with VOF, David Gibson, 2021/10/21
- [PULL 01/25] spapr/xive: Add source status helpers, David Gibson, 2021/10/21
- [PULL 09/25] linux-user/ppc: Fix XER access in save/restore_user_regs, David Gibson, 2021/10/21
- [PULL 05/25] hw/ppc/spapr_softmmu: Reduce include list, David Gibson, 2021/10/21
- [PULL 12/25] target/ppc: Fix XER access in monitor, David Gibson, 2021/10/21
- [PULL 03/25] target/ppc: Use tcg_constant_i64() in gen_brh(), David Gibson, 2021/10/21
- [PULL 11/25] linux-user: Fix XER access in ppc version of elf_core_copy_regs,
David Gibson <=
- [PULL 10/25] target/ppc: Fix XER access in gdbstub, David Gibson, 2021/10/21
- [PULL 08/25] tests/acceptance: Add tests for the ppc405 boards, David Gibson, 2021/10/21
- [PULL 13/25] ppc/pegasos2: Restrict memory to 2 gigabytes, David Gibson, 2021/10/21
- [PULL 20/25] target/ppc: Filter mtmsr[d] input before setting MSR, David Gibson, 2021/10/21
- [PULL 14/25] ppc/pegasos2: Warn when using VOF but no kernel is specified, David Gibson, 2021/10/21
- [PULL 18/25] ppc/pegasos2: Implement power-off RTAS function with VOF, David Gibson, 2021/10/21
- [PULL 16/25] ppc/pegasos2: Access MV64361 registers via their memory region, David Gibson, 2021/10/21
- [PULL 19/25] tests/acceptance: Add a test for the bamboo ppc board, David Gibson, 2021/10/21
- [PULL 22/25] target/ppc: add user read/write functions for MMCR0, David Gibson, 2021/10/21
- [PULL 23/25] target/ppc: add user read/write functions for MMCR2, David Gibson, 2021/10/21