Move global variable private_tss into per-cpu area.

Reviewed by: jhb
This commit is contained in:
David Xu 2005-12-26 00:07:19 +00:00
parent 6ae8d74a9e
commit 1bfa910843
5 changed files with 10 additions and 10 deletions

View File

@ -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));

View File

@ -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);

View File

@ -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. */

View File

@ -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;
}

View File

@ -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)