summaryrefslogtreecommitdiffstats
path: root/sys/compat
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2003-05-15 00:23:40 +0000
committerpeter <peter@FreeBSD.org>2003-05-15 00:23:40 +0000
commit12d7e4bee670b00c658676727ee630be6fbb7af1 (patch)
tree1cae0c59e2d1157890a9bc0eb09af3e021373ef6 /sys/compat
parent7208ad8cbbe97024b739c1267077266cf9792ad3 (diff)
downloadFreeBSD-src-12d7e4bee670b00c658676727ee630be6fbb7af1.zip
FreeBSD-src-12d7e4bee670b00c658676727ee630be6fbb7af1.tar.gz
Collect the nastiness for preserving the kernel MSR_GSBASE around the
load_gs() calls into a single place that is less likely to go wrong. Eliminate the per-process context switching of MSR_GSBASE, because it should be constant for a single cpu. Instead, save/restore it during the loading of the new %gs selector for the new process. Approved by: re (amd64/* blanket)
Diffstat (limited to 'sys/compat')
-rw-r--r--sys/compat/ia32/ia32_sysvec.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/sys/compat/ia32/ia32_sysvec.c b/sys/compat/ia32/ia32_sysvec.c
index 684677a..5ced18c 100644
--- a/sys/compat/ia32/ia32_sysvec.c
+++ b/sys/compat/ia32/ia32_sysvec.c
@@ -241,22 +241,15 @@ ia32_setregs(td, entry, stack, ps_strings)
{
struct trapframe *regs = td->td_frame;
struct pcb *pcb = td->td_pcb;
- u_int64_t pc;
- register_t s;
wrmsr(MSR_FSBASE, 0);
wrmsr(MSR_KGSBASE, 0); /* User value while we're in the kernel */
pcb->pcb_fsbase = 0;
pcb->pcb_gsbase = 0;
- pcb->pcb_kgsbase = rdmsr(MSR_GSBASE);
load_ds(_udatasel);
load_es(_udatasel);
load_fs(_udatasel);
- s = intr_disable();
- pc = rdmsr(MSR_GSBASE);
- load_gs(_udatasel); /* Clobbers kernel %GS.base */
- wrmsr(MSR_GSBASE, pc);
- intr_restore(s);
+ load_gs(_udatasel);
pcb->pcb_ds = _udatasel;
pcb->pcb_es = _udatasel;
pcb->pcb_fs = _udatasel;
OpenPOWER on IntegriCloud