diff options
author | cperciva <cperciva@FreeBSD.org> | 2010-12-31 17:42:25 +0000 |
---|---|---|
committer | cperciva <cperciva@FreeBSD.org> | 2010-12-31 17:42:25 +0000 |
commit | 0440193beb95256383dde71c5882a825313210ba (patch) | |
tree | afb839a025af5a1120c28764202de506965d6188 | |
parent | 0f106c39c9adc30994f9502bda1ffa9cb14cf934 (diff) | |
download | FreeBSD-src-0440193beb95256383dde71c5882a825313210ba.zip FreeBSD-src-0440193beb95256383dde71c5882a825313210ba.tar.gz |
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
-rw-r--r-- | sys/i386/i386/sys_machdep.c | 5 | ||||
-rw-r--r-- | sys/i386/include/segments.h | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/sys/i386/i386/sys_machdep.c b/sys/i386/i386/sys_machdep.c index b47679a..3fb231b 100644 --- a/sys/i386/i386/sys_machdep.c +++ b/sys/i386/i386/sys_machdep.c @@ -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; diff --git a/sys/i386/include/segments.h b/sys/i386/include/segments.h index deeaf76..1c1ddee 100644 --- a/sys/i386/include/segments.h +++ b/sys/i386/include/segments.h @@ -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 |