[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 34/41] target/ppc: Implement ppc_cpu_record_sigsegv
From: |
Richard Henderson |
Subject: |
[PATCH v4 34/41] target/ppc: Implement ppc_cpu_record_sigsegv |
Date: |
Wed, 6 Oct 2021 10:23:00 -0700 |
Record DAR, DSISR, and exception_index. That last means
that we must exit to cpu_loop ourselves, instead of letting
exception_index being overwritten.
This is exactly what the user-mode ppc_cpu_tlb_fill does,
so simply rename it as ppc_cpu_record_sigsegv.
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/ppc/cpu.h | 3 ---
target/ppc/internal.h | 9 +++++++++
target/ppc/cpu_init.c | 6 ++++--
target/ppc/user_only_helper.c | 15 +++++++++++----
4 files changed, 24 insertions(+), 9 deletions(-)
diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
index baa4e7c34d..2242d57718 100644
--- a/target/ppc/cpu.h
+++ b/target/ppc/cpu.h
@@ -1279,9 +1279,6 @@ extern const VMStateDescription vmstate_ppc_cpu;
/*****************************************************************************/
void ppc_translate_init(void);
-bool ppc_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
- MMUAccessType access_type, int mmu_idx,
- bool probe, uintptr_t retaddr);
#if !defined(CONFIG_USER_ONLY)
void ppc_store_sdr1(CPUPPCState *env, target_ulong value);
diff --git a/target/ppc/internal.h b/target/ppc/internal.h
index 55284369f5..339974b7d8 100644
--- a/target/ppc/internal.h
+++ b/target/ppc/internal.h
@@ -283,5 +283,14 @@ static inline void pte_invalidate(target_ulong *pte0)
#define PTE_PTEM_MASK 0x7FFFFFBF
#define PTE_CHECK_MASK (TARGET_PAGE_MASK | 0x7B)
+#ifdef CONFIG_USER_ONLY
+void ppc_cpu_record_sigsegv(CPUState *cs, vaddr addr,
+ MMUAccessType access_type,
+ bool maperr, uintptr_t ra);
+#else
+bool ppc_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
+ MMUAccessType access_type, int mmu_idx,
+ bool probe, uintptr_t retaddr);
+#endif
#endif /* PPC_INTERNAL_H */
diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c
index 6aad01d1d3..ec8da08f0b 100644
--- a/target/ppc/cpu_init.c
+++ b/target/ppc/cpu_init.c
@@ -9014,9 +9014,11 @@ static const struct SysemuCPUOps ppc_sysemu_ops = {
static const struct TCGCPUOps ppc_tcg_ops = {
.initialize = ppc_translate_init,
- .tlb_fill = ppc_cpu_tlb_fill,
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_USER_ONLY
+ .record_sigsegv = ppc_cpu_record_sigsegv,
+#else
+ .tlb_fill = ppc_cpu_tlb_fill,
.cpu_exec_interrupt = ppc_cpu_exec_interrupt,
.do_interrupt = ppc_cpu_do_interrupt,
.cpu_exec_enter = ppc_cpu_exec_enter,
diff --git a/target/ppc/user_only_helper.c b/target/ppc/user_only_helper.c
index aa3f867596..7ff76f7a06 100644
--- a/target/ppc/user_only_helper.c
+++ b/target/ppc/user_only_helper.c
@@ -21,16 +21,23 @@
#include "qemu/osdep.h"
#include "cpu.h"
#include "exec/exec-all.h"
+#include "internal.h"
-
-bool ppc_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
- MMUAccessType access_type, int mmu_idx,
- bool probe, uintptr_t retaddr)
+void ppc_cpu_record_sigsegv(CPUState *cs, vaddr address,
+ MMUAccessType access_type,
+ bool maperr, uintptr_t retaddr)
{
PowerPCCPU *cpu = POWERPC_CPU(cs);
CPUPPCState *env = &cpu->env;
int exception, error_code;
+ /*
+ * Both DSISR and the "trap number" (exception vector offset,
+ * looked up from exception_index) are present in the linux-user
+ * signal frame.
+ * FIXME: we don't actually populate the trap number properly.
+ * It would be easiest to fill in an env->trap value now.
+ */
if (access_type == MMU_INST_FETCH) {
exception = POWERPC_EXCP_ISI;
error_code = 0x40000000;
--
2.25.1
- [PATCH v4 29/41] target/microblaze: Make mb_cpu_tlb_fill sysemu only, (continued)
- [PATCH v4 29/41] target/microblaze: Make mb_cpu_tlb_fill sysemu only, Richard Henderson, 2021/10/06
- [PATCH v4 15/41] linux-user/host/riscv: Populate host_signal.h, Richard Henderson, 2021/10/06
- [PATCH v4 18/41] linux-user/signal: Drop HOST_SIGNAL_PLACEHOLDER, Richard Henderson, 2021/10/06
- [PATCH v4 20/41] linux-user: Add cpu_loop_exit_sigsegv, Richard Henderson, 2021/10/06
- [PATCH v4 21/41] target/alpha: Implement alpha_cpu_record_sigsegv, Richard Henderson, 2021/10/06
- [PATCH v4 23/41] target/arm: Implement arm_cpu_record_sigsegv, Richard Henderson, 2021/10/06
- [PATCH v4 27/41] target/i386: Implement x86_cpu_record_sigsegv, Richard Henderson, 2021/10/06
- [PATCH v4 28/41] target/m68k: Make m68k_cpu_tlb_fill sysemu only, Richard Henderson, 2021/10/06
- [PATCH v4 33/41] target/openrisc: Make openrisc_cpu_tlb_fill sysemu only, Richard Henderson, 2021/10/06
- [PATCH v4 34/41] target/ppc: Implement ppc_cpu_record_sigsegv,
Richard Henderson <=
- [PATCH v4 24/41] target/cris: Make cris_cpu_tlb_fill sysemu only, Richard Henderson, 2021/10/06
- [PATCH v4 07/41] linux-user/host/x86: Populate host_signal.h, Richard Henderson, 2021/10/06
- [PATCH v4 09/41] linux-user/host/alpha: Populate host_signal.h, Richard Henderson, 2021/10/06
- [PATCH v4 37/41] target/s390x: Implement s390_cpu_record_sigsegv, Richard Henderson, 2021/10/06
- [PATCH v4 39/41] target/sparc: Make sparc_cpu_tlb_fill sysemu only, Richard Henderson, 2021/10/06
- [PATCH v4 11/41] linux-user/host/arm: Populate host_signal.h, Richard Henderson, 2021/10/06
- [PATCH v4 01/41] accel/tcg: Split out adjust_signal_pc, Richard Henderson, 2021/10/06
- [PATCH v4 08/41] linux-user/host/ppc: Populate host_signal.h, Richard Henderson, 2021/10/06
- [PATCH v4 02/41] accel/tcg: Move clear_helper_retaddr to cpu loop, Richard Henderson, 2021/10/06
- [PATCH v4 22/41] target/arm: Use cpu_loop_exit_sigsegv for mte tag lookup, Richard Henderson, 2021/10/06