* Initialize floating point unit. */
| 417 | * Initialize floating point unit. |
| 418 | */ |
| 419 | void |
| 420 | npxinit(bool bsp) |
| 421 | { |
| 422 | static union savefpu dummy; |
| 423 | register_t saveintr; |
| 424 | u_int mxcsr; |
| 425 | u_short control; |
| 426 | |
| 427 | if (bsp) { |
| 428 | if (!npx_probe()) |
| 429 | return; |
| 430 | npxinit_bsp1(); |
| 431 | } |
| 432 | |
| 433 | if (use_xsave) { |
| 434 | load_cr4(rcr4() | CR4_XSAVE); |
| 435 | load_xcr(XCR0, xsave_mask); |
| 436 | } |
| 437 | |
| 438 | /* |
| 439 | * XCR0 shall be set up before CPU can report the save area size. |
| 440 | */ |
| 441 | if (bsp) |
| 442 | npxinit_bsp2(); |
| 443 | |
| 444 | /* |
| 445 | * fninit has the same h/w bugs as fnsave. Use the detoxified |
| 446 | * fnsave to throw away any junk in the fpu. fpusave() initializes |
| 447 | * the fpu. |
| 448 | * |
| 449 | * It is too early for critical_enter() to work on AP. |
| 450 | */ |
| 451 | saveintr = intr_disable(); |
| 452 | stop_emulating(); |
| 453 | if (cpu_fxsr) |
| 454 | fninit(); |
| 455 | else |
| 456 | fnsave(&dummy); |
| 457 | control = __INITIAL_NPXCW__; |
| 458 | fldcw(control); |
| 459 | if (cpu_fxsr) { |
| 460 | mxcsr = __INITIAL_MXCSR__; |
| 461 | ldmxcsr(mxcsr); |
| 462 | } |
| 463 | start_emulating(); |
| 464 | intr_restore(saveintr); |
| 465 | } |
| 466 | |
| 467 | /* |
| 468 | * On the boot CPU we generate a clean state that is used to |
no test coverage detected