diff -x .svn -I '$FreeBSD.*$' -Naur head/lib/libc/arm/gen/__aeabi_read_tp.S armv6/lib/libc/arm/gen/__aeabi_read_tp.S --- head/lib/libc/arm/gen/__aeabi_read_tp.S 2012-08-12 16:59:09.289725534 -0700 +++ armv6/lib/libc/arm/gen/__aeabi_read_tp.S 2012-08-08 12:43:32.324723907 -0700 @@ -31,10 +31,16 @@ #include ENTRY(__aeabi_read_tp) +#ifdef ARM_TP_ADDRESS ldr r0, .Larm_tp_address ldr r0, [r0] +#else + mrc p15, 0, r0, c13, c0, 3 +#endif RET +#ifdef ARM_TP_ADDRESS .Larm_tp_address: .word ARM_TP_ADDRESS +#endif diff -x .svn -I '$FreeBSD.*$' -Naur head/lib/libc/arm/gen/_set_tp.c armv6/lib/libc/arm/gen/_set_tp.c --- head/lib/libc/arm/gen/_set_tp.c 2012-08-12 16:59:09.313724138 -0700 +++ armv6/lib/libc/arm/gen/_set_tp.c 2012-08-08 12:43:32.325724480 -0700 @@ -35,5 +35,9 @@ _set_tp(void *tp) { +#ifdef ARM_TP_ADDRESS *((struct tcb **)ARM_TP_ADDRESS) = tp; +#else + sysarch(ARM_SET_TP, tp); +#endif } diff -x .svn -I '$FreeBSD.*$' -Naur head/lib/libthr/arch/arm/include/pthread_md.h armv6/lib/libthr/arch/arm/include/pthread_md.h --- head/lib/libthr/arch/arm/include/pthread_md.h 2012-08-12 16:59:09.718724122 -0700 +++ armv6/lib/libthr/arch/arm/include/pthread_md.h 2012-08-08 12:43:37.987723657 -0700 @@ -57,7 +57,11 @@ static __inline void _tcb_set(struct tcb *tcb) { - *((struct tcb **)ARM_TP_ADDRESS) = tcb; +#ifdef ARM_TP_ADDRESS + *((struct tcb **)ARM_TP_ADDRESS) = tcb; /* avoids a system call */ +#else + sysarch(ARM_SET_TP, tcb); +#endif } /* @@ -66,7 +70,15 @@ static __inline struct tcb * _tcb_get(void) { +#ifdef ARM_TP_ADDRESS return (*((struct tcb **)ARM_TP_ADDRESS)); +#else + struct tcb *tcb; + + __asm __volatile("mrc p15, 0, %0, c13, c0, 3" \ + : "=r" (tcb)); + return (tcb); +#endif } extern struct pthread *_thr_initial; diff -x .svn -I '$FreeBSD.*$' -Naur head/libexec/rtld-elf/arm/reloc.c armv6/libexec/rtld-elf/arm/reloc.c --- head/libexec/rtld-elf/arm/reloc.c 2012-08-12 16:59:10.179910198 -0700 +++ armv6/libexec/rtld-elf/arm/reloc.c 2012-08-09 12:08:27.743724570 -0700 @@ -433,7 +433,9 @@ void allocate_initial_tls(Obj_Entry *objs) { +#ifdef ARM_TP_ADDRESS void **_tp = (void **)ARM_TP_ADDRESS; +#endif /* * Fix the size of the static TLS block by using the maximum @@ -443,16 +445,27 @@ tls_static_space = tls_last_offset + tls_last_size + RTLD_STATIC_TLS_EXTRA; +#ifdef ARM_TP_ADDRESS (*_tp) = (void *) allocate_tls(objs, NULL, TLS_TCB_SIZE, 8); +#else + sysarch(ARM_SET_TP, allocate_tls(objs, NULL, TLS_TCB_SIZE, 8)); +#endif } void * __tls_get_addr(tls_index* ti) { - void **_tp = (void **)ARM_TP_ADDRESS; char *p; +#ifdef ARM_TP_ADDRESS + void **_tp = (void **)ARM_TP_ADDRESS; p = tls_get_addr_common((Elf_Addr **)(*_tp), ti->ti_module, ti->ti_offset); +#else + void *_tp; + __asm __volatile("mrc p15, 0, %0, c13, c0, 3" \ + : "=r" (_tp)); + p = tls_get_addr_common((Elf_Addr **)(_tp), ti->ti_module, ti->ti_offset); +#endif return (p); }