Make i386_set_ldt work on i386/XEN, step 5/5.

When cleaning up a thread, reset its LDT to the default LDT.

Note: Casting the LDT pointer to an int and storing it in pc_currentldt is
wildly bogus, but is harmless since pc_currentldt is a write-only variable.

MFC after:	3 days
This commit is contained in:
Colin Percival 2010-12-31 17:42:25 +00:00
parent 698cc19d6b
commit aaaf607148
2 changed files with 6 additions and 0 deletions

View file

@ -523,8 +523,13 @@ user_ldt_free(struct thread *td)
}
if (td == PCPU_GET(curthread)) {
#ifdef XEN
i386_reset_ldt(&default_proc_ldt);
PCPU_SET(currentldt, (int)&default_proc_ldt);
#else
lldt(_default_ldt);
PCPU_SET(currentldt, _default_ldt);
#endif
}
mdp->md_ldt = NULL;

View file

@ -257,6 +257,7 @@ struct region_descriptor {
#ifdef _KERNEL
extern int _default_ldt;
#ifdef XEN
extern struct proc_ldt default_proc_ldt;
extern union descriptor *gdt;
extern union descriptor *ldt;
#else