[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 59/60] tcg: Add helper_unaligned_{ld,st} for user-only sigbus
From: |
Richard Henderson |
Subject: |
[PULL 59/60] tcg: Add helper_unaligned_{ld,st} for user-only sigbus |
Date: |
Tue, 2 Nov 2021 07:07:39 -0400 |
To be called from tcg generated code on hosts that support
unaligned accesses natively, in response to an access that
is supposed to be aligned.
Reviewed-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
include/tcg/tcg-ldst.h | 5 +++++
accel/tcg/user-exec.c | 11 +++++++++++
2 files changed, 16 insertions(+)
diff --git a/include/tcg/tcg-ldst.h b/include/tcg/tcg-ldst.h
index 8c86365611..bf40942de4 100644
--- a/include/tcg/tcg-ldst.h
+++ b/include/tcg/tcg-ldst.h
@@ -70,5 +70,10 @@ void helper_be_stl_mmu(CPUArchState *env, target_ulong addr,
uint32_t val,
void helper_be_stq_mmu(CPUArchState *env, target_ulong addr, uint64_t val,
MemOpIdx oi, uintptr_t retaddr);
+#else
+
+void QEMU_NORETURN helper_unaligned_ld(CPUArchState *env, target_ulong addr);
+void QEMU_NORETURN helper_unaligned_st(CPUArchState *env, target_ulong addr);
+
#endif /* CONFIG_SOFTMMU */
#endif /* TCG_LDST_H */
diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c
index aaf47d89d2..1528a21fad 100644
--- a/accel/tcg/user-exec.c
+++ b/accel/tcg/user-exec.c
@@ -27,6 +27,7 @@
#include "exec/helper-proto.h"
#include "qemu/atomic128.h"
#include "trace/trace-root.h"
+#include "tcg/tcg-ldst.h"
#include "internal.h"
__thread uintptr_t helper_retaddr;
@@ -215,6 +216,16 @@ static void validate_memop(MemOpIdx oi, MemOp expected)
#endif
}
+void helper_unaligned_ld(CPUArchState *env, target_ulong addr)
+{
+ cpu_loop_exit_sigbus(env_cpu(env), addr, MMU_DATA_LOAD, GETPC());
+}
+
+void helper_unaligned_st(CPUArchState *env, target_ulong addr)
+{
+ cpu_loop_exit_sigbus(env_cpu(env), addr, MMU_DATA_STORE, GETPC());
+}
+
static void *cpu_mmu_lookup(CPUArchState *env, target_ulong addr,
MemOpIdx oi, uintptr_t ra, MMUAccessType type)
{
--
2.25.1
- [PULL 50/60] target/ppc: Restrict ppc_cpu_do_unaligned_access to sysemu, (continued)
- [PULL 50/60] target/ppc: Restrict ppc_cpu_do_unaligned_access to sysemu, Richard Henderson, 2021/11/02
- [PULL 52/60] target/s390x: Implement s390x_cpu_record_sigbus, Richard Henderson, 2021/11/02
- [PULL 54/60] target/sparc: Remove DEBUG_UNALIGNED, Richard Henderson, 2021/11/02
- [PULL 57/60] accel/tcg: Report unaligned atomics for user-only, Richard Henderson, 2021/11/02
- [PULL 56/60] target/sparc: Set fault address in sparc_cpu_do_unaligned_access, Richard Henderson, 2021/11/02
- [PULL 55/60] target/sparc: Split out build_sfsr, Richard Henderson, 2021/11/02
- [PULL 51/60] linux-user/ppc: Remove POWERPC_EXCP_ALIGN handling, Richard Henderson, 2021/11/02
- [PULL 53/60] target/sh4: Set fault address in superh_cpu_do_unaligned_access, Richard Henderson, 2021/11/02
- [PULL 58/60] accel/tcg: Report unaligned load/store for user-only, Richard Henderson, 2021/11/02
- [PULL 60/60] linux-user: Handle BUS_ADRALN in host_signal_handler, Richard Henderson, 2021/11/02
- [PULL 59/60] tcg: Add helper_unaligned_{ld,st} for user-only sigbus,
Richard Henderson <=
- Re: [PULL 00/60] accel/tcg patch queue, Richard Henderson, 2021/11/02