1/*-
2 * Copyright (c) 1990 William Jolitz.
3 * Copyright (c) 1991 The Regents of the University of California.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
--- 18 unchanged lines hidden (view full) ---
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 * from: @(#)npx.c 7.2 (Berkeley) 5/12/91
35 * $Id: npx.c,v 1.17 1994/11/14 14:59:06 bde Exp $
36 */
37
38#include "npx.h"
39#if NNPX > 0
40
41#include <sys/param.h>
42#include <sys/systm.h>
43#include <sys/conf.h>
--- 290 unchanged lines hidden (view full) ---
334int
335npxattach(dvp)
336 struct isa_device *dvp;
337{
338 printf("npx%d: ", dvp->id_unit);
339 if (npx_ex16)
340 printf("INT 16 interface\n");
341 else if (npx_irq13)
342 printf("IRQ 13 interface\n");
343#if defined(MATH_EMULATE) || defined(GPL_MATH_EMULATE)
344 else if (npx_exists) {
345 printf("error reporting broken; using 387 emulator\n");
346 npx_exists = 0;
347 } else
348 printf("387 emulator\n");
349#else
350 else
--- 88 unchanged lines hidden (view full) ---
439 panic("npxintr from nowhere");
440 }
441 if (npxproc != curproc) {
442 printf("npxintr: npxproc = %p, curproc = %p, npx_exists = %d\n",
443 npxproc, curproc, npx_exists);
444 panic("npxintr from non-current process");
445 }
446
447 fnstsw(&curpcb->pcb_savefpu.sv_ex_sw);
448 fnclex();
449 outb(0xf0, 0);
450
451 /*
452 * Pass exception to process.
453 */
454 if (ISPL(frame.if_cs) == SEL_UPL) {
455 /*
456 * Interrupt is essentially a trap, so we can afford to call
457 * the SIGFPE handler (if any) as soon as the interrupt
--- 99 unchanged lines hidden (view full) ---
557 save_idt_npxintr = idt[npx_intrno];
558 outb(IO_ICU1 + 1, old_icu1_mask & ~(IRQ_SLAVE | npx0_imask));
559 outb(IO_ICU2 + 1, old_icu2_mask & ~(npx0_imask >> 8));
560 idt[npx_intrno] = npx_idt_probeintr;
561 enable_intr();
562 stop_emulating();
563 fnsave(addr);
564 fnop();
565 outb(0xf0, 0);
566 start_emulating();
567 npxproc = NULL;
568 disable_intr();
569 icu1_mask = inb(IO_ICU1 + 1); /* masks may have changed */
570 icu2_mask = inb(IO_ICU2 + 1);
571 outb(IO_ICU1 + 1,
572 (icu1_mask & ~npx0_imask) | (old_icu1_mask & npx0_imask));
573 outb(IO_ICU2 + 1,
574 (icu2_mask & ~(npx0_imask >> 8))
575 | (old_icu2_mask & (npx0_imask >> 8)));
576 idt[npx_intrno] = save_idt_npxintr;
577 enable_intr(); /* back to usual state */
578}
579
580#endif /* NNPX > 0 */
2 * Copyright (c) 1990 William Jolitz.
3 * Copyright (c) 1991 The Regents of the University of California.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
--- 18 unchanged lines hidden (view full) ---
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 * from: @(#)npx.c 7.2 (Berkeley) 5/12/91
35 * $Id: npx.c,v 1.17 1994/11/14 14:59:06 bde Exp $
36 */
37
38#include "npx.h"
39#if NNPX > 0
40
41#include <sys/param.h>
42#include <sys/systm.h>
43#include <sys/conf.h>
--- 290 unchanged lines hidden (view full) ---
334int
335npxattach(dvp)
336 struct isa_device *dvp;
337{
338 printf("npx%d: ", dvp->id_unit);
339 if (npx_ex16)
340 printf("INT 16 interface\n");
341 else if (npx_irq13)
342 printf("IRQ 13 interface\n");
343#if defined(MATH_EMULATE) || defined(GPL_MATH_EMULATE)
344 else if (npx_exists) {
345 printf("error reporting broken; using 387 emulator\n");
346 npx_exists = 0;
347 } else
348 printf("387 emulator\n");
349#else
350 else
--- 88 unchanged lines hidden (view full) ---
439 panic("npxintr from nowhere");
440 }
441 if (npxproc != curproc) {
442 printf("npxintr: npxproc = %p, curproc = %p, npx_exists = %d\n",
443 npxproc, curproc, npx_exists);
444 panic("npxintr from non-current process");
445 }
446
447 fnstsw(&curpcb->pcb_savefpu.sv_ex_sw);
448 fnclex();
449 outb(0xf0, 0);
450
451 /*
452 * Pass exception to process.
453 */
454 if (ISPL(frame.if_cs) == SEL_UPL) {
455 /*
456 * Interrupt is essentially a trap, so we can afford to call
457 * the SIGFPE handler (if any) as soon as the interrupt
--- 99 unchanged lines hidden (view full) ---
557 save_idt_npxintr = idt[npx_intrno];
558 outb(IO_ICU1 + 1, old_icu1_mask & ~(IRQ_SLAVE | npx0_imask));
559 outb(IO_ICU2 + 1, old_icu2_mask & ~(npx0_imask >> 8));
560 idt[npx_intrno] = npx_idt_probeintr;
561 enable_intr();
562 stop_emulating();
563 fnsave(addr);
564 fnop();
565 outb(0xf0, 0);
566 start_emulating();
567 npxproc = NULL;
568 disable_intr();
569 icu1_mask = inb(IO_ICU1 + 1); /* masks may have changed */
570 icu2_mask = inb(IO_ICU2 + 1);
571 outb(IO_ICU1 + 1,
572 (icu1_mask & ~npx0_imask) | (old_icu1_mask & npx0_imask));
573 outb(IO_ICU2 + 1,
574 (icu2_mask & ~(npx0_imask >> 8))
575 | (old_icu2_mask & (npx0_imask >> 8)));
576 idt[npx_intrno] = save_idt_npxintr;
577 enable_intr(); /* back to usual state */
578}
579
580#endif /* NNPX > 0 */