[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 38/38] linux-user, target-ppc: fix use of MSR_LE
From: |
riku . voipio |
Subject: |
[Qemu-devel] [PULL 38/38] linux-user, target-ppc: fix use of MSR_LE |
Date: |
Wed, 25 May 2016 13:32:10 +0300 |
From: Laurent Vivier <address@hidden>
setup_frame()/setup_rt_frame()/restore_user_regs() are using
MSR_LE as the similar kernel functions do: as a bitmask.
But in QEMU, MSR_LE is a bit position, so change this
accordingly.
The previous code was doing nothing as MSR_LE is 0,
and "env->msr &= ~MSR_LE" doesn't change the value of msr.
And yes, a user process can change its endianness,
see linux kernel commit:
fab5db9 [PATCH] powerpc: Implement support for setting little-endian mode
via prctl
and prctl(2): PR_SET_ENDIAN, PR_GET_ENDIAN
Reviewed-by: Thomas Huth <address@hidden>
Signed-off-by: Laurent Vivier <address@hidden>
Signed-off-by: Riku Voipio <address@hidden>
---
linux-user/signal.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/linux-user/signal.c b/linux-user/signal.c
index 28ce921..8090b4d 100644
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -4632,7 +4632,7 @@ static void restore_user_regs(CPUPPCState *env,
/* If doing signal return, restore the previous little-endian mode. */
if (sig)
- env->msr = (env->msr & ~MSR_LE) | (msr & MSR_LE);
+ env->msr = (env->msr & ~(1ull << MSR_LE)) | (msr & (1ull << MSR_LE));
/* Restore Altivec registers if necessary. */
if (env->insns_flags & PPC_ALTIVEC) {
@@ -4747,7 +4747,7 @@ static void setup_frame(int sig, struct target_sigaction
*ka,
#endif
/* Signal handlers are entered in big-endian mode. */
- env->msr &= ~MSR_LE;
+ env->msr &= ~(1ull << MSR_LE);
unlock_user_struct(frame, frame_addr, 1);
return;
@@ -4842,7 +4842,7 @@ static void setup_rt_frame(int sig, struct
target_sigaction *ka,
#endif
/* Signal handlers are entered in big-endian mode. */
- env->msr &= ~MSR_LE;
+ env->msr &= ~(1ull << MSR_LE);
unlock_user_struct(rt_sf, rt_sf_addr, 1);
return;
--
2.1.4
- [Qemu-devel] [PULL 27/38] linux-user: Use safe_syscall for pselect, select syscalls, (continued)
- [Qemu-devel] [PULL 27/38] linux-user: Use safe_syscall for pselect, select syscalls, riku . voipio, 2016/05/25
- [Qemu-devel] [PULL 29/38] linux-user: Handle negative values in timespec conversion, riku . voipio, 2016/05/25
- [Qemu-devel] [PULL 31/38] linux-user: Use g_try_malloc() in do_msgrcv(), riku . voipio, 2016/05/25
- [Qemu-devel] [PULL 35/38] linux-user/signal.c: Generate opcode data for restorer in setup_rt_frame, riku . voipio, 2016/05/25
- [Qemu-devel] [PULL 30/38] linux-user: Handle msgrcv error case correctly, riku . voipio, 2016/05/25
- [Qemu-devel] [PULL 32/38] linux-user: x86_64: Don't use 16-bit UIDs, riku . voipio, 2016/05/25
- [Qemu-devel] [PULL 34/38] linux-user: arm: Remove ARM_cpsr and similar #defines, riku . voipio, 2016/05/25
- [Qemu-devel] [PULL 33/38] linux-user: Use direct syscalls for setuid(), etc, riku . voipio, 2016/05/25
- [Qemu-devel] [PULL 36/38] linux-user/signal.c: Use target address instead of host address for microblaze restorer, riku . voipio, 2016/05/25
- [Qemu-devel] [PULL 37/38] linux-user/signal.c: Use s390 target space address instead of host space, riku . voipio, 2016/05/25
- [Qemu-devel] [PULL 38/38] linux-user, target-ppc: fix use of MSR_LE,
riku . voipio <=
- Re: [Qemu-devel] [PULL 00/38] linux-user update, Peter Maydell, 2016/05/25