MCPcopy Create free account
hub / github.com/F-Stack/f-stack / npxinit

Function npxinit

freebsd/i386/i386/npx.c:419–465  ·  view source on GitHub ↗

* Initialize floating point unit. */

Source from the content-addressed store, hash-verified

417 * Initialize floating point unit.
418 */
419void
420npxinit(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

Callers 3

init386Function · 0.85
npxresumeFunction · 0.85
init_secondary_tailFunction · 0.85

Calls 7

npx_probeFunction · 0.85
npxinit_bsp2Function · 0.85
load_cr4Function · 0.50
rcr4Function · 0.50
load_xcrFunction · 0.50
intr_disableFunction · 0.50
intr_restoreFunction · 0.50

Tested by

no test coverage detected