|
From: <sv...@va...> - 2005-04-27 08:59:04
|
Author: tom
Date: 2005-04-27 09:58:53 +0100 (Wed, 27 Apr 2005)
New Revision: 3574
Modified:
trunk/coregrind/m_debuglog.c
Log:
Rework the inline assembly implementations of write and getpid for x86 to
work in PIE builds.
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 2005-04-27 00:34:11 UTC (rev 3573)
+++ trunk/coregrind/m_debuglog.c 2005-04-27 08:58:53 UTC (rev 3574)
@@ -62,12 +62,15 @@
static UInt local_sys_write_stderr ( HChar* buf, Int n )
{
UInt __res;
- __asm__ volatile ("int $0x80"
- : "=3Da" (__res)
- : "0" (4), /* __NR_write */
- "b" (2), /* stderr */
- "c" (buf),
- "d" (n) );
+ __asm__ volatile (
+ "movl $4, %%eax\n" /* set %eax =3D __NR_write */
+ "movl $2, %%ebx\n" /* set %ebx =3D stderr */
+ "movl %1, %%ecx\n" /* set %ecx =3D buf */
+ "movl %2, %%edx\n" /* set %ecx =3D n */
+ "int $0x80\n" /* write(stderr, buf, n) */
+ "movl %%eax, %0\n" /* set __res =3D eax */
+ : "=3Dmr" (__res)
+ : "g" (buf), "g" (n) );
if (__res < 0)=20
__res =3D -1;
return __res;
@@ -76,9 +79,11 @@
static UInt local_sys_getpid ( void )
{
UInt __res;
- __asm__ volatile ("int $0x80"
- : "=3Da" (__res)
- : "0" (20) /* __NR_getpid */);
+ __asm__ volatile (
+ "movl $20, %%eax\n" /* set %eax =3D __NR_getpid */
+ "int $0x80\n" /* getpid() */
+ "movl %%eax, %0\n" /* set __res =3D eax */
+ : "=3Dmr" (__res) );
return __res;
}
=20
|