|
From: <sv...@va...> - 2006-04-28 22:49:04
|
Author: sewardj
Date: 2006-04-28 22:01:33 +0100 (Fri, 28 Apr 2006)
New Revision: 5865
Log:
Fix completely bogus asm, which didn't work when compiled with gcc-4.1.0
since it trashed the regs that gcc assigned for %0 and %1 before reading
them. local_sys_write_stderr() for the 3 other targets suffer from the
same problem.
Modified:
trunk/coregrind/m_debuglog.c
Modified: trunk/coregrind/m_debuglog.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_debuglog.c 2006-04-27 11:05:13 UTC (rev 5864)
+++ trunk/coregrind/m_debuglog.c 2006-04-28 21:01:33 UTC (rev 5865)
@@ -60,23 +60,28 @@
=20
static UInt local_sys_write_stderr ( HChar* buf, Int n )
{
- UInt __res;
+ Int block[2];
+ block[0] =3D (Int)buf;
+ block[1] =3D n;
__asm__ volatile (
- "pushl %%ebx\n" // ebx is callee-save
- "movl $4, %%eax\n" /* %eax =3D __NR_write */
- "movl $1, %%ebx\n" /* %ebx =3D stderr */
- "movl %1, %%ecx\n" /* %ecx =3D buf */
- "movl %2, %%edx\n" /* %edx =3D n */
- "int $0x80\n" /* write(stderr, buf, n) */
- "movl %%eax, %0\n" /* __res =3D eax */
- "popl %%ebx\n" // restore ebx
- : "=3Dmr" (__res)
- : "g" (buf), "g" (n)
- : "eax", "edi", "ecx", "edx"
+ "pushl %%ebx\n" /* ebx is callee-save */
+ "movl %0, %%ebx\n" /* ebx =3D &block */
+ "pushl %%ebx\n" /* save &block */
+ "movl 0(%%ebx), %%ecx\n" /* %ecx =3D buf */
+ "movl 4(%%ebx), %%edx\n" /* %edx =3D n */
+ "movl $4, %%eax\n" /* %eax =3D __NR_write */
+ "movl $1, %%ebx\n" /* %ebx =3D stderr */
+ "int $0x80\n" /* write(stderr, buf, n) */
+ "popl %%ebx\n" /* reestablish &block */
+ "movl %%eax, 0(%%ebx)\n" /* block[0] =3D result */
+ "popl %%ebx\n" /* restore ebx */
+ : /*wr*/
+ : /*rd*/ "g" (block)
+ : /*trash*/ "eax", "edi", "ecx", "edx", "memory", "cc"
);
- if (__res < 0)=20
- __res =3D -1;
- return __res;
+ if (block[0] < 0)=20
+ block[0] =3D -1;
+ return block[0];
}
=20
static UInt local_sys_getpid ( void )
|