summaryrefslogtreecommitdiffstats
path: root/lib/libthr/arch
diff options
context:
space:
mode:
authormtm <mtm@FreeBSD.org>2003-12-02 16:00:26 +0000
committermtm <mtm@FreeBSD.org>2003-12-02 16:00:26 +0000
commit9449459c1740caaf5e1539ab804a01ba84a7120c (patch)
treedd330974c25946a6a324781a26bb5103a8db4da1 /lib/libthr/arch
parentba4ca33c01ba85e79f06f405a94bb55195f730c9 (diff)
downloadFreeBSD-src-9449459c1740caaf5e1539ab804a01ba84a7120c.zip
FreeBSD-src-9449459c1740caaf5e1539ab804a01ba84a7120c.tar.gz
Use dynamic instead of static LDT allocation.
Approved by: re (scottl)
Diffstat (limited to 'lib/libthr/arch')
-rw-r--r--lib/libthr/arch/i386/i386/_setcurthread.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/libthr/arch/i386/i386/_setcurthread.c b/lib/libthr/arch/i386/i386/_setcurthread.c
index 1960c0e..2225df2 100644
--- a/lib/libthr/arch/i386/i386/_setcurthread.c
+++ b/lib/libthr/arch/i386/i386/_setcurthread.c
@@ -90,7 +90,6 @@ _set_curthread(ucontext_t *uc, struct pthread *thr, int *err)
union descriptor desc;
void **ldt_entry;
int ldt_index;
- int error;
*err = 0;
@@ -128,7 +127,6 @@ _set_curthread(ucontext_t *uc, struct pthread *thr, int *err)
* what the gs register will point to.
*/
*ldt_entry = (void *)thr;
- ldt_index = LDT_INDEX(ldt_entry);
bzero(&desc, sizeof(desc));
@@ -147,9 +145,10 @@ _set_curthread(ucontext_t *uc, struct pthread *thr, int *err)
desc.sd.sd_gran = 0;
desc.sd.sd_hibase = (unsigned int)ldt_entry >> 24;
- error = i386_set_ldt(ldt_index, &desc, 1);
- if (error == -1)
- abort();
+ /* Get a slot from the process' LDT list */
+ ldt_index = i386_set_ldt(LDT_AUTO_ALLOC, &desc, 1);
+ if (ldt_index == -1)
+ abort();
/*
* Set up our gs with the index into the ldt for this entry.
OpenPOWER on IntegriCloud