coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
cr.h File Reference
#include <stdint.h>
Include dependency graph for cr.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define COMPILER_BARRIER   "memory"
 
#define CRx_TYPE   uint32_t
 
#define CRx_IN   "r"
 
#define CRx_RET   "=r"
 
#define CR0_PE   (1 << 0)
 
#define CR0_MP   (1 << 1)
 
#define CR0_EM   (1 << 2)
 
#define CR0_TS   (1 << 3)
 
#define CR0_ET   (1 << 4)
 
#define CR0_NE   (1 << 5)
 
#define CR0_WP   (1 << 16)
 
#define CR0_AM   (1 << 18)
 
#define CR0_NW   (1 << 29)
 
#define CR0_CD   (1 << 30)
 
#define CR0_PG   (1 << 31)
 
#define CR4_VME   (1 << 0)
 
#define CR4_PVI   (1 << 1)
 
#define CR4_TSD   (1 << 2)
 
#define CR4_DE   (1 << 3)
 
#define CR4_PSE   (1 << 4)
 
#define CR4_PAE   (1 << 5)
 
#define CR4_MCE   (1 << 6)
 
#define CR4_PGE   (1 << 7)
 
#define CR4_PCE   (1 << 8)
 
#define CR4_OSFXSR   (1 << 9)
 
#define CR4_OSXMMEXCPT   (1 << 10)
 
#define CR4_VMXE   (1 << 13)
 
#define CR4_SMXE   (1 << 14)
 
#define CR4_FSGSBASE   (1 << 16)
 
#define CR4_PCIDE   (1 << 17)
 
#define CR4_OSXSAVE   (1 << 18)
 
#define CR4_SMEP   (1 << 20)
 

Functions

static __always_inline CRx_TYPE read_cr0 (void)
 
static __always_inline void write_cr0 (CRx_TYPE data)
 
static __always_inline CRx_TYPE read_cr2 (void)
 
static __always_inline CRx_TYPE read_cr3 (void)
 
static __always_inline void write_cr3 (CRx_TYPE data)
 
static __always_inline CRx_TYPE read_cr4 (void)
 
static __always_inline void write_cr4 (CRx_TYPE data)
 

Macro Definition Documentation

◆ COMPILER_BARRIER

#define COMPILER_BARRIER   "memory"

Definition at line 10 of file cr.h.

◆ CR0_AM

#define CR0_AM   (1 << 18)

Definition at line 108 of file cr.h.

◆ CR0_CD

#define CR0_CD   (1 << 30)

Definition at line 110 of file cr.h.

◆ CR0_EM

#define CR0_EM   (1 << 2)

Definition at line 103 of file cr.h.

◆ CR0_ET

#define CR0_ET   (1 << 4)

Definition at line 105 of file cr.h.

◆ CR0_MP

#define CR0_MP   (1 << 1)

Definition at line 102 of file cr.h.

◆ CR0_NE

#define CR0_NE   (1 << 5)

Definition at line 106 of file cr.h.

◆ CR0_NW

#define CR0_NW   (1 << 29)

Definition at line 109 of file cr.h.

◆ CR0_PE

#define CR0_PE   (1 << 0)

Definition at line 101 of file cr.h.

◆ CR0_PG

#define CR0_PG   (1 << 31)

Definition at line 111 of file cr.h.

◆ CR0_TS

#define CR0_TS   (1 << 3)

Definition at line 104 of file cr.h.

◆ CR0_WP

#define CR0_WP   (1 << 16)

Definition at line 107 of file cr.h.

◆ CR4_DE

#define CR4_DE   (1 << 3)

Definition at line 117 of file cr.h.

◆ CR4_FSGSBASE

#define CR4_FSGSBASE   (1 << 16)

Definition at line 127 of file cr.h.

◆ CR4_MCE

#define CR4_MCE   (1 << 6)

Definition at line 120 of file cr.h.

◆ CR4_OSFXSR

#define CR4_OSFXSR   (1 << 9)

Definition at line 123 of file cr.h.

◆ CR4_OSXMMEXCPT

#define CR4_OSXMMEXCPT   (1 << 10)

Definition at line 124 of file cr.h.

◆ CR4_OSXSAVE

#define CR4_OSXSAVE   (1 << 18)

Definition at line 129 of file cr.h.

◆ CR4_PAE

#define CR4_PAE   (1 << 5)

Definition at line 119 of file cr.h.

◆ CR4_PCE

#define CR4_PCE   (1 << 8)

Definition at line 122 of file cr.h.

◆ CR4_PCIDE

#define CR4_PCIDE   (1 << 17)

Definition at line 128 of file cr.h.

◆ CR4_PGE

#define CR4_PGE   (1 << 7)

Definition at line 121 of file cr.h.

◆ CR4_PSE

#define CR4_PSE   (1 << 4)

Definition at line 118 of file cr.h.

◆ CR4_PVI

#define CR4_PVI   (1 << 1)

Definition at line 115 of file cr.h.

◆ CR4_SMEP

#define CR4_SMEP   (1 << 20)

Definition at line 130 of file cr.h.

◆ CR4_SMXE

#define CR4_SMXE   (1 << 14)

Definition at line 126 of file cr.h.

◆ CR4_TSD

#define CR4_TSD   (1 << 2)

Definition at line 116 of file cr.h.

◆ CR4_VME

#define CR4_VME   (1 << 0)

Definition at line 114 of file cr.h.

◆ CR4_VMXE

#define CR4_VMXE   (1 << 13)

Definition at line 125 of file cr.h.

◆ CRx_IN

#define CRx_IN   "r"

Definition at line 18 of file cr.h.

◆ CRx_RET

#define CRx_RET   "=r"

Definition at line 19 of file cr.h.

◆ CRx_TYPE

#define CRx_TYPE   uint32_t

Definition at line 17 of file cr.h.

Function Documentation

◆ read_cr0()

static __always_inline CRx_TYPE read_cr0 ( void  )
static

Definition at line 21 of file cr.h.

References COMPILER_BARRIER, CRx_RET, CRx_TYPE, and value.

Referenced by disable_cache(), enable_cache(), paging_disable_pae(), paging_enable_pae(), paging_is_enabled(), and reg_cpu_cr_read().

Here is the caller graph for this function:

◆ read_cr2()

static __always_inline CRx_TYPE read_cr2 ( void  )
static

Definition at line 43 of file cr.h.

References COMPILER_BARRIER, CRx_RET, CRx_TYPE, and value.

Referenced by x86_exception().

Here is the caller graph for this function:

◆ read_cr3()

static __always_inline CRx_TYPE read_cr3 ( void  )
static

Definition at line 55 of file cr.h.

References COMPILER_BARRIER, CRx_RET, CRx_TYPE, and value.

Referenced by get_pdpt_addr().

Here is the caller graph for this function:

◆ read_cr4()

◆ write_cr0()

static __always_inline void write_cr0 ( CRx_TYPE  data)
static

Definition at line 33 of file cr.h.

References COMPILER_BARRIER, and CRx_IN.

Referenced by disable_cache(), enable_cache(), paging_disable_pae(), paging_enable_pae(), and reg_cpu_cr_write().

Here is the caller graph for this function:

◆ write_cr3()

static __always_inline void write_cr3 ( CRx_TYPE  data)
static

Definition at line 67 of file cr.h.

References COMPILER_BARRIER, and CRx_IN.

Referenced by paging_enable_pae_cr3().

Here is the caller graph for this function:

◆ write_cr4()

static __always_inline void write_cr4 ( CRx_TYPE  data)
static