From: Tom Hughes Date: Wed, 27 Apr 2005 09:23:02 +0000 (+0000) Subject: Make the debug log module work on amd64. X-Git-Tag: svn/VALGRIND_3_0_0~743 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9767dcb99fba982e577a929aec7ef25dbd6861ea;p=thirdparty%2Fvalgrind.git Make the debug log module work on amd64. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3575 --- diff --git a/coregrind/m_debuglog.c b/coregrind/m_debuglog.c index 9b79f3768e..c90695ec55 100644 --- a/coregrind/m_debuglog.c +++ b/coregrind/m_debuglog.c @@ -91,12 +91,33 @@ static UInt local_sys_getpid ( void ) static UInt local_sys_write_stderr ( HChar* buf, Int n ) { - return 0; + UInt __res; + __asm__ volatile ( + "movq $1, %%rax\n" /* set %rax = __NR_write */ + "movq $2, %%rdi\n" /* set %rdi = stderr */ + "movq %1, %%rsi\n" /* set %rsi = buf */ + "movl %2, %%edx\n" /* set %edx = n */ + "syscall\n" /* write(stderr, buf, n) */ + "movl %%eax, %0\n" /* set __res = %eax */ + : "=mr" (__res) + : "g" (buf), "g" (n) + : "rax", "rdi", "rsi", "rdx" ); + if (__res < 0) + __res = -1; + return __res; } static UInt local_sys_getpid ( void ) { - return 0; + UInt __res; + __asm__ volatile ( + "movq $39, %%rax\n" /* set %rax = __NR_getpid */ + "syscall\n" /* getpid() */ + "movl %%eax, %0\n" /* set __res = %eax */ + : "=mr" (__res) + : + : "rax" ); + return __res; } #else