[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[qemu-s390x] [PATCH v3 02/29] s390x/tcg: MVCL: Zero out unused bits of a
From: |
David Hildenbrand |
Subject: |
[qemu-s390x] [PATCH v3 02/29] s390x/tcg: MVCL: Zero out unused bits of address |
Date: |
Mon, 16 Sep 2019 15:57:39 +0200 |
We have to zero out unused bits in 24 and 31-bit addressing mode.
Provide a new helper.
Reviewed-by: Richard Henderson <address@hidden>
Signed-off-by: David Hildenbrand <address@hidden>
---
target/s390x/mem_helper.c | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c
index 39ee9b3175..b02ad148e5 100644
--- a/target/s390x/mem_helper.c
+++ b/target/s390x/mem_helper.c
@@ -469,6 +469,25 @@ static inline uint64_t get_address(CPUS390XState *env, int
reg)
return wrap_address(env, env->regs[reg]);
}
+/*
+ * Store the address to the given register, zeroing out unused leftmost
+ * bits in bit positions 32-63 (24-bit and 31-bit mode only).
+ */
+static inline void set_address_zero(CPUS390XState *env, int reg,
+ uint64_t address)
+{
+ if (env->psw.mask & PSW_MASK_64) {
+ env->regs[reg] = address;
+ } else {
+ if (!(env->psw.mask & PSW_MASK_32)) {
+ address &= 0x00ffffff;
+ } else {
+ address &= 0x7fffffff;
+ }
+ env->regs[reg] = deposit64(env->regs[reg], 0, 32, address);
+ }
+}
+
static inline void set_address(CPUS390XState *env, int reg, uint64_t address)
{
if (env->psw.mask & PSW_MASK_64) {
@@ -772,8 +791,8 @@ uint32_t HELPER(mvcl)(CPUS390XState *env, uint32_t r1,
uint32_t r2)
env->regs[r1 + 1] = deposit64(env->regs[r1 + 1], 0, 24, destlen);
env->regs[r2 + 1] = deposit64(env->regs[r2 + 1], 0, 24, srclen);
- set_address(env, r1, dest);
- set_address(env, r2, src);
+ set_address_zero(env, r1, dest);
+ set_address_zero(env, r2, src);
return cc;
}
--
2.21.0
- [qemu-s390x] [PATCH v3 00/29] s390x/tcg: mem_helper: Fault-safe handling, David Hildenbrand, 2019/09/16
- [qemu-s390x] [PATCH v3 01/29] s390x/tcg: Reset exception_index to -1 instead of 0, David Hildenbrand, 2019/09/16
- [qemu-s390x] [PATCH v3 02/29] s390x/tcg: MVCL: Zero out unused bits of address,
David Hildenbrand <=
- [qemu-s390x] [PATCH v3 03/29] s390x/tcg: MVCL: Detect destructive overlaps, David Hildenbrand, 2019/09/16
- [qemu-s390x] [PATCH v3 04/29] s390x/tcg: MVCL: Process max 4k bytes at a time, David Hildenbrand, 2019/09/16
- [qemu-s390x] [PATCH v3 06/29] s390x/tcg: MVC: Use is_destructive_overlap(), David Hildenbrand, 2019/09/16
- [qemu-s390x] [PATCH v3 05/29] s390x/tcg: MVC: Increment the length once, David Hildenbrand, 2019/09/16
- [qemu-s390x] [PATCH v3 07/29] s390x/tcg: MVPG: Check for specification exceptions, David Hildenbrand, 2019/09/16
- [qemu-s390x] [PATCH v3 09/29] s390x/tcg: MVCLU/MVCLE: Process max 4k bytes at a time, David Hildenbrand, 2019/09/16
- [qemu-s390x] [PATCH v3 08/29] s390x/tcg: MVPG: Properly wrap the addresses, David Hildenbrand, 2019/09/16
- [qemu-s390x] [PATCH v3 10/29] s390x/tcg: MVCS/MVCP: Check for special operation exceptions, David Hildenbrand, 2019/09/16