[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[qemu-s390x] [PATCH v2 18/28] s390x/tcg: MVC: Fault-safe handling on des
From: |
David Hildenbrand |
Subject: |
[qemu-s390x] [PATCH v2 18/28] s390x/tcg: MVC: Fault-safe handling on destructive overlaps |
Date: |
Fri, 6 Sep 2019 09:57:40 +0200 |
The last remaining bit for MVC is handling destructive overlaps in a
fault-safe way.
Signed-off-by: David Hildenbrand <address@hidden>
---
target/s390x/mem_helper.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c
index 2607dd1677..f636f3a011 100644
--- a/target/s390x/mem_helper.c
+++ b/target/s390x/mem_helper.c
@@ -145,6 +145,14 @@ static S390Access access_prepare_idx(CPUS390XState *env,
vaddr vaddr, int size,
return access;
}
+static S390Access access_prepare(CPUS390XState *env, vaddr vaddr, int size,
+ MMUAccessType access_type, uintptr_t ra)
+{
+ int mmu_idx = cpu_mmu_index(env, false);
+
+ return access_prepare_idx(env, vaddr, size, access_type, mmu_idx, ra);
+}
+
static void access_memset_idx(CPUS390XState *env, vaddr vaddr, uint8_t byte,
int size, int mmu_idx, uintptr_t ra)
{
@@ -420,9 +428,13 @@ static uint32_t do_helper_mvc(CPUS390XState *env, uint32_t
l, uint64_t dest,
} else if (!is_destructive_overlap(env, dest, src, l)) {
access_memmove(env, dest, src, l, ra);
} else {
+ S390Access srca = access_prepare(env, src, l, MMU_DATA_LOAD, ra);
+ S390Access desta = access_prepare(env, dest, l, MMU_DATA_STORE, ra);
+
for (i = 0; i < l; i++) {
- uint8_t x = cpu_ldub_data_ra(env, src + i, ra);
- cpu_stb_data_ra(env, dest + i, x, ra);
+ uint8_t byte = access_get_byte(env, &srca, i, ra);
+
+ access_set_byte(env, &desta, i, byte, ra);
}
}
--
2.21.0
- Re: [qemu-s390x] [Qemu-devel] [PATCH v2 14/28] s390x/tcg: Always use MMU_USER_IDX for CONFIG_USER_ONLY, (continued)
- [qemu-s390x] [PATCH v2 15/28] s390x/tcg: Fault-safe memset, David Hildenbrand, 2019/09/06
- [qemu-s390x] [PATCH v2 17/28] s390x/tcg: MVCS/MVCP: Use access_memmove_idx(), David Hildenbrand, 2019/09/06
- [qemu-s390x] [PATCH v2 16/28] s390x/tcg: Fault-safe memmove, David Hildenbrand, 2019/09/06
- [qemu-s390x] [PATCH v2 18/28] s390x/tcg: MVC: Fault-safe handling on destructive overlaps,
David Hildenbrand <=
- [qemu-s390x] [PATCH v2 19/28] s390x/tcg: MVCLU: Fault-safe handling, David Hildenbrand, 2019/09/06
- [qemu-s390x] [PATCH v2 20/28] s390x/tcg: OC: Fault-safe handling, David Hildenbrand, 2019/09/06
- [qemu-s390x] [PATCH v2 21/28] s390x/tcg: XC: Fault-safe handling, David Hildenbrand, 2019/09/06
- [qemu-s390x] [PATCH v2 23/28] s390x/tcg: MVCIN: Fault-safe handling, David Hildenbrand, 2019/09/06