[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v7 35/60] target/riscv: Make riscv_cpu_tlb_fill sysemu only
From: |
Richard Henderson |
Subject: |
[PATCH v7 35/60] target/riscv: Make riscv_cpu_tlb_fill sysemu only |
Date: |
Mon, 1 Nov 2021 13:27:04 -0400 |
The fallback code in cpu_loop_exit_sigsegv is sufficient
for riscv linux-user.
Remove the code from cpu_loop that raised SIGSEGV.
Reviewed-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
linux-user/riscv/cpu_loop.c | 7 -------
target/riscv/cpu.c | 2 +-
target/riscv/cpu_helper.c | 21 +--------------------
3 files changed, 2 insertions(+), 28 deletions(-)
diff --git a/linux-user/riscv/cpu_loop.c b/linux-user/riscv/cpu_loop.c
index e5bb6d908a..b301dac802 100644
--- a/linux-user/riscv/cpu_loop.c
+++ b/linux-user/riscv/cpu_loop.c
@@ -87,13 +87,6 @@ void cpu_loop(CPURISCVState *env)
sigcode = TARGET_TRAP_BRKPT;
sigaddr = env->pc;
break;
- case RISCV_EXCP_INST_PAGE_FAULT:
- case RISCV_EXCP_LOAD_PAGE_FAULT:
- case RISCV_EXCP_STORE_PAGE_FAULT:
- signum = TARGET_SIGSEGV;
- sigcode = TARGET_SEGV_MAPERR;
- sigaddr = env->badaddr;
- break;
case RISCV_EXCP_SEMIHOST:
env->gpr[xA0] = do_common_semihosting(cs);
env->pc += 4;
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
index 7d53125dbc..f812998123 100644
--- a/target/riscv/cpu.c
+++ b/target/riscv/cpu.c
@@ -694,9 +694,9 @@ static const struct SysemuCPUOps riscv_sysemu_ops = {
static const struct TCGCPUOps riscv_tcg_ops = {
.initialize = riscv_translate_init,
.synchronize_from_tb = riscv_cpu_synchronize_from_tb,
- .tlb_fill = riscv_cpu_tlb_fill,
#ifndef CONFIG_USER_ONLY
+ .tlb_fill = riscv_cpu_tlb_fill,
.cpu_exec_interrupt = riscv_cpu_exec_interrupt,
.do_interrupt = riscv_cpu_do_interrupt,
.do_transaction_failed = riscv_cpu_do_transaction_failed,
diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c
index f30ff672f8..9eeed38c7e 100644
--- a/target/riscv/cpu_helper.c
+++ b/target/riscv/cpu_helper.c
@@ -814,7 +814,6 @@ void riscv_cpu_do_unaligned_access(CPUState *cs, vaddr addr,
riscv_cpu_two_stage_lookup(mmu_idx);
riscv_raise_exception(env, cs->exception_index, retaddr);
}
-#endif /* !CONFIG_USER_ONLY */
bool riscv_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
MMUAccessType access_type, int mmu_idx,
@@ -822,7 +821,6 @@ bool riscv_cpu_tlb_fill(CPUState *cs, vaddr address, int
size,
{
RISCVCPU *cpu = RISCV_CPU(cs);
CPURISCVState *env = &cpu->env;
-#ifndef CONFIG_USER_ONLY
vaddr im_address;
hwaddr pa = 0;
int prot, prot2, prot_pmp;
@@ -954,25 +952,8 @@ bool riscv_cpu_tlb_fill(CPUState *cs, vaddr address, int
size,
}
return true;
-
-#else
- switch (access_type) {
- case MMU_INST_FETCH:
- cs->exception_index = RISCV_EXCP_INST_PAGE_FAULT;
- break;
- case MMU_DATA_LOAD:
- cs->exception_index = RISCV_EXCP_LOAD_PAGE_FAULT;
- break;
- case MMU_DATA_STORE:
- cs->exception_index = RISCV_EXCP_STORE_PAGE_FAULT;
- break;
- default:
- g_assert_not_reached();
- }
- env->badaddr = address;
- cpu_loop_exit_restore(cs, retaddr);
-#endif
}
+#endif /* !CONFIG_USER_ONLY */
/*
* Handle Traps
--
2.25.1
- [PATCH v7 31/60] target/nios2: Implement nios2_cpu_record_sigsegv, (continued)
- [PATCH v7 31/60] target/nios2: Implement nios2_cpu_record_sigsegv, Richard Henderson, 2021/11/01
- [PATCH v7 39/60] target/sparc: Make sparc_cpu_tlb_fill sysemu only, Richard Henderson, 2021/11/01
- [PATCH v7 26/60] target/hppa: Make hppa_cpu_tlb_fill sysemu only, Richard Henderson, 2021/11/01
- [PATCH v7 09/60] linux-user/host/alpha: Populate host_signal.h, Richard Henderson, 2021/11/01
- [PATCH v7 30/60] target/mips: Make mips_cpu_tlb_fill sysemu only, Richard Henderson, 2021/11/01
- [PATCH v7 22/60] target/arm: Use cpu_loop_exit_sigsegv for mte tag lookup, Richard Henderson, 2021/11/01
- [PATCH v7 24/60] target/cris: Make cris_cpu_tlb_fill sysemu only, Richard Henderson, 2021/11/01
- [PATCH v7 32/60] linux-user/openrisc: Abort for EXCP_RANGE, EXCP_FPE, Richard Henderson, 2021/11/01
- [PATCH v7 36/60] target/s390x: Use probe_access_flags in s390_probe_access, Richard Henderson, 2021/11/01
- [PATCH v7 37/60] target/s390x: Implement s390_cpu_record_sigsegv, Richard Henderson, 2021/11/01
- [PATCH v7 35/60] target/riscv: Make riscv_cpu_tlb_fill sysemu only,
Richard Henderson <=
- [PATCH v7 25/60] target/hexagon: Remove hexagon_cpu_tlb_fill, Richard Henderson, 2021/11/01
- [PATCH v7 38/60] target/sh4: Make sh4_cpu_tlb_fill sysemu only, Richard Henderson, 2021/11/01
- [PATCH v7 33/60] target/openrisc: Make openrisc_cpu_tlb_fill sysemu only, Richard Henderson, 2021/11/01
- [PATCH v7 23/60] target/arm: Implement arm_cpu_record_sigsegv, Richard Henderson, 2021/11/01
- [PATCH v7 29/60] target/microblaze: Make mb_cpu_tlb_fill sysemu only, Richard Henderson, 2021/11/01
- [PATCH v7 42/60] hw/core: Add TCGCPUOps.record_sigbus, Richard Henderson, 2021/11/01
- [PATCH v7 40/60] target/xtensa: Make xtensa_cpu_tlb_fill sysemu only, Richard Henderson, 2021/11/01
- [PATCH v7 44/60] target/alpha: Implement alpha_cpu_record_sigbus, Richard Henderson, 2021/11/01
- [PATCH v7 45/60] target/arm: Implement arm_cpu_record_sigbus, Richard Henderson, 2021/11/01
- [PATCH v7 47/60] target/microblaze: Do not set MO_ALIGN for user-only, Richard Henderson, 2021/11/01