diff options
author | David Hildenbrand <david@redhat.com> | 2019-09-04 16:51:21 +0200 |
---|---|---|
committer | David Hildenbrand <david@redhat.com> | 2019-09-23 09:28:29 +0200 |
commit | 4d78c68bafe4c12d8185a4c33932a1aea35c4921 (patch) | |
tree | 41994807c9f9e223451a14cce198ad72560d8441 | |
parent | a8821dd56ea65f73858df0b400702da79608cfeb (diff) | |
download | qemu-4d78c68bafe4c12d8185a4c33932a1aea35c4921.zip |
s390x/tcg: NC: Fault-safe handling
We can process a maximum of 256 bytes, crossing two pages.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
-rw-r--r-- | target/s390x/mem_helper.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c index 0d4e0bc45a..a97e4aa535 100644 --- a/target/s390x/mem_helper.c +++ b/target/s390x/mem_helper.c @@ -329,17 +329,26 @@ static int mmu_idx_from_as(uint8_t as) static uint32_t do_helper_nc(CPUS390XState *env, uint32_t l, uint64_t dest, uint64_t src, uintptr_t ra) { + const int mmu_idx = cpu_mmu_index(env, false); + 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); - 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); + /* NC 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); + 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; } |