From 258cacb69b83efc7d65c0c44c1bca08e88cd0ce2 Mon Sep 17 00:00:00 2001 From: KATO Takenori Date: Thu, 7 Sep 2000 13:33:48 +0000 Subject: [PATCH] Merged from sys/i386/isa/npx.c revision 1.84. --- sys/pc98/pc98/npx.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/sys/pc98/pc98/npx.c b/sys/pc98/pc98/npx.c index 2bd3d5045528..264d3ba838c7 100644 --- a/sys/pc98/pc98/npx.c +++ b/sys/pc98/pc98/npx.c @@ -280,6 +280,12 @@ npx_probe(dev) setidt(16, probetrap, SDT_SYS386TGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL)); setidt(npx_intrno, probeintr, SDT_SYS386IGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL)); npx_idt_probeintr = idt[npx_intrno]; + + /* + * XXX This looks highly bogus, but it appears that npc_probe1 + * needs interrupts enabled. Does this make any difference + * here? + */ enable_intr(); result = npx_probe1(dev); disable_intr(); @@ -853,7 +859,7 @@ npxdna() /* * Record new context early in case frstor causes an IRQ13. */ - npxproc = curproc; + PCPU_SET(npxproc, CURPROC); curpcb->pcb_savefpu.sv_ex_sw = 0; /* * The following frstor may cause an IRQ13 when the state being @@ -890,16 +896,18 @@ npxsave(addr) fnsave(addr); /* fnop(); */ start_emulating(); - npxproc = NULL; + PCPU_SET(npxproc, NULL); #else /* SMP */ + int intrstate; u_char icu1_mask; u_char icu2_mask; u_char old_icu1_mask; u_char old_icu2_mask; struct gate_descriptor save_idt_npxintr; + intrstate = save_intr(); disable_intr(); #ifdef PC98 old_icu1_mask = inb(IO_ICU1 + 2); @@ -917,12 +925,12 @@ npxsave(addr) outb(IO_ICU2 + 1, old_icu2_mask & ~(npx0_imask >> 8)); #endif idt[npx_intrno] = npx_idt_probeintr; - enable_intr(); + write_eflags(intrstate); stop_emulating(); fnsave(addr); fnop(); start_emulating(); - npxproc = NULL; + PCPU_SET(npxproc, NULL); disable_intr(); #ifdef PC98 icu1_mask = inb(IO_ICU1 + 2); /* masks may have changed */ @@ -942,7 +950,7 @@ npxsave(addr) | (old_icu2_mask & (npx0_imask >> 8))); #endif idt[npx_intrno] = save_idt_npxintr; - enable_intr(); /* back to usual state */ + restore_intr(intrstate); /* back to previous state */ #endif /* SMP */ }