[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 18/66] target/sparc: Set fault address in sparc_cpu_do_unalign
From: |
Richard Henderson |
Subject: |
[PATCH v3 18/66] target/sparc: Set fault address in sparc_cpu_do_unaligned_access |
Date: |
Wed, 18 Aug 2021 09:18:32 -1000 |
We ought to have been recording the virtual address for reporting
to the guest trap handler. Move the function to mmu_helper.c, so
that we can re-use code shared with get_physical_address_data.
Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/sparc/ldst_helper.c | 13 -------------
target/sparc/mmu_helper.c | 18 ++++++++++++++++++
2 files changed, 18 insertions(+), 13 deletions(-)
diff --git a/target/sparc/ldst_helper.c b/target/sparc/ldst_helper.c
index 974afea041..ea163200a4 100644
--- a/target/sparc/ldst_helper.c
+++ b/target/sparc/ldst_helper.c
@@ -1953,16 +1953,3 @@ void sparc_cpu_do_transaction_failed(CPUState *cs,
hwaddr physaddr,
is_asi, size, retaddr);
}
#endif
-
-#if !defined(CONFIG_USER_ONLY)
-void QEMU_NORETURN sparc_cpu_do_unaligned_access(CPUState *cs, vaddr addr,
- MMUAccessType access_type,
- int mmu_idx,
- uintptr_t retaddr)
-{
- SPARCCPU *cpu = SPARC_CPU(cs);
- CPUSPARCState *env = &cpu->env;
-
- cpu_raise_exception_ra(env, TT_UNALIGNED, retaddr);
-}
-#endif
diff --git a/target/sparc/mmu_helper.c b/target/sparc/mmu_helper.c
index 5b2fda534a..2f260b0085 100644
--- a/target/sparc/mmu_helper.c
+++ b/target/sparc/mmu_helper.c
@@ -946,4 +946,22 @@ hwaddr sparc_cpu_get_phys_page_debug(CPUState *cs, vaddr
addr)
}
return phys_addr;
}
+
+void QEMU_NORETURN sparc_cpu_do_unaligned_access(CPUState *cs, vaddr addr,
+ MMUAccessType access_type,
+ int mmu_idx,
+ uintptr_t retaddr)
+{
+ SPARCCPU *cpu = SPARC_CPU(cs);
+ CPUSPARCState *env = &cpu->env;
+
+#ifdef TARGET_SPARC64
+ env->dmmu.sfsr = build_sfsr(env, mmu_idx, access_type);
+ env->dmmu.sfar = addr;
+#else
+ env->mmuregs[4] = addr;
#endif
+
+ cpu_raise_exception_ra(env, TT_UNALIGNED, retaddr);
+}
+#endif /* CONFIG_USER_ONLY */
--
2.25.1
- Re: [PATCH v3 09/66] target/ppc: Move SPR_DSISR setting to powerpc_excp, (continued)
- [PATCH v3 10/66] target/ppc: Set fault address in ppc_cpu_do_unaligned_access, Richard Henderson, 2021/08/18
- [PATCH v3 11/66] target/ppc: Implement do_unaligned_access for user-only, Richard Henderson, 2021/08/18
- [PATCH v3 07/66] target/microblaze: Do not set MO_ALIGN for user-only, Richard Henderson, 2021/08/18
- [PATCH v3 12/66] target/riscv: Implement do_unaligned_access for user-only, Richard Henderson, 2021/08/18
- [PATCH v3 14/66] target/sh4: Set fault address in superh_cpu_do_unaligned_access, Richard Henderson, 2021/08/18
- [PATCH v3 16/66] target/sparc: Remove DEBUG_UNALIGNED, Richard Henderson, 2021/08/18
- [PATCH v3 18/66] target/sparc: Set fault address in sparc_cpu_do_unaligned_access,
Richard Henderson <=
- [PATCH v3 13/66] target/s390x: Implement do_unaligned_access for user-only, Richard Henderson, 2021/08/18
- [PATCH v3 08/66] target/mips: Implement do_unaligned_access for user-only, Richard Henderson, 2021/08/18
- [PATCH v3 15/66] target/sh4: Implement do_unaligned_access for user-only, Richard Henderson, 2021/08/18
- [PATCH v3 17/66] target/sparc: Split out build_sfsr, Richard Henderson, 2021/08/18
- [PATCH v3 20/66] target/xtensa: Implement do_unaligned_access for user-only, Richard Henderson, 2021/08/18
- [PATCH v3 22/66] accel/tcg: Drop signness in tracing in cputlb.c, Richard Henderson, 2021/08/18