summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2006-09-01 21:01:11 +0000
committermarcel <marcel@FreeBSD.org>2006-09-01 21:01:11 +0000
commitd21513035e974a57a899870d0a415c547123a037 (patch)
tree3ee5945c7906135a73d8f56e192d472f334a2aa9 /lib
parent323d8166ad1294b31560e947a1f3b57209141279 (diff)
downloadFreeBSD-src-d21513035e974a57a899870d0a415c547123a037.zip
FreeBSD-src-d21513035e974a57a899870d0a415c547123a037.tar.gz
Stylize: avoid using a global register variable.
Diffstat (limited to 'lib')
-rw-r--r--lib/libthr/arch/ia64/ia64/pthread_md.c2
-rw-r--r--lib/libthr/arch/ia64/include/pthread_md.h12
2 files changed, 8 insertions, 6 deletions
diff --git a/lib/libthr/arch/ia64/ia64/pthread_md.c b/lib/libthr/arch/ia64/ia64/pthread_md.c
index e0e837e..c2ad71a 100644
--- a/lib/libthr/arch/ia64/ia64/pthread_md.c
+++ b/lib/libthr/arch/ia64/ia64/pthread_md.c
@@ -40,7 +40,7 @@ _tcb_ctor(struct pthread *thread, int initial)
{
struct tcb *tcb;
- tcb = _rtld_allocate_tls((initial) ? _tp : NULL,
+ tcb = _rtld_allocate_tls((initial) ? _tcb_get() : NULL,
sizeof(struct tcb), 16);
if (tcb)
tcb->tcb_thread = thread;
diff --git a/lib/libthr/arch/ia64/include/pthread_md.h b/lib/libthr/arch/ia64/include/pthread_md.h
index d64800b..eff38bb 100644
--- a/lib/libthr/arch/ia64/include/pthread_md.h
+++ b/lib/libthr/arch/ia64/include/pthread_md.h
@@ -42,8 +42,6 @@ struct tcb {
struct pthread *tcb_thread;
};
-register struct tcb *_tp __asm("%r13");
-
/*
* The tcb constructors.
*/
@@ -54,13 +52,17 @@ void _tcb_dtor(struct tcb *);
static __inline void
_tcb_set(struct tcb *tcb)
{
- __asm __volatile("mov r13 = %0;;" :: "r"(tcb));
+ register struct tcb *tp __asm("%r13");
+
+ __asm __volatile("mov %0 = %1;;" : "=r"(tp) : "r"(tcb));
}
static __inline struct tcb *
_tcb_get(void)
{
- return (_tp);
+ register struct tcb *tp __asm("%r13");
+
+ return (tp);
}
extern struct pthread *_thr_initial;
@@ -69,7 +71,7 @@ static __inline struct pthread *
_get_curthread(void)
{
if (_thr_initial)
- return (_tp->tcb_thread);
+ return (_tcb_get()->tcb_thread);
return (NULL);
}
OpenPOWER on IntegriCloud