powerpc64: fix 64-bit process detection on embedded
authorJames Yang <james.yang@freescale.com>
Tue, 18 Feb 2014 21:32:43 +0000 (15:32 -0600)
committerDmitry V. Levin <ldv@altlinux.org>
Tue, 25 Feb 2014 23:33:30 +0000 (23:33 +0000)
* syscall.c (get_scno) [POWERPC64]: Fix 64-bit process detection
on embedded powerpc.

Signed-off-by: James Yang <james.yang@freescale.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
syscall.c

index 4b6b4eb07213ca32f7f7e469f13398426e6deae4..a0cc31279e189542b34d01046064b905d8dd53b3 100644 (file)
--- a/syscall.c
+++ b/syscall.c
@@ -1218,12 +1218,13 @@ get_scno(struct tcb *tcp)
 # ifdef POWERPC64
        int currpers;
 
-       /* Check for 64/32 bit mode. */
-       /* SF is bit 0 of MSR */
-       if ((ppc_regs.msr >> 63) & 1)
-               currpers = 0;
-       else
-               currpers = 1;
+       /*
+        * Check for 64/32 bit mode.
+        * Embedded implementations covered by Book E extension of PPC use
+        * bit 0 (CM) of 32-bit Machine state register (MSR).
+        * Other implementations use bit 0 (SF) of 64-bit MSR.
+        */
+       currpers = (ppc_regs.msr & 0x8000000080000000) ? 0 : 1;
        update_personality(tcp, currpers);
 # endif
 #elif defined(AVR32)