From owner-p4-projects@FreeBSD.ORG Tue Oct 28 00:12:03 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 3EB1A1065676; Tue, 28 Oct 2008 00:12:03 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 02C831065670 for ; Tue, 28 Oct 2008 00:12:03 +0000 (UTC) (envelope-from peter-gmail@wemm.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id E50188FC19 for ; Tue, 28 Oct 2008 00:12:02 +0000 (UTC) (envelope-from peter-gmail@wemm.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id m9S0C29O094473 for ; Tue, 28 Oct 2008 00:12:02 GMT (envelope-from peter-gmail@wemm.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id m9S0C2O1094471 for perforce@freebsd.org; Tue, 28 Oct 2008 00:12:02 GMT (envelope-from peter-gmail@wemm.org) Date: Tue, 28 Oct 2008 00:12:02 GMT Message-Id: <200810280012.m9S0C2O1094471@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to peter-gmail@wemm.org using -f From: Peter Wemm To: Perforce Change Reviews Cc: Subject: PERFORCE change 152069 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Oct 2008 00:12:03 -0000 http://perforce.freebsd.org/chv.cgi?CH=152069 Change 152069 by peter@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