fpu.c revision 924
155714Skris/*- 255714Skris * Copyright (c) 1990 William Jolitz. 355714Skris * Copyright (c) 1991 The Regents of the University of California. 455714Skris * All rights reserved. 555714Skris * 655714Skris * Redistribution and use in source and binary forms, with or without 755714Skris * modification, are permitted provided that the following conditions 8280297Sjkim * are met: 955714Skris * 1. Redistributions of source code must retain the above copyright 1055714Skris * notice, this list of conditions and the following disclaimer. 1155714Skris * 2. Redistributions in binary form must reproduce the above copyright 1255714Skris * notice, this list of conditions and the following disclaimer in the 1355714Skris * documentation and/or other materials provided with the distribution. 1455714Skris * 3. All advertising materials mentioning features or use of this software 15280297Sjkim * must display the following acknowledgement: 1655714Skris * This product includes software developed by the University of 1755714Skris * California, Berkeley and its contributors. 1855714Skris * 4. Neither the name of the University nor the names of its contributors 1955714Skris * may be used to endorse or promote products derived from this software 2055714Skris * without specific prior written permission. 2155714Skris * 22280297Sjkim * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2355714Skris * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2455714Skris * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2555714Skris * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2655714Skris * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2755714Skris * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2855714Skris * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2955714Skris * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 3055714Skris * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3155714Skris * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3255714Skris * SUCH DAMAGE. 3355714Skris * 3455714Skris * from: @(#)npx.c 7.2 (Berkeley) 5/12/91 3555714Skris * $Id: npx.c,v 1.5 1993/11/03 23:32:35 paul Exp $ 3655714Skris */ 37280297Sjkim 3855714Skris#include "npx.h" 3955714Skris#if NNPX > 0 40280297Sjkim 4155714Skris#include "param.h" 4255714Skris#include "systm.h" 4355714Skris#include "conf.h" 4455714Skris#include "file.h" 4555714Skris#include "proc.h" 4655714Skris#include "machine/cpu.h" 4755714Skris#include "machine/pcb.h" 4855714Skris#include "machine/trap.h" 4955714Skris#include "ioctl.h" 5055714Skris#include "machine/specialreg.h" 5155714Skris#include "i386/isa/icu.h" 52280297Sjkim#include "i386/isa/isa_device.h" 5355714Skris#include "i386/isa/isa.h" 5455714Skris 5555714Skris/* 5655714Skris * 387 and 287 Numeric Coprocessor Extension (NPX) Driver. 5755714Skris */ 5855714Skris 5955714Skris#ifdef __GNUC__ 6055714Skris 6155714Skris#define disable_intr() __asm("cli") 6255714Skris#define enable_intr() __asm("sti") 63111147Snectar#define fldcw(addr) __asm("fldcw %0" : : "m" (*addr)) 64280297Sjkim#define fnclex() __asm("fnclex") 65111147Snectar#define fninit() __asm("fninit") 6655714Skris#define fnsave(addr) __asm("fnsave %0" : "=m" (*addr) : "0" (*addr)) 67238405Sjkim#define fnstcw(addr) __asm("fnstcw %0" : "=m" (*addr) : "0" (*addr)) 68280297Sjkim#define fnstsw(addr) __asm("fnstsw %0" : "=m" (*addr) : "0" (*addr)) 69238405Sjkim#define fp_divide_by_0() __asm("fldz; fld1; fdiv %st,%st(1); fwait") 70238405Sjkim#define frstor(addr) __asm("frstor %0" : : "m" (*addr)) 71280297Sjkim#define fwait() __asm("fwait") 7255714Skris#define read_eflags() ({u_long ef; \ 73109998Smarkm __asm("pushf; popl %0" : "=a" (ef)); \ 7459191Skris ef; }) 75109998Smarkm#define start_emulating() __asm("smsw %%ax; orb %0,%%al; lmsw %%ax" \ 76280297Sjkim : : "n" (CR0_TS) : "ax") 77280297Sjkim#define stop_emulating() __asm("clts") 78280297Sjkim#define write_eflags(ef) __asm("pushl %0; popf" : : "a" ((u_long) ef)) 7959191Skris 80109998Smarkm#else /* not __GNUC__ */ 81280297Sjkim 82280297Sjkimvoid disable_intr __P((void)); 83238405Sjkimvoid enable_intr __P((void)); 84280297Sjkimvoid fldcw __P((caddr_t addr)); 85280297Sjkimvoid fnclex __P((void)); 86280297Sjkimvoid fninit __P((void)); 87280297Sjkimvoid fnsave __P((caddr_t addr)); 88238405Sjkimvoid fnstcw __P((caddr_t addr)); 89280297Sjkimvoid fnstsw __P((caddr_t addr)); 90238405Sjkimvoid fp_divide_by_0 __P((void)); 91280297Sjkimvoid frstor __P((caddr_t addr)); 92280297Sjkimvoid fwait __P((void)); 93280297Sjkimu_long read_eflags __P((void)); 9459191Skrisvoid start_emulating __P((void)); 95109998Smarkmvoid stop_emulating __P((void)); 96280297Sjkimvoid write_eflags __P((u_long ef)); 97280297Sjkim 98280297Sjkim#endif /* __GNUC__ */ 99280297Sjkim 100280297Sjkimtypedef u_char bool_t; 101280297Sjkim 102280297Sjkimextern struct gate_descriptor idt[]; 103280297Sjkim 104280297Sjkimint npxdna __P((void)); 105111147Snectarvoid npxexit __P((struct proc *p)); 106280297Sjkimvoid npxinit __P((u_int control)); 107280297Sjkimvoid npxintr __P((struct intrframe frame)); 108280297Sjkimvoid npxsave __P((struct save87 *addr)); 109280297Sjkimstatic int npxattach __P((struct isa_device *dvp)); 110111147Snectarstatic int npxprobe __P((struct isa_device *dvp)); 111280297Sjkimstatic int npxprobe1 __P((struct isa_device *dvp)); 112280297Sjkim 113280297Sjkimstruct isa_driver npxdriver = { 114280297Sjkim npxprobe, npxattach, "npx", 115280297Sjkim}; 11659191Skris 11755714Skrisu_int npx0mask; 118280297Sjkimstruct proc *npxproc; 119280297Sjkim 120280297Sjkimstatic bool_t npx_ex16; 12159191Skrisstatic bool_t npx_exists; 122109998Smarkmstatic struct gate_descriptor npx_idt_probeintr; 123280297Sjkimstatic int npx_intrno; 124280297Sjkimstatic volatile u_int npx_intrs_while_probing; 125109998Smarkmstatic bool_t npx_irq13; 126280297Sjkimstatic volatile u_int npx_traps_while_probing; 127280297Sjkim 128280297Sjkim/* 129280297Sjkim * Special interrupt handlers. Someday intr0-intr15 will be used to count 130280297Sjkim * interrupts. We'll still need a special exception 16 handler. The busy 131109998Smarkm * latch stuff in probintr() can be moved to npxprobe(). 132280297Sjkim */ 133111147Snectarvoid probeintr(void); 134280297Sjkimasm 135280297Sjkim(" 136280297Sjkim .text 137280297Sjkim_probeintr: 138280297Sjkim ss 139280297Sjkim incl _npx_intrs_while_probing 140280297Sjkim pushl %eax 141280297Sjkim movb $0x20,%al # EOI (asm in strings loses cpp features) 142280297Sjkim outb %al,$0xa0 # IO_ICU2 143280297Sjkim outb %al,$0x20 #IO_ICU1 144280297Sjkim movb $0,%al 145280297Sjkim outb %al,$0xf0 # clear BUSY# latch 146280297Sjkim popl %eax 147280297Sjkim iret 148280297Sjkim"); 149280297Sjkim 150280297Sjkimvoid probetrap(void); 151280297Sjkimasm 152111147Snectar(" 153109998Smarkm .text 154280297Sjkim_probetrap: 155280297Sjkim ss 156280297Sjkim incl _npx_traps_while_probing 157280297Sjkim fnclex 158280297Sjkim iret 159280297Sjkim"); 160280297Sjkim 161280297Sjkim/* 162280297Sjkim * Probe routine. Initialize cr0 to give correct behaviour for [f]wait 163280297Sjkim * whether the device exists or not (XXX should be elsewhere). Set flags 164280297Sjkim * to tell npxattach() what to do. Modify device struct if npx doesn't 165280297Sjkim * need to use interrupts. Return 1 if device exists. 166280297Sjkim */ 167280297Sjkimstatic int 168280297Sjkimnpxprobe(dvp) 169280297Sjkim struct isa_device *dvp; 170280297Sjkim{ 171111147Snectar int result; 172280297Sjkim u_long save_eflags; 173280297Sjkim u_char save_icu1_mask; 174111147Snectar u_char save_icu2_mask; 175280297Sjkim struct gate_descriptor save_idt_npxintr; 176280297Sjkim struct gate_descriptor save_idt_npxtrap; 177280297Sjkim /* 178280297Sjkim * This routine is now just a wrapper for npxprobe1(), to install 179280297Sjkim * special npx interrupt and trap handlers, to enable npx interrupts 180280297Sjkim * and to disable other interrupts. Someday isa_configure() will 18155714Skris * install suitable handlers and run with interrupts enabled so we 18255714Skris * won't need to do so much here. 183280297Sjkim */ 184280297Sjkim npx_intrno = NRSVIDT + ffs(dvp->id_irq) - 1; 185280297Sjkim save_eflags = read_eflags(); 186280297Sjkim disable_intr(); 187280297Sjkim save_icu1_mask = inb(IO_ICU1 + 1); 18859191Skris save_icu2_mask = inb(IO_ICU2 + 1); 189280297Sjkim save_idt_npxintr = idt[npx_intrno]; 19059191Skris save_idt_npxtrap = idt[16]; 191280297Sjkim outb(IO_ICU1 + 1, ~(IRQ_SLAVE | dvp->id_irq)); 192280297Sjkim outb(IO_ICU2 + 1, ~(dvp->id_irq >> 8)); 19359191Skris setidt(16, probetrap, SDT_SYS386TGT, SEL_KPL); 194280297Sjkim setidt(npx_intrno, probeintr, SDT_SYS386IGT, SEL_KPL); 195280297Sjkim npx_idt_probeintr = idt[npx_intrno]; 196280297Sjkim enable_intr(); 197280297Sjkim result = npxprobe1(dvp); 19859191Skris disable_intr(); 19959191Skris outb(IO_ICU1 + 1, save_icu1_mask); 200280297Sjkim outb(IO_ICU2 + 1, save_icu2_mask); 201280297Sjkim idt[npx_intrno] = save_idt_npxintr; 202111147Snectar idt[16] = save_idt_npxtrap; 203280297Sjkim write_eflags(save_eflags); 204280297Sjkim return (result); 205111147Snectar} 20676866Skris 207280297Sjkimstatic int 20859191Skrisnpxprobe1(dvp) 209280297Sjkim struct isa_device *dvp; 210280297Sjkim{ 211280297Sjkim int control; 212280297Sjkim int status; 213280297Sjkim#ifdef lint 214280297Sjkim npxintr(); 215280297Sjkim#endif 216280297Sjkim /* 217280297Sjkim * Partially reset the coprocessor, if any. Some BIOS's don't reset 218280297Sjkim * it after a warm boot. 219280297Sjkim */ 220280297Sjkim outb(0xf1, 0); /* full reset on some systems, NOP on others */ 221280297Sjkim outb(0xf0, 0); /* clear BUSY# latch */ 222280297Sjkim /* 223280297Sjkim * Prepare to trap all ESC (i.e., NPX) instructions and all WAIT 224280297Sjkim * instructions. We must set the CR0_MP bit and use the CR0_TS 225280297Sjkim * bit to control the trap, because setting the CR0_EM bit does 226280297Sjkim * not cause WAIT instructions to trap. It's important to trap 22755714Skris * WAIT instructions - otherwise the "wait" variants of no-wait 228109998Smarkm * control instructions would degenerate to the "no-wait" variants 229280297Sjkim * after FP context switches but work correctly otherwise. It's 230280297Sjkim * particularly important to trap WAITs when there is no NPX - 231109998Smarkm * otherwise the "wait" variants would always degenerate. 232280297Sjkim * 233109998Smarkm * Try setting CR0_NE to get correct error reporting on 486DX's. 234109998Smarkm * Setting it should fail or do nothing on lesser processors. 235280297Sjkim */ 236280297Sjkim load_cr0(rcr0() | CR0_MP | CR0_NE); 237280297Sjkim /* 238280297Sjkim * But don't trap while we're probing. 239109998Smarkm */ 240280297Sjkim stop_emulating(); 241280297Sjkim /* 242109998Smarkm * Finish resetting the coprocessor, if any. If there is an error 24359191Skris * pending, then we may get a bogus IRQ13, but probeintr() will handle 244280297Sjkim * it OK. Bogus halts have never been observed, but we enabled 245280297Sjkim * IRQ13 and cleared the BUSY# latch early to handle them anyway. 246280297Sjkim */ 247280297Sjkim fninit(); 248280297Sjkim DELAY(1000); /* wait for any IRQ13 (fwait might hang) */ 24959191Skris#ifdef DIAGNOSTIC 25059191Skris if (npx_intrs_while_probing != 0) 251280297Sjkim printf("fninit caused %u bogus npx interrupt(s)\n", 252280297Sjkim npx_intrs_while_probing); 253280297Sjkim if (npx_traps_while_probing != 0) 25459191Skris printf("fninit caused %u bogus npx trap(s)\n", 25559191Skris npx_traps_while_probing); 256280297Sjkim#endif 257280297Sjkim /* 258280297Sjkim * Check for a status of mostly zero. 25959191Skris */ 260109998Smarkm status = 0x5a5a; 261280297Sjkim fnstsw(&status); 262280297Sjkim if ((status & 0xb8ff) == 0) { 263280297Sjkim /* 264 * Good, now check for a proper control word. 265 */ 266 control = 0x5a5a; 267 fnstcw(&control); 268 if ((control & 0x1f3f) == 0x033f) { 269 npx_exists = 1; 270 /* 271 * We have an npx, now divide by 0 to see if exception 272 * 16 works. 273 */ 274 control &= ~(1 << 2); /* enable divide by 0 trap */ 275 fldcw(&control); 276 npx_traps_while_probing = npx_intrs_while_probing = 0; 277 fp_divide_by_0(); 278 if (npx_traps_while_probing != 0) { 279 /* 280 * Good, exception 16 works. 281 */ 282 npx_ex16 = 1; 283 dvp->id_irq = 0; /* zap the interrupt */ 284 /* 285 * special return value to flag that we do not 286 * actually use any I/O registers 287 */ 288 return (-1); 289 } 290 if (npx_intrs_while_probing != 0) { 291 /* 292 * Bad, we are stuck with IRQ13. 293 */ 294 npx_irq13 = 1; 295 npx0mask = dvp->id_irq; /* npxattach too late */ 296 return (IO_NPXSIZE); 297 } 298 /* 299 * Worse, even IRQ13 is broken. Use emulator. 300 */ 301 } 302 } 303 /* 304 * Probe failed, but we want to get to npxattach to initialize the 305 * emulator and say that it has been installed. XXX handle devices 306 * that aren't really devices better. 307 */ 308 dvp->id_irq = 0; 309 /* 310 * special return value to flag that we do not 311 * actually use any I/O registers 312 */ 313 return (-1); 314} 315 316/* 317 * Attach routine - announce which it is, and wire into system 318 */ 319int 320npxattach(dvp) 321 struct isa_device *dvp; 322{ 323 if (!npx_ex16 && !npx_irq13) { 324 if (npx_exists) 325 printf("npx%d: Error reporting broken, using 387 emulator\n",dvp->id_unit); 326 else 327 printf("npx%d: 387 Emulator\n",dvp->id_unit); 328 } 329 npxinit(__INITIAL_NPXCW__); 330 return (1); /* XXX unused */ 331} 332 333/* 334 * Initialize floating point unit. 335 */ 336void 337npxinit(control) 338 u_int control; 339{ 340 struct save87 dummy; 341 342 if (!npx_exists) 343 return; 344 /* 345 * fninit has the same h/w bugs as fnsave. Use the detoxified 346 * fnsave to throw away any junk in the fpu. fnsave initializes 347 * the fpu and sets npxproc = NULL as important side effects. 348 */ 349 npxsave(&dummy); 350 stop_emulating(); 351 fldcw(&control); 352 if (curpcb != NULL) 353 fnsave(&curpcb->pcb_savefpu); 354 start_emulating(); 355} 356 357/* 358 * Free coprocessor (if we have it). 359 */ 360void 361npxexit(p) 362 struct proc *p; 363{ 364 365 if (p == npxproc) { 366 start_emulating(); 367 npxproc = NULL; 368 } 369} 370 371/* 372 * Record the FPU state and reinitialize it all except for the control word. 373 * Then generate a SIGFPE. 374 * 375 * Reinitializing the state allows naive SIGFPE handlers to longjmp without 376 * doing any fixups. 377 * 378 * XXX there is currently no way to pass the full error state to signal 379 * handlers, and if this is a nested interrupt there is no way to pass even 380 * a status code! So there is no way to have a non-naive SIGFPE handler. At 381 * best a handler could do an fninit followed by an fldcw of a static value. 382 * fnclex would be of little use because it would leave junk on the FPU stack. 383 * Returning from the handler would be even less safe than usual because 384 * IRQ13 exception handling makes exceptions even less precise than usual. 385 */ 386void 387npxintr(frame) 388 struct intrframe frame; 389{ 390 int code; 391 392 if (npxproc == NULL || !npx_exists) { 393 /* XXX no %p in stand/printf.c. Cast to quiet gcc -Wall. */ 394 printf("npxintr: npxproc = %lx, curproc = %lx, npx_exists = %d\n", 395 (u_long) npxproc, (u_long) curproc, npx_exists); 396 panic("npxintr from nowhere"); 397 } 398 if (npxproc != curproc) { 399 printf("npxintr: npxproc = %lx, curproc = %lx, npx_exists = %d\n", 400 (u_long) npxproc, (u_long) curproc, npx_exists); 401 panic("npxintr from non-current process"); 402 } 403 /* 404 * Save state. This does an implied fninit. It had better not halt 405 * the cpu or we'll hang. 406 */ 407 outb(0xf0, 0); 408 fnsave(&curpcb->pcb_savefpu); 409 fwait(); 410 /* 411 * Restore control word (was clobbered by fnsave). 412 */ 413 fldcw(&curpcb->pcb_savefpu.sv_env.en_cw); 414 fwait(); 415 /* 416 * Remember the exception status word and tag word. The current 417 * (almost fninit'ed) fpu state is in the fpu and the exception 418 * state just saved will soon be junk. However, the implied fninit 419 * doesn't change the error pointers or register contents, and we 420 * preserved the control word and will copy the status and tag 421 * words, so the complete exception state can be recovered. 422 */ 423 curpcb->pcb_savefpu.sv_ex_sw = curpcb->pcb_savefpu.sv_env.en_sw; 424 curpcb->pcb_savefpu.sv_ex_tw = curpcb->pcb_savefpu.sv_env.en_tw; 425 426 /* 427 * Pass exception to process. 428 */ 429 if (ISPL(frame.if_cs) == SEL_UPL) { 430 /* 431 * Interrupt is essentially a trap, so we can afford to call 432 * the SIGFPE handler (if any) as soon as the interrupt 433 * returns. 434 * 435 * XXX little or nothing is gained from this, and plenty is 436 * lost - the interrupt frame has to contain the trap frame 437 * (this is otherwise only necessary for the rescheduling trap 438 * in doreti, and the frame for that could easily be set up 439 * just before it is used). 440 */ 441 curproc->p_regs = (int *)&frame.if_es; 442#ifdef notyet 443 /* 444 * Encode the appropriate code for detailed information on 445 * this exception. 446 */ 447 code = XXX_ENCODE(curpcb->pcb_savefpu.sv_ex_sw); 448#else 449 code = 0; /* XXX */ 450#endif 451 trapsignal(curproc, SIGFPE, code); 452 } else { 453 /* 454 * Nested interrupt. These losers occur when: 455 * o an IRQ13 is bogusly generated at a bogus time, e.g.: 456 * o immediately after an fnsave or frstor of an 457 * error state. 458 * o a couple of 386 instructions after 459 * "fstpl _memvar" causes a stack overflow. 460 * These are especially nasty when combined with a 461 * trace trap. 462 * o an IRQ13 occurs at the same time as another higher- 463 * priority interrupt. 464 * 465 * Treat them like a true async interrupt. 466 */ 467 psignal(npxproc, SIGFPE); 468 } 469} 470 471/* 472 * Implement device not available (DNA) exception 473 * 474 * It would be better to switch FP context here (only). This would require 475 * saving the state in the proc table instead of in the pcb. 476 */ 477int 478npxdna() 479{ 480 if (!npx_exists) 481 return (0); 482 if (npxproc != NULL) { 483 printf("npxdna: npxproc = %lx, curproc = %lx\n", 484 (u_long) npxproc, (u_long) curproc); 485 panic("npxdna"); 486 } 487 stop_emulating(); 488 /* 489 * Record new context early in case frstor causes an IRQ13. 490 */ 491 npxproc = curproc; 492 /* 493 * The following frstor may cause an IRQ13 when the state being 494 * restored has a pending error. The error will appear to have been 495 * triggered by the current (npx) user instruction even when that 496 * instruction is a no-wait instruction that should not trigger an 497 * error (e.g., fnclex). On at least one 486 system all of the 498 * no-wait instructions are broken the same as frstor, so our 499 * treatment does not amplify the breakage. On at least one 500 * 386/Cyrix 387 system, fnclex works correctly while frstor and 501 * fnsave are broken, so our treatment breaks fnclex if it is the 502 * first FPU instruction after a context switch. 503 */ 504 frstor(&curpcb->pcb_savefpu); 505 506 return (1); 507} 508 509/* 510 * Wrapper for fnsave instruction to handle h/w bugs. If there is an error 511 * pending, then fnsave generates a bogus IRQ13 on some systems. Force 512 * any IRQ13 to be handled immediately, and then ignore it. This routine is 513 * often called at splhigh so it must not use many system services. In 514 * particular, it's much easier to install a special handler than to 515 * guarantee that it's safe to use npxintr() and its supporting code. 516 */ 517void 518npxsave(addr) 519 struct save87 *addr; 520{ 521 u_char icu1_mask; 522 u_char icu2_mask; 523 u_char old_icu1_mask; 524 u_char old_icu2_mask; 525 struct gate_descriptor save_idt_npxintr; 526 527 disable_intr(); 528 old_icu1_mask = inb(IO_ICU1 + 1); 529 old_icu2_mask = inb(IO_ICU2 + 1); 530 save_idt_npxintr = idt[npx_intrno]; 531 outb(IO_ICU1 + 1, old_icu1_mask & ~(IRQ_SLAVE | npx0mask)); 532 outb(IO_ICU2 + 1, old_icu2_mask & ~(npx0mask >> 8)); 533 idt[npx_intrno] = npx_idt_probeintr; 534 enable_intr(); 535 stop_emulating(); 536 fnsave(addr); 537 fwait(); 538 start_emulating(); 539 npxproc = NULL; 540 disable_intr(); 541 icu1_mask = inb(IO_ICU1 + 1); /* masks may have changed */ 542 icu2_mask = inb(IO_ICU2 + 1); 543 outb(IO_ICU1 + 1, 544 (icu1_mask & ~npx0mask) | (old_icu1_mask & npx0mask)); 545 outb(IO_ICU2 + 1, 546 (icu2_mask & ~(npx0mask >> 8)) 547 | (old_icu2_mask & (npx0mask >> 8))); 548 idt[npx_intrno] = save_idt_npxintr; 549 enable_intr(); /* back to usual state */ 550} 551 552#endif /* NNPX > 0 */ 553