[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[qemu-s390x] [PATCH v1 3/9] tcg: Factor out CONFIG_USER_ONLY probe_write
From: |
David Hildenbrand |
Subject: |
[qemu-s390x] [PATCH v1 3/9] tcg: Factor out CONFIG_USER_ONLY probe_write() from s390x code |
Date: |
Fri, 23 Aug 2019 12:07:35 +0200 |
Factor it out, we'll do some further changes/extensions to both
probe_write() implementations soon. Make sure to allow "size = 0".
Signed-off-by: David Hildenbrand <address@hidden>
---
accel/tcg/user-exec.c | 16 ++++++++++++++++
include/exec/exec-all.h | 4 ++--
target/s390x/mem_helper.c | 7 -------
3 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c
index 897d1571c4..322d49c9b8 100644
--- a/accel/tcg/user-exec.c
+++ b/accel/tcg/user-exec.c
@@ -188,6 +188,22 @@ static inline int handle_cpu_signal(uintptr_t pc,
siginfo_t *info,
g_assert_not_reached();
}
+void probe_write(CPUArchState *env, target_ulong addr, int size, int mmu_idx,
+ uintptr_t retaddr)
+{
+ CPUState *cpu = env_cpu(env);
+ CPUClass *cc;
+
+ if (!guest_addr_valid(addr) ||
+ (size > 0 && !guest_addr_valid(addr + size - 1)) ||
+ page_check_range(addr, size, PAGE_WRITE) < 0) {
+ cc = CPU_GET_CLASS(cpu);
+ cc->tlb_fill(cpu, addr, size, MMU_DATA_STORE, MMU_USER_IDX, false,
+ retaddr);
+ g_assert_not_reached();
+ }
+}
+
#if defined(__i386__)
#if defined(__NetBSD__)
diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h
index 135aeaab0d..cbcc85add3 100644
--- a/include/exec/exec-all.h
+++ b/include/exec/exec-all.h
@@ -260,8 +260,6 @@ void tlb_set_page_with_attrs(CPUState *cpu, target_ulong
vaddr,
void tlb_set_page(CPUState *cpu, target_ulong vaddr,
hwaddr paddr, int prot,
int mmu_idx, target_ulong size);
-void probe_write(CPUArchState *env, target_ulong addr, int size, int mmu_idx,
- uintptr_t retaddr);
#else
static inline void tlb_init(CPUState *cpu)
{
@@ -312,6 +310,8 @@ static inline void
tlb_flush_by_mmuidx_all_cpus_synced(CPUState *cpu,
{
}
#endif
+void probe_write(CPUArchState *env, target_ulong addr, int size, int mmu_idx,
+ uintptr_t retaddr);
#define CODE_GEN_ALIGN 16 /* must be >= of the size of a icache line
*/
diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c
index 4b43440e89..fdff60ce5d 100644
--- a/target/s390x/mem_helper.c
+++ b/target/s390x/mem_helper.c
@@ -2615,12 +2615,6 @@ uint32_t HELPER(cu42)(CPUS390XState *env, uint32_t r1,
uint32_t r2, uint32_t m3)
void probe_write_access(CPUS390XState *env, uint64_t addr, uint64_t len,
uintptr_t ra)
{
-#ifdef CONFIG_USER_ONLY
- if (!guest_addr_valid(addr) || !guest_addr_valid(addr + len - 1) ||
- page_check_range(addr, len, PAGE_WRITE) < 0) {
- s390_program_interrupt(env, PGM_ADDRESSING, ILEN_AUTO, ra);
- }
-#else
/* test the actual access, not just any access to the page due to LAP */
while (len) {
const uint64_t pagelen = -(addr | TARGET_PAGE_MASK);
@@ -2630,7 +2624,6 @@ void probe_write_access(CPUS390XState *env, uint64_t
addr, uint64_t len,
addr = wrap_address(env, addr + curlen);
len -= curlen;
}
-#endif
}
void HELPER(probe_write_access)(CPUS390XState *env, uint64_t addr, uint64_t
len)
--
2.21.0
- [qemu-s390x] [PATCH v1 0/9] tcg: probe_write() refactorings and watchpoints, David Hildenbrand, 2019/08/23
- [qemu-s390x] [PATCH v1 1/9] s390x/tcg: Use guest_addr_valid() instead of h2g_valid() in probe_write_access(), David Hildenbrand, 2019/08/23
- [qemu-s390x] [PATCH v1 2/9] s390x/tcg: Fix length calculation in probe_write_access(), David Hildenbrand, 2019/08/23
- [qemu-s390x] [PATCH v1 3/9] tcg: Factor out CONFIG_USER_ONLY probe_write() from s390x code,
David Hildenbrand <=
- [qemu-s390x] [PATCH v1 4/9] tcg: Enforce single page access in probe_write() for !CONFIG_USER_ONLY, David Hildenbrand, 2019/08/23
- [qemu-s390x] [PATCH v1 5/9] mips/tcg: Call probe_write() for CONFIG_USER_ONLY as well, David Hildenbrand, 2019/08/23
- [qemu-s390x] [PATCH v1 6/9] hppa/tcg: Call probe_write() also for CONFIG_USER_ONLY, David Hildenbrand, 2019/08/23
- [qemu-s390x] [PATCH v1 7/9] s390x/tcg: Pass a size to probe_write() in do_csst(), David Hildenbrand, 2019/08/23