aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Wemm <peter@FreeBSD.org>2004-11-06 03:30:53 +0000
committerPeter Wemm <peter@FreeBSD.org>2004-11-06 03:30:53 +0000
commitc5bfff3bab0d99779336e362a4062416c6ebdb1a (patch)
tree353cfbd6c58eafe170d0aa06d2fe7b6771fbe101
parent5bc7bd5ff24ce33440863f7c353f95f65890bbce (diff)
downloadsrc-c5bfff3bab0d99779336e362a4062416c6ebdb1a.tar.gz
src-c5bfff3bab0d99779336e362a4062416c6ebdb1a.zip
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.
Notes
Notes: svn path=/head/; revision=137292
-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 4e07579f3fe1..1f3b20adc226 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);
}