summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorgonzo <gonzo@FreeBSD.org>2012-02-14 00:17:43 +0000
committergonzo <gonzo@FreeBSD.org>2012-02-14 00:17:43 +0000
commit04a89c6a3dd966bcd4e1d7cde49f0419d8fd496c (patch)
treea07450079ba14b48f7ffc85358baa2a8f4314ad4 /lib
parentffed3e927facdeeac2d9422c67edbec8da0e3eee (diff)
downloadFreeBSD-src-04a89c6a3dd966bcd4e1d7cde49f0419d8fd496c.zip
FreeBSD-src-04a89c6a3dd966bcd4e1d7cde49f0419d8fd496c.tar.gz
Add thread-local storage support for arm:
- Switch to Variant I TCB layout - Use function from rtld for TCB allocation/deallocation
Diffstat (limited to 'lib')
-rw-r--r--lib/libthr/arch/arm/arm/pthread_md.c7
-rw-r--r--lib/libthr/arch/arm/include/pthread_md.h2
2 files changed, 5 insertions, 4 deletions
diff --git a/lib/libthr/arch/arm/arm/pthread_md.c b/lib/libthr/arch/arm/arm/pthread_md.c
index 7ca2b25..028f06c 100644
--- a/lib/libthr/arch/arm/arm/pthread_md.c
+++ b/lib/libthr/arch/arm/arm/pthread_md.c
@@ -37,14 +37,17 @@ _tcb_ctor(struct pthread *thread, int initial)
{
struct tcb *tcb;
- tcb = malloc(sizeof(struct tcb));
+ tcb = _rtld_allocate_tls((initial) ? _tcb_get() : NULL,
+ sizeof(struct tcb), 16);
if (tcb)
tcb->tcb_thread = thread;
+
return (tcb);
}
void
_tcb_dtor(struct tcb *tcb)
{
- free(tcb);
+
+ _rtld_free_tls(tcb, sizeof(struct tcb), 16);
}
diff --git a/lib/libthr/arch/arm/include/pthread_md.h b/lib/libthr/arch/arm/include/pthread_md.h
index e799c54..83ddf7f 100644
--- a/lib/libthr/arch/arm/include/pthread_md.h
+++ b/lib/libthr/arch/arm/include/pthread_md.h
@@ -43,10 +43,8 @@
* Variant II tcb, first two members are required by rtld.
*/
struct tcb {
- struct tcb *tcb_self; /* required by rtld */
void *tcb_dtv; /* required by rtld */
struct pthread *tcb_thread; /* our hook */
- void *tcb_spare[1];
};
/*
OpenPOWER on IntegriCloud