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/sparc64 | |
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/sparc64')
-rw-r--r-- | libexec/rtld-elf/sparc64/reloc.c | 34 | ||||
-rw-r--r-- | libexec/rtld-elf/sparc64/rtld_machdep.h | 10 | ||||
-rw-r--r-- | libexec/rtld-elf/sparc64/rtld_start.S | 12 |
3 files changed, 23 insertions, 33 deletions
diff --git a/libexec/rtld-elf/sparc64/reloc.c b/libexec/rtld-elf/sparc64/reloc.c index 5808fd3..c083c9c 100644 --- a/libexec/rtld-elf/sparc64/reloc.c +++ b/libexec/rtld-elf/sparc64/reloc.c @@ -142,9 +142,9 @@ static const char *reloc_names[] = { "GLOB_DAT", "JMP_SLOT", "RELATIVE", "UA_32", "PLT32", "HIPLT22", "LOPLT10", "LOPLT10", "PCPLT22", "PCPLT32", "10", "11", "64", "OLO10", "HH22", - "HM10", "LM22", "PC_HH22", "PC_HM10", "PC_LM22", + "HM10", "LM22", "PC_HH22", "PC_HM10", "PC_LM22", "WDISP16", "WDISP19", "GLOB_JMP", "7", "5", "6", - "DISP64", "PLT64", "HIX22", "LOX10", "H44", "M44", + "DISP64", "PLT64", "HIX22", "LOX10", "H44", "M44", "L44", "REGISTER", "UA64", "UA16" }; #endif @@ -166,7 +166,7 @@ static long reloc_target_bitmask[] = { _BM(22), _BM(22), /* HI22, _22 */ _BM(13), _BM(10), /* RELOC_13, _LO10 */ _BM(10), _BM(13), _BM(22), /* GOT10, GOT13, GOT22 */ - _BM(10), _BM(22), /* _PC10, _PC22 */ + _BM(10), _BM(22), /* _PC10, _PC22 */ _BM(30), 0, /* _WPLT30, _COPY */ _BM(32), _BM(32), _BM(32), /* _GLOB_DAT, JMP_SLOT, _RELATIVE */ _BM(32), _BM(32), /* _UA32, PLT32 */ @@ -284,7 +284,7 @@ reloc_nonplt_object(Obj_Entry *obj, const Elf_Rela *rela, SymCache *cache) Elf_Word type; Elf_Addr value; Elf_Addr mask; - + where = (Elf_Addr *)(obj->relocbase + rela->r_offset); where32 = (Elf_Half *)where; defobj = NULL; @@ -364,11 +364,11 @@ reloc_nonplt_object(Obj_Entry *obj, const Elf_Rela *rela, SymCache *cache) char *ptr; int size; int i; - + size = RELOC_TARGET_SIZE(type) / 8; ptr = (char *)where; tmp = 0; - + /* Read it in one byte at a time. */ for (i = 0; i < size; i++) tmp = (tmp << 8) | ptr[i]; @@ -499,7 +499,7 @@ reloc_jmpslot(Elf_Addr *wherep, Elf_Addr target, const Obj_Entry *obj, where = (Elf_Half *)wherep; offset = ((Elf_Addr)where) - target; if (offset <= (1L<<20) && offset >= -(1L<<20)) { - /* + /* * We're within 1MB -- we can use a direct branch insn. * * We can generate this pattern: @@ -517,7 +517,7 @@ reloc_jmpslot(Elf_Addr *wherep, Elf_Addr target, const Obj_Entry *obj, where[1] = BAA | ((offset >> 2) &0x3fffff); flush(where, 4); } else if (target >= 0 && target < (1L<<32)) { - /* + /* * We're withing 32-bits of address zero. * * The resulting code in the jump slot is: @@ -537,7 +537,7 @@ reloc_jmpslot(Elf_Addr *wherep, Elf_Addr target, const Obj_Entry *obj, where[1] = SETHI | HIVAL(target, 10); flush(where, 4); } else if (target <= 0 && target > -(1L<<32)) { - /* + /* * We're withing 32-bits of address -1. * * The resulting code in the jump slot is: @@ -559,7 +559,7 @@ reloc_jmpslot(Elf_Addr *wherep, Elf_Addr target, const Obj_Entry *obj, where[1] = SETHI | HIVAL(~target, 10); flush(where, 4); } else if (offset <= (1L<<32) && offset >= -((1L<<32) - 4)) { - /* + /* * We're withing 32-bits -- we can use a direct call * insn * @@ -582,7 +582,7 @@ reloc_jmpslot(Elf_Addr *wherep, Elf_Addr target, const Obj_Entry *obj, where[1] = MOV71; flush(where, 4); } else if (offset >= 0 && offset < (1L<<44)) { - /* + /* * We're withing 44 bits. We can generate this pattern: * * The resulting code in the jump slot is: @@ -590,8 +590,8 @@ reloc_jmpslot(Elf_Addr *wherep, Elf_Addr target, const Obj_Entry *obj, * sethi %hi(. - .PLT0), %g1 * sethi %h44(addr), %g1 * or %g1, %m44(addr), %g1 - * sllx %g1, 12, %g1 - * jmp %g1+%l44(addr) + * sllx %g1, 12, %g1 + * jmp %g1+%l44(addr) * nop * nop * nop @@ -606,7 +606,7 @@ reloc_jmpslot(Elf_Addr *wherep, Elf_Addr target, const Obj_Entry *obj, where[1] = SETHI | HIVAL(offset, 22); flush(where, 4); } else if (offset < 0 && offset > -(1L<<44)) { - /* + /* * We're withing 44 bits. We can generate this pattern: * * The resulting code in the jump slot is: @@ -614,8 +614,8 @@ reloc_jmpslot(Elf_Addr *wherep, Elf_Addr target, const Obj_Entry *obj, * sethi %hi(. - .PLT0), %g1 * sethi %h44(-addr), %g1 * xor %g1, %m44(-addr), %g1 - * sllx %g1, 12, %g1 - * jmp %g1+%l44(addr) + * sllx %g1, 12, %g1 + * jmp %g1+%l44(addr) * nop * nop * nop @@ -630,7 +630,7 @@ reloc_jmpslot(Elf_Addr *wherep, Elf_Addr target, const Obj_Entry *obj, where[1] = SETHI | HIVAL(~offset, 22); flush(where, 4); } else { - /* + /* * We need to load all 64-bits * * The resulting code in the jump slot is: diff --git a/libexec/rtld-elf/sparc64/rtld_machdep.h b/libexec/rtld-elf/sparc64/rtld_machdep.h index 0d028c8..9efadca 100644 --- a/libexec/rtld-elf/sparc64/rtld_machdep.h +++ b/libexec/rtld-elf/sparc64/rtld_machdep.h @@ -32,16 +32,6 @@ #include <sys/types.h> #include <machine/atomic.h> -#define atomic_incr_int(p) atomic_add_int((p), 1) -#define atomic_decr_int(p) atomic_subtract_int((p), 1) - -/* - * 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; diff --git a/libexec/rtld-elf/sparc64/rtld_start.S b/libexec/rtld-elf/sparc64/rtld_start.S index b97e798..f9d05b7 100644 --- a/libexec/rtld-elf/sparc64/rtld_start.S +++ b/libexec/rtld-elf/sparc64/rtld_start.S @@ -79,7 +79,7 @@ END(.rtld_start) * * The first two entries of PLT2 contain the xword object pointer. * - * These routines are called with two longword arguments, + * These routines are called with two longword arguments, * x and y. To calculate the address of the entry, * _rtld_bind_start_1(x, y) does: * @@ -120,7 +120,7 @@ ENTRY(_rtld_bind_start_0) add %l4, %l5, %l4 /* (i / 5120) * 160 + (i % 5120) / 24 */ add %l4, %l6, %l4 /* + NPLTLOSLOTS */ sub %l4, 4, %l4 /* XXX: 4 entries are reserved */ - + sllx %l4, 1, %l5 /* Each element is an Elf_Rela which */ add %l5, %l4, %l4 /* is 3 longwords or 24 bytes. */ sllx %l4, 3, %l4 /* So multiply by 24. */ @@ -133,17 +133,17 @@ ENTRY(_rtld_bind_start_0) jmp %o0 /* return value == function address */ restore /* Dump our stack frame */ END(_rtld_bind_start_0) - + ENTRY(_rtld_bind_start_1) srax %o0, 15, %o2 /* %o0 is the index to our PLT slot */ sub %o2, 4, %o2 /* XXX: 4 entries are reserved */ - + sllx %o2, 1, %o3 /* Each element is an Elf_Rela which */ add %o3, %o2, %o2 /* is 3 longwords or 24 bytes. */ sllx %o2, 3, %o2 /* So multiply by 24. */ - + ldx [%o1 + 8], %o0 /* The object pointer is at [%o1 + 8] */ - + call _rtld_bind /* Call _rtld_bind(obj, offset) */ mov %o2, %o1 |