aboutsummaryrefslogtreecommitdiff
path: root/target-sparc
diff options
context:
space:
mode:
authorRichard Henderson <rth@twiddle.net>2010-04-22 22:56:42 -0700
committerBlue Swirl <blauwirbel@gmail.com>2010-04-23 18:38:04 +0000
commit41db525e9c6e4c98d6e41c403c7dc704ce0e77aa (patch)
tree49638aca1b2c81b01202dd528c7c580d831e369c /target-sparc
parent6c557ab975fc8e5edb4167a241266c7c4657054a (diff)
downloadqemu-41db525e9c6e4c98d6e41c403c7dc704ce0e77aa.zip
qemu-41db525e9c6e4c98d6e41c403c7dc704ce0e77aa.tar.gz
qemu-41db525e9c6e4c98d6e41c403c7dc704ce0e77aa.tar.bz2
target-sparc: Fix address masking in ldqf and stqf.
Use address_mask on both addr and addr+8 in both these routines, rather than explicit masking with 0xffffffff. Reformulate address_mask to return a result, rather than masking a pass-by-reference argument. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'target-sparc')
-rw-r--r--target-sparc/op_helper.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/target-sparc/op_helper.c b/target-sparc/op_helper.c
index 704631a..b27778b 100644
--- a/target-sparc/op_helper.c
+++ b/target-sparc/op_helper.c
@@ -201,12 +201,13 @@ static void replace_tlb_1bit_lru(SparcTLBEntry *tlb,
#endif
-static inline void address_mask(CPUState *env1, target_ulong *addr)
+static inline target_ulong address_mask(CPUState *env1, target_ulong addr)
{
#ifdef TARGET_SPARC64
if (AM_CHECK(env1))
- *addr &= 0xffffffffULL;
+ addr &= 0xffffffffULL;
#endif
+ return addr;
}
static void raise_exception(int tt)
@@ -1923,7 +1924,7 @@ uint64_t helper_ld_asi(target_ulong addr, int asi, int size, int sign)
raise_exception(TT_PRIV_ACT);
helper_check_align(addr, size - 1);
- address_mask(env, &addr);
+ addr = address_mask(env, addr);
switch (asi) {
case 0x82: // Primary no-fault
@@ -2026,7 +2027,7 @@ void helper_st_asi(target_ulong addr, target_ulong val, int asi, int size)
raise_exception(TT_PRIV_ACT);
helper_check_align(addr, size - 1);
- address_mask(env, &addr);
+ addr = address_mask(env, addr);
/* Convert to little endian */
switch (asi) {
@@ -2944,8 +2945,7 @@ void helper_stdf(target_ulong addr, int mem_idx)
break;
}
#else
- address_mask(env, &addr);
- stfq_raw(addr, DT0);
+ stfq_raw(address_mask(env, addr), DT0);
#endif
}
@@ -2969,8 +2969,7 @@ void helper_lddf(target_ulong addr, int mem_idx)
break;
}
#else
- address_mask(env, &addr);
- DT0 = ldfq_raw(addr);
+ DT0 = ldfq_raw(address_mask(env, addr));
#endif
}
@@ -3003,9 +3002,8 @@ void helper_ldqf(target_ulong addr, int mem_idx)
break;
}
#else
- address_mask(env, &addr);
- u.ll.upper = ldq_raw(addr);
- u.ll.lower = ldq_raw((addr + 8) & 0xffffffffULL);
+ u.ll.upper = ldq_raw(address_mask(env, addr));
+ u.ll.lower = ldq_raw(address_mask(env, addr + 8));
QT0 = u.q;
#endif
}
@@ -3040,9 +3038,8 @@ void helper_stqf(target_ulong addr, int mem_idx)
}
#else
u.q = QT0;
- address_mask(env, &addr);
- stq_raw(addr, u.ll.upper);
- stq_raw((addr + 8) & 0xffffffffULL, u.ll.lower);
+ stq_raw(address_mask(env, addr), u.ll.upper);
+ stq_raw(address_mask(env, addr + 8), u.ll.lower);
#endif
}