Merged from sys/i386/isa/npx.c revision 1.84.

This commit is contained in:
KATO Takenori 2000-09-07 13:33:48 +00:00
parent 841d7a731e
commit 258cacb69b

View File

@ -280,6 +280,12 @@ npx_probe(dev)
setidt(16, probetrap, SDT_SYS386TGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL)); 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)); setidt(npx_intrno, probeintr, SDT_SYS386IGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL));
npx_idt_probeintr = idt[npx_intrno]; 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(); enable_intr();
result = npx_probe1(dev); result = npx_probe1(dev);
disable_intr(); disable_intr();
@ -853,7 +859,7 @@ npxdna()
/* /*
* Record new context early in case frstor causes an IRQ13. * Record new context early in case frstor causes an IRQ13.
*/ */
npxproc = curproc; PCPU_SET(npxproc, CURPROC);
curpcb->pcb_savefpu.sv_ex_sw = 0; curpcb->pcb_savefpu.sv_ex_sw = 0;
/* /*
* The following frstor may cause an IRQ13 when the state being * The following frstor may cause an IRQ13 when the state being
@ -890,16 +896,18 @@ npxsave(addr)
fnsave(addr); fnsave(addr);
/* fnop(); */ /* fnop(); */
start_emulating(); start_emulating();
npxproc = NULL; PCPU_SET(npxproc, NULL);
#else /* SMP */ #else /* SMP */
int intrstate;
u_char icu1_mask; u_char icu1_mask;
u_char icu2_mask; u_char icu2_mask;
u_char old_icu1_mask; u_char old_icu1_mask;
u_char old_icu2_mask; u_char old_icu2_mask;
struct gate_descriptor save_idt_npxintr; struct gate_descriptor save_idt_npxintr;
intrstate = save_intr();
disable_intr(); disable_intr();
#ifdef PC98 #ifdef PC98
old_icu1_mask = inb(IO_ICU1 + 2); old_icu1_mask = inb(IO_ICU1 + 2);
@ -917,12 +925,12 @@ npxsave(addr)
outb(IO_ICU2 + 1, old_icu2_mask & ~(npx0_imask >> 8)); outb(IO_ICU2 + 1, old_icu2_mask & ~(npx0_imask >> 8));
#endif #endif
idt[npx_intrno] = npx_idt_probeintr; idt[npx_intrno] = npx_idt_probeintr;
enable_intr(); write_eflags(intrstate);
stop_emulating(); stop_emulating();
fnsave(addr); fnsave(addr);
fnop(); fnop();
start_emulating(); start_emulating();
npxproc = NULL; PCPU_SET(npxproc, NULL);
disable_intr(); disable_intr();
#ifdef PC98 #ifdef PC98
icu1_mask = inb(IO_ICU1 + 2); /* masks may have changed */ icu1_mask = inb(IO_ICU1 + 2); /* masks may have changed */
@ -942,7 +950,7 @@ npxsave(addr)
| (old_icu2_mask & (npx0_imask >> 8))); | (old_icu2_mask & (npx0_imask >> 8)));
#endif #endif
idt[npx_intrno] = save_idt_npxintr; idt[npx_intrno] = save_idt_npxintr;
enable_intr(); /* back to usual state */ restore_intr(intrstate); /* back to previous state */
#endif /* SMP */ #endif /* SMP */
} }