MentOS
0.8.0
The Mentoring Operating System
|
Set of functions and flags used to manage processors registers. More...
Go to the source code of this file.
Macros | |
#define | CR0_PE 0x00000001u |
Protected mode Enable. | |
#define | CR0_MP 0x00000002u |
"Math" Present (e.g. npx), wait for it. | |
#define | CR0_EM 0x00000004u |
EMulate NPX, e.g. trap, don't execute code. | |
#define | CR0_TS 0x00000008u |
Process has done Task Switch, do NPX save. | |
#define | CR0_ET 0x00000010u |
32 bit (if set) vs 16 bit (387 vs 287). | |
#define | CR0_PG 0x80000000u |
Paging Enable. | |
#define | CR4_SEE 0x00008000u |
Secure Enclave Enable XXX. | |
#define | CR4_SMAP 0x00200000u |
Supervisor-Mode Access Protect. | |
#define | CR4_SMEP 0x00100000u |
Supervisor-Mode Execute Protect. | |
#define | CR4_OSXSAVE 0x00040000u |
OS supports XSAVE. | |
#define | CR4_PCIDE 0x00020000u |
PCID Enable. | |
#define | CR4_RDWRFSGS 0x00010000u |
RDWRFSGS Enable. | |
#define | CR4_SMXE 0x00004000u |
Enable SMX operation. | |
#define | CR4_VMXE 0x00002000u |
Enable VMX operation. | |
#define | CR4_OSXMM 0x00000400u |
SSE/SSE2 exception support in OS. | |
#define | CR4_OSFXS 0x00000200u |
SSE/SSE2 OS supports FXSave. | |
#define | CR4_PCE 0x00000100u |
Performance-Monitor Count Enable. | |
#define | CR4_PGE 0x00000080u |
Page Global Enable. | |
#define | CR4_MCE 0x00000040u |
Machine Check Exceptions. | |
#define | CR4_PAE 0x00000020u |
Physical Address Extensions. | |
#define | CR4_PSE 0x00000010u |
Page Size Extensions. | |
#define | CR4_DE 0x00000008u |
Debugging Extensions. | |
#define | CR4_TSD 0x00000004u |
Time Stamp Disable. | |
#define | CR4_PVI 0x00000002u |
Protected-mode Virtual Interrupts. | |
#define | CR4_VME 0x00000001u |
Virtual-8086 Mode Extensions. | |
Functions | |
static uint16_t | get_es (void) |
Reads the Extra Segment (DS). More... | |
static void | set_es (uint16_t es) |
Sets the Extra Segment (DS). More... | |
static uint16_t | get_ds (void) |
Reads the Data Segment (DS). More... | |
static void | set_ds (uint16_t ds) |
Sets the Data Segment (DS). More... | |
static uint16_t | get_fs (void) |
Reads FS. More... | |
static void | set_fs (uint16_t fs) |
Sets FS. More... | |
static uint16_t | get_gs (void) |
Reads GS. More... | |
static void | set_gs (uint16_t gs) |
Sets GS. More... | |
static uint16_t | get_ss (void) |
Reads the Stack Segment (SS). More... | |
static void | set_ss (uint16_t ss) |
Sets the Stack Segment (SS). More... | |
static uintptr_t | get_cr0 (void) |
Reads the current cr0 value. More... | |
static void | set_cr0 (uintptr_t cr0) |
Sets the cr0 value. More... | |
static uintptr_t | get_cr2 (void) |
Reads the current cr2 value. More... | |
static void | set_cr2 (uintptr_t cr2) |
Sets the cr2 value. More... | |
static uintptr_t | get_cr3 (void) |
Reads the current cr3 value. More... | |
static void | set_cr3 (uintptr_t cr3) |
Sets the cr3 value. More... | |
static uintptr_t | get_cr4 (void) |
Reads the current cr4 value. More... | |
static void | set_cr4 (uintptr_t cr4) |
Sets the cr4 value. More... | |
static uintptr_t | get_eflags (void) |
Reads entire contents of the EFLAGS register. More... | |
static void | clear_ts (void) |
Clears the task-switched (TS) flag in the CR0 register. | |
static unsigned short | get_tr (void) |
Reads the segment selector from the task register (TR). More... | |
static void | set_tr (unsigned short seg) |
Loads the source operand into the segment selector field of the task register. More... | |
static unsigned short | sldt (void) |
Reads the segment selector from the local descriptor table register (LDTR). More... | |
static void | lldt (unsigned short seg) |
Loads the source operand into the segment selector field of the local descriptor table register (LDTR). More... | |
static void | lgdt (uintptr_t *desc) |
Loads the values in the source operand into the global descriptor table register (GDTR) or the interrupt descriptor table register (IDTR). More... | |
static void | lidt (uintptr_t *desc) |
Loads the values in the source operand into the global descriptor table register (GDTR) or the interrupt descriptor table register (IDTR). More... | |
static void | sti (void) |
Set interrupt flag; external, maskable interrupts enabled at the end of the next instruction. | |
static void | cli (void) |
Clear interrupt flag; interrupts disabled when interrupt flag cleared. | |
static void | swapgs (void) |
Exchanges the current GS base register value with the value contained in MSR address C0000102H. | |
static void | hlt (void) |
Halts the CPU until the next external interrupt is fired. | |
static void | pause (void) |
Gives hint to processor that improves performance of spin-wait loops. | |
Set of functions and flags used to manage processors registers.
|
inlinestatic |
Reads the current cr0 value.
|
inlinestatic |
Reads the current cr2 value.
|
inlinestatic |
Reads the current cr3 value.
|
inlinestatic |
Reads the current cr4 value.
|
inlinestatic |
Reads the Data Segment (DS).
|
inlinestatic |
Reads entire contents of the EFLAGS register.
|
inlinestatic |
Reads the Extra Segment (DS).
|
inlinestatic |
Reads FS.
|
inlinestatic |
Reads GS.
|
inlinestatic |
Reads the Stack Segment (SS).
|
inlinestatic |
Reads the segment selector from the task register (TR).
|
inlinestatic |
Loads the values in the source operand into the global descriptor table register (GDTR) or the interrupt descriptor table register (IDTR).
desc | the value we need to load. |
|
inlinestatic |
Loads the values in the source operand into the global descriptor table register (GDTR) or the interrupt descriptor table register (IDTR).
desc | the value we need to load. |
|
inlinestatic |
Loads the source operand into the segment selector field of the local descriptor table register (LDTR).
seg | The segment selector we need to set. |
|
inlinestatic |
Sets the cr0 value.
cr0 | the value we want to set. |
|
inlinestatic |
Sets the cr2 value.
cr2 | the value we want to set. |
|
inlinestatic |
Sets the cr3 value.
cr3 | the value we want to set. |
|
inlinestatic |
Sets the cr4 value.
cr4 | the value we want to set. |
|
inlinestatic |
Sets the Data Segment (DS).
ds | the value we set. |
|
inlinestatic |
Sets the Extra Segment (DS).
es | the value we set. |
|
inlinestatic |
Sets FS.
fs | the value we set. |
|
inlinestatic |
Sets GS.
gs | the value we set. |
|
inlinestatic |
Sets the Stack Segment (SS).
ss | the value we set. |
|
inlinestatic |
Loads the source operand into the segment selector field of the task register.
seg | the segment selector we want to set. |
|
inlinestatic |
Reads the segment selector from the local descriptor table register (LDTR).