From: Julian Seward Date: Wed, 27 Apr 2005 23:17:48 +0000 (+0000) Subject: local_sys_write_stderr: tell gcc what registers the asm trashes. X-Git-Tag: svn/VALGRIND_3_0_0~740 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e55e18c4ba7f8d64db66a235690939208534ec10;p=thirdparty%2Fvalgrind.git local_sys_write_stderr: tell gcc what registers the asm trashes. Otherwise it doesn't save %ebx across the routine, which is fatal as %ebx is a callee-save register, it seems. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3578 --- diff --git a/coregrind/m_debuglog.c b/coregrind/m_debuglog.c index c90695ec55..3808e60eaf 100644 --- a/coregrind/m_debuglog.c +++ b/coregrind/m_debuglog.c @@ -66,11 +66,13 @@ static UInt local_sys_write_stderr ( HChar* buf, Int n ) "movl $4, %%eax\n" /* set %eax = __NR_write */ "movl $2, %%ebx\n" /* set %ebx = stderr */ "movl %1, %%ecx\n" /* set %ecx = buf */ - "movl %2, %%edx\n" /* set %ecx = n */ + "movl %2, %%edx\n" /* set %edx = n */ "int $0x80\n" /* write(stderr, buf, n) */ "movl %%eax, %0\n" /* set __res = eax */ : "=mr" (__res) - : "g" (buf), "g" (n) ); + : "g" (buf), "g" (n) + : "eax", "ebx", "ecx", "edx" + ); if (__res < 0) __res = -1; return __res; @@ -83,7 +85,9 @@ static UInt local_sys_getpid ( void ) "movl $20, %%eax\n" /* set %eax = __NR_getpid */ "int $0x80\n" /* getpid() */ "movl %%eax, %0\n" /* set __res = eax */ - : "=mr" (__res) ); + : "=mr" (__res) + : + : "eax" ); return __res; } @@ -96,7 +100,7 @@ static UInt local_sys_write_stderr ( HChar* buf, Int n ) "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 */ + "movl %2, %%edx\n" /* set %edx = n */ "syscall\n" /* write(stderr, buf, n) */ "movl %%eax, %0\n" /* set __res = %eax */ : "=mr" (__res)