diff options
Diffstat (limited to 'libc')
20 files changed, 0 insertions, 1403 deletions
diff --git a/libc/sysdeps/linux/alpha/bits/atomicity.h b/libc/sysdeps/linux/alpha/bits/atomicity.h deleted file mode 100644 index df6e01a1e..000000000 --- a/libc/sysdeps/linux/alpha/bits/atomicity.h +++ /dev/null @@ -1,102 +0,0 @@ -/* Low-level functions for atomic operations. Alpha version. - Copyright (C) 1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#ifndef _ATOMICITY_H -#define _ATOMICITY_H 1 - -#include <inttypes.h> - - -static inline int -__attribute_used__ -exchange_and_add (volatile uint32_t *mem, int val) -{ - register int result, tmp; - - __asm__ __volatile__ ( - "/* Inline exchange & add */\n" - "1:\t" - "ldl_l %0,%3\n\t" - "addl %0,%4,%1\n\t" - "stl_c %1,%2\n\t" - "beq %1,2f\n" - ".subsection 1\n" - "2:\t" - "br 1b\n" - ".previous\n\t" - "mb\n\t" - "/* End exchange & add */" - : "=&r"(result), "=&r"(tmp), "=m"(*mem) - : "m" (*mem), "r"(val)); - - return result; -} - -static inline void -__attribute_used__ -atomic_add (volatile uint32_t *mem, int val) -{ - register int result; - - __asm__ __volatile__ ( - "/* Inline exchange & add */\n" - "1:\t" - "ldl_l %0,%2\n\t" - "addl %0,%3,%0\n\t" - "stl_c %0,%1\n\t" - "beq %0,2f\n\t" - ".subsection 1\n" - "2:\t" - "br 1b\n" - ".previous\n\t" - "mb\n\t" - "/* End exchange & add */" - : "=&r"(result), "=m"(*mem) - : "m" (*mem), "r"(val)); -} - -static inline long -__attribute_used__ -compare_and_swap (volatile long int *p, long int oldval, long int newval) -{ - long int ret; - - __asm__ __volatile__ ( - "/* Inline compare & swap */\n" - "1:\t" - "ldq_l %0,%4\n\t" - "cmpeq %0,%2,%0\n\t" - "beq %0,3f\n\t" - "mov %3,%0\n\t" - "stq_c %0,%1\n\t" - "beq %0,2f\n\t" - ".subsection 1\n" - "2:\t" - "br 1b\n" - ".previous\n\t" - "3:\t" - "mb\n\t" - "/* End compare & swap */" - : "=&r"(ret), "=m"(*p) - : "r"(oldval), "r"(newval), "m"(*p)); - - return ret; -} - -#endif /* atomicity.h */ diff --git a/libc/sysdeps/linux/arm/bits/atomicity.h b/libc/sysdeps/linux/arm/bits/atomicity.h deleted file mode 100644 index 97d278610..000000000 --- a/libc/sysdeps/linux/arm/bits/atomicity.h +++ /dev/null @@ -1,120 +0,0 @@ -/* Low-level functions for atomic operations. ARM version. - Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#ifndef _ATOMICITY_H -#define _ATOMICITY_H 1 - -#include <inttypes.h> - - -static inline int -__attribute_used__ -exchange_and_add (volatile uint32_t *mem, int val) -{ - int tmp1; - int tmp2; - int result; - __asm__ ("\n" -#if defined(__thumb__) - "\t.align 0\n" - "\tbx pc\n" - "\tnop\n" - "\t.arm\n" -#endif - "0:\tldr\t%0,[%3]\n\t" - "add\t%1,%0,%4\n\t" - "swp\t%2,%1,[%3]\n\t" - "cmp\t%0,%2\n\t" - "swpne\t%1,%2,[%3]\n\t" - "bne\t0b" -#if defined(__thumb__) - "\torr %1, pc, #1\n" - "\tbx %1\n" - "\t.force_thumb" -#endif - : "=&r" (result), "=&r" (tmp1), "=&r" (tmp2) - : "r" (mem), "r"(val) - : "cc", "memory"); - return result; -} - -static inline void -__attribute_used__ -atomic_add (volatile uint32_t *mem, int val) -{ - int tmp1; - int tmp2; - int tmp3; - __asm__ ("\n" -#if defined(__thumb__) - "\t.align 0\n" - "\tbx pc\n" - "\tnop\n" - "\t.arm\n" -#endif - "0:\tldr\t%0,[%3]\n\t" - "add\t%1,%0,%4\n\t" - "swp\t%2,%1,[%3]\n\t" - "cmp\t%0,%2\n\t" - "swpne\t%1,%2,[%3]\n\t" - "bne\t0b" -#if defined(__thumb__) - "\torr %1, pc, #1\n" - "\tbx %1\n" - "\t.force_thumb" -#endif - : "=&r" (tmp1), "=&r" (tmp2), "=&r" (tmp3) - : "r" (mem), "r"(val) - : "cc", "memory"); -} - -static inline int -__attribute_used__ -compare_and_swap (volatile long int *p, long int oldval, long int newval) -{ - int result, tmp; - __asm__ ("\n" -#if defined(__thumb__) - "\t.align 0\n" - "\tbx pc\n" - "\tnop\n" - "\t.arm\n" -#endif - "0:\tldr\t%1,[%2]\n\t" - "mov\t%0,#0\n\t" - "cmp\t%1,%4\n\t" - "bne\t1f\n\t" - "swp\t%0,%3,[%2]\n\t" - "cmp\t%1,%0\n\t" - "swpne\t%1,%0,[%2]\n\t" - "bne\t0b\n\t" - "mov\t%0,#1\n" - "1:" -#if defined(__thumb__) - "\torr %1, pc, #1\n" - "\tbx %1\n" - "\t.force_thumb" -#endif - : "=&r" (result), "=&r" (tmp) - : "r" (p), "r" (newval), "r" (oldval) - : "cc", "memory"); - return result; -} - -#endif /* atomicity.h */ diff --git a/libc/sysdeps/linux/arm/bits/profil-counter.h b/libc/sysdeps/linux/arm/bits/profil-counter.h deleted file mode 100644 index 7639883f1..000000000 --- a/libc/sysdeps/linux/arm/bits/profil-counter.h +++ /dev/null @@ -1,37 +0,0 @@ -/* Low-level statistical profiling support function. Linux/ARM version. - Copyright (C) 1996, 1997, 1998, 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <signal.h> -#include <bits/armsigctx.h> - -void -profil_counter (int signo, int _a2, int _a3, int _a4, union k_sigcontext sc) -{ - void *pc; - if (sc.v20.magic == SIGCONTEXT_2_0_MAGIC) - pc = (void *) sc.v20.reg.ARM_pc; - else - pc = (void *) sc.v21.arm_pc; - profil_count (pc); - - /* This is a hack to prevent the compiler from implementing the - above function call as a sibcall. The sibcall would overwrite - the signal context. */ - asm volatile (""); -} diff --git a/libc/sysdeps/linux/common/bits/atomicity.h b/libc/sysdeps/linux/common/bits/atomicity.h deleted file mode 100644 index 57bcaad5d..000000000 --- a/libc/sysdeps/linux/common/bits/atomicity.h +++ /dev/null @@ -1,54 +0,0 @@ -/* Low-level functions for atomic operations. Stub version. - Copyright (C) 1997,2001 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#ifndef _ATOMICITY_H -#define _ATOMICITY_H 1 - -#include <inttypes.h> - -#warning stub atomicity functions are not really atomic - -static inline int -__attribute_used__ -exchange_and_add (volatile uint32_t *mem, int val) -{ - int result = *mem; - *mem += val; - return result; -} - -static inline void -__attribute_used__ -atomic_add (volatile uint32_t *mem, int val) -{ - *mem += val; -} - -static inline int -__attribute_used__ -compare_and_swap (volatile long int *p, long int oldval, long int newval) -{ - if (*p != oldval) - return 0; - - *p = newval; - return 1; -} - -#endif /* atomicity.h */ diff --git a/libc/sysdeps/linux/common/bits/profil-counter.h b/libc/sysdeps/linux/common/bits/profil-counter.h deleted file mode 100644 index 9cae5840d..000000000 --- a/libc/sysdeps/linux/common/bits/profil-counter.h +++ /dev/null @@ -1,27 +0,0 @@ -/* Machine-dependent SIGPROF signal handler. "Generic" version w/ sigcontext - Copyright (C) 1996, 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -/* In many Unix systems signal handlers are called like this - and the interrupted PC is easily findable in the `struct sigcontext'. */ - -static void -profil_counter (int signr, int code, struct sigcontext *scp) -{ - profil_count ((void *) scp->sc_pc); -} diff --git a/libc/sysdeps/linux/cris/bits/profil-counter.h b/libc/sysdeps/linux/cris/bits/profil-counter.h deleted file mode 100644 index 37adc1fee..000000000 --- a/libc/sysdeps/linux/cris/bits/profil-counter.h +++ /dev/null @@ -1,26 +0,0 @@ -/* Low-level statistical profiling support function. Linux/CRIS version. - Copyright (C) 2001 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <signal.h> - -static void -profil_counter (int signo, struct sigcontext *scp) -{ - profil_count ((void *) scp->regs.irp); -} diff --git a/libc/sysdeps/linux/h8300/bits/atomicity.h b/libc/sysdeps/linux/h8300/bits/atomicity.h deleted file mode 100644 index a4fcc1524..000000000 --- a/libc/sysdeps/linux/h8300/bits/atomicity.h +++ /dev/null @@ -1,79 +0,0 @@ -/* Low-level functions for atomic operations. H8/300 version. - Copyright (C) 1997, 2000, 2001 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#ifndef _ATOMICITY_H -#define _ATOMICITY_H 1 - -#include <inttypes.h> - - -static inline uint32_t -__attribute__ ((unused)) -exchange_and_add (volatile uint32_t *mem, uint32_t val) -{ - uint32_t result; - __asm__ __volatile__ ("stc ccr,@-sp\n\t" - "orc #0x80,ccr\n\t" - "mov.l %1,er1\n\t" - "mov.l %0,%1\n\t" - "add.l er1,%0\n\t" - "ldc @sp+,ccr" - : "=r" (result), "=m" (*mem) - : "0" (val), "1" (*mem) - : "er1"); - return result; -} - -static inline void -__attribute__ ((unused)) -atomic_add (volatile uint32_t *mem, int val) -{ - __asm__ __volatile__ ("stc ccr,@-sp\n\t" - "orc #0x80,ccr\n\t" - "mov.l %0,er0\n\t" - "add %1,er0\n\t" - "mov.l er0,%0\n\t" - "ldc @sp+,ccr" - : "=m" (*mem) - : "r" (val), "0" (*mem) - : "er0"); -} - -static inline int -__attribute__ ((unused)) -compare_and_swap (volatile long int *p, long int oldval, long int newval) -{ - int ret = 0; - - __asm__ __volatile__ ("stc ccr,@-sp\n\t" - "orc #0x80,ccr\n\t" - "mov.l %1,er0\n\t" - "cmp.l %2,er0\n\t" - "bne 1f\n\t" - "mov.l %3,%1\n\t" - "inc.l #1,%0\n" - "1:\n\t" - "ldc @sp+,ccr" - : "=r"(ret),"=m"(*p) - : "r"(oldval),"r"(newval),"0"(ret),"1"(*p) - : "er0"); - return ret; -} - -#endif /* atomicity.h */ diff --git a/libc/sysdeps/linux/i386/bits/atomicity.h b/libc/sysdeps/linux/i386/bits/atomicity.h deleted file mode 100644 index d83ae791e..000000000 --- a/libc/sysdeps/linux/i386/bits/atomicity.h +++ /dev/null @@ -1,57 +0,0 @@ -/* Low-level functions for atomic operations. ix86 version, x >= 4. - Copyright (C) 1997, 2000, 2001 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#ifndef _ATOMICITY_H -#define _ATOMICITY_H 1 - -#include <inttypes.h> - - -static inline uint32_t -__attribute_used__ -exchange_and_add (volatile uint32_t *mem, uint32_t val) -{ - register uint32_t result; - __asm__ __volatile__ ("lock; xaddl %0,%1" - : "=r" (result), "=m" (*mem) : "0" (val), "1" (*mem)); - return result; -} - -static inline void -__attribute_used__ -atomic_add (volatile uint32_t *mem, int val) -{ - __asm__ __volatile__ ("lock; addl %1,%0" - : "=m" (*mem) : "ir" (val), "0" (*mem)); -} - -static inline char -__attribute_used__ -compare_and_swap (volatile long int *p, long int oldval, long int newval) -{ - char ret; - long int readval; - - __asm__ __volatile__ ("lock; cmpxchgl %3, %1; sete %0" - : "=q" (ret), "=m" (*p), "=a" (readval) - : "r" (newval), "1" (*p), "a" (oldval)); - return ret; -} - -#endif /* atomicity.h */ diff --git a/libc/sysdeps/linux/i386/bits/profil-counter.h b/libc/sysdeps/linux/i386/bits/profil-counter.h deleted file mode 100644 index 69045b55b..000000000 --- a/libc/sysdeps/linux/i386/bits/profil-counter.h +++ /dev/null @@ -1,32 +0,0 @@ -/* Low-level statistical profiling support function. Linux/i386 version. - Copyright (C) 1996, 1997, 1998, 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <signal.h> -#include <bits/sigcontextinfo.h> - -static void -profil_counter (int signo, const SIGCONTEXT scp) -{ - profil_count ((void *) GET_PC (scp)); - - /* This is a hack to prevent the compiler from implementing the - above function call as a sibcall. The sibcall would overwrite - the signal context. */ - asm volatile (""); -} diff --git a/libc/sysdeps/linux/m68k/bits/atomicity.h b/libc/sysdeps/linux/m68k/bits/atomicity.h deleted file mode 100644 index db1c9bfae..000000000 --- a/libc/sysdeps/linux/m68k/bits/atomicity.h +++ /dev/null @@ -1,64 +0,0 @@ -/* Low-level functions for atomic operations. m680x0 version, x >= 2. - Copyright (C) 1997 Free Software Foundation, Inc. - Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#ifndef _ATOMICITY_H -#define _ATOMICITY_H 1 - -#include <inttypes.h> - - -static inline int -__attribute_used__ -exchange_and_add (volatile uint32_t *mem, int val) -{ - register int result = *mem; - register int temp; - __asm__ __volatile__ ("1: move%.l %0,%1;" - " add%.l %2,%1;" - " cas%.l %0,%1,%3;" - " jbne 1b" - : "=d" (result), "=&d" (temp) - : "d" (val), "m" (*mem), "0" (result) : "memory"); - return result; -} - -static inline void -__attribute_used__ -atomic_add (volatile uint32_t *mem, int val) -{ - /* XXX Use cas here as well? */ - __asm__ __volatile__ ("add%.l %0,%1" - : : "id" (val), "m" (*mem) : "memory"); -} - -static inline int -__attribute_used__ -compare_and_swap (volatile long int *p, long int oldval, long int newval) -{ - char ret; - long int readval; - - __asm__ __volatile__ ("cas%.l %2,%3,%1; seq %0" - : "=dm" (ret), "=m" (*p), "=d" (readval) - : "d" (newval), "m" (*p), "2" (oldval)); - return ret; -} - -#endif /* atomicity.h */ diff --git a/libc/sysdeps/linux/mips/bits/atomicity.h b/libc/sysdeps/linux/mips/bits/atomicity.h deleted file mode 100644 index 5d1020352..000000000 --- a/libc/sysdeps/linux/mips/bits/atomicity.h +++ /dev/null @@ -1,98 +0,0 @@ -/* Low-level functions for atomic operations. Mips version. - Copyright (C) 2001, 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#ifndef _MIPS_ATOMICITY_H -#define _MIPS_ATOMICITY_H 1 - -#include <inttypes.h> - -static inline int -__attribute_used__ -exchange_and_add (volatile uint32_t *mem, int val) -{ - int result, tmp; - - __asm__ __volatile__ - ("/* Inline exchange & add */\n" - "1:\n\t" - ".set push\n\t" - ".set mips2\n\t" - "ll %0,%3\n\t" - "addu %1,%4,%0\n\t" - "sc %1,%2\n\t" - ".set pop\n\t" - "beqz %1,1b\n\t" - "/* End exchange & add */" - : "=&r"(result), "=&r"(tmp), "=m"(*mem) - : "m" (*mem), "r"(val) - : "memory"); - - return result; -} - -static inline void -__attribute_used__ -atomic_add (volatile uint32_t *mem, int val) -{ - int result; - - __asm__ __volatile__ - ("/* Inline atomic add */\n" - "1:\n\t" - ".set push\n\t" - ".set mips2\n\t" - "ll %0,%2\n\t" - "addu %0,%3,%0\n\t" - "sc %0,%1\n\t" - ".set pop\n\t" - "beqz %0,1b\n\t" - "/* End atomic add */" - : "=&r"(result), "=m"(*mem) - : "m" (*mem), "r"(val) - : "memory"); -} - -static inline int -__attribute_used__ -compare_and_swap (volatile long int *p, long int oldval, long int newval) -{ - long int ret, temp; - - __asm__ __volatile__ - ("/* Inline compare & swap */\n" - "1:\n\t" - ".set push\n\t" - ".set mips2\n\t" - "ll %1,%5\n\t" - "move %0,$0\n\t" - "bne %1,%3,2f\n\t" - "move %0,%4\n\t" - "sc %0,%2\n\t" - ".set pop\n\t" - "beqz %0,1b\n" - "2:\n\t" - "/* End compare & swap */" - : "=&r" (ret), "=&r" (temp), "=m" (*p) - : "r" (oldval), "r" (newval), "m" (*p) - : "memory"); - - return ret; -} - -#endif /* atomicity.h */ diff --git a/libc/sysdeps/linux/nios2/bits/profil-counter.h b/libc/sysdeps/linux/nios2/bits/profil-counter.h deleted file mode 100644 index 3aa3fc0ad..000000000 --- a/libc/sysdeps/linux/nios2/bits/profil-counter.h +++ /dev/null @@ -1,26 +0,0 @@ -/* Low-level statistical profiling support function. Linux/SPARC version. - Copyright (C) 1997, 1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <signal.h> - -void -profil_counter (int signo, struct sigcontext *si) -{ - profil_count ((void *) si->regs.ea); -} diff --git a/libc/sysdeps/linux/powerpc/bits/atomicity.h b/libc/sysdeps/linux/powerpc/bits/atomicity.h deleted file mode 100644 index 6969749e8..000000000 --- a/libc/sysdeps/linux/powerpc/bits/atomicity.h +++ /dev/null @@ -1,104 +0,0 @@ -/* Low-level functions for atomic operations. PowerPC version. - Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#ifndef _ATOMICITY_H -#define _ATOMICITY_H 1 - -#include <inttypes.h> - -#if BROKEN_PPC_ASM_CR0 -# define __ATOMICITY_INLINE /* nothing */ -#else -# define __ATOMICITY_INLINE inline -#endif - -static __ATOMICITY_INLINE int -__attribute_used__ -exchange_and_add (volatile uint32_t *mem, int val) -{ - int tmp, result; - __asm__ ("\n\ -0: lwarx %0,0,%2 \n\ - add%I3 %1,%0,%3 \n\ - stwcx. %1,0,%2 \n\ - bne- 0b \n\ -" : "=&b"(result), "=&r"(tmp) : "r" (mem), "Ir"(val) : "cr0", "memory"); - return result; -} - -static __ATOMICITY_INLINE void -__attribute_used__ -atomic_add (volatile uint32_t *mem, int val) -{ - int tmp; - __asm__ ("\n\ -0: lwarx %0,0,%1 \n\ - add%I2 %0,%0,%2 \n\ - stwcx. %0,0,%1 \n\ - bne- 0b \n\ -" : "=&b"(tmp) : "r" (mem), "Ir"(val) : "cr0", "memory"); -} - -static __ATOMICITY_INLINE int -__attribute_used__ -compare_and_swap (volatile long int *p, long int oldval, long int newval) -{ - int result; - __asm__ ("\n\ -0: lwarx %0,0,%1 \n\ - sub%I2c. %0,%0,%2 \n\ - cntlzw %0,%0 \n\ - bne- 1f \n\ - stwcx. %3,0,%1 \n\ - bne- 0b \n\ -1: \n\ -" : "=&b"(result) : "r"(p), "Ir"(oldval), "r"(newval) : "cr0", "memory"); - return result >> 5; -} - -static __ATOMICITY_INLINE long int -__attribute_used__ -always_swap (volatile long int *p, long int newval) -{ - long int result; - __asm__ ("\n\ -0: lwarx %0,0,%1 \n\ - stwcx. %2,0,%1 \n\ - bne- 0b \n\ -" : "=&r"(result) : "r"(p), "r"(newval) : "cr0", "memory"); - return result; -} - -static __ATOMICITY_INLINE int -__attribute_used__ -test_and_set (volatile long int *p, long int newval) -{ - int result; - __asm__ ("\n\ -0: lwarx %0,0,%1 \n\ - cmpwi %0,0 \n\ - bne- 1f \n\ - stwcx. %2,0,%1 \n\ - bne- 0b \n\ -1: \n\ -" : "=&r"(result) : "r"(p), "r"(newval) : "cr0", "memory"); - return result; -} - -#endif /* atomicity.h */ diff --git a/libc/sysdeps/linux/powerpc/bits/profil-counter.h b/libc/sysdeps/linux/powerpc/bits/profil-counter.h deleted file mode 100644 index 69045b55b..000000000 --- a/libc/sysdeps/linux/powerpc/bits/profil-counter.h +++ /dev/null @@ -1,32 +0,0 @@ -/* Low-level statistical profiling support function. Linux/i386 version. - Copyright (C) 1996, 1997, 1998, 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <signal.h> -#include <bits/sigcontextinfo.h> - -static void -profil_counter (int signo, const SIGCONTEXT scp) -{ - profil_count ((void *) GET_PC (scp)); - - /* This is a hack to prevent the compiler from implementing the - above function call as a sibcall. The sibcall would overwrite - the signal context. */ - asm volatile (""); -} diff --git a/libc/sysdeps/linux/sh/bits/profil-counter.h b/libc/sysdeps/linux/sh/bits/profil-counter.h deleted file mode 100644 index ae1b97828..000000000 --- a/libc/sysdeps/linux/sh/bits/profil-counter.h +++ /dev/null @@ -1,33 +0,0 @@ -/* Low-level statistical profiling support function. Linux/SH version. - Copyright (C) 1996, 1997, 1998, 2000, 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <signal.h> - -static void -profil_counter (int signo, int _a2, int _a3, int _a4, struct sigcontext sc) -{ - void *pc; - pc = (void *) sc.sc_pc; - profil_count (pc); - - /* This is a hack to prevent the compiler from implementing the - above function call as a sibcall. The sibcall would overwrite - the signal context. */ - asm volatile (""); -} diff --git a/libc/sysdeps/linux/sparc/bits/atomicity.h b/libc/sysdeps/linux/sparc/bits/atomicity.h deleted file mode 100644 index 22f5b3f50..000000000 --- a/libc/sysdeps/linux/sparc/bits/atomicity.h +++ /dev/null @@ -1,98 +0,0 @@ -/* Low-level functions for atomic operations. Sparc32 version. - Copyright (C) 1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#ifndef _ATOMICITY_H -#define _ATOMICITY_H 1 - -#include <inttypes.h> - -static int -__attribute_used__ -exchange_and_add (volatile uint32_t *mem, int val) -{ - static unsigned char lock; - int result, tmp; - - __asm__ __volatile__("1: ldstub [%1], %0\n\t" - " cmp %0, 0\n\t" - " bne 1b\n\t" - " nop" - : "=&r" (tmp) - : "r" (&lock) - : "memory"); - result = *mem; - *mem += val; - __asm__ __volatile__("stb %%g0, [%0]" - : /* no outputs */ - : "r" (&lock) - : "memory"); - return result; -} - -static void -__attribute_used__ -atomic_add (volatile uint32_t *mem, int val) -{ - static unsigned char lock; - int tmp; - - __asm__ __volatile__("1: ldstub [%1], %0\n\t" - " cmp %0, 0\n\t" - " bne 1b\n\t" - " nop" - : "=&r" (tmp) - : "r" (&lock) - : "memory"); - *mem += val; - __asm__ __volatile__("stb %%g0, [%0]" - : /* no outputs */ - : "r" (&lock) - : "memory"); -} - -static int -__attribute_used__ -compare_and_swap (volatile long int *p, long int oldval, long int newval) -{ - static unsigned char lock; - int ret, tmp; - - __asm__ __volatile__("1: ldstub [%1], %0\n\t" - " cmp %0, 0\n\t" - " bne 1b\n\t" - " nop" - : "=&r" (tmp) - : "r" (&lock) - : "memory"); - if (*p != oldval) - ret = 0; - else - { - *p = newval; - ret = 1; - } - __asm__ __volatile__("stb %%g0, [%0]" - : /* no outputs */ - : "r" (&lock) - : "memory"); - - return ret; -} - -#endif /* atomicity.h */ diff --git a/libc/sysdeps/linux/sparc/bits/profil-counter.h b/libc/sysdeps/linux/sparc/bits/profil-counter.h deleted file mode 100644 index 1e22e8cce..000000000 --- a/libc/sysdeps/linux/sparc/bits/profil-counter.h +++ /dev/null @@ -1,26 +0,0 @@ -/* Low-level statistical profiling support function. Linux/SPARC version. - Copyright (C) 1997, 1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <signal.h> - -void -profil_counter (int signo, struct sigcontext *si) -{ - profil_count ((void *) si->si_regs.pc); -} diff --git a/libc/sysdeps/linux/vax/bits/profil-counter.h b/libc/sysdeps/linux/vax/bits/profil-counter.h deleted file mode 100644 index 529bbe4a0..000000000 --- a/libc/sysdeps/linux/vax/bits/profil-counter.h +++ /dev/null @@ -1,32 +0,0 @@ -/* Low-level statistical profiling support function. Linux/i386 version. - Copyright (C) 1996, 1997, 1998, 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <signal.h> -#include <bits/sigcontextinfo.h> - -static void -profil_counter (int signo, const SIGCONTEXT scp) -{ -// profil_count ((void *) GET_PC (scp)); - - /* This is a hack to prevent the compiler from implementing the - above function call as a sibcall. The sibcall would overwrite - the signal context. */ - asm volatile (""); -} diff --git a/libc/sysdeps/linux/x86_64/bits/atomicity.h b/libc/sysdeps/linux/x86_64/bits/atomicity.h deleted file mode 100644 index 133a68d19..000000000 --- a/libc/sysdeps/linux/x86_64/bits/atomicity.h +++ /dev/null @@ -1,324 +0,0 @@ -/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. - - The GNU C Library is free software; you can redistribute it and/or - 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <stdint.h> - - -typedef int8_t atomic8_t; -typedef uint8_t uatomic8_t; -typedef int_fast8_t atomic_fast8_t; -typedef uint_fast8_t uatomic_fast8_t; - -typedef int16_t atomic16_t; -typedef uint16_t uatomic16_t; -typedef int_fast16_t atomic_fast16_t; -typedef uint_fast16_t uatomic_fast16_t; - -typedef int32_t atomic32_t; -typedef uint32_t uatomic32_t; -typedef int_fast32_t atomic_fast32_t; -typedef uint_fast32_t uatomic_fast32_t; - -typedef int64_t atomic64_t; -typedef uint64_t uatomic64_t; -typedef int_fast64_t atomic_fast64_t; -typedef uint_fast64_t uatomic_fast64_t; - -typedef intptr_t atomicptr_t; -typedef uintptr_t uatomicptr_t; -typedef intmax_t atomic_max_t; -typedef uintmax_t uatomic_max_t; - - -#ifndef LOCK_PREFIX -# ifdef UP -# define LOCK_PREFIX /* nothing */ -# else -# define LOCK_PREFIX "lock;" -# endif -#endif - - -#define __arch_compare_and_exchange_val_8_acq(mem, newval, oldval) \ - ({ __typeof (*mem) ret; \ - __asm __volatile (LOCK_PREFIX "cmpxchgb %b2, %1" \ - : "=a" (ret), "=m" (*mem) \ - : "q" (newval), "m" (*mem), "0" (oldval)); \ - ret; }) - -#define __arch_compare_and_exchange_val_16_acq(mem, newval, oldval) \ - ({ __typeof (*mem) ret; \ - __asm __volatile (LOCK_PREFIX "cmpxchgw %w2, %1" \ - : "=a" (ret), "=m" (*mem) \ - : "r" (newval), "m" (*mem), "0" (oldval)); \ - ret; }) - -#define __arch_compare_and_exchange_val_32_acq(mem, newval, oldval) \ - ({ __typeof (*mem) ret; \ - __asm __volatile (LOCK_PREFIX "cmpxchgl %2, %1" \ - : "=a" (ret), "=m" (*mem) \ - : "r" (newval), "m" (*mem), "0" (oldval)); \ - ret; }) - -#define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \ - ({ __typeof (*mem) ret; \ - __asm __volatile (LOCK_PREFIX "cmpxchgq %q2, %1" \ - : "=a" (ret), "=m" (*mem) \ - : "r" ((long) (newval)), "m" (*mem), \ - "0" ((long) (oldval))); \ - ret; }) - - -/* Note that we need no lock prefix. */ -#define atomic_exchange_acq(mem, newvalue) \ - ({ __typeof (*mem) result; \ - if (sizeof (*mem) == 1) \ - __asm __volatile ("xchgb %b0, %1" \ - : "=r" (result), "=m" (*mem) \ - : "0" (newvalue), "m" (*mem)); \ - else if (sizeof (*mem) == 2) \ - __asm __volatile ("xchgw %w0, %1" \ - : "=r" (result), "=m" (*mem) \ - : "0" (newvalue), "m" (*mem)); \ - else if (sizeof (*mem) == 4) \ - __asm __volatile ("xchgl %0, %1" \ - : "=r" (result), "=m" (*mem) \ - : "0" (newvalue), "m" (*mem)); \ - else \ - __asm __volatile ("xchgq %q0, %1" \ - : "=r" (result), "=m" (*mem) \ - : "0" ((long) (newvalue)), "m" (*mem)); \ - result; }) - - -#define atomic_exchange_and_add(mem, value) \ - ({ __typeof (*mem) result; \ - if (sizeof (*mem) == 1) \ - __asm __volatile (LOCK_PREFIX "xaddb %b0, %1" \ - : "=r" (result), "=m" (*mem) \ - : "0" (value), "m" (*mem)); \ - else if (sizeof (*mem) == 2) \ - __asm __volatile (LOCK_PREFIX "xaddw %w0, %1" \ - : "=r" (result), "=m" (*mem) \ - : "0" (value), "m" (*mem)); \ - else if (sizeof (*mem) == 4) \ - __asm __volatile (LOCK_PREFIX "xaddl %0, %1" \ - : "=r" (result), "=m" (*mem) \ - : "0" (value), "m" (*mem)); \ - else \ - __asm __volatile (LOCK_PREFIX "xaddq %q0, %1" \ - : "=r" (result), "=m" (*mem) \ - : "0" ((long) (value)), "m" (*mem)); \ - result; }) - - -#define atomic_add(mem, value) \ - (void) ({ if (__builtin_constant_p (value) && (value) == 1) \ - atomic_increment (mem); \ - else if (__builtin_constant_p (value) && (value) == 1) \ - atomic_decrement (mem); \ - else if (sizeof (*mem) == 1) \ - __asm __volatile (LOCK_PREFIX "addb %b1, %0" \ - : "=m" (*mem) \ - : "ir" (value), "m" (*mem)); \ - else if (sizeof (*mem) == 2) \ - __asm __volatile (LOCK_PREFIX "addw %w1, %0" \ - : "=m" (*mem) \ - : "ir" (value), "m" (*mem)); \ - else if (sizeof (*mem) == 4) \ - __asm __volatile (LOCK_PREFIX "addl %1, %0" \ - : "=m" (*mem) \ - : "ir" (value), "m" (*mem)); \ - else \ - __asm __volatile (LOCK_PREFIX "addq %q1, %0" \ - : "=m" (*mem) \ - : "ir" ((long) (value)), "m" (*mem)); \ - }) - - -#define atomic_add_negative(mem, value) \ - ({ unsigned char __result; \ - if (sizeof (*mem) == 1) \ - __asm __volatile (LOCK_PREFIX "addb %b2, %0; sets %1" \ - : "=m" (*mem), "=qm" (__result) \ - : "ir" (value), "m" (*mem)); \ - else if (sizeof (*mem) == 2) \ - __asm __volatile (LOCK_PREFIX "addw %w2, %0; sets %1" \ - : "=m" (*mem), "=qm" (__result) \ - : "ir" (value), "m" (*mem)); \ - else if (sizeof (*mem) == 4) \ - __asm __volatile (LOCK_PREFIX "addl %2, %0; sets %1" \ - : "=m" (*mem), "=qm" (__result) \ - : "ir" (value), "m" (*mem)); \ - else \ - __asm __volatile (LOCK_PREFIX "addq %q2, %0; sets %1" \ - : "=m" (*mem), "=qm" (__result) \ - : "ir" ((long) (value)), "m" (*mem)); \ - __result; }) - - -#define atomic_add_zero(mem, value) \ - ({ unsigned char __result; \ - if (sizeof (*mem) == 1) \ - __asm __volatile (LOCK_PREFIX "addb %b2, %0; setz %1" \ - : "=m" (*mem), "=qm" (__result) \ - : "ir" (value), "m" (*mem)); \ - else if (sizeof (*mem) == 2) \ - __asm __volatile (LOCK_PREFIX "addw %w2, %0; setz %1" \ - : "=m" (*mem), "=qm" (__result) \ - : "ir" (value), "m" (*mem)); \ - else if (sizeof (*mem) == 4) \ - __asm __volatile (LOCK_PREFIX "addl %2, %0; setz %1" \ - : "=m" (*mem), "=qm" (__result) \ - : "ir" (value), "m" (*mem)); \ - else \ - __asm __volatile (LOCK_PREFIX "addq %q2, %0; setz %1" \ - : "=m" (*mem), "=qm" (__result) \ - : "ir" ((long) (value)), "m" (*mem)); \ - __result; }) - - -#define atomic_increment(mem) \ - (void) ({ if (sizeof (*mem) == 1) \ - __asm __volatile (LOCK_PREFIX "incb %b0" \ - : "=m" (*mem) \ - : "m" (*mem)); \ - else if (sizeof (*mem) == 2) \ - __asm __volatile (LOCK_PREFIX "incw %w0" \ - : "=m" (*mem) \ - : "m" (*mem)); \ - else if (sizeof (*mem) == 4) \ - __asm __volatile (LOCK_PREFIX "incl %0" \ - : "=m" (*mem) \ - : "m" (*mem)); \ - else \ - __asm __volatile (LOCK_PREFIX "incq %q0" \ - : "=m" (*mem) \ - : "m" (*mem)); \ - }) - - -#define atomic_increment_and_test(mem) \ - ({ unsigned char __result; \ - if (sizeof (*mem) == 1) \ - __asm __volatile (LOCK_PREFIX "incb %b0; sete %1" \ - : "=m" (*mem), "=qm" (__result) \ - : "m" (*mem)); \ - else if (sizeof (*mem) == 2) \ - __asm __volatile (LOCK_PREFIX "incw %w0; sete %1" \ - : "=m" (*mem), "=qm" (__result) \ - : "m" (*mem)); \ - else if (sizeof (*mem) == 4) \ - __asm __volatile (LOCK_PREFIX "incl %0; sete %1" \ - : "=m" (*mem), "=qm" (__result) \ - : "m" (*mem)); \ - else \ - __asm __volatile (LOCK_PREFIX "incq %q0; sete %1" \ - : "=m" (*mem), "=qm" (__result) \ - : "m" (*mem)); \ - __result; }) - - -#define atomic_decrement(mem) \ - (void) ({ if (sizeof (*mem) == 1) \ - __asm __volatile (LOCK_PREFIX "decb %b0" \ - : "=m" (*mem) \ - : "m" (*mem)); \ - else if (sizeof (*mem) == 2) \ - __asm __volatile (LOCK_PREFIX "decw %w0" \ - : "=m" (*mem) \ - : "m" (*mem)); \ - else if (sizeof (*mem) == 4) \ - __asm __volatile (LOCK_PREFIX "decl %0" \ - : "=m" (*mem) \ - : "m" (*mem)); \ - else \ - __asm __volatile (LOCK_PREFIX "decq %q0" \ - : "=m" (*mem) \ - : "m" (*mem)); \ - }) - - -#define atomic_decrement_and_test(mem) \ - ({ unsigned char __result; \ - if (sizeof (*mem) == 1) \ - __asm __volatile (LOCK_PREFIX "decb %b0; sete %1" \ - : "=m" (*mem), "=qm" (__result) \ - : "m" (*mem)); \ - else if (sizeof (*mem) == 2) \ - __asm __volatile (LOCK_PREFIX "decw %w0; sete %1" \ - : "=m" (*mem), "=qm" (__result) \ - : "m" (*mem)); \ - else if (sizeof (*mem) == 4) \ - __asm __volatile (LOCK_PREFIX "decl %0; sete %1" \ - : "=m" (*mem), "=qm" (__result) \ - : "m" (*mem)); \ - else \ - __asm __volatile (LOCK_PREFIX "decq %q0; sete %1" \ - : "=m" (*mem), "=qm" (__result) \ - : "m" (*mem)); \ - __result; }) - - -#define atomic_bit_set(mem, bit) \ - (void) ({ if (sizeof (*mem) == 1) \ - __asm __volatile (LOCK_PREFIX "orb %b2, %0" \ - : "=m" (*mem) \ - : "m" (*mem), "ir" (1L << (bit))); \ - else if (sizeof (*mem) == 2) \ - __asm __volatile (LOCK_PREFIX "orw %w2, %0" \ - : "=m" (*mem) \ - : "m" (*mem), "ir" (1L << (bit))); \ - else if (sizeof (*mem) == 4) \ - __asm __volatile (LOCK_PREFIX "orl %2, %0" \ - : "=m" (*mem) \ - : "m" (*mem), "ir" (1L << (bit))); \ - else if (__builtin_constant_p (bit) && (bit) < 32) \ - __asm __volatile (LOCK_PREFIX "orq %2, %0" \ - : "=m" (*mem) \ - : "m" (*mem), "i" (1L << (bit))); \ - else \ - __asm __volatile (LOCK_PREFIX "orq %q2, %0" \ - : "=m" (*mem) \ - : "m" (*mem), "r" (1UL << (bit))); \ - }) - - -#define atomic_bit_test_set(mem, bit) \ - ({ unsigned char __result; \ - if (sizeof (*mem) == 1) \ - __asm __volatile (LOCK_PREFIX "btsb %3, %1; setc %0" \ - : "=q" (__result), "=m" (*mem) \ - : "m" (*mem), "ir" (bit)); \ - else if (sizeof (*mem) == 2) \ - __asm __volatile (LOCK_PREFIX "btsw %3, %1; setc %0" \ - : "=q" (__result), "=m" (*mem) \ - : "m" (*mem), "ir" (bit)); \ - else if (sizeof (*mem) == 4) \ - __asm __volatile (LOCK_PREFIX "btsl %3, %1; setc %0" \ - : "=q" (__result), "=m" (*mem) \ - : "m" (*mem), "ir" (bit)); \ - else \ - __asm __volatile (LOCK_PREFIX "btsq %3, %1; setc %0" \ - : "=q" (__result), "=m" (*mem) \ - : "m" (*mem), "ir" (bit)); \ - __result; }) - - -#define atomic_delay() asm ("rep; nop") diff --git a/libc/sysdeps/linux/x86_64/bits/profil-counter.h b/libc/sysdeps/linux/x86_64/bits/profil-counter.h deleted file mode 100644 index 0b244175a..000000000 --- a/libc/sysdeps/linux/x86_64/bits/profil-counter.h +++ /dev/null @@ -1,32 +0,0 @@ -/* Low-level statistical profiling support function. Linux/x86-64 version. - Copyright (C) 2001, 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <signal.h> -#include <sigcontextinfo.h> - -static void -profil_counter (int signo, SIGCONTEXT scp) -{ - profil_count ((void *) GET_PC (scp)); - - /* This is a hack to prevent the compiler from implementing the - above function call as a sibcall. The sibcall would overwrite - the signal context. */ - asm volatile (""); -} |