[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[qemu-s390x] [PULL SUBSYSTEM s390x 24/29] s390x/tcg: MVCIN: Fault-safe h
From: |
David Hildenbrand |
Subject: |
[qemu-s390x] [PULL SUBSYSTEM s390x 24/29] s390x/tcg: MVCIN: Fault-safe handling |
Date: |
Wed, 18 Sep 2019 17:29:17 +0200 |
We can process a maximum of 256 bytes, crossing two pages. Calculate the
accessed range upfront - src is accessed right-to-left.
Reviewed-by: Richard Henderson <address@hidden>
Signed-off-by: David Hildenbrand <address@hidden>
---
target/s390x/mem_helper.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c
index 20fc17d44d..4f46d0be90 100644
--- a/target/s390x/mem_helper.c
+++ b/target/s390x/mem_helper.c
@@ -473,12 +473,21 @@ void HELPER(mvc)(CPUS390XState *env, uint32_t l, uint64_t
dest, uint64_t src)
/* move inverse */
void HELPER(mvcin)(CPUS390XState *env, uint32_t l, uint64_t dest, uint64_t src)
{
+ const int mmu_idx = cpu_mmu_index(env, false);
+ S390Access srca, desta;
uintptr_t ra = GETPC();
int i;
- for (i = 0; i <= l; i++) {
- uint8_t v = cpu_ldub_data_ra(env, src - i, ra);
- cpu_stb_data_ra(env, dest + i, v, ra);
+ /* MVCIN always copies one more byte than specified - maximum is 256 */
+ l++;
+
+ src = wrap_address(env, src - l + 1);
+ srca = access_prepare(env, src, 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, &srca, l - i - 1, ra);
+
+ access_set_byte(env, &desta, i, x, ra);
}
}
--
2.21.0
- [qemu-s390x] [PULL SUBSYSTEM s390x 14/29] s390x/tcg: MVST: Fix storing back the addresses to registers, (continued)
- [qemu-s390x] [PULL SUBSYSTEM s390x 14/29] s390x/tcg: MVST: Fix storing back the addresses to registers, David Hildenbrand, 2019/09/18
- [qemu-s390x] [PULL SUBSYSTEM s390x 15/29] s390x/tcg: Always use MMU_USER_IDX for CONFIG_USER_ONLY, David Hildenbrand, 2019/09/18
- [qemu-s390x] [PULL SUBSYSTEM s390x 16/29] s390x/tcg: Fault-safe memset, David Hildenbrand, 2019/09/18
- [qemu-s390x] [PULL SUBSYSTEM s390x 17/29] s390x/tcg: Fault-safe memmove, David Hildenbrand, 2019/09/18
- [qemu-s390x] [PULL SUBSYSTEM s390x 19/29] s390x/tcg: MVC: Fault-safe handling on destructive overlaps, David Hildenbrand, 2019/09/18
- [qemu-s390x] [PULL SUBSYSTEM s390x 18/29] s390x/tcg: MVCS/MVCP: Use access_memmove(), David Hildenbrand, 2019/09/18
- [qemu-s390x] [PULL SUBSYSTEM s390x 22/29] s390x/tcg: XC: Fault-safe handling, David Hildenbrand, 2019/09/18
- [qemu-s390x] [PULL SUBSYSTEM s390x 20/29] s390x/tcg: MVCLU: Fault-safe handling, David Hildenbrand, 2019/09/18
- [qemu-s390x] [PULL SUBSYSTEM s390x 21/29] s390x/tcg: OC: Fault-safe handling, David Hildenbrand, 2019/09/18
- [qemu-s390x] [PULL SUBSYSTEM s390x 23/29] s390x/tcg: NC: Fault-safe handling, David Hildenbrand, 2019/09/18
- [qemu-s390x] [PULL SUBSYSTEM s390x 24/29] s390x/tcg: MVCIN: Fault-safe handling,
David Hildenbrand <=
- [qemu-s390x] [PULL SUBSYSTEM s390x 25/29] s390x/tcg: MVN: Fault-safe handling, David Hildenbrand, 2019/09/18
- [qemu-s390x] [PULL SUBSYSTEM s390x 26/29] s390x/tcg: MVZ: Fault-safe handling, David Hildenbrand, 2019/09/18
- [qemu-s390x] [PULL SUBSYSTEM s390x 27/29] s390x/tcg: MVST: Fault-safe handling, David Hildenbrand, 2019/09/18
- [qemu-s390x] [PULL SUBSYSTEM s390x 29/29] tests/tcg: target/s390x: Test MVO, David Hildenbrand, 2019/09/18
- [qemu-s390x] [PULL SUBSYSTEM s390x 28/29] s390x/tcg: MVO: Fault-safe handling, David Hildenbrand, 2019/09/18
- Re: [qemu-s390x] [PULL SUBSYSTEM s390x 00/29] s390x/tcg: mem_helper: Fault-safe handling, Cornelia Huck, 2019/09/19