From f3fc5196251adf45cfbfdddcce50fa2f7b8368c2 Mon Sep 17 00:00:00 2001 From: Yoshihiro Takahashi Date: Mon, 21 May 2007 11:57:36 +0000 Subject: [PATCH] MFi386: revision 1.652 - Move GDT/LDT locking into a seperate spinlock, removing the global scheduler lock from this responsibility. --- sys/pc98/pc98/machdep.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/pc98/pc98/machdep.c b/sys/pc98/pc98/machdep.c index 2d9ca3d50ce..28fff4e0069 100644 --- a/sys/pc98/pc98/machdep.c +++ b/sys/pc98/pc98/machdep.c @@ -1168,8 +1168,10 @@ exec_setregs(td, entry, stack, ps_strings) pcb->pcb_gs = _udatasel; load_gs(_udatasel); + mtx_lock_spin(&dt_lock); if (td->td_proc->p_md.md_ldt) user_ldt_free(td); + mtx_unlock_spin(&dt_lock); bzero((char *)regs, sizeof(struct trapframe)); regs->tf_eip = entry; @@ -1275,6 +1277,7 @@ static struct gate_descriptor idt0[NIDT]; 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 */ +struct mtx dt_lock; /* lock for GDT and LDT */ #if defined(I586_CPU) && !defined(NO_F00F_HACK) extern int has_f00f_bug; @@ -1954,6 +1957,7 @@ init386(first) r_gdt.rd_limit = NGDT * sizeof(gdt[0]) - 1; r_gdt.rd_base = (int) gdt; + mtx_init(&dt_lock, "descriptor tables", NULL, MTX_SPIN); lgdt(&r_gdt); pcpu_init(pc, 0, sizeof(struct pcpu));