PERFORCE change 152069 for review
Peter Wemm
peter at FreeBSD.org
Tue Oct 28 00:12:03 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=152069
Change 152069 by peter at peter_overcee on 2008/10/28 00:11:34
Make this almost run. Throws a fault while firing up ld-elf, but at least
gets somewhere.
Affected files ...
.. //depot/projects/valgrind/coregrind/m_syscall.c#6 edit
Differences ...
==== //depot/projects/valgrind/coregrind/m_syscall.c#6 (text+ko) ====
@@ -160,11 +160,12 @@
if (res.isError) {
res.err = val;
res.res = 0;
+ res.res2 = 0;
} else {
res.err = 0;
res.res = val;
+ res.res2 = val2;
}
- res.res2 = val2;
return res;
}
#else
@@ -320,24 +321,37 @@
*/
// AAA: fix 7th arg!
extern UWord do_syscall_WRK (
- UWord syscall_no,
- UWord a1, UWord a2, UWord a3,
- UWord a4, UWord a5, UWord a6,
- UWord a7, UWord a8, UInt *flags, UWord rv2
+ UWord syscall_no, /* %rdi */
+ UWord a1, /* %rsi */
+ UWord a2, /* %rdx */
+ UWord a3, /* %rcx */
+ UWord a4, /* %r8 */
+ UWord a5, /* %r9 */
+ UWord a6, /* 8(%rsp) */
+ UWord a7, /* 16(%rsp) */
+ UWord a8, /* 24(%rsp) */
+ UInt *flags, /* 32(%rsp) */
+ UWord *rv2 /* 40(%rsp) */
);
asm(
".text\n"
"do_syscall_WRK:\n"
/* Convert function calling convention --> syscall calling
convention */
-" movq %rdi, %rax\n"
-" movq %rsi, %rdi\n"
-" movq %rdx, %rsi\n"
-" movq %rcx, %rdx\n"
-" movq %r8, %r10\n"
-" movq %r9, %r8\n"
-" movq 8(%rsp), %r9\n" /* last arg from stack */
+" movq %rdi, %rax\n" /* syscall_no */
+" movq %rsi, %rdi\n" /* a1 */
+" movq %rdx, %rsi\n" /* a2 */
+" movq %rcx, %rdx\n" /* a3 */
+" movq %r8, %r10\n" /* a4 */
+" movq %r9, %r8\n" /* a5 */
+" movq 8(%rsp), %r9\n" /* a6 last arg from stack */
" syscall\n"
+" jb 1f\n"
+" movq 40(%rsp),%rsi\n"
+" movq %rdx, (%rsi)\n"
+" ret\n"
+"1: movq 32(%rsp), %rsi\n"
+" movl $1,(%rsi)\n"
" ret\n"
".previous\n"
);
@@ -578,10 +592,9 @@
ULong val = do_syscall_WRK(sysno,a1,a2,a3,a4,a5,a6,a7,a8,&flags,rv2);
return VG_(mk_SysRes_x86_freebsd)( (UInt)val, (UInt)(val>>32), flags );
#elif defined(VGP_amd64_freebsd)
- // AAA: collect second return value!! this calling convention doesn't work
- // AAA: cheat for now and return old rv2 value
- ULong val = do_syscall_WRK(sysno,a1,a2,a3,a4,a5,a6,a7,a8,&flags,rv2);
- return VG_(mk_SysRes_amd64_freebsd)( (ULong)val, rv2, flags );
+ ULong val2 = -10;
+ ULong val = do_syscall_WRK(sysno,a1,a2,a3,a4,a5,a6,a7,a8,&flags,&val2);
+ return VG_(mk_SysRes_amd64_freebsd)( val, val2, flags );
#else
# error Unknown platform
#endif
More information about the p4-projects
mailing list