From 505dfdefb586fe0ba00090a267bf5637b5605102 Mon Sep 17 00:00:00 2001 From: Peter Chapman <9gfrye202@sneakemail.com> Date: Thu, 2 Dec 2004 18:19:25 +0000 Subject: [PATCH] Fix up several inline assembler blocks so that they produce correct code with the -fomit-frame-pointer gcc flag. --- dlls/msvcrt/cppexcept.c | 6 +++--- dlls/msvcrt/except.c | 2 +- dlls/msvcrt/tests/cpp.c | 9 ++++----- dlls/ntdll/signal_i386.c | 4 ++-- dlls/ntdll/virtual.c | 2 +- libs/wine/ldt.c | 2 +- loader/kthread.c | 2 +- loader/preloader.c | 14 +++++++------- server/fd.c | 6 +++--- 9 files changed, 23 insertions(+), 24 deletions(-) diff --git a/dlls/msvcrt/cppexcept.c b/dlls/msvcrt/cppexcept.c index 2ecbdd27331..7e7c64296d1 100644 --- a/dlls/msvcrt/cppexcept.c +++ b/dlls/msvcrt/cppexcept.c @@ -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 */ diff --git a/dlls/msvcrt/except.c b/dlls/msvcrt/except.c index cf5eaba6906..b3242225d9d 100644 --- a/dlls/msvcrt/except.c +++ b/dlls/msvcrt/except.c @@ -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; } diff --git a/dlls/msvcrt/tests/cpp.c b/dlls/msvcrt/tests/cpp.c index 15bbcc254ba..f7a37e26a5c 100644 --- a/dlls/msvcrt/tests/cpp.c +++ b/dlls/msvcrt/tests/cpp.c @@ -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; } diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c index 204c04bb070..683060f3955 100644 --- a/dlls/ntdll/signal_i386.c +++ b/dlls/ntdll/signal_i386.c @@ -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; diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c index e48ea7b834b..dbbef38029f 100644 --- a/dlls/ntdll/virtual.c +++ b/dlls/ntdll/virtual.c @@ -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) { diff --git a/libs/wine/ldt.c b/libs/wine/ldt.c index afb47ac8bb6..dfd5a6a6a2c 100644 --- a/libs/wine/ldt.c +++ b/libs/wine/ldt.c @@ -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; diff --git a/loader/kthread.c b/loader/kthread.c index f27b3de71e3..368410e20cc 100644 --- a/loader/kthread.c +++ b/loader/kthread.c @@ -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; } diff --git a/loader/preloader.c b/loader/preloader.c index 91ed99f6431..aebb6983052 100644 --- a/loader/preloader.c +++ b/loader/preloader.c @@ -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); } diff --git a/server/fd.c b/server/fd.c index 926b7c0c997..e29c6cf85a6 100644 --- a/server/fd.c +++ b/server/fd.c @@ -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); } -- 2.11.4.GIT