|
From: <sv...@va...> - 2006-10-17 01:53:43
|
Author: sewardj
Date: 2006-10-17 02:53:34 +0100 (Tue, 17 Oct 2006)
New Revision: 6283
Log:
Merge r6150 and 6151:
- track SysRes changes
- add AIX support
Modified:
trunk/coregrind/m_debuglog.c
trunk/coregrind/m_syscall.c
trunk/coregrind/pub_core_syscall.h
Modified: trunk/coregrind/m_debuglog.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_debuglog.c 2006-10-17 01:52:05 UTC (rev 6282)
+++ trunk/coregrind/m_debuglog.c 2006-10-17 01:53:34 UTC (rev 6283)
@@ -47,6 +47,7 @@
stage1 and stage2. */
=20
#include "pub_core_basics.h" /* basic types */
+#include "pub_core_vkiscnums.h" /* for syscall numbers */
#include "pub_core_debuglog.h" /* our own iface */
#include "valgrind.h" /* for RUNNING_ON_VALGRIND */
=20
@@ -60,7 +61,7 @@
=20
static UInt local_sys_write_stderr ( HChar* buf, Int n )
{
- Int block[2];
+ volatile Int block[2];
block[0] =3D (Int)buf;
block[1] =3D n;
__asm__ volatile (
@@ -69,7 +70,7 @@
"pushl %%ebx\n" /* save &block */
"movl 0(%%ebx), %%ecx\n" /* %ecx =3D buf */
"movl 4(%%ebx), %%edx\n" /* %edx =3D n */
- "movl $4, %%eax\n" /* %eax =3D __NR_write */
+ "movl $"VG_STRINGIFY(__NR_write)", %%eax\n" /* %eax =3D __NR_writ=
e */
"movl $1, %%ebx\n" /* %ebx =3D stderr */
"int $0x80\n" /* write(stderr, buf, n) */
"popl %%ebx\n" /* reestablish &block */
@@ -88,7 +89,7 @@
{
UInt __res;
__asm__ volatile (
- "movl $20, %%eax\n" /* set %eax =3D __NR_getpid */
+ "movl $"VG_STRINGIFY(__NR_getpid)", %%eax\n" /* %eax =3D __NR_getp=
id */
"int $0x80\n" /* getpid() */
"movl %%eax, %0\n" /* set __res =3D eax */
: "=3Dmr" (__res)
@@ -101,7 +102,7 @@
__attribute__((noinline))
static UInt local_sys_write_stderr ( HChar* buf, Int n )
{
- Long block[2];
+ volatile Long block[2];
block[0] =3D (Long)buf;
block[1] =3D n;
__asm__ volatile (
@@ -109,7 +110,7 @@
"pushq %%r15\n" /* r15 is callee-save */
"movq %0, %%r15\n" /* r15 =3D &block */
"pushq %%r15\n" /* save &block */
- "movq $1, %%rax\n" /* rax =3D __NR_write */
+ "movq $"VG_STRINGIFY(__NR_write)", %%rax\n" /* rax =3D __NR_write=
*/
"movq $2, %%rdi\n" /* rdi =3D stderr */
"movq 0(%%r15), %%rsi\n" /* rsi =3D buf */
"movq 8(%%r15), %%rdx\n" /* rdx =3D n */
@@ -131,7 +132,7 @@
{
UInt __res;
__asm__ volatile (
- "movq $39, %%rax\n" /* set %rax =3D __NR_getpid */
+ "movq $"VG_STRINGIFY(__NR_getpid)", %%rax\n" /* %rax =3D __NR_getp=
id */
"syscall\n" /* getpid() */
"movl %%eax, %0\n" /* set __res =3D %eax */
: "=3Dmr" (__res)
@@ -144,14 +145,14 @@
=20
static UInt local_sys_write_stderr ( HChar* buf, Int n )
{
- Int block[2];
+ volatile Int block[2];
block[0] =3D (Int)buf;
block[1] =3D n;
__asm__ volatile (
"addi 1,1,-256\n\t"
"mr 5,%0\n\t" /* r5 =3D &block[0] */
"stw 5,0(1)\n\t" /* stash on stack */
- "li 0,4\n\t" /* set %r0 =3D __NR_write (=3D=3D 4) */
+ "li 0,"VG_STRINGIFY(__NR_write)"\n\t" /* set %r0 =3D __NR_write =
*/
"li 3,2\n\t" /* set %r3 =3D stderr */
"lwz 4,0(5)\n\t" /* set %r4 =3D buf */
"lwz 5,4(5)\n\t" /* set %r5 =3D n */
@@ -176,7 +177,7 @@
"li 0, %1\n\t"
"sc"
: "=3D&r" (__res)
- : "i" (20) /* =3D=3D __NR_getpid */
+ : "i" (__NR_getpid)
: "cc","memory","cr0","ctr",
"r0","r2","r4","r5","r6","r7","r8","r9","r10","r11","r12"
);
@@ -187,14 +188,14 @@
=20
static UInt local_sys_write_stderr ( HChar* buf, Int n )
{
- Long block[2];
+ volatile Long block[2];
block[0] =3D (Long)buf;
block[1] =3D (Long)n;
__asm__ volatile (
"addi 1,1,-256\n\t"
"mr 5,%0\n\t" /* r5 =3D &block[0] */
"std 5,0(1)\n\t" /* stash on stack */
- "li 0,4\n\t" /* set %r0 =3D __NR_write (=3D=3D 4) */
+ "li 0,"VG_STRINGIFY(__NR_write)"\n\t" /* %r0 =3D __NR_write */
"li 3,2\n\t" /* set %r3 =3D stderr */
"ld 4,0(5)\n\t" /* set %r4 =3D buf */
"ld 5,8(5)\n\t" /* set %r5 =3D n */
@@ -219,13 +220,179 @@
"li 0, %1\n\t"
"sc"
: "=3D&r" (__res)
- : "i" (20) /* =3D=3D __NR_getpid */
+ : "i" (__NR_getpid)
: "cc","memory","cr0","ctr",
"r0","r2","r4","r5","r6","r7","r8","r9","r10","r11","r12"
);
return (UInt)__res;
}
=20
+#elif defined(VGP_ppc32_aix5)
+
+static UInt local_sys_write_stderr ( HChar* buf, Int n )
+{
+ /* For some reason gcc-3.3.2 doesn't preserve r31 across the asm
+ even though we state it to be trashed. So use r27 instead. */
+ volatile UInt block[3];
+ block[0] =3D (UInt)buf;
+ block[1] =3D n;
+ block[2] =3D __NR_write;
+ __asm__ __volatile__ (
+ "mr 28,%0\n\t" /* establish base ptr */
+ "mr 27,2\n\t" /* save r2 in r27 */
+ "mflr 30\n\t" /* save lr in r30 */
+
+ "lwz 2,8(28)\n\t" /* set %r2 =3D __NR_write */
+ "li 3,2\n\t" /* set %r3 =3D stderr */
+ "lwz 4,0(28)\n\t" /* set %r4 =3D buf */
+ "lwz 5,4(28)\n\t" /* set %r5 =3D n */
+
+ ".long 0x48000005\n\t" /* bl .+4 */
+ "mflr 29\n\t"
+ "addi 29,29,20\n\t"
+ "mtlr 29\n\t"
+ "crorc 6,6,6\n\t"
+ "sc\n\t" /* write() */
+
+ "stw 3,0(28)\n\t" /* result */
+ "stw 4,4(28)\n\t" /* error? */
+
+ "mr 2,27\n\t" /* restore r2 */
+ "mtlr 30" /* restore lr */
+
+ : /*out*/
+ : /*in*/ "b" (&block[0])
+ : /*trash*/
+ /*temps*/ "r31","r30","r29","r28","r27",
+ /*args*/ "r3","r4","r5","r6","r7","r8","r9","r10",
+ /*paranoia*/ "memory","cc","r0","r1","r11","r12","r13",
+ "xer","ctr","cr0","cr1","cr2","cr3",
+ "cr4","cr5","cr6","cr7"
+ );
+ if (block[1] !=3D 0)
+ return -1;
+ else
+ return block[0];
+}
+
+static UInt local_sys_getpid ( void )
+{
+ /* For some reason gcc-3.3.2 doesn't preserve r31 across the asm
+ even though we state it to be trashed. So use r27 instead. */
+ volatile UInt block[1];
+ block[0] =3D __NR_getpid;
+ __asm__ __volatile__ (
+ "mr 28,%0\n\t" /* establish base ptr */
+ "mr 27,2\n\t" /* save r2 in r27 */
+ "mflr 30\n\t" /* save lr in r30 */
+
+ "lwz 2,0(28)\n\t" /* set %r2 =3D __NR_getpid */
+
+ ".long 0x48000005\n\t" /* bl .+4 */
+ "mflr 29\n\t"
+ "addi 29,29,20\n\t"
+ "mtlr 29\n\t"
+ "crorc 6,6,6\n\t"
+ "sc\n\t" /* getpid() */
+
+ "stw 3,0(28)\n\t" /* result -> block[0] */
+
+ "mr 2,27\n\t" /* restore r2 */
+ "mtlr 30" /* restore lr */
+
+ : /*out*/
+ : /*in*/ "b" (&block[0])
+ : /*trash*/
+ /*temps*/ "r31","r30","r29","r28","r27",
+ /*args*/ "r3","r4","r5","r6","r7","r8","r9","r10",
+ /*paranoia*/ "memory","cc","r0","r1","r11","r12","r13",
+ "xer","ctr","cr0","cr1","cr2","cr3",
+ "cr4","cr5","cr6","cr7"
+ );
+ return block[0];
+}
+
+#elif defined(VGP_ppc64_aix5)
+
+static UInt local_sys_write_stderr ( HChar* buf, Int n )
+{
+ volatile ULong block[3];
+ block[0] =3D (ULong)buf;
+ block[1] =3D n;
+ block[2] =3D (ULong)__NR_write;
+ __asm__ __volatile__ (
+ "mr 28,%0\n\t" /* establish base ptr */
+ "mr 27,2\n\t" /* save r2 in r27 */
+ "mflr 30\n\t" /* save lr in r30 */
+
+ "ld 2,16(28)\n\t" /* set %r2 =3D __NR_write */
+ "li 3,2\n\t" /* set %r3 =3D stderr */
+ "ld 4,0(28)\n\t" /* set %r4 =3D buf */
+ "ld 5,8(28)\n\t" /* set %r5 =3D n */
+
+ ".long 0x48000005\n\t" /* bl .+4 */
+ "mflr 29\n\t"
+ "addi 29,29,20\n\t"
+ "mtlr 29\n\t"
+ "crorc 6,6,6\n\t"
+ "sc\n\t" /* write() */
+
+ "std 3,0(28)\n\t" /* result */
+ "std 4,8(28)\n\t" /* error? */
+
+ "mr 2,27\n\t" /* restore r2 */
+ "mtlr 30" /* restore lr */
+
+ : /*out*/
+ : /*in*/ "b" (&block[0])
+ : /*trash*/
+ /*temps*/ "r31","r30","r29","r28","r27",
+ /*args*/ "r3","r4","r5","r6","r7","r8","r9","r10",
+ /*paranoia*/ "memory","cc","r0","r1","r11","r12","r13",
+ "xer","ctr","cr0","cr1","cr2","cr3",
+ "cr4","cr5","cr6","cr7"
+ );
+ if (block[1] !=3D 0)
+ return (UInt)-1;
+ else
+ return (UInt)block[0];
+}
+
+static UInt local_sys_getpid ( void )
+{
+ volatile ULong block[1];
+ block[0] =3D __NR_getpid;
+ __asm__ __volatile__ (
+ "mr 28,%0\n\t" /* establish base ptr */
+ "mr 27,2\n\t" /* save r2 in r27 */
+ "mflr 30\n\t" /* save lr in r30 */
+
+ "ld 2,0(28)\n\t" /* set %r2 =3D __NR_getpid */
+
+ ".long 0x48000005\n\t" /* bl .+4 */
+ "mflr 29\n\t"
+ "addi 29,29,20\n\t"
+ "mtlr 29\n\t"
+ "crorc 6,6,6\n\t"
+ "sc\n\t" /* getpid() */
+
+ "std 3,0(28)\n\t" /* result -> block[0] */
+
+ "mr 2,27\n\t" /* restore r2 */
+ "mtlr 30" /* restore lr */
+
+ : /*out*/
+ : /*in*/ "b" (&block[0])
+ : /*trash*/
+ /*temps*/ "r31","r30","r29","r28","r27",
+ /*args*/ "r3","r4","r5","r6","r7","r8","r9","r10",
+ /*paranoia*/ "memory","cc","r0","r1","r11","r12","r13",
+ "xer","ctr","cr0","cr1","cr2","cr3",
+ "cr4","cr5","cr6","cr7"
+ );
+ return (UInt)block[0];
+}
+
#else
# error Unknown platform
#endif
Modified: trunk/coregrind/m_syscall.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_syscall.c 2006-10-17 01:52:05 UTC (rev 6282)
+++ trunk/coregrind/m_syscall.c 2006-10-17 01:53:34 UTC (rev 6283)
@@ -30,6 +30,7 @@
=20
#include "pub_core_basics.h"
#include "pub_core_vki.h"
+#include "pub_core_vkiscnums.h"
#include "pub_core_syscall.h"
=20
/* ---------------------------------------------------------------------
@@ -58,7 +59,13 @@
SysRes VG_(mk_SysRes_x86_linux) ( UInt val ) {
SysRes res;
res.isError =3D val >=3D -4095 && val <=3D -1;
- res.val =3D res.isError ? -val : val;
+ if (res.isError) {
+ res.err =3D -val;
+ res.res =3D 0;
+ } else {
+ res.err =3D 0;
+ res.res =3D val;
+ }
return res;
}
=20
@@ -66,16 +73,28 @@
SysRes VG_(mk_SysRes_amd64_linux) ( ULong val ) {
SysRes res;
res.isError =3D val >=3D -4095 && val <=3D -1;
- res.val =3D res.isError ? -val : val;
+ if (res.isError) {
+ res.err =3D -val;
+ res.res =3D 0;
+ } else {
+ res.err =3D 0;
+ res.res =3D val;
+ }
return res;
}
=20
-/* PPC uses the CR7.SO bit to flag an error (CR0 in IBM-speke) */
+/* PPC uses the CR7.SO bit to flag an error (CR0 in IBM-speak) */
/* 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 =3D (cr0so & 1) !=3D 0;
- res.val =3D val;
+ if (res.isError) {
+ res.err =3D val;
+ res.res =3D 0;
+ } else {
+ res.err =3D 0;
+ res.res =3D val;
+ }
return res;
}
=20
@@ -83,22 +102,54 @@
SysRes VG_(mk_SysRes_ppc64_linux) ( ULong val, ULong cr0so ) {
SysRes res;
res.isError =3D (cr0so & 1) !=3D 0;
- res.val =3D val;
+ if (res.isError) {
+ res.err =3D val;
+ res.res =3D 0;
+ } else {
+ res.err =3D 0;
+ res.res =3D val;
+ }
return res;
}
=20
+/* AIX scheme: we have to record both 'res' (r3) and 'err' (r4). If
+ 'err' is nonzero then the call has failed, but it could still be
+ that AIX userspace will ignore 'err' and instead consult 'res' to
+ determine if the call failed. So we have to record both. */
+SysRes VG_(mk_SysRes_ppc32_aix5) ( UInt res, UInt err ) {
+ SysRes r;
+ r.res =3D res;
+ r.err =3D err;
+ r.isError =3D r.err !=3D 0;
+ return r;
+}
=20
-SysRes VG_(mk_SysRes_Error) ( UWord val ) {
- SysRes r =3D { val, True };
+SysRes VG_(mk_SysRes_ppc64_aix5) ( ULong res, ULong err ) {
+ SysRes r;
+ r.res =3D res;
+ r.err =3D err;
+ r.isError =3D r.err !=3D 0;
return r;
}
=20
-SysRes VG_(mk_SysRes_Success) ( UWord val ) {
- SysRes r =3D { val, False };
+/* Generic constructors. */
+SysRes VG_(mk_SysRes_Error) ( UWord err ) {
+ SysRes r;
+ r.res =3D 0;
+ r.err =3D err;
+ r.isError =3D True;
return r;
}
=20
+SysRes VG_(mk_SysRes_Success) ( UWord res ) {
+ SysRes r;
+ r.res =3D res;
+ r.err =3D 0;
+ r.isError =3D False;
+ return r;
+}
=20
+
/* ---------------------------------------------------------------------
A function for doing syscalls.
------------------------------------------------------------------ */
@@ -247,24 +298,181 @@
" std 3,8(5)\n" /* argblock[1] =3D cr0.s0 & 1 */
" blr\n"
);
+
+#elif defined(VGP_ppc32_aix5)
+static void do_syscall_WRK ( UWord* res_r3, UWord* res_r4,
+ UWord sysno,=20
+ UWord a1, UWord a2, UWord a3,
+ UWord a4, UWord a5, UWord a6,
+ UWord a7, UWord a8 )
+{
+ /* Syscalls on AIX are very similar to function calls:
+ - up to 8 args in r3-r10
+ - syscall number in r2
+ - kernel resumes at 'lr', so must set it appropriately beforehand
+ - r3 holds the result and r4 any applicable error code
+ See http://www.cs.utexas.edu/users/cart/publications/tr00-04.ps
+ and also 'man truss'.
+ */
+ /* For some reason gcc-3.3.2 doesn't preserve r31 across the asm
+ even though we state it to be trashed. So use r27 instead. */
+ UWord args[9];
+ args[0] =3D sysno;
+ args[1] =3D a1; args[2] =3D a2;
+ args[3] =3D a3; args[4] =3D a4;
+ args[5] =3D a5; args[6] =3D a6;
+ args[7] =3D a7; args[8] =3D a8;
+
+ __asm__ __volatile__(
+
+ // establish base ptr
+ "mr 28,%0\n\t"
+
+ // save r2, lr
+ "mr 27,2\n\t" // save r2 in r27
+ "mflr 30\n\t" // save lr in r30
+
+ // set syscall number and args
+ "lwz 2, 0(28)\n\t"
+ "lwz 3, 4(28)\n\t"
+ "lwz 4, 8(28)\n\t"
+ "lwz 5, 12(28)\n\t"
+ "lwz 6, 16(28)\n\t"
+ "lwz 7, 20(28)\n\t"
+ "lwz 8, 24(28)\n\t"
+ "lwz 9, 28(28)\n\t"
+ "lwz 10, 32(28)\n\t"
+
+ // set up LR to point just after the sc insn
+ ".long 0x48000005\n\t" // "bl here+4" -- lr :=3D & next insn
+ "mflr 29\n\t"
+ "addi 29,29,20\n\t"
+ "mtlr 29\n\t"
+
+ // set bit 3 of CR1 otherwise AIX 5.1 returns to the
+ // wrong address after the sc instruction
+ "crorc 6,6,6\n\t"
+
+ // do it!
+ "sc\n\t"
+
+ // result is now in r3; save it in args[0]
+ "stw 3,0(28)\n\t"
+ // error code in r4; save it in args[1]
+ "stw 4,4(28)\n\t"
+
+ // restore
+ "mr 2,27\n\t"
+ "mtlr 30\n\t"
+
+ : /*out*/
+ : /*in*/ "b" (&args[0])
+ : /*trash*/
+ /*temps*/ "r31","r30","r29","r28","r27",
+ /*args*/ "r3","r4","r5","r6","r7","r8","r9","r10",
+ /*paranoia*/ "memory","cc","r0","r1","r11","r12","r13",
+ "xer","ctr","cr0","cr1","cr2","cr3",
+ "cr4","cr5","cr6","cr7"
+ );
+
+ *res_r3 =3D args[0];
+ *res_r4 =3D args[1];
+}
+
+#elif defined(VGP_ppc64_aix5)
+static void do_syscall_WRK ( UWord* res_r3, UWord* res_r4,
+ UWord sysno,=20
+ UWord a1, UWord a2, UWord a3,
+ UWord a4, UWord a5, UWord a6,
+ UWord a7, UWord a8 )
+{
+ /* Same scheme as ppc32-aix5. */
+ UWord args[9];
+ args[0] =3D sysno;
+ args[1] =3D a1; args[2] =3D a2;
+ args[3] =3D a3; args[4] =3D a4;
+ args[5] =3D a5; args[6] =3D a6;
+ args[7] =3D a7; args[8] =3D a8;
+
+ __asm__ __volatile__(
+
+ // establish base ptr
+ "mr 28,%0\n\t"
+
+ // save r2, lr
+ "mr 27,2\n\t" // save r2 in r27
+ "mflr 30\n\t" // save lr in r30
+
+ // set syscall number and args
+ "ld 2, 0(28)\n\t"
+ "ld 3, 8(28)\n\t"
+ "ld 4, 16(28)\n\t"
+ "ld 5, 24(28)\n\t"
+ "ld 6, 32(28)\n\t"
+ "ld 7, 40(28)\n\t"
+ "ld 8, 48(28)\n\t"
+ "ld 9, 56(28)\n\t"
+ "ld 10, 64(28)\n\t"
+
+ // set up LR to point just after the sc insn
+ ".long 0x48000005\n\t" // "bl here+4" -- lr :=3D & next insn
+ "mflr 29\n\t"
+ "addi 29,29,20\n\t"
+ "mtlr 29\n\t"
+
+ // set bit 3 of CR1 otherwise AIX 5.1 returns to the
+ // wrong address after the sc instruction
+ "crorc 6,6,6\n\t"
+
+ // do it!
+ "sc\n\t"
+
+ // result is now in r3; save it in args[0]
+ "std 3,0(28)\n\t"
+ // error code in r4; save it in args[1]
+ "std 4,8(28)\n\t"
+
+ // restore
+ "mr 2,27\n\t"
+ "mtlr 30\n\t"
+
+ : /*out*/
+ : /*in*/ "b" (&args[0])
+ : /*trash*/
+ /*temps*/ "r31","r30","r29","r28","r27",
+ /*args*/ "r3","r4","r5","r6","r7","r8","r9","r10",
+ /*paranoia*/ "memory","cc","r0","r1","r11","r12","r13",
+ "xer","ctr","cr0","cr1","cr2","cr3",
+ "cr4","cr5","cr6","cr7"
+ );
+
+ *res_r3 =3D args[0];
+ *res_r4 =3D args[1];
+}
+
#else
# error Unknown platform
#endif
=20
+
SysRes VG_(do_syscall) ( UWord sysno, UWord a1, UWord a2, UWord a3,
- UWord a4, UWord a5, UWord a6 )
+ UWord a4, UWord a5, UWord a6,
+ UWord a7, UWord a8 )
{
#if defined(VGP_x86_linux)
UWord val =3D do_syscall_WRK(sysno,a1,a2,a3,a4,a5,a6);
return VG_(mk_SysRes_x86_linux)( val );
+
#elif defined(VGP_amd64_linux)
UWord val =3D do_syscall_WRK(sysno,a1,a2,a3,a4,a5,a6);
return VG_(mk_SysRes_amd64_linux)( val );
+
#elif defined(VGP_ppc32_linux)
ULong ret =3D do_syscall_WRK(sysno,a1,a2,a3,a4,a5,a6);
UInt val =3D (UInt)(ret>>32);
UInt cr0so =3D (UInt)(ret);
return VG_(mk_SysRes_ppc32_linux)( val, cr0so );
+
#elif defined(VGP_ppc64_linux)
ULong argblock[7];
argblock[0] =3D sysno;
@@ -276,6 +484,47 @@
argblock[6] =3D a6;
do_syscall_WRK( &argblock[0] );
return VG_(mk_SysRes_ppc64_linux)( argblock[0], argblock[1] );
+
+#elif defined(VGP_ppc32_aix5)
+ UWord res;
+ UWord err;
+ do_syscall_WRK( &res, &err,=20
+ sysno, a1, a2, a3, a4, a5, a6, a7, a8);
+ /* Try to set the error number to zero if the syscall hasn't
+ really failed. */
+ if (sysno =3D=3D __NR_AIX5_kread
+ || sysno =3D=3D __NR_AIX5_kwrite) {
+ if (res !=3D (UWord)-1L)
+ err =3D 0;
+ }
+ else if (sysno =3D=3D __NR_AIX5_sigprocmask
+ || sysno =3D=3D __NR_AIX5__sigpending) {
+ if (res =3D=3D 0)
+ err =3D 0;
+ }
+
+ return VG_(mk_SysRes_ppc32_aix5)( res, err );
+
+#elif defined(VGP_ppc64_aix5)
+ UWord res;
+ UWord err;
+ do_syscall_WRK( &res, &err,=20
+ sysno, a1, a2, a3, a4, a5, a6, a7, a8);
+ /* Try to set the error number to zero if the syscall hasn't
+ really failed. */
+ if (sysno =3D=3D __NR_AIX5_kread
+ || sysno =3D=3D __NR_AIX5_kwrite) {
+ if (res !=3D (UWord)-1L)
+ err =3D 0;
+ }
+ else if (sysno =3D=3D __NR_AIX5_sigprocmask
+ || sysno =3D=3D __NR_AIX5__sigpending) {
+ if (res =3D=3D 0)
+ err =3D 0;
+ }
+
+ return VG_(mk_SysRes_ppc64_aix5)( res, err );
+
#else
# error Unknown platform
#endif
Modified: trunk/coregrind/pub_core_syscall.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/pub_core_syscall.h 2006-10-17 01:52:05 UTC (rev 6282)
+++ trunk/coregrind/pub_core_syscall.h 2006-10-17 01:53:34 UTC (rev 6283)
@@ -46,25 +46,31 @@
=20
extern SysRes VG_(do_syscall) ( UWord sysno,=20
UWord, UWord, UWord,=20
- UWord, UWord, UWord );
+ UWord, UWord, UWord,=20
+ UWord, UWord );
=20
/* Macros make life easier. */
=20
-#define vgPlain_do_syscall0(s) VG_(do_syscall)((s),0,0,0,0,0=
,0)
-#define vgPlain_do_syscall1(s,a) VG_(do_syscall)((s),(a),0,0,0=
,0,0)
-#define vgPlain_do_syscall2(s,a,b) VG_(do_syscall)((s),(a),(b),0=
,0,0,0)
-#define vgPlain_do_syscall3(s,a,b,c) VG_(do_syscall)((s),(a),(b),(=
c),0,0,0)
+#define vgPlain_do_syscall0(s) VG_(do_syscall)((s),0,0,0,0,0=
,0,0,0)
+#define vgPlain_do_syscall1(s,a) VG_(do_syscall)((s),(a),\
+ 0,0,0,0,0,0,0=
)
+#define vgPlain_do_syscall2(s,a,b) VG_(do_syscall)((s),(a),(b),\
+ 0,0,0,0,0,0)
+#define vgPlain_do_syscall3(s,a,b,c) VG_(do_syscall)((s),(a),(b),(=
c),\
+ 0,0,0,0,0)
#define vgPlain_do_syscall4(s,a,b,c,d) VG_(do_syscall)((s),(a),(b),\
- (c),(d),0,0)
+ (c),(d),0,0,0=
,0)
#define vgPlain_do_syscall5(s,a,b,c,d,e) VG_(do_syscall)((s),(a),(b),\
- (c),(d),(e),0=
)
-#define vgPlain_do_syscall6(s,a,b,c,d,e,f) VG_(do_syscall)((s),(a),(b),\
- (c),(d),(e),(=
f))
+ (c),(d),(e),0=
,0,0)
+#define vgPlain_do_syscall6(s,a,b,c,d,e,f) VG_(do_syscall)((s),(a),(b),(=
c),\
+ (d),(e),(f),0=
,0)
=20
extern SysRes VG_(mk_SysRes_x86_linux) ( UInt val );
extern SysRes VG_(mk_SysRes_amd64_linux) ( ULong val );
extern SysRes VG_(mk_SysRes_ppc32_linux) ( UInt val, UInt cr0so );
extern SysRes VG_(mk_SysRes_ppc64_linux) ( ULong val, ULong cr0so );
+extern SysRes VG_(mk_SysRes_ppc32_aix5) ( UInt val, UInt err );
+extern SysRes VG_(mk_SysRes_ppc64_aix5) ( ULong val, ULong err );
extern SysRes VG_(mk_SysRes_Error) ( UWord val );
extern SysRes VG_(mk_SysRes_Success) ( UWord val );
=20
|