]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
ppc32 only: clarify meaning of second arg of VG_(mk_SysRes_ppc32_linux)
authorJulian Seward <jseward@acm.org>
Thu, 24 Nov 2005 03:54:38 +0000 (03:54 +0000)
committerJulian Seward <jseward@acm.org>
Thu, 24 Nov 2005 03:54:38 +0000 (03:54 +0000)
and fix an inconsistent use of it, from m_signals.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5231

coregrind/m_signals.c
coregrind/m_syscall.c
coregrind/pub_core_syscall.h

index 9dcf1879fed9c17919828d65d4dfc015e0b37d8b..2b4d23c8a179ac60a1953baa7e0bf3307f89dcd7 100644 (file)
@@ -155,10 +155,12 @@ typedef struct SigQueue {
 #  define VG_UCONTEXT_STACK_PTR(uc)       ((uc)->uc_mcontext.mc_gregs[1])
 #  define VG_UCONTEXT_FRAME_PTR(uc)       ((uc)->uc_mcontext.mc_gregs[1])
 #  define VG_UCONTEXT_SYSCALL_NUM(uc)     ((uc)->uc_mcontext.mc_gregs[0])
-#  define VG_UCONTEXT_SYSCALL_SYSRES(uc)                                 \
-      /* Convert the values in uc_mcontext r3,cr into a SysRes. */       \
-      VG_(mk_SysRes_ppc32_linux)( (uc)->uc_mcontext.mc_gregs[3],         \
-                                 (uc)->uc_mcontext.mc_gregs[VKI_PT_CCR] )
+#  define VG_UCONTEXT_SYSCALL_SYSRES(uc)                            \
+      /* Convert the values in uc_mcontext r3,cr into a SysRes. */  \
+      VG_(mk_SysRes_ppc32_linux)(                                   \
+         (uc)->uc_mcontext.mc_gregs[3],                             \
+         (((uc)->uc_mcontext.mc_gregs[VKI_PT_CCR] >> 28) & 1)       \
+      )
 #  define VG_UCONTEXT_LINK_REG(uc)        ((uc)->uc_mcontext.mc_gregs[VKI_PT_LNK]) 
 
 #else
index fa94a4b8561542d3258992a507d22901ab3e9f65..af905172938891c5a0cc7b31cbeb5fe9b150d3c2 100644 (file)
@@ -70,9 +70,10 @@ SysRes VG_(mk_SysRes_amd64_linux) ( Word val ) {
 }
 
 /* PPC uses the CR7.SO bit to flag an error (CR0 in IBM-speke) */
-SysRes VG_(mk_SysRes_ppc32_linux) ( UInt val, UInt errflag ) {
+/* Note this must be in the bottom bit of the second arg */
+SysRes VG_(mk_SysRes_ppc32_linux) ( UInt val, UInt cr0so ) {
    SysRes res;
-   res.isError = errflag != 0;
+   res.isError = (cr0so & 1) != 0;
    res.val     = val;
    return res;
 }
@@ -167,13 +168,14 @@ asm(
 ".previous\n"
 );
 #elif defined(VGP_ppc32_linux)
-/* Incoming args (syscall number + up to 6 args) come in %r0, %r3:%r8
+/* Incoming args (syscall number + up to 6 args) come in %r3:%r9.
 
    The syscall number goes in %r0.  The args are passed to the syscall in
    the regs %r3:%r8, i.e. the kernel's syscall calling convention.
 
    The %cr0.so bit flags an error.
-   We return the syscall return value in %r3, and the %cr in %r4.
+   We return the syscall return value in %r3, and the %cr0.so in 
+   the lowest bit of %r4.
    We return a ULong, of which %r3 is the high word, and %r4 the low.
    No callee-save regs are clobbered, so no saving/restoring is needed.
 */
@@ -214,8 +216,8 @@ SysRes VG_(do_syscall) ( UWord sysno, UWord a1, UWord a2, UWord a3,
 #elif defined(VGP_ppc32_linux)
   ULong ret     = do_syscall_WRK(sysno,a1,a2,a3,a4,a5,a6);
   UInt  val     = (UInt)(ret>>32);
-  UInt  errflag = (UInt)(ret);
-  return VG_(mk_SysRes_ppc32_linux)( val, errflag );
+  UInt  cr0so   = (UInt)(ret);
+  return VG_(mk_SysRes_ppc32_linux)( val, cr0so );
 #else
 #  error Unknown platform
 #endif
index d6be42804f0a13831e346b61dd835ac75ffa96c1..f5c762819245c4f0481cbdaba65a754cfacf1730 100644 (file)
@@ -63,7 +63,7 @@ extern SysRes VG_(do_syscall) ( UWord sysno,
 
 extern SysRes VG_(mk_SysRes_x86_linux)   ( Word val );
 extern SysRes VG_(mk_SysRes_amd64_linux) ( Word val );
-extern SysRes VG_(mk_SysRes_ppc32_linux) ( UInt val, UInt errflag );
+extern SysRes VG_(mk_SysRes_ppc32_linux) ( UInt val, UInt cr0so );
 extern SysRes VG_(mk_SysRes_Error)       ( UWord val );
 extern SysRes VG_(mk_SysRes_Success)     ( UWord val );