MOS Source Code
Loading...
Searching...
No Matches
cpu.h File Reference
#include <cpuid.h>
#include <mos/types.h>
+ Include dependency graph for cpu.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define x86_cpuid(return_reg, leaf, subleaf)
 
#define x86_cpu_get_crx(x)
 
#define x86_cpu_set_crx(x, val)
 
#define x86_cpu_get_cr0()
 
#define x86_cpu_get_cr2()
 
#define x86_cpu_get_cr3()
 
#define x86_cpu_get_cr4()
 
#define x86_cpu_set_cr0(val)
 
#define x86_cpu_set_cr3(val)
 
#define x86_cpu_set_cr4(val)
 

Functions

should_inline u64 cpu_rdmsr (u32 msr)
 
should_inline void cpu_wrmsr (u32 msr, u64 val)
 
should_inline void x86_cpu_halt (void)
 
should_inline void x86_cpu_invlpg (ptr_t addr)
 
should_inline void x86_cpu_invlpg_all (void)
 
void x86_cpu_initialise_caps (void)
 
void x86_cpu_setup_xsave_area (void)
 

Macro Definition Documentation

◆ x86_cpuid

#define x86_cpuid ( return_reg,
leaf,
subleaf )
Value:
__extension__({ \
reg32_t a = 0, b = 0, c = 0, d = 0; \
__get_cpuid_count(leaf, subleaf, &a, &b, &c, &d); \
return_reg; \
})
u32 reg32_t
Definition types.h:53

Definition at line 28 of file cpu.h.

Referenced by platform_current_cpu_id().

◆ x86_cpu_get_crx

#define x86_cpu_get_crx ( x)
Value:
__extension__({ reg_t crx; __asm__ volatile("mov %%cr" #x ", %0" : "=r"(crx)); crx; })
uintn reg_t
Definition types.h:51

Definition at line 36 of file cpu.h.

◆ x86_cpu_set_crx

#define x86_cpu_set_crx ( x,
val )
Value:
__asm__ volatile("mov %0, %%cr" #x : : "r"(val) : "memory")

Definition at line 37 of file cpu.h.

◆ x86_cpu_get_cr0

#define x86_cpu_get_cr0 ( )
Value:
#define x86_cpu_get_crx(x)
Definition cpu.h:36

Definition at line 40 of file cpu.h.

Referenced by x86_cpu_setup_xsave_area().

◆ x86_cpu_get_cr2

#define x86_cpu_get_cr2 ( )
Value:

Definition at line 41 of file cpu.h.

Referenced by x86_handle_exception().

◆ x86_cpu_get_cr3

#define x86_cpu_get_cr3 ( )
Value:

Definition at line 42 of file cpu.h.

◆ x86_cpu_get_cr4

#define x86_cpu_get_cr4 ( )
Value:

Definition at line 43 of file cpu.h.

Referenced by x86_cpu_initialise_caps(), and x86_cpu_setup_xsave_area().

◆ x86_cpu_set_cr0

#define x86_cpu_set_cr0 ( val)
Value:
#define x86_cpu_set_crx(x, val)
Definition cpu.h:37

Definition at line 45 of file cpu.h.

Referenced by x86_cpu_setup_xsave_area().

◆ x86_cpu_set_cr3

#define x86_cpu_set_cr3 ( val)
Value:

Definition at line 46 of file cpu.h.

Referenced by platform_switch_mm().

◆ x86_cpu_set_cr4

#define x86_cpu_set_cr4 ( val)
Value:

Definition at line 47 of file cpu.h.

Referenced by x86_cpu_initialise_caps(), and x86_cpu_setup_xsave_area().

Function Documentation

◆ cpu_rdmsr()

should_inline u64 cpu_rdmsr ( u32 msr)

Definition at line 8 of file cpu.h.

◆ cpu_wrmsr()

should_inline void cpu_wrmsr ( u32 msr,
u64 val )

Definition at line 15 of file cpu.h.

◆ x86_cpu_halt()

should_inline void x86_cpu_halt ( void )

Definition at line 22 of file cpu.h.

Referenced by platform_halt_cpu(), and platform_shutdown().

◆ x86_cpu_invlpg()

should_inline void x86_cpu_invlpg ( ptr_t addr)

Definition at line 49 of file cpu.h.

Referenced by platform_invalidate_tlb().

◆ x86_cpu_invlpg_all()

should_inline void x86_cpu_invlpg_all ( void )

Definition at line 54 of file cpu.h.

Referenced by platform_invalidate_tlb().

◆ x86_cpu_initialise_caps()

void x86_cpu_initialise_caps ( void )

Definition at line 20 of file cpu.c.

Referenced by platform_ap_entry(), and platform_startup_early().

◆ x86_cpu_setup_xsave_area()

void x86_cpu_setup_xsave_area ( void )

Definition at line 37 of file cpu.c.

Referenced by platform_ap_entry(), and platform_startup_early().