From d032e7fca37d794f5e169437ead6635ee8f62cf2 Mon Sep 17 00:00:00 2001 From: jhb Date: Thu, 15 Sep 2005 17:30:08 +0000 Subject: Explicitly switch to the new TSS by updating the current CPU's TSS selector and reloading it in i386_extend_pcb() rather than trying to force a context switch to reload the TSS via the TDF_NEEDRESCHED flag. Optimizations to avoid calling cpu_switch() when the new thread was identical to the old thread defeated the attempt to force a TSS reload. Explicitly loading the new TSS is what we really want to do anyway. PR: i386/84842 Reported by: Alexander Best arundel at h3c dot de MFC after: 1 week Reviewed by: bde (mostly) --- sys/i386/i386/sys_machdep.c | 10 ++++++---- sys/i386/include/pcb_ext.h | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'sys/i386') diff --git a/sys/i386/i386/sys_machdep.c b/sys/i386/i386/sys_machdep.c index 467ee65..23e8144 100644 --- a/sys/i386/i386/sys_machdep.c +++ b/sys/i386/i386/sys_machdep.c @@ -263,13 +263,15 @@ i386_extend_pcb(struct thread *td) ssd.ssd_limit -= ((unsigned)&ext->ext_tss - (unsigned)ext); ssdtosd(&ssd, &ext->ext_tssd); - KASSERT(td->td_proc == curthread->td_proc, ("giving TSS to !curproc")); + KASSERT(td == curthread, ("giving TSS to !curthread")); KASSERT(td->td_pcb->pcb_ext == 0, ("already have a TSS!")); + + /* Switch to the new TSS. */ mtx_lock_spin(&sched_lock); td->td_pcb->pcb_ext = ext; - - /* switch to the new TSS after syscall completes */ - td->td_flags |= TDF_NEEDRESCHED; + private_tss |= PCPU_GET(cpumask); + *PCPU_GET(tss_gdt) = ext->ext_tssd; + ltr(GSEL(GPROC0_SEL, SEL_KPL)); mtx_unlock_spin(&sched_lock); return 0; diff --git a/sys/i386/include/pcb_ext.h b/sys/i386/include/pcb_ext.h index cf5a911..81e1bed 100644 --- a/sys/i386/include/pcb_ext.h +++ b/sys/i386/include/pcb_ext.h @@ -44,6 +44,7 @@ struct pcb_ext { }; #ifdef _KERNEL +extern int private_tss; int i386_extend_pcb(struct thread *); -- cgit v1.1