From e22c357b3ec01c1141969ae81397d60d52e8c87b Mon Sep 17 00:00:00 2001 From: Doug Kwan Date: Thu, 29 May 2014 09:12:20 -0500 Subject: target-ppc: Allow little-endian user mode. This allows running PPC64 little-endian in user mode if target is configured that way. In PPC64 LE user mode we set MSR.LE during initialization. Signed-off-by: Doug Kwan Signed-off-by: Tom Musta Signed-off-by: Alexander Graf --- linux-user/main.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'linux-user/main.c') diff --git a/linux-user/main.c b/linux-user/main.c index 3e21024056..f577e19646 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -1484,7 +1484,7 @@ static int do_store_exclusive(CPUPPCState *env) { target_ulong addr; target_ulong page_addr; - target_ulong val, val2 __attribute__((unused)); + target_ulong val, val2 __attribute__((unused)) = 0; int flags; int segv = 0; @@ -1527,6 +1527,12 @@ static int do_store_exclusive(CPUPPCState *env) case 8: segv = put_user_u64(val, addr); break; case 16: { if (val2 == env->reserve_val2) { + if (msr_le) { + val2 = val; + val = env->gpr[reg+1]; + } else { + val2 = env->gpr[reg+1]; + } segv = put_user_u64(val, addr); if (!segv) { segv = put_user_u64(val2, addr + 8); -- cgit 1.4.1 From 4b1daa72d3b68b050bb9013edd0888972a0e22dd Mon Sep 17 00:00:00 2001 From: Tom Musta Date: Thu, 29 May 2014 09:12:24 -0500 Subject: target-ppc: Store Quadword Conditional Drops Size Bit The size and register information are encoded into the reserve_info field of CPU state in the store conditional translation code. Specifically, the size is shifted left by 5 bits (see target-ppc/translate.c gen_conditional_store). The user-mode store conditional code erroneously extracts the size by ANDing with a 4 bit mask; this breaks if size >= 16. Eliminate the mask to make the extraction of size mirror its encoding. Signed-off-by: Tom Musta Signed-off-by: Alexander Graf --- linux-user/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'linux-user/main.c') diff --git a/linux-user/main.c b/linux-user/main.c index f577e19646..a87c6f7ed4 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -1497,7 +1497,7 @@ static int do_store_exclusive(CPUPPCState *env) segv = 1; } else { int reg = env->reserve_info & 0x1f; - int size = (env->reserve_info >> 5) & 0xf; + int size = env->reserve_info >> 5; int stored = 0; if (addr == env->reserve_addr) { -- cgit 1.4.1