[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[qemu-s390x] [PULL 27/34] s390x/tcg: MVST: Fault-safe handling
From: |
Cornelia Huck |
Subject: |
[qemu-s390x] [PULL 27/34] s390x/tcg: MVST: Fault-safe handling |
Date: |
Thu, 19 Sep 2019 14:41:08 +0200 |
From: David Hildenbrand <address@hidden>
Access at most single pages and document why. Using the access helpers
might over-indicate watchpoints within the same page, I guess we can
live with that.
Reviewed-by: Richard Henderson <address@hidden>
Signed-off-by: David Hildenbrand <address@hidden>
---
target/s390x/mem_helper.c | 24 +++++++++++++++++-------
1 file changed, 17 insertions(+), 7 deletions(-)
diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c
index c836b69fcc12..671e917dc1f8 100644
--- a/target/s390x/mem_helper.c
+++ b/target/s390x/mem_helper.c
@@ -860,23 +860,33 @@ uint32_t HELPER(mvpg)(CPUS390XState *env, uint64_t r0,
uint64_t r1, uint64_t r2)
/* string copy */
uint32_t HELPER(mvst)(CPUS390XState *env, uint32_t r1, uint32_t r2)
{
+ const int mmu_idx = cpu_mmu_index(env, false);
const uint64_t d = get_address(env, r1);
const uint64_t s = get_address(env, r2);
const uint8_t c = env->regs[0];
+ const int len = MIN(-(d | TARGET_PAGE_MASK), -(s | TARGET_PAGE_MASK));
+ S390Access srca, desta;
uintptr_t ra = GETPC();
- uint32_t len;
+ int i;
if (env->regs[0] & 0xffffff00ull) {
s390_program_interrupt(env, PGM_SPECIFICATION, ILEN_AUTO, ra);
}
- /* Lest we fail to service interrupts in a timely manner, limit the
- amount of work we're willing to do. For now, let's cap at 8k. */
- for (len = 0; len < 0x2000; ++len) {
- uint8_t v = cpu_ldub_data_ra(env, s + len, ra);
- cpu_stb_data_ra(env, d + len, v, ra);
+ /*
+ * Our access should not exceed single pages, as we must not report access
+ * exceptions exceeding the actually copied range (which we don't know at
+ * this point). We might over-indicate watchpoints within the pages
+ * (if we ever care, we have to limit processing to a single byte).
+ */
+ srca = access_prepare(env, s, len, MMU_DATA_LOAD, mmu_idx, ra);
+ desta = access_prepare(env, d, len, MMU_DATA_STORE, mmu_idx, ra);
+ for (i = 0; i < len; i++) {
+ const uint8_t v = access_get_byte(env, &srca, i, ra);
+
+ access_set_byte(env, &desta, i, v, ra);
if (v == c) {
- set_address_zero(env, r1, d + len);
+ set_address_zero(env, r1, d + i);
return 1;
}
}
--
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 <=
- [qemu-s390x] [PULL 25/34] s390x/tcg: MVN: Fault-safe handling, Cornelia Huck, 2019/09/19
- [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