[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 25/30] s390x/tcg: MVN: Fault-safe handling
From: |
David Hildenbrand |
Subject: |
[PULL 25/30] s390x/tcg: MVN: Fault-safe handling |
Date: |
Mon, 23 Sep 2019 10:07:07 +0200 |
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 eeb2552979..7c981f7902 100644
--- a/target/s390x/mem_helper.c
+++ b/target/s390x/mem_helper.c
@@ -500,13 +500,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.21.0
- [PULL 15/30] s390x/tcg: Always use MMU_USER_IDX for CONFIG_USER_ONLY, (continued)
- [PULL 15/30] s390x/tcg: Always use MMU_USER_IDX for CONFIG_USER_ONLY, David Hildenbrand, 2019/09/23
- [PULL 16/30] s390x/tcg: Fault-safe memset, David Hildenbrand, 2019/09/23
- [PULL 18/30] s390x/tcg: MVCS/MVCP: Use access_memmove(), David Hildenbrand, 2019/09/23
- [PULL 17/30] s390x/tcg: Fault-safe memmove, David Hildenbrand, 2019/09/23
- [PULL 19/30] s390x/tcg: MVC: Fault-safe handling on destructive overlaps, David Hildenbrand, 2019/09/23
- [PULL 20/30] s390x/tcg: MVCLU: Fault-safe handling, David Hildenbrand, 2019/09/23
- [PULL 21/30] s390x/tcg: OC: Fault-safe handling, David Hildenbrand, 2019/09/23
- [PULL 22/30] s390x/tcg: XC: Fault-safe handling, David Hildenbrand, 2019/09/23
- [PULL 23/30] s390x/tcg: NC: Fault-safe handling, David Hildenbrand, 2019/09/23
- [PULL 24/30] s390x/tcg: MVCIN: Fault-safe handling, David Hildenbrand, 2019/09/23
- [PULL 25/30] s390x/tcg: MVN: Fault-safe handling,
David Hildenbrand <=
- [PULL 26/30] s390x/tcg: MVZ: Fault-safe handling, David Hildenbrand, 2019/09/23
- [PULL 27/30] s390x/tcg: MVST: Fault-safe handling, David Hildenbrand, 2019/09/23
- [PULL 28/30] s390x/tcg: MVO: Fault-safe handling, David Hildenbrand, 2019/09/23
- [PULL 29/30] tests/tcg: target/s390x: Test MVO, David Hildenbrand, 2019/09/23
- [PULL 30/30] tests/tcg: target/s390x: Test MVC, David Hildenbrand, 2019/09/23
- Re: [PULL 00/30] s390x/tcg update, no-reply, 2019/09/23
- Re: [PULL 00/30] s390x/tcg update, no-reply, 2019/09/23
- Re: [PULL 00/30] s390x/tcg update, Peter Maydell, 2019/09/23