summaryrefslogtreecommitdiff
path: root/libpthread/linuxthreads.old/sysdeps
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2008-05-03 13:59:11 +0000
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2008-05-03 13:59:11 +0000
commit923bc203ec138c55db521050f20ec96d423f4422 (patch)
tree5f25f5ec6d01c395cf3ea6aa26be061c75e1405d /libpthread/linuxthreads.old/sysdeps
parent7145fac593684e0df4113ff20c4436a6e5ae467b (diff)
- cleanup by manually expanding the helpers.
Saves several 100 bytes
Diffstat (limited to 'libpthread/linuxthreads.old/sysdeps')
-rw-r--r--libpthread/linuxthreads.old/sysdeps/i386/pt-machine.h27
1 files changed, 14 insertions, 13 deletions
diff --git a/libpthread/linuxthreads.old/sysdeps/i386/pt-machine.h b/libpthread/linuxthreads.old/sysdeps/i386/pt-machine.h
index 989641439..f928c5040 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. */
@@ -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,8 +121,8 @@ __compare_and_swap (long int *p, long int oldval, long int newval)
return ret;
}
-
-PT_EI int
+#if 00
+static __always_inline int
get_eflags (void)
{
int res;
@@ -132,25 +130,28 @@ get_eflags (void)
return res;
}
-
-PT_EI void
+static __always_inline void
set_eflags (int newflags)
{
__asm__ __volatile__ ("pushl %0; popfl" : : "r" (newflags) : "cc");
}
-
+#endif
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;