Fix up several inline assembler blocks so that they produce correct

code with the -fomit-frame-pointer gcc flag.
This commit is contained in:
Peter Chapman 2004-12-02 18:19:25 +00:00 committed by Alexandre Julliard
parent faa7df1e08
commit 505dfdefb5
9 changed files with 23 additions and 24 deletions

View file

@ -53,7 +53,7 @@ inline static void *call_ebp_func( void *func, void *ebp )
{
void *ret;
__asm__ __volatile__ ("pushl %%ebp; movl %2,%%ebp; call *%%eax; popl %%ebp" \
: "=a" (ret) : "0" (func), "g" (ebp) : "ecx", "edx", "memory" );
: "=a" (ret) : "0" (func), "r" (ebp) : "ecx", "edx", "memory" );
return ret;
}
@ -64,10 +64,10 @@ inline static void call_copy_ctor( void *func, void *this, void *src, int has_vb
if (has_vbase)
/* in that case copy ctor takes an extra bool indicating whether to copy the base class */
__asm__ __volatile__("pushl $1; pushl %2; call *%0"
: : "r" (func), "c" (this), "g" (src) : "eax", "edx", "memory" );
: : "r" (func), "c" (this), "r" (src) : "eax", "edx", "memory" );
else
__asm__ __volatile__("pushl %2; call *%0"
: : "r" (func), "c" (this), "g" (src) : "eax", "edx", "memory" );
: : "r" (func), "c" (this), "r" (src) : "eax", "edx", "memory" );
}
/* call the destructor of the exception object */

View file

@ -76,7 +76,7 @@ inline static DWORD call_filter( void *func, void *arg, void *ebp )
DWORD ret;
__asm__ __volatile__ ("pushl %%ebp; pushl %3; movl %2,%%ebp; call *%%eax; popl %%ebp; popl %%ebp"
: "=a" (ret)
: "0" (func), "g" (ebp), "g" (arg)
: "0" (func), "r" (ebp), "r" (arg)
: "ecx", "edx", "memory" );
return ret;
}

View file

@ -154,19 +154,18 @@ inline static void* do_call_func2(void *func, void *_this, void* arg)
static void* do_call_func1(void *func, void *_this)
{
void* ret;
__asm__ __volatile__ ("pushl %%ecx;\n\tmovl %2, %%ecx;\n\tcall *%1;\n\tpopl %%ecx;"
__asm__ __volatile__ ("call *%1"
: "=a" (ret)
: "g" (func), "m" (_this)
: "g" (func), "c" (_this)
: "memory" );
return ret;
}
static void* do_call_func2(void *func, void *_this, void* arg)
{
void* ret;
__asm__ __volatile__ ("pushl %%ecx;\n\tpushl %2;\n\t"
"movl %3, %%ecx;\n\tcall *%1;\n\tpopl %%ecx;"
__asm__ __volatile__ ("pushl %2\n\tcall *%1"
: "=a" (ret)
: "g" (func), "m" (arg), "m" (_this)
: "r" (func), "g" (arg), "c" (_this)
: "memory" );
return ret;
}

View file

@ -111,7 +111,7 @@ static inline int wine_sigaction( int sig, struct kernel_sigaction *new,
"int $0x80\n\t"
"popl %%ebx"
: "=a" (sig)
: "0" (SYS_sigaction), "r" (sig), "c" (new), "d" (old) );
: "0" (SYS_sigaction), "S" (sig), "c" (new), "d" (old) );
if (sig>=0) return 0;
errno = -sig;
return -1;
@ -128,7 +128,7 @@ static inline int wine_sigaltstack( const struct sigaltstack *new,
"int $0x80\n\t"
"popl %%ebx"
: "=a" (ret)
: "0" (SYS_sigaltstack), "r" (new), "c" (old) );
: "0" (SYS_sigaltstack), "q" (new), "c" (old) );
if (ret >= 0) return 0;
errno = -ret;
return -1;

View file

@ -672,7 +672,7 @@ static void *unaligned_mmap( void *addr, size_t length, unsigned int prot,
"popl %%ebx"
: "=a" (ret)
: "0" (90), /* SYS_mmap */
"g" (&args)
"q" (&args)
: "memory" );
if (ret < 0 && ret > -4096)
{

View file

@ -94,7 +94,7 @@ static inline int set_thread_area( struct modify_ldt_s *ptr )
"int $0x80\n\t"
"popl %%ebx"
: "=a" (res)
: "0" (243) /* SYS_set_thread_area */, "r" (ptr) );
: "0" (243) /* SYS_set_thread_area */, "q" (ptr) );
if (res >= 0) return res;
errno = -res;
return -1;

View file

@ -272,7 +272,7 @@ int wine_pthread_create_thread( struct wine_pthread_thread_info *info )
"ret;\n"
"1:\n\t" /* parent -> caller thread */
"addl $8,%%esp" :
: "r" (sp), "g" (SYS_rfork), "g" (RFPROC | RFMEM | RFTHREAD)
: "r" (sp), "r" (SYS_rfork), "r" (RFPROC | RFMEM | RFTHREAD)
: "eax", "edx");
return 0;
}

View file

@ -174,14 +174,14 @@ static inline __attribute__((noreturn)) void wld_exit( int code )
{
for (;;) /* avoid warning */
__asm__ __volatile__( "pushl %%ebx; movl %1,%%ebx; int $0x80; popl %%ebx"
: : "a" (SYS_exit), "g" (code) );
: : "a" (SYS_exit), "r" (code) );
}
static inline int wld_open( const char *name, int flags )
{
int ret;
__asm__ __volatile__( "pushl %%ebx; movl %2,%%ebx; int $0x80; popl %%ebx"
: "=a" (ret) : "0" (SYS_open), "g" (name), "c" (flags) );
: "=a" (ret) : "0" (SYS_open), "r" (name), "c" (flags) );
return SYSCALL_RET(ret);
}
@ -189,7 +189,7 @@ static inline int wld_close( int fd )
{
int ret;
__asm__ __volatile__( "pushl %%ebx; movl %2,%%ebx; int $0x80; popl %%ebx"
: "=a" (ret) : "0" (SYS_close), "g" (fd) );
: "=a" (ret) : "0" (SYS_close), "r" (fd) );
return SYSCALL_RET(ret);
}
@ -198,7 +198,7 @@ static inline ssize_t wld_read( int fd, void *buffer, size_t len )
int ret;
__asm__ __volatile__( "pushl %%ebx; movl %2,%%ebx; int $0x80; popl %%ebx"
: "=a" (ret)
: "0" (SYS_read), "g" (fd), "c" (buffer), "d" (len)
: "0" (SYS_read), "r" (fd), "c" (buffer), "d" (len)
: "memory" );
return SYSCALL_RET(ret);
}
@ -207,7 +207,7 @@ static inline ssize_t wld_write( int fd, const void *buffer, size_t len )
{
int ret;
__asm__ __volatile__( "pushl %%ebx; movl %2,%%ebx; int $0x80; popl %%ebx"
: "=a" (ret) : "0" (SYS_write), "g" (fd), "c" (buffer), "d" (len) );
: "=a" (ret) : "0" (SYS_write), "r" (fd), "c" (buffer), "d" (len) );
return SYSCALL_RET(ret);
}
@ -215,7 +215,7 @@ static inline int wld_mprotect( const void *addr, size_t len, int prot )
{
int ret;
__asm__ __volatile__( "pushl %%ebx; movl %2,%%ebx; int $0x80; popl %%ebx"
: "=a" (ret) : "0" (SYS_mprotect), "g" (addr), "c" (len), "d" (prot) );
: "=a" (ret) : "0" (SYS_mprotect), "r" (addr), "c" (len), "d" (prot) );
return SYSCALL_RET(ret);
}
@ -240,7 +240,7 @@ static void *wld_mmap( void *start, size_t len, int prot, int flags, int fd, off
args.fd = fd;
args.offset = offset;
__asm__ __volatile__( "pushl %%ebx; movl %2,%%ebx; int $0x80; popl %%ebx"
: "=a" (ret) : "0" (SYS_mmap), "g" (&args) : "memory" );
: "=a" (ret) : "0" (SYS_mmap), "q" (&args) : "memory" );
return (void *)SYSCALL_RET(ret);
}

View file

@ -87,7 +87,7 @@ static inline int epoll_create( int size )
{
int ret;
__asm__( "pushl %%ebx; movl %2,%%ebx; int $0x80; popl %%ebx"
: "=a" (ret) : "0" (254 /*NR_epoll_create*/), "g" (size) );
: "=a" (ret) : "0" (254 /*NR_epoll_create*/), "r" (size) );
SYSCALL_RET(ret);
}
@ -96,7 +96,7 @@ static inline int epoll_ctl( int epfd, int op, int fd, const struct epoll_event
int ret;
__asm__( "pushl %%ebx; movl %2,%%ebx; int $0x80; popl %%ebx"
: "=a" (ret)
: "0" (255 /*NR_epoll_ctl*/), "g" (epfd), "c" (op), "d" (fd), "S" (event), "m" (*event) );
: "0" (255 /*NR_epoll_ctl*/), "r" (epfd), "c" (op), "d" (fd), "S" (event), "m" (*event) );
SYSCALL_RET(ret);
}
@ -105,7 +105,7 @@ static inline int epoll_wait( int epfd, struct epoll_event *events, int maxevent
int ret;
__asm__( "pushl %%ebx; movl %2,%%ebx; int $0x80; popl %%ebx"
: "=a" (ret)
: "0" (256 /*NR_epoll_wait*/), "g" (epfd), "c" (events), "d" (maxevents), "S" (timeout)
: "0" (256 /*NR_epoll_wait*/), "r" (epfd), "c" (events), "d" (maxevents), "S" (timeout)
: "memory" );
SYSCALL_RET(ret);
}