[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[qemu-s390x] [PULL 25/34] s390x/tcg: MVN: Fault-safe handling
From: |
Cornelia Huck |
Subject: |
[qemu-s390x] [PULL 25/34] s390x/tcg: MVN: Fault-safe handling |
Date: |
Thu, 19 Sep 2019 14:41:06 +0200 |
From: David Hildenbrand <address@hidden>
We can process a maximum of 256 bytes, crossing two pages.
Reviewed-by: Richard Henderson <address@hidden>
Signed-off-by: David Hildenbrand <address@hidden>
---
target/s390x/mem_helper.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c
index 4f46d0be90b3..fbf65ac42bd2 100644
--- a/target/s390x/mem_helper.c
+++ b/target/s390x/mem_helper.c
@@ -494,13 +494,22 @@ void HELPER(mvcin)(CPUS390XState *env, uint32_t l,
uint64_t dest, uint64_t src)
/* move numerics */
void HELPER(mvn)(CPUS390XState *env, uint32_t l, uint64_t dest, uint64_t src)
{
+ const int mmu_idx = cpu_mmu_index(env, false);
+ S390Access srca1, srca2, desta;
uintptr_t ra = GETPC();
int i;
- for (i = 0; i <= l; i++) {
- uint8_t v = cpu_ldub_data_ra(env, dest + i, ra) & 0xf0;
- v |= cpu_ldub_data_ra(env, src + i, ra) & 0x0f;
- cpu_stb_data_ra(env, dest + i, v, ra);
+ /* MVN always copies 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);
+ for (i = 0; i < l; i++) {
+ const uint8_t x = (access_get_byte(env, &srca1, i, ra) & 0x0f) |
+ (access_get_byte(env, &srca2, i, ra) & 0xf0);
+
+ access_set_byte(env, &desta, i, x, ra);
}
}
--
2.20.1
- [qemu-s390x] [PULL 00/34] s390x update, Cornelia Huck, 2019/09/19
- [qemu-s390x] [PULL 34/34] s390x/cpumodel: Add the z15 name to the description of gen15a, Cornelia Huck, 2019/09/19
- [qemu-s390x] [PULL 33/34] s390x/kvm: Officially require at least kernel 3.15, Cornelia Huck, 2019/09/19
- [qemu-s390x] [PULL 31/34] pc-bios/s390-ccw/net: fix a possible memory leak in get_uuid(), Cornelia Huck, 2019/09/19
- [qemu-s390x] [PULL 32/34] pc-bios/s390-ccw: Rebuild the s390-netboot.img firmware image, Cornelia Huck, 2019/09/19
- [qemu-s390x] [PULL 30/34] pc-bios/s390-ccw: Do not pre-initialize empty array, Cornelia Huck, 2019/09/19
- [qemu-s390x] [PULL 29/34] tests/tcg: target/s390x: Test MVO, Cornelia Huck, 2019/09/19
- [qemu-s390x] [PULL 28/34] s390x/tcg: MVO: Fault-safe handling, Cornelia Huck, 2019/09/19
- [qemu-s390x] [PULL 27/34] s390x/tcg: MVST: Fault-safe handling, Cornelia Huck, 2019/09/19
- [qemu-s390x] [PULL 25/34] s390x/tcg: MVN: Fault-safe handling,
Cornelia Huck <=
- [qemu-s390x] [PULL 23/34] s390x/tcg: NC: Fault-safe handling, Cornelia Huck, 2019/09/19
- [qemu-s390x] [PULL 24/34] s390x/tcg: MVCIN: Fault-safe handling, Cornelia Huck, 2019/09/19
- [qemu-s390x] [PULL 26/34] s390x/tcg: MVZ: Fault-safe handling, Cornelia Huck, 2019/09/19
- [qemu-s390x] [PULL 21/34] s390x/tcg: OC: Fault-safe handling, Cornelia Huck, 2019/09/19
- [qemu-s390x] [PULL 20/34] s390x/tcg: MVCLU: Fault-safe handling, Cornelia Huck, 2019/09/19
- [qemu-s390x] [PULL 17/34] s390x/tcg: Fault-safe memmove, Cornelia Huck, 2019/09/19
- [qemu-s390x] [PULL 22/34] s390x/tcg: XC: Fault-safe handling, Cornelia Huck, 2019/09/19
- [qemu-s390x] [PULL 19/34] s390x/tcg: MVC: Fault-safe handling on destructive overlaps, Cornelia Huck, 2019/09/19
- [qemu-s390x] [PULL 18/34] s390x/tcg: MVCS/MVCP: Use access_memmove(), Cornelia Huck, 2019/09/19
- [qemu-s390x] [PULL 13/34] s390x/tcg: MVST: Check for specification exceptions, Cornelia Huck, 2019/09/19