diff options
author | kan <kan@FreeBSD.org> | 2003-05-29 22:58:26 +0000 |
---|---|---|
committer | kan <kan@FreeBSD.org> | 2003-05-29 22:58:26 +0000 |
commit | 949c40c5fd683b40f39ebfa2783d06b8226148ab (patch) | |
tree | b9989a6b77c2c503eafdb3cf6bf13370f5c6396b /libexec/rtld-elf/alpha | |
parent | b292a2679ee1e9385409c38e0e898f0c2f4cb41c (diff) | |
download | FreeBSD-src-949c40c5fd683b40f39ebfa2783d06b8226148ab.zip FreeBSD-src-949c40c5fd683b40f39ebfa2783d06b8226148ab.tar.gz |
Allow threading libraries to register their own locking
implementation in case default one provided by rtld is
not suitable.
Consolidate various identical MD lock implementation into
a single file using appropriate machine/atomic.h.
Approved by: re (scottl)
Diffstat (limited to 'libexec/rtld-elf/alpha')
-rw-r--r-- | libexec/rtld-elf/alpha/rtld_machdep.h | 18 | ||||
-rw-r--r-- | libexec/rtld-elf/alpha/rtld_start.S | 49 |
2 files changed, 12 insertions, 55 deletions
diff --git a/libexec/rtld-elf/alpha/rtld_machdep.h b/libexec/rtld-elf/alpha/rtld_machdep.h index d224b9c..008abce 100644 --- a/libexec/rtld-elf/alpha/rtld_machdep.h +++ b/libexec/rtld-elf/alpha/rtld_machdep.h @@ -29,6 +29,18 @@ #ifndef RTLD_MACHDEP_H #define RTLD_MACHDEP_H 1 +#include <sys/types.h> +#include <machine/atomic.h> + +/* + * This value of CACHE_LINE_SIZE is conservative. The actual size + * is 32 on the 21064, 21064A, 21066, 21066A, and 21164. It is 64 + * on the 21264. Compaq recommends sequestering each lock in its own + * 128-byte block to allow for future implementations with larger + * cache lines. + */ +#define CACHE_LINE_SIZE 128 + struct Struct_Obj_Entry; /* Return the address of the .dynamic section in the dynamic linker. */ @@ -48,10 +60,4 @@ Elf_Addr reloc_jmpslot(Elf_Addr *, Elf_Addr, /* Lazy binding entry point, called via PLT. */ void _rtld_bind_start_old(void); -/* Atomic operations. */ -int cmp0_and_store_int(volatile int *, int); -void atomic_add_int(volatile int *, int); -void atomic_incr_int(volatile int *); -void atomic_decr_int(volatile int *); - #endif diff --git a/libexec/rtld-elf/alpha/rtld_start.S b/libexec/rtld-elf/alpha/rtld_start.S index d21c088..8ab7605 100644 --- a/libexec/rtld-elf/alpha/rtld_start.S +++ b/libexec/rtld-elf/alpha/rtld_start.S @@ -209,52 +209,3 @@ NESTED_NOPROFILE(_rtld_bind_start_old, 0, 168, ra, 0, 0) END(_rtld_bind_start_old) -/* - * int cmp0_and_store_int(volatile int *p, int newval); - * - * If an int holds 0, store newval into it; else do nothing. Returns - * the previous value. - */ -LEAF(cmp0_and_store_int, 2) -1: mov a1, t0 - ldl_l v0, 0(a0) - bne v0, 3f - stl_c t0, 0(a0) - beq t0, 2f - mb - RET -2: br 1b -3: RET -END(cmp0_and_store_int) - -LEAF(atomic_add_int, 2) -0: ldl_l t0, 0(a0) - addq t0, a1, t0 - stl_c t0, 0(a0) - beq t0, 1f - mb - RET -1: br 0b -END(atomic_add_int) - -/* Atomically increment an int. */ -LEAF(atomic_incr_int, 1) -0: ldl_l t0, 0(a0) - addq t0, 1, t0 - stl_c t0, 0(a0) - beq t0, 1f - mb - RET -1: br 0b -END(atomic_incr_int) - -/* Atomically decrement an int. */ -LEAF(atomic_decr_int, 1) -0: ldl_l t0, 0(a0) - subq t0, 1, t0 - stl_c t0, 0(a0) - beq t0, 1f - mb - RET -1: br 0b -END(atomic_decr_int) |