diff --git a/sys/i386/i386/genassym.c b/sys/i386/i386/genassym.c index 0cb371c652c0..d7df503b3bd4 100644 --- a/sys/i386/i386/genassym.c +++ b/sys/i386/i386/genassym.c @@ -198,6 +198,7 @@ ASSYM(PC_FSGS_GDT, offsetof(struct pcpu, pc_fsgs_gdt)); ASSYM(PC_CURRENTLDT, offsetof(struct pcpu, pc_currentldt)); ASSYM(PC_CPUID, offsetof(struct pcpu, pc_cpuid)); ASSYM(PC_CURPMAP, offsetof(struct pcpu, pc_curpmap)); +ASSYM(PC_PRIVATE_TSS, offsetof(struct pcpu, pc_private_tss)); #ifdef DEV_APIC ASSYM(LA_VER, offsetof(struct LAPIC, version)); diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index 19eba7cf3eca..18e30f8a0c05 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -1285,8 +1285,6 @@ struct gate_descriptor *idt = &idt0[0]; /* interrupt descriptor table */ union descriptor ldt[NLDT]; /* local descriptor table */ struct region_descriptor r_gdt, r_idt; /* table descriptors */ -int private_tss; /* flag indicating private tss */ - #if defined(I586_CPU) && !defined(NO_F00F_HACK) extern int has_f00f_bug; #endif @@ -2241,7 +2239,6 @@ init386(first) KSTACK_PAGES * PAGE_SIZE - sizeof(struct pcb) - 16); PCPU_SET(common_tss.tss_ss0, GSEL(GDATA_SEL, SEL_KPL)); gsel_tss = GSEL(GPROC0_SEL, SEL_KPL); - private_tss = 0; PCPU_SET(tss_gdt, &gdt[GPROC0_SEL].sd); PCPU_SET(common_tssd, *PCPU_GET(tss_gdt)); PCPU_SET(common_tss.tss_ioopt, (sizeof (struct i386tss)) << 16); diff --git a/sys/i386/i386/swtch.s b/sys/i386/i386/swtch.s index 9f03440de273..5d3f4a34b72c 100644 --- a/sys/i386/i386/swtch.s +++ b/sys/i386/i386/swtch.s @@ -197,7 +197,7 @@ sw1: */ cmpl $0, PCB_EXT(%edx) /* has pcb extension? */ je 1f /* If not, use the default */ - btsl %esi, private_tss /* mark use of private tss */ + movl $1, PCPU(PRIVATE_TSS) /* mark use of private tss */ movl PCB_EXT(%edx), %edi /* new tss descriptor */ jmp 2f /* Load it up */ @@ -213,8 +213,9 @@ sw1: * Test this CPU's bit in the bitmap to see if this * CPU was using a private TSS. */ - btrl %esi, private_tss /* Already using the common? */ - jae 3f /* if so, skip reloading */ + cmpl $0, PCPU(PRIVATE_TSS) /* Already using the common? */ + je 3f /* if so, skip reloading */ + movl $0, PCPU(PRIVATE_TSS) PCPU_ADDR(COMMON_TSSD, %edi) 2: /* Move correct tss descriptor into GDT slot, then reload tr. */ diff --git a/sys/i386/i386/sys_machdep.c b/sys/i386/i386/sys_machdep.c index 23e81447db8e..d177b997e386 100644 --- a/sys/i386/i386/sys_machdep.c +++ b/sys/i386/i386/sys_machdep.c @@ -267,12 +267,12 @@ i386_extend_pcb(struct thread *td) KASSERT(td->td_pcb->pcb_ext == 0, ("already have a TSS!")); /* Switch to the new TSS. */ - mtx_lock_spin(&sched_lock); + critical_enter(); td->td_pcb->pcb_ext = ext; - private_tss |= PCPU_GET(cpumask); + PCPU_SET(private_tss, 1); *PCPU_GET(tss_gdt) = ext->ext_tssd; ltr(GSEL(GPROC0_SEL, SEL_KPL)); - mtx_unlock_spin(&sched_lock); + critical_exit(); return 0; } diff --git a/sys/i386/include/pcpu.h b/sys/i386/include/pcpu.h index 6312b973834d..78621a8788f1 100644 --- a/sys/i386/include/pcpu.h +++ b/sys/i386/include/pcpu.h @@ -54,7 +54,8 @@ struct segment_descriptor *pc_fsgs_gdt; \ int pc_currentldt; \ u_int pc_acpi_id; \ - u_int pc_apic_id + u_int pc_apic_id; \ + int pc_private_tss /* flag indicating private tss */ #if defined(lint)