Use the recently exposed fs/gs set functions when compiling libthr to

run as a 32 bit support library for an amd64 kernel.  32 bit consumers of
libthr have zero chance of running on an amd64 kernel since we don't
implement the i386_set_ldt() family of functions.  Note that this commit
doesn't make it actually work, it just removes one more obstacle.
This commit is contained in:
Peter Wemm 2004-11-06 03:30:53 +00:00
parent 5bc7bd5ff2
commit c5bfff3bab
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=137292

View File

@ -62,14 +62,21 @@ _retire_thread(void *entry)
void *
_set_curthread(ucontext_t *uc, struct pthread *thr, int *err)
{
#ifndef COMPAT_32BIT
union descriptor desc;
#endif
struct tcb *tcb;
void *oldtls;
#ifndef COMPAT_32BIT
int ldt_index;
#endif
*err = 0;
if (uc == NULL && thr->arch_id != NULL) {
#ifndef COMPAT_32BIT
_amd64_set_gsbase(thr->arch_id);
#endif
return (thr->arch_id);
}
@ -91,6 +98,7 @@ _set_curthread(ucontext_t *uc, struct pthread *thr, int *err)
*/
tcb->tcb_thread = thr;
#ifndef COMPAT_32BIT
bzero(&desc, sizeof(desc));
/*
@ -119,6 +127,10 @@ _set_curthread(ucontext_t *uc, struct pthread *thr, int *err)
uc->uc_mcontext.mc_gs = LSEL(ldt_index, SEL_UPL);
else
_set_gs(LSEL(ldt_index, SEL_UPL));
#else
if (uc == NULL)
_amd64_set_gsbase(tcb);
#endif
return (tcb);
}