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.18 1995/01/03 04:00: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 ; /* higher level has printed "irq 13" */ |
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 outb(0xf0, 0); |
448 fnstsw(&curpcb->pcb_savefpu.sv_ex_sw); 449 fnclex(); |
450 fnop(); |
451 452 /* 453 * Pass exception to process. 454 */ 455 if (ISPL(frame.if_cs) == SEL_UPL) { 456 /* 457 * Interrupt is essentially a trap, so we can afford to call 458 * the SIGFPE handler (if any) as soon as the interrupt --- 99 unchanged lines hidden (view full) --- 558 save_idt_npxintr = idt[npx_intrno]; 559 outb(IO_ICU1 + 1, old_icu1_mask & ~(IRQ_SLAVE | npx0_imask)); 560 outb(IO_ICU2 + 1, old_icu2_mask & ~(npx0_imask >> 8)); 561 idt[npx_intrno] = npx_idt_probeintr; 562 enable_intr(); 563 stop_emulating(); 564 fnsave(addr); 565 fnop(); |
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 */ |