Turnstone Operating System
|
cpu commands which needs assembly codes. More...
#include <types.h>
Classes | |
struct | cpu_cpuid_regs_t |
cpuid command set/get registers. More... | |
Macros | |
#define | ___CPU_H 0 |
Typedefs | |
typedef struct cpu_cpuid_regs_t | cpu_cpuid_regs_t |
struct short hand | |
Functions | |
void | cpu_hlt (void) |
stops cpu. More... | |
void | cpu_idle (void) |
static boolean_t | cpu_cli (void) |
disables interrupts More... | |
static void | cpu_sti (void) |
enables interrupts More... | |
static void | cpu_nop (void) |
nop instruction More... | |
static void | cpu_cld (void) |
cld instruction More... | |
uint16_t | cpu_read_data_segment (void) |
reads data segment (ds) value from cpu. More... | |
int8_t | cpu_check_rdrand (void) |
checks rdrand supported More... | |
uint64_t | cpu_read_msr (uint32_t msr_address) |
read msr and return More... | |
int8_t | cpu_write_msr (uint32_t msr_address, uint64_t value) |
writes msr More... | |
uint64_t | cpu_read_cr2 (void) |
read cr2 and return More... | |
uint64_t | cpu_read_cr3 (void) |
read cr3 and return More... | |
uint8_t | cpu_cpuid (cpu_cpuid_regs_t query, cpu_cpuid_regs_t *answer) |
void | cpu_clear_segments (void) |
clears segments More... | |
static void | cpu_set_and_clear_stack (uint64_t stack_address) |
prepares stack More... | |
static void | cpu_tlb_invalidate (void *address) |
invalidates tlb for address More... | |
static void | cpu_tlb_flush (void) |
boolean_t | cpu_is_interrupt_enabled (void) |
uint64_t | cpu_read_fs_base (void) |
uint64_t | cpu_read_gs_base (void) |
cpu commands which needs assembly codes.
This work is licensed under TURNSTONE OS Public License. Please read and understand latest version of Licence.
#define ___CPU_H 0 |
prevent duplicate header error macro
int8_t cpu_check_rdrand | ( | void | ) |
checks rdrand supported
|
inlinestatic |
cld instruction
This command clears direction flag.
void cpu_clear_segments | ( | void | ) |
clears segments
sets segment registers to zero
|
inlinestatic |
disables interrupts
This command disables interrupts with cli assembly command.
void cpu_hlt | ( | void | ) |
stops cpu.
This command stops cpu using hlt assembly command inside for.
|
inlinestatic |
nop instruction
This command nops.
uint64_t cpu_read_cr2 | ( | void | ) |
read cr2 and return
returns cr2 value for page faults
uint64_t cpu_read_cr3 | ( | void | ) |
read cr3 and return
returns cr3 value for page tables
uint16_t cpu_read_data_segment | ( | void | ) |
reads data segment (ds) value from cpu.
This function is meaningful at real mode. At long mode is does nothing
read msr and return
[in] | msr_address | model Specific register address |
returns edx:eax as uint64_t
|
inlinestatic |
prepares stack
[in] | stack_address | stack top value |
sets esp and clears ebp
|
inlinestatic |
enables interrupts
This command enables interrupts with sti assembly command.
|
inlinestatic |
invalidates tlb for address
[in] | address | adddress to invalidate |
calls invlpg instruction