* Initialize the floating point unit. */
| 391 | * Initialize the floating point unit. |
| 392 | */ |
| 393 | void |
| 394 | fpuinit(void) |
| 395 | { |
| 396 | register_t saveintr; |
| 397 | u_int mxcsr; |
| 398 | u_short control; |
| 399 | |
| 400 | if (IS_BSP()) |
| 401 | fpuinit_bsp1(); |
| 402 | |
| 403 | if (use_xsave) { |
| 404 | load_cr4(rcr4() | CR4_XSAVE); |
| 405 | load_xcr(XCR0, xsave_mask); |
| 406 | } |
| 407 | |
| 408 | /* |
| 409 | * XCR0 shall be set up before CPU can report the save area size. |
| 410 | */ |
| 411 | if (IS_BSP()) |
| 412 | fpuinit_bsp2(); |
| 413 | |
| 414 | /* |
| 415 | * It is too early for critical_enter() to work on AP. |
| 416 | */ |
| 417 | saveintr = intr_disable(); |
| 418 | stop_emulating(); |
| 419 | fninit(); |
| 420 | control = __INITIAL_FPUCW__; |
| 421 | fldcw(control); |
| 422 | mxcsr = __INITIAL_MXCSR__; |
| 423 | ldmxcsr(mxcsr); |
| 424 | start_emulating(); |
| 425 | intr_restore(saveintr); |
| 426 | } |
| 427 | |
| 428 | /* |
| 429 | * On the boot CPU we generate a clean state that is used to |
no test coverage detected