- Switch to saving non-offseted pointer to TLS block in order too keep things simple

This commit is contained in:
gonzo 2012-03-06 03:27:08 +00:00
parent c6be4f4d2d
commit f348ee84f4
2 changed files with 4 additions and 17 deletions

View File

@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$");
#include <inttypes.h> #include <inttypes.h>
#include <machine/sysarch.h> #include <machine/sysarch.h>
#include <machine/tls.h>
#include "debug.h" #include "debug.h"
#include "rtld.h" #include "rtld.h"
@ -622,8 +623,7 @@ allocate_initial_tls(Obj_Entry *objs)
*/ */
tls_static_space = tls_last_offset + tls_last_size + RTLD_STATIC_TLS_EXTRA; tls_static_space = tls_last_offset + tls_last_size + RTLD_STATIC_TLS_EXTRA;
tls = ((char *) allocate_tls(objs, NULL, TLS_TCB_SIZE, 8) tls = (char *) allocate_tls(objs, NULL, TLS_TCB_SIZE, 8);
+ TLS_TP_OFFSET + TLS_TCB_SIZE);
sysarch(MIPS_SET_TLS, tls); sysarch(MIPS_SET_TLS, tls);
} }
@ -636,8 +636,7 @@ __tls_get_addr(tls_index* ti)
sysarch(MIPS_GET_TLS, &tls); sysarch(MIPS_GET_TLS, &tls);
p = tls_get_addr_common((Elf_Addr**)((Elf_Addr)tls - TLS_TP_OFFSET p = tls_get_addr_common(tls, ti->ti_module, ti->ti_offset + TLS_DTP_OFFSET);
- TLS_TCB_SIZE), ti->ti_module, ti->ti_offset + TLS_DTP_OFFSET);
return (p); return (p);
} }

View File

@ -31,6 +31,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <machine/atomic.h> #include <machine/atomic.h>
#include <machine/tls.h>
struct Struct_Obj_Entry; struct Struct_Obj_Entry;
@ -48,19 +49,6 @@ Elf_Addr reloc_jmpslot(Elf_Addr *where, Elf_Addr target,
#define call_initfini_pointer(obj, target) \ #define call_initfini_pointer(obj, target) \
(((InitFunc)(target))()) (((InitFunc)(target))())
/*
* TLS
*/
#define TLS_TP_OFFSET 0x7000
#define TLS_DTP_OFFSET 0x8000
#ifdef __mips_n64
#define TLS_TCB_SIZE 16
#else
#define TLS_TCB_SIZE 8
#endif
typedef struct { typedef struct {
unsigned long ti_module; unsigned long ti_module;
unsigned long ti_offset; unsigned long ti_offset;