]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Even more pissing with inline asm around to placate gcc-3.4 -fpic. We
authorJulian Seward <jseward@acm.org>
Thu, 28 Apr 2005 09:40:53 +0000 (09:40 +0000)
committerJulian Seward <jseward@acm.org>
Thu, 28 Apr 2005 09:40:53 +0000 (09:40 +0000)
can't trash %ebx without gcc getting unhappy, so trash %edi instead.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3579

coregrind/m_debuglog.c

index 3808e60eaf28247e7abf8747fc95fe438a55118a..940d1881e017b4f63c01cd20ab7ed4f89c104bbc 100644 (file)
@@ -63,15 +63,18 @@ static UInt local_sys_write_stderr ( HChar* buf, Int n )
 {
    UInt __res;
    __asm__ volatile (
-      "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 %edx = n */
-      "int $0x80\n"        /* write(stderr, buf, n) */
-      "movl %%eax, %0\n"   /* set __res = eax */
+      "movl  $4, %%eax\n"    /* %eax = __NR_write */
+      "movl  $2, %%edi\n"    /* %edi = stderr */
+      "movl  %1, %%ecx\n"    /* %ecx = buf */
+      "movl  %2, %%edx\n"    /* %edx = n */
+      "pushl %%ebx\n"
+      "movl  %%edi, %%ebx\n"
+      "int   $0x80\n"        /* write(stderr, buf, n) */
+      "popl  %%ebx\n"
+      "movl  %%eax, %0\n"    /* __res = eax */
       : "=mr" (__res)
       : "g" (buf), "g" (n)
-      : "eax", "ebx", "ecx", "edx"
+      : "eax", "edi", "ecx", "edx"
    );
    if (__res < 0) 
       __res = -1;