Stylize: avoid using a global register variable.
This commit is contained in:
parent
94d8eb4fc7
commit
be2f4bda88
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=161840
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user