Support compiling with -fPIC for people who somehow think this is a

good idea.
This commit is contained in:
Alexandre Julliard 2004-09-24 00:25:32 +00:00
parent 9d3019f8cc
commit e9f2eb5241
1 changed files with 15 additions and 9 deletions

View File

@ -173,28 +173,32 @@ __ASM_GLOBAL_FUNC(_start,
static inline __attribute__((noreturn)) void wld_exit( int code )
{
for (;;) /* avoid warning */
__asm__ __volatile__( "int $0x80" : : "a" (SYS_exit), "b" (code) );
__asm__ __volatile__( "pushl %%ebx; movl %1,%%ebx; int $0x80; popl %%ebx"
: : "a" (SYS_exit), "g" (code) );
}
static inline int wld_open( const char *name, int flags )
{
int ret;
__asm__ __volatile__( "int $0x80" : "=a" (ret) : "0" (SYS_open), "b" (name), "c" (flags) );
__asm__ __volatile__( "pushl %%ebx; movl %2,%%ebx; int $0x80; popl %%ebx"
: "=a" (ret) : "0" (SYS_open), "g" (name), "c" (flags) );
return SYSCALL_RET(ret);
}
static inline int wld_close( int fd )
{
int ret;
__asm__ __volatile__( "int $0x80" : "=a" (ret) : "0" (SYS_close), "b" (fd) );
__asm__ __volatile__( "pushl %%ebx; movl %2,%%ebx; int $0x80; popl %%ebx"
: "=a" (ret) : "0" (SYS_close), "g" (fd) );
return SYSCALL_RET(ret);
}
static inline ssize_t wld_read( int fd, void *buffer, size_t len )
{
int ret;
__asm__ __volatile__( "int $0x80" : "=a" (ret)
: "0" (SYS_read), "b" (fd), "c" (buffer), "d" (len)
__asm__ __volatile__( "pushl %%ebx; movl %2,%%ebx; int $0x80; popl %%ebx"
: "=a" (ret)
: "0" (SYS_read), "g" (fd), "c" (buffer), "d" (len)
: "memory" );
return SYSCALL_RET(ret);
}
@ -202,15 +206,16 @@ static inline ssize_t wld_read( int fd, void *buffer, size_t len )
static inline ssize_t wld_write( int fd, const void *buffer, size_t len )
{
int ret;
__asm__ __volatile__( "int $0x80" : "=a" (ret)
: "0" (SYS_write), "b" (fd), "c" (buffer), "d" (len) );
__asm__ __volatile__( "pushl %%ebx; movl %2,%%ebx; int $0x80; popl %%ebx"
: "=a" (ret) : "0" (SYS_write), "g" (fd), "c" (buffer), "d" (len) );
return SYSCALL_RET(ret);
}
static inline int wld_mprotect( const void *addr, size_t len, int prot )
{
int ret;
__asm__ __volatile__( "int $0x80" : "=a" (ret) : "0" (SYS_mprotect), "b" (addr), "c" (len), "d" (prot) );
__asm__ __volatile__( "pushl %%ebx; movl %2,%%ebx; int $0x80; popl %%ebx"
: "=a" (ret) : "0" (SYS_mprotect), "g" (addr), "c" (len), "d" (prot) );
return SYSCALL_RET(ret);
}
@ -234,7 +239,8 @@ static void *wld_mmap( void *start, size_t len, int prot, int flags, int fd, off
args.flags = flags;
args.fd = fd;
args.offset = offset;
__asm__ __volatile__( "int $0x80" : "=a" (ret) : "0" (SYS_mmap), "b" (&args) : "memory" );
__asm__ __volatile__( "pushl %%ebx; movl %2,%%ebx; int $0x80; popl %%ebx"
: "=a" (ret) : "0" (SYS_mmap), "g" (&args) : "memory" );
return (void *)SYSCALL_RET(ret);
}