diff options
author | gonzo <gonzo@FreeBSD.org> | 2012-08-15 03:08:29 +0000 |
---|---|---|
committer | gonzo <gonzo@FreeBSD.org> | 2012-08-15 03:08:29 +0000 |
commit | 0761ed25354c932b4754aa6fa130cc9d9d2254c4 (patch) | |
tree | 83d0901dd480064bae15946e8fc4297661804a7b | |
parent | 2187caf32ab56951cfad529357413ac58b57d553 (diff) | |
download | FreeBSD-src-0761ed25354c932b4754aa6fa130cc9d9d2254c4.zip FreeBSD-src-0761ed25354c932b4754aa6fa130cc9d9d2254c4.tar.gz |
Merging of projects/armv6, part 2
Handle TLS for ARMv6 and ARMv7
-rw-r--r-- | lib/libthr/arch/arm/include/pthread_md.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/libthr/arch/arm/include/pthread_md.h b/lib/libthr/arch/arm/include/pthread_md.h index 83ddf7f..3c3dd6d 100644 --- a/lib/libthr/arch/arm/include/pthread_md.h +++ b/lib/libthr/arch/arm/include/pthread_md.h @@ -57,7 +57,11 @@ void _tcb_dtor(struct tcb *); 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 @@ _tcb_set(struct tcb *tcb) 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; |