ArvernOS
Loading...
Searching...
No Matches
register.h File Reference
#include <stdint.h>
Include dependency graph for register.h:

Macros

#define IA32_EFER   0xC0000080
 
#define IA32_STAR   0xC0000081
 System Call Target Address.
 
#define IA32_LSTAR   0xC0000082
 IA-32e Mode System Call Target Address.
 
#define IA32_SFMASK   0xC0000084
 System Call Flag Mask.
 

Functions

uint64_t read_cr0 ()
 
uint64_t read_cr2 ()
 
uint64_t read_cr3 ()
 
uint64_t read_cr4 ()
 
void write_cr0 (uint64_t value)
 
void write_cr3 (uint64_t value)
 
void write_cr4 (uint64_t value)
 
uint64_t read_msr (uint64_t msr)
 
void write_msr (uint64_t msr, uint64_t value)
 
uint64_t read_rsp ()
 

Macro Definition Documentation

◆ IA32_EFER

#define IA32_EFER   0xC0000080

Function Documentation

◆ read_cr0()

uint64_t read_cr0 ( )

Returns the value of the CR0 register.

Returns
the address contained in the CR0 register

◆ read_cr2()

uint64_t read_cr2 ( )

Returns the value of the CR2 register.

Returns
the address contained in the CR2 register

◆ read_cr3()

uint64_t read_cr3 ( )

Returns the value of the CR3 register.

Returns
the address contained in the CR3 register

◆ read_cr4()

uint64_t read_cr4 ( )

Returns the value of the CR4 register.

Returns
the address contained in the CR4 register

◆ read_msr()

uint64_t read_msr ( uint64_t msr)

Read a Model Specific Register.

See also
https://wiki.osdev.org/Model_Specific_Registers
Returns
the value for the specified register

◆ read_rsp()

uint64_t read_rsp ( )

Returns the value of the RSP register (stack pointer).

Returns
the address contained in the RSP register

◆ write_cr0()

void write_cr0 ( uint64_t value)

Updates the value of the CR0 register.

Parameters
valuethe new value for the CR0 register

◆ write_cr3()

void write_cr3 ( uint64_t value)

Updates the value of the CR3 register.

Parameters
valuethe new value for the CR3 register

◆ write_cr4()

void write_cr4 ( uint64_t value)

Updates the value of the CR4 register.

Parameters
valuethe new value for the CR4 register

◆ write_msr()

void write_msr ( uint64_t msr,
uint64_t value )

Updates the value of the given Model Specific Register.

See also
https://wiki.osdev.org/Model_Specific_Registers
Parameters
msrthe model specific register number
valuethe new value