patch for testandset etc.
Andreas Jaeger
aj@suse.de
Sat Mar 16 23:07:00 GMT 2002
Here's the promised patch to move the prototypes to pt-machine.h.
I've tested on i686 and via crosscompilation to x86-64.
Ok to commit?
Andreas
2002-03-16 Andreas Jaeger <aj@suse.de>
* sysdeps/i386/pt-machine.h: Add testandset and __compare_and_swap
prototpyes.
* sysdeps/alpha/pt-machine.h: Likewise.
* sysdeps/arm/pt-machine.h: Likewise.
* sysdeps/cris/pt-machine.h: Likewise.
* sysdeps/hppa/pt-machine.h: Likewise.
* sysdeps/i386/i686/pt-machine.h: Likewise.
* sysdeps/ia64/pt-machine.h: Likewise.
* sysdeps/m68k/pt-machine.h: Likewise.
* sysdeps/mips/pt-machine.h: Likewise.
* sysdeps/powerpc/pt-machine.h: Likewise.
* sysdeps/s390/s390-32/pt-machine.h: Likewise.
* sysdeps/s390/s390-64/pt-machine.h: Likewise.
* sysdeps/sh/pt-machine.h: Likewise.
* sysdeps/sparc/sparc32/pt-machine.h: Likewise.
* sysdeps/sparc/sparc64/pt-machine.h: Likewise.
* sysdeps/x86_64/pt-machine.h: Likewise.
* internals.h: Move testandset and __compare_and_swap prototypes
to pt-machine.h.
============================================================
Index: linuxthreads/sysdeps/alpha/pt-machine.h
--- linuxthreads/sysdeps/alpha/pt-machine.h 2001/07/23 17:52:42 1.7
+++ linuxthreads/sysdeps/alpha/pt-machine.h 2002/03/16 19:39:37
@@ -1,6 +1,6 @@
/* Machine-dependent pthreads configuration and inline functions.
Alpha version.
- Copyright (C) 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1998, 2000, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson <rth@tamu.edu>.
@@ -25,6 +25,8 @@
#include <asm/pal.h>
+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. */
============================================================
Index: linuxthreads/sysdeps/arm/pt-machine.h
--- linuxthreads/sysdeps/arm/pt-machine.h 2000/12/18 05:55:14 1.3
+++ linuxthreads/sysdeps/arm/pt-machine.h 2002/03/16 19:39:37
@@ -1,6 +1,6 @@
/* Machine-dependent pthreads configuration and inline functions.
ARM version.
- Copyright (C) 1997, 1998, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998, 2000, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Philip Blundell <philb@gnu.org>.
@@ -19,10 +19,13 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
+
#ifndef PT_EI
# define PT_EI extern inline
#endif
+extern long int testandset (int *spinlock);
+extern int __compare_and_swap (long int *p, long int oldval, long int newval);
/* This will not work on ARM1 or ARM2 because SWP is lacking on those
machines. Unfortunately we have no way to detect this at compile
============================================================
Index: linuxthreads/sysdeps/cris/pt-machine.h
--- linuxthreads/sysdeps/cris/pt-machine.h 2001/04/09 04:52:20 1.1
+++ linuxthreads/sysdeps/cris/pt-machine.h 2002/03/16 19:39:37
@@ -1,6 +1,6 @@
/* Machine-dependent pthreads configuration and inline functions.
CRIS version.
- Copyright (C) 2001 Free Software Foundation, Inc.
+ 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
@@ -21,6 +21,9 @@
#ifndef PT_EI
# define PT_EI extern inline
#endif
+
+extern long int testandset (int *spinlock);
+extern int __compare_and_swap (long int *p, long int oldval, long int newval);
PT_EI long int
testandset (int *spinlock)
============================================================
Index: linuxthreads/sysdeps/hppa/pt-machine.h
--- linuxthreads/sysdeps/hppa/pt-machine.h 2000/12/18 05:55:14 1.2
+++ linuxthreads/sysdeps/hppa/pt-machine.h 2002/03/16 19:39:37
@@ -1,6 +1,6 @@
/* Machine-dependent pthreads configuration and inline functions.
hppa version.
- Copyright (C) 2000 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson <rth@tamu.edu>.
@@ -24,6 +24,9 @@
#ifndef PT_EI
# define PT_EI extern inline
#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. */
============================================================
Index: linuxthreads/sysdeps/i386/pt-machine.h
--- linuxthreads/sysdeps/i386/pt-machine.h 2002/02/24 04:55:57 1.11
+++ linuxthreads/sysdeps/i386/pt-machine.h 2002/03/16 19:39:37
@@ -26,6 +26,9 @@
# define PT_EI extern inline
#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. */
#define CURRENT_STACK_FRAME __builtin_frame_address (0)
============================================================
Index: linuxthreads/sysdeps/ia64/pt-machine.h
--- linuxthreads/sysdeps/ia64/pt-machine.h 2001/07/22 23:39:58 1.3
+++ linuxthreads/sysdeps/ia64/pt-machine.h 2002/03/16 19:39:37
@@ -1,6 +1,6 @@
/* Machine-dependent pthreads configuration and inline functions.
IA-64 version.
- Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1999, 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
@@ -21,6 +21,9 @@
#ifndef PT_EI
# define PT_EI extern inline
#endif
+
+extern long int testandset (int *spinlock);
+extern int __compare_and_swap (long int *p, long int oldval, long int newval);
/* Make sure gcc doesn't try to be clever and move things around on
us. We need to use _exactly_ the address the user gave us, not some
============================================================
Index: linuxthreads/sysdeps/m68k/pt-machine.h
--- linuxthreads/sysdeps/m68k/pt-machine.h 2000/12/18 05:55:14 1.3
+++ linuxthreads/sysdeps/m68k/pt-machine.h 2002/03/16 19:39:37
@@ -1,6 +1,6 @@
/* Machine-dependent pthreads configuration and inline functions.
m68k version.
- Copyright (C) 1996, 1998, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1998, 2000, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson <rth@tamu.edu>.
@@ -23,6 +23,8 @@
# define PT_EI extern inline
#endif
+extern long int testandset (int *spinlock);
+extern int __compare_and_swap (long int *p, long int oldval, long int newval);
/* Spinlock implementation; required. */
PT_EI long int
============================================================
Index: linuxthreads/sysdeps/mips/pt-machine.h
--- linuxthreads/sysdeps/mips/pt-machine.h 2002/02/08 16:14:43 1.9
+++ linuxthreads/sysdeps/mips/pt-machine.h 2002/03/16 19:39:37
@@ -27,6 +27,9 @@
# define PT_EI extern inline
#endif
+extern long int testandset (int *spinlock);
+extern int __compare_and_swap (long int *p, long int oldval, long int newval);
+
/* Memory barrier. */
#define MEMORY_BARRIER() __asm__ ("" : : : "memory")
============================================================
Index: linuxthreads/sysdeps/powerpc/pt-machine.h
--- linuxthreads/sysdeps/powerpc/pt-machine.h 2001/05/17 19:47:46 1.8
+++ linuxthreads/sysdeps/powerpc/pt-machine.h 2002/03/16 19:39:37
@@ -1,6 +1,6 @@
/* Machine-dependent pthreads configuration and inline functions.
powerpc version.
- Copyright (C) 1996, 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1998, 2000, 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
@@ -25,6 +25,9 @@
# define PT_EI extern inline
#endif
+extern long int testandset (int *spinlock);
+extern int __compare_and_swap (long int *p, long int oldval, long int newval);
+
/* For multiprocessor systems, we want to ensure all memory accesses
are completed before we reset a lock. On other systems, we still
need to make sure that the compiler has flushed everything to memory. */
@@ -65,7 +68,7 @@ __compare_and_swap (long int *p, long in
}
PT_EI int
-__compare_and_swap_with_release_semantics (long int *p,
+__compare_and_swap_with_release_semantics (long int *p,
long int oldval, long int newval)
{
int ret;
============================================================
Index: linuxthreads/sysdeps/sh/pt-machine.h
--- linuxthreads/sysdeps/sh/pt-machine.h 2001/12/12 18:01:23 1.6
+++ linuxthreads/sysdeps/sh/pt-machine.h 2002/03/16 19:39:37
@@ -1,6 +1,6 @@
/* Machine-dependent pthreads configuration and inline functions.
SuperH version.
- Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Niibe Yutaka <gniibe@m17n.org>.
@@ -22,6 +22,9 @@
#ifndef PT_EI
# define PT_EI extern inline
#endif
+
+extern long int testandset (int *spinlock);
+extern int __compare_and_swap (long int *p, long int oldval, long int newval);
/* Spinlock implementation; required. */
PT_EI long int
============================================================
Index: linuxthreads/sysdeps/x86_64/pt-machine.h
--- linuxthreads/sysdeps/x86_64/pt-machine.h 2002/01/14 15:43:08 1.3
+++ linuxthreads/sysdeps/x86_64/pt-machine.h 2002/03/16 19:39:37
@@ -27,6 +27,9 @@
# define PT_EI extern inline
#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. */
#define CURRENT_STACK_FRAME stack_pointer
============================================================
Index: linuxthreads/sysdeps/i386/i686/pt-machine.h
--- linuxthreads/sysdeps/i386/i686/pt-machine.h 2002/02/24 04:55:58 1.15
+++ linuxthreads/sysdeps/i386/i686/pt-machine.h 2002/03/16 19:39:37
@@ -27,6 +27,9 @@
#endif
#include "kernel-features.h"
+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 __builtin_frame_address (0)
============================================================
Index: linuxthreads/sysdeps/s390/s390-32/pt-machine.h
--- linuxthreads/sysdeps/s390/s390-32/pt-machine.h 2002/01/17 00:48:43 1.2
+++ linuxthreads/sysdeps/s390/s390-32/pt-machine.h 2002/03/16 19:39:37
@@ -1,6 +1,6 @@
/* Machine-dependent pthreads configuration and inline functions.
S390 version.
- Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
This file is part of the GNU C Library.
@@ -23,6 +23,9 @@
# define PT_EI extern inline
#endif
+extern long int testandset (int *spinlock);
+extern int __compare_and_swap (long int *p, long int oldval, long int newval);
+
/* For multiprocessor systems, we want to ensure all memory accesses
are completed before we reset a lock. On other systems, we still
need to make sure that the compiler has flushed everything to memory. */
@@ -98,4 +101,3 @@ __compare_and_swap(long int *p, long int
: "cc", "0", "1" );
return retval == 0;
}
-
============================================================
Index: linuxthreads/sysdeps/s390/s390-64/pt-machine.h
--- linuxthreads/sysdeps/s390/s390-64/pt-machine.h 2002/01/17 00:48:44 1.2
+++ linuxthreads/sysdeps/s390/s390-64/pt-machine.h 2002/03/16 19:39:37
@@ -1,6 +1,6 @@
/* Machine-dependent pthreads configuration and inline functions.
64 bit S/390 version.
- Copyright (C) 2001 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002 Free Software Foundation, Inc.
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
This file is part of the GNU C Library.
@@ -23,6 +23,9 @@
# define PT_EI extern inline
#endif
+extern long int testandset (int *spinlock);
+extern int __compare_and_swap (long int *p, long int oldval, long int newval);
+
/* For multiprocessor systems, we want to ensure all memory accesses
are completed before we reset a lock. On other systems, we still
need to make sure that the compiler has flushed everything to memory. */
@@ -103,4 +106,3 @@ __compare_and_swap(long int *p, long int
: "cc", "0");
return retval == 0;
}
-
============================================================
Index: linuxthreads/sysdeps/sparc/sparc32/pt-machine.h
--- linuxthreads/sysdeps/sparc/sparc32/pt-machine.h 2001/07/23 17:52:43 1.9
+++ linuxthreads/sysdeps/sparc/sparc32/pt-machine.h 2002/03/16 19:39:37
@@ -1,6 +1,6 @@
/* Machine-dependent pthreads configuration and inline functions.
sparc version.
- Copyright (C) 1996, 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1998, 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson <rth@tamu.edu>.
@@ -22,6 +22,9 @@
#ifndef PT_EI
# define PT_EI extern inline
#endif
+
+extern long int testandset (int *spinlock);
+extern int __compare_and_swap (long int *p, long int oldval, long int newval);
/* Spinlock implementation; required. */
PT_EI long int
============================================================
Index: linuxthreads/sysdeps/sparc/sparc64/pt-machine.h
--- linuxthreads/sysdeps/sparc/sparc64/pt-machine.h 2001/07/23 17:52:44 1.13
+++ linuxthreads/sysdeps/sparc/sparc64/pt-machine.h 2002/03/16 19:39:37
@@ -1,6 +1,6 @@
/* Machine-dependent pthreads configuration and inline functions.
Sparc v9 version.
- Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson <rth@tamu.edu>.
@@ -23,6 +23,8 @@
# define PT_EI extern inline
#endif
+extern long int testandset (int *spinlock);
+extern int __compare_and_swap (long int *p, long int oldval, long int newval);
/* Spinlock implementation; required. */
PT_EI long int
============================================================
Index: linuxthreads/internals.h
--- linuxthreads/internals.h 2002/02/23 08:02:09 1.73
+++ linuxthreads/internals.h 2002/03/16 19:39:38
@@ -26,9 +26,6 @@
#include <tls.h>
#include "descr.h"
-extern long int testandset (int *spinlock);
-extern int __compare_and_swap (long int *p, long int oldval, long int newval);
-
#include "semaphore.h"
#ifndef THREAD_GETMEM
--
Andreas Jaeger
SuSE Labs aj@suse.de
private aj@arthur.inka.de
http://www.suse.de/~aj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 231 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-hacker/attachments/20020316/0c1b9271/attachment.sig>
More information about the Libc-hacker
mailing list