From 6185c69a2b510d449838ff2ba5973e3933fc3742 Mon Sep 17 00:00:00 2001 From: peter Date: Sat, 6 Nov 2004 03:30:53 +0000 Subject: 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. --- lib/libthr/arch/i386/i386/_setcurthread.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lib/libthr') 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); } -- cgit v1.1