diff options
Diffstat (limited to 'libpthread/linuxthreads.old/sysdeps')
-rw-r--r-- | libpthread/linuxthreads.old/sysdeps/i386/pt-machine.h | 39 | ||||
-rw-r--r-- | libpthread/linuxthreads.old/sysdeps/pthread/bits/libc-tsd.h | 2 | ||||
-rw-r--r-- | libpthread/linuxthreads.old/sysdeps/sh/pt-machine.h | 2 |
3 files changed, 15 insertions, 28 deletions
diff --git a/libpthread/linuxthreads.old/sysdeps/i386/pt-machine.h b/libpthread/linuxthreads.old/sysdeps/i386/pt-machine.h index 989641439..a6256c58f 100644 --- a/libpthread/linuxthreads.old/sysdeps/i386/pt-machine.h +++ b/libpthread/linuxthreads.old/sysdeps/i386/pt-machine.h @@ -26,13 +26,11 @@ #ifndef __ASSEMBLER__ #ifndef PT_EI -# define PT_EI __extern_always_inline +# define PT_EI __extern_always_inline __attribute__((visibility("hidden"))) #endif -/* extern long int testandset (int *spinlock); extern int __compare_and_swap (long int *p, long int oldval, long int newval); -*/ /* Get some notion of the current stack. Need not be exactly the top of the stack, just something somewhere in the current frame. */ @@ -75,8 +73,8 @@ __compare_and_swap (long int *p, long int oldval, long int newval) return ret; } -#if __ASSUME_LDT_WORKS > 0 -#include "../useldt.h" +#if defined(__ASSUME_LDT_WORKS) && __ASSUME_LDT_WORKS > 0 +#include "useldt.h" #endif /* The P4 and above really want some help to prevent overheating. */ @@ -85,7 +83,7 @@ __compare_and_swap (long int *p, long int oldval, long int newval) #else /* Generic i386 implementation */ - +extern int compare_and_swap_is_available (void); /* Spinlock implementation; required. */ PT_EI long int @@ -123,34 +121,21 @@ __compare_and_swap (long int *p, long int oldval, long int newval) return ret; } - -PT_EI int -get_eflags (void) -{ - int res; - __asm__ __volatile__ ("pushfl; popl %0" : "=r" (res) : ); - return res; -} - - -PT_EI void -set_eflags (int newflags) -{ - __asm__ __volatile__ ("pushl %0; popfl" : : "r" (newflags) : "cc"); -} - - PT_EI int compare_and_swap_is_available (void) { - int oldflags = get_eflags (); int changed; + int oldflags; + /* get EFLAGS */ + __asm__ __volatile__ ("pushfl; popl %0" : "=r" (oldflags) : ); /* Flip AC bit in EFLAGS. */ - set_eflags (oldflags ^ 0x40000); + __asm__ __volatile__ ("pushl %0; popfl" : : "r" (oldflags ^ 0x40000) : "cc"); + /* reread EFLAGS */ + __asm__ __volatile__ ("pushfl; popl %0" : "=r" (changed) : ); /* See if bit changed. */ - changed = (get_eflags () ^ oldflags) & 0x40000; + changed = (changed ^ oldflags) & 0x40000; /* Restore EFLAGS. */ - set_eflags (oldflags); + __asm__ __volatile__ ("pushl %0; popfl" : : "r" (oldflags) : "cc"); /* If the AC flag did not change, it's a 386 and it lacks cmpxchg. Otherwise, it's a 486 or above and it has cmpxchg. */ return changed != 0; diff --git a/libpthread/linuxthreads.old/sysdeps/pthread/bits/libc-tsd.h b/libpthread/linuxthreads.old/sysdeps/pthread/bits/libc-tsd.h index ce56ea30d..2b889e621 100644 --- a/libpthread/linuxthreads.old/sysdeps/pthread/bits/libc-tsd.h +++ b/libpthread/linuxthreads.old/sysdeps/pthread/bits/libc-tsd.h @@ -37,7 +37,7 @@ enum __libc_tsd_key_t { _LIBC_TSD_KEY_MALLOC = 0, #include <linuxthreads.old/internals.h> -#if USE_TLS && HAVE___THREAD +#if defined(USE_TLS) && USE_TLS && HAVE___THREAD /* When __thread works, the generic definition is what we want. */ # include <sysdeps/generic/bits/libc-tsd.h> diff --git a/libpthread/linuxthreads.old/sysdeps/sh/pt-machine.h b/libpthread/linuxthreads.old/sysdeps/sh/pt-machine.h index 4ec87ad89..793f80b2d 100644 --- a/libpthread/linuxthreads.old/sysdeps/sh/pt-machine.h +++ b/libpthread/linuxthreads.old/sysdeps/sh/pt-machine.h @@ -29,6 +29,8 @@ # define PT_EI __extern_always_inline #endif +extern long int testandset (int *spinlock); + /* Spinlock implementation; required. */ PT_EI long int testandset (int *spinlock) |