Commit e9f2eb52 authored by Alexandre Julliard's avatar Alexandre Julliard

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

good idea.
parent 9d3019f8
...@@ -173,28 +173,32 @@ __ASM_GLOBAL_FUNC(_start, ...@@ -173,28 +173,32 @@ __ASM_GLOBAL_FUNC(_start,
static inline __attribute__((noreturn)) void wld_exit( int code ) static inline __attribute__((noreturn)) void wld_exit( int code )
{ {
for (;;) /* avoid warning */ 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 ) static inline int wld_open( const char *name, int flags )
{ {
int ret; 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); return SYSCALL_RET(ret);
} }
static inline int wld_close( int fd ) static inline int wld_close( int fd )
{ {
int ret; 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); return SYSCALL_RET(ret);
} }
static inline ssize_t wld_read( int fd, void *buffer, size_t len ) static inline ssize_t wld_read( int fd, void *buffer, size_t len )
{ {
int ret; int ret;
__asm__ __volatile__( "int $0x80" : "=a" (ret) __asm__ __volatile__( "pushl %%ebx; movl %2,%%ebx; int $0x80; popl %%ebx"
: "0" (SYS_read), "b" (fd), "c" (buffer), "d" (len) : "=a" (ret)
: "0" (SYS_read), "g" (fd), "c" (buffer), "d" (len)
: "memory" ); : "memory" );
return SYSCALL_RET(ret); return SYSCALL_RET(ret);
} }
...@@ -202,15 +206,16 @@ static inline ssize_t wld_read( int fd, void *buffer, size_t len ) ...@@ -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 ) static inline ssize_t wld_write( int fd, const void *buffer, size_t len )
{ {
int ret; int ret;
__asm__ __volatile__( "int $0x80" : "=a" (ret) __asm__ __volatile__( "pushl %%ebx; movl %2,%%ebx; int $0x80; popl %%ebx"
: "0" (SYS_write), "b" (fd), "c" (buffer), "d" (len) ); : "=a" (ret) : "0" (SYS_write), "g" (fd), "c" (buffer), "d" (len) );
return SYSCALL_RET(ret); return SYSCALL_RET(ret);
} }
static inline int wld_mprotect( const void *addr, size_t len, int prot ) static inline int wld_mprotect( const void *addr, size_t len, int prot )
{ {
int ret; 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); return SYSCALL_RET(ret);
} }
...@@ -234,7 +239,8 @@ static void *wld_mmap( void *start, size_t len, int prot, int flags, int fd, off ...@@ -234,7 +239,8 @@ static void *wld_mmap( void *start, size_t len, int prot, int flags, int fd, off
args.flags = flags; args.flags = flags;
args.fd = fd; args.fd = fd;
args.offset = offset; 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); return (void *)SYSCALL_RET(ret);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment