[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[qemu-s390x] [PATCH v3 22/29] s390x/tcg: XC: Fault-safe handling
From: |
David Hildenbrand |
Subject: |
[qemu-s390x] [PATCH v3 22/29] s390x/tcg: XC: Fault-safe handling |
Date: |
Mon, 16 Sep 2019 15:57:59 +0200 |
We can process a maximum of 256 bytes, crossing two pages. While at it,
increment the length once.
Reviewed-by: Richard Henderson <address@hidden>
Signed-off-by: David Hildenbrand <address@hidden>
---
target/s390x/mem_helper.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c
index 0574c31d9a..a2118a82e3 100644
--- a/target/s390x/mem_helper.c
+++ b/target/s390x/mem_helper.c
@@ -349,14 +349,19 @@ static uint32_t do_helper_xc(CPUS390XState *env, uint32_t
l, uint64_t dest,
uint64_t src, uintptr_t ra)
{
const int mmu_idx = cpu_mmu_index(env, false);
- S390Access desta;
+ S390Access srca1, srca2, desta;
uint32_t i;
uint8_t c = 0;
HELPER_LOG("%s l %d dest %" PRIx64 " src %" PRIx64 "\n",
__func__, l, dest, src);
- desta = access_prepare(env, dest, l + 1, MMU_DATA_STORE, mmu_idx, ra);
+ /* XC always processes one more byte than specified - maximum is 256 */
+ l++;
+
+ srca1 = access_prepare(env, src, l, MMU_DATA_LOAD, mmu_idx, ra);
+ srca2 = access_prepare(env, dest, l, MMU_DATA_LOAD, mmu_idx, ra);
+ desta = access_prepare(env, dest, l, MMU_DATA_STORE, mmu_idx, ra);
/* xor with itself is the same as memset(0) */
if (src == dest) {
@@ -364,11 +369,12 @@ static uint32_t do_helper_xc(CPUS390XState *env, uint32_t
l, uint64_t dest,
return 0;
}
- for (i = 0; i <= l; i++) {
- uint8_t x = cpu_ldub_data_ra(env, src + i, ra);
- x ^= cpu_ldub_data_ra(env, dest + i, ra);
+ for (i = 0; i < l; i++) {
+ const uint8_t x = access_get_byte(env, &srca1, i, ra) ^
+ access_get_byte(env, &srca2, i, ra);
+
c |= x;
- cpu_stb_data_ra(env, dest + i, x, ra);
+ access_set_byte(env, &desta, i, x, ra);
}
return c != 0;
}
--
2.21.0
- Re: [qemu-s390x] [Qemu-devel] [PATCH v3 18/29] s390x/tcg: MVCS/MVCP: Use access_memmove(), (continued)
- [qemu-s390x] [PATCH v3 19/29] s390x/tcg: MVC: Fault-safe handling on destructive overlaps, David Hildenbrand, 2019/09/16
- [qemu-s390x] [PATCH v3 17/29] s390x/tcg: Fault-safe memmove, David Hildenbrand, 2019/09/16
- [qemu-s390x] [PATCH v3 16/29] s390x/tcg: Fault-safe memset, David Hildenbrand, 2019/09/16
- [qemu-s390x] [PATCH v3 20/29] s390x/tcg: MVCLU: Fault-safe handling, David Hildenbrand, 2019/09/16
- [qemu-s390x] [PATCH v3 21/29] s390x/tcg: OC: Fault-safe handling, David Hildenbrand, 2019/09/16
- [qemu-s390x] [PATCH v3 22/29] s390x/tcg: XC: Fault-safe handling,
David Hildenbrand <=
- [qemu-s390x] [PATCH v3 23/29] s390x/tcg: NC: Fault-safe handling, David Hildenbrand, 2019/09/16
- [qemu-s390x] [PATCH v3 24/29] s390x/tcg: MVCIN: Fault-safe handling, David Hildenbrand, 2019/09/16
- [qemu-s390x] [PATCH v3 25/29] s390x/tcg: MVN: Fault-safe handling, David Hildenbrand, 2019/09/16
- [qemu-s390x] [PATCH v3 26/29] s390x/tcg: MVZ: Fault-safe handling, David Hildenbrand, 2019/09/16
- [qemu-s390x] [PATCH v3 27/29] s390x/tcg: MVST: Fault-safe handling, David Hildenbrand, 2019/09/16
- [qemu-s390x] [PATCH v3 28/29] s390x/tcg: MVO: Fault-safe handling, David Hildenbrand, 2019/09/16
- [qemu-s390x] [PATCH v3 29/29] tests/tcg: target/s390x: Test MVO, David Hildenbrand, 2019/09/16