diff options
Diffstat (limited to 'libpthread/linuxthreads/sysdeps/i386/i686')
-rw-r--r-- | libpthread/linuxthreads/sysdeps/i386/i686/pt-machine.h | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/libpthread/linuxthreads/sysdeps/i386/i686/pt-machine.h b/libpthread/linuxthreads/sysdeps/i386/i686/pt-machine.h index 8d9ea709b..3596224c1 100644 --- a/libpthread/linuxthreads/sysdeps/i386/i686/pt-machine.h +++ b/libpthread/linuxthreads/sysdeps/i386/i686/pt-machine.h @@ -1,45 +1,51 @@ /* Machine-dependent pthreads configuration and inline functions. i686 version. - Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. + Copyright (C) 1996-2001, 2002 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Richard Henderson <rth@tamu.edu>. The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the + modify it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU Library General Public + You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#ifndef _PT_MACHINE_H +#define _PT_MACHINE_H 1 + #ifndef PT_EI # define PT_EI extern inline #endif +#include "kernel-features.h" +#ifndef ASSEMBLER +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. */ -#define CURRENT_STACK_FRAME stack_pointer -register char * stack_pointer __asm__ ("%esp"); +#define CURRENT_STACK_FRAME __builtin_frame_address (0) /* Spinlock implementation; required. */ -PT_EI int +PT_EI long int testandset (int *spinlock) { - int ret; + long int ret; __asm__ __volatile__ ( "xchgl %0, %1" - : "=r"(ret), "=m"(*spinlock) - : "0"(1), "m"(*spinlock) + : "=r" (ret), "=m" (*spinlock) + : "0" (1), "m" (*spinlock) : "memory"); return ret; @@ -61,7 +67,13 @@ __compare_and_swap (long int *p, long int oldval, long int newval) : "memory"); return ret; } +#endif + +#if __ASSUME_LDT_WORKS > 0 +#include "../useldt.h" +#endif +/* The P4 and above really want some help to prevent overheating. */ +#define BUSY_WAIT_NOP __asm__ ("rep; nop") -/* Use the LDT implementation only if the kernel is fixed. */ -//#include "../useldt.h" +#endif /* pt-machine.h */ |