|
ginnOS
The reference: libc, the libraries and the kernel
|
the FPU (x87) and SSE register state of user programs. More...
Macros | |
| #define | CR0_MP 0x00000002u |
| #define | CR0_EM 0x00000004u |
| #define | CR0_TS 0x00000008u |
| #define | CR0_NE 0x00000020u |
| #define | CR4_OSFXSR 0x00000200u |
| #define | CR4_OSXMMEXCPT 0x00000400u |
| #define | CPUID_EDX_FXSR 0x01000000u |
| #define | CPUID_EDX_SSE 0x02000000u |
| #define | MXCSR_VALID 0x0000FFBFu |
| #define | FXSAVE_MXCSR_OFFSET 24 |
Functions | |
| void | arch_fpu_init_core (void) |
| turn on the FPU (and SSE) on the core that runs the call. | |
| void | arch_fpu_init (void) |
| turn on the FPU (and SSE) for user programs and make the clean state a new program starts with. | |
| void | arch_fpu_save (void *area) |
| save the CPU's FPU/SSE registers. | |
| void | arch_fpu_restore (const void *area) |
| load the FPU/SSE registers. | |
| void | arch_fpu_clean (void *area) |
| fill an area with the state of a fresh program. | |
| void | arch_fpu_sanitize (void *area) |
| make a state that came from user memory safe to load (a signal frame). | |
the FPU (x87) and SSE register state of user programs.
the kernel itself never uses these registers, so a user program's state stays in the CPU while it is in the kernel. the scheduler saves it when it switches away and loads the next program's state, every time (no lazy switching). FXSAVE/FXRSTOR keep the x87 and SSE registers in 512 bytes; a CPU without them uses FNSAVE/FRSTOR (108 bytes, no SSE).
| #define CR0_MP 0x00000002u |
| #define CR0_EM 0x00000004u |
| #define CR0_TS 0x00000008u |
| #define CR0_NE 0x00000020u |
| #define CR4_OSFXSR 0x00000200u |
| #define CR4_OSXMMEXCPT 0x00000400u |
| #define CPUID_EDX_FXSR 0x01000000u |
| #define CPUID_EDX_SSE 0x02000000u |
| #define MXCSR_VALID 0x0000FFBFu |
| #define FXSAVE_MXCSR_OFFSET 24 |
| void arch_fpu_init_core | ( | void | ) |
turn on the FPU (and SSE) on the core that runs the call.
arch_fpu_init() does it for the boot core; each other core calls this when it starts.
| void arch_fpu_init | ( | void | ) |
turn on the FPU (and SSE) for user programs and make the clean state a new program starts with.
call once at boot.
| void arch_fpu_save | ( | void * | area | ) |
save the CPU's FPU/SSE registers.
| area | ARCH_FPU_STATE_SIZE bytes, 16-byte aligned. |
| void arch_fpu_restore | ( | const void * | area | ) |
load the FPU/SSE registers.
| area | state saved by arch_fpu_save (or arch_fpu_clean). |
| void arch_fpu_clean | ( | void * | area | ) |
fill an area with the state of a fresh program.
| void arch_fpu_sanitize | ( | void * | area | ) |
make a state that came from user memory safe to load (a signal frame).