summaryrefslogtreecommitdiffstats
path: root/lib/libthr
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2004-11-06 03:30:53 +0000
committerpeter <peter@FreeBSD.org>2004-11-06 03:30:53 +0000
commit6185c69a2b510d449838ff2ba5973e3933fc3742 (patch)
tree353cfbd6c58eafe170d0aa06d2fe7b6771fbe101 /lib/libthr
parent290cd3dfdf35209c9e1b907901da23a06fd0a8ec (diff)
downloadFreeBSD-src-6185c69a2b510d449838ff2ba5973e3933fc3742.zip
FreeBSD-src-6185c69a2b510d449838ff2ba5973e3933fc3742.tar.gz
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.
Diffstat (limited to 'lib/libthr')
-rw-r--r--lib/libthr/arch/i386/i386/_setcurthread.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/libthr/arch/i386/i386/_setcurthread.c b/lib/libthr/arch/i386/i386/_setcurthread.c
index 4e07579..1f3b20a 100644
--- a/lib/libthr/arch/i386/i386/_setcurthread.c
+++ b/lib/libthr/arch/i386/i386/_setcurthread.c
@@ -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);
}
OpenPOWER on IntegriCloud