# 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
}
/* 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;
}
".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.
*/
#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
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 );