[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[qemu-s390x] [PATCH v2 26/28] s390x/tcg: MVST: Fault-safe handling
From: |
David Hildenbrand |
Subject: |
[qemu-s390x] [PATCH v2 26/28] s390x/tcg: MVST: Fault-safe handling |
Date: |
Fri, 6 Sep 2019 09:57:48 +0200 |
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.
Signed-off-by: David Hildenbrand <address@hidden>
---
target/s390x/mem_helper.c | 23 ++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c
index 4c67c6f37e..73b00b582b 100644
--- a/target/s390x/mem_helper.c
+++ b/target/s390x/mem_helper.c
@@ -845,21 +845,30 @@ uint32_t HELPER(mvst)(CPUS390XState *env, uint64_t c,
uint32_t r1, uint32_t r2)
{
const uint64_t d = get_address(env, r1);
const uint64_t s = get_address(env, r2);
+ 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 (c & 0xffffff00ull) {
s390_program_interrupt(env, PGM_SPECIFICATION, ILEN_AUTO, ra);
}
c = c & 0xff;
- /* 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, ra);
+ desta = access_prepare(env, d, len, MMU_DATA_STORE, 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.21.0
- [qemu-s390x] [PATCH v2 23/28] s390x/tcg: MVCIN: Fault-safe handling, (continued)
- [qemu-s390x] [PATCH v2 23/28] s390x/tcg: MVCIN: Fault-safe handling, David Hildenbrand, 2019/09/06
- [qemu-s390x] [PATCH v2 25/28] s390x/tcg: MVZ: Fault-safe handling, David Hildenbrand, 2019/09/06
- [qemu-s390x] [PATCH v2 22/28] s390x/tcg: NC: Fault-safe handling, David Hildenbrand, 2019/09/06
- [qemu-s390x] [PATCH v2 24/28] s390x/tcg: MVN: Fault-safe handling, David Hildenbrand, 2019/09/06
- [qemu-s390x] [PATCH v2 27/28] s390x/tcg: MVO: Fault-safe handling, David Hildenbrand, 2019/09/06
- [qemu-s390x] [PATCH v2 26/28] s390x/tcg: MVST: Fault-safe handling,
David Hildenbrand <=
- [qemu-s390x] [PATCH v2 28/28] tests/tcg: target/s390x: Test MVO, David Hildenbrand, 2019/09/06
- Re: [qemu-s390x] [PATCH v2 00/28] s390x/tcg: mem_helper: Fault-safe handling, David Hildenbrand, 2019/09/11