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

Go to the source code of this file.

Macros

#define EXTRACT_FIELD(val, which)   (((val) & (which)) / ((which) & ~((which)-1)))
 
#define INSERT_FIELD(val, which, fieldval)   (((val) & ~(which)) | ((fieldval) * ((which) & ~((which)-1))))
 
#define DEFINE_MPRV_READ_FLAGS(name, type, insn, flags)
 
#define DEFINE_MPRV_READ(name, type, insn)    DEFINE_MPRV_READ_FLAGS(name, type, insn, MSTATUS_MPRV)
 
#define DEFINE_MPRV_READ_MXR(name, type, insn)    DEFINE_MPRV_READ_FLAGS(name, type, insn, MSTATUS_MPRV | MSTATUS_MXR)
 
#define DEFINE_MPRV_WRITE(name, type, insn)
 

Functions

void mstatus_init (void)
 

Macro Definition Documentation

◆ DEFINE_MPRV_READ

#define DEFINE_MPRV_READ (   name,
  type,
  insn 
)     DEFINE_MPRV_READ_FLAGS(name, type, insn, MSTATUS_MPRV)

Definition at line 30 of file vm.h.

◆ DEFINE_MPRV_READ_FLAGS

#define DEFINE_MPRV_READ_FLAGS (   name,
  type,
  insn,
  flags 
)
Value:
static inline type name(type *p); \
static inline type name(type *p) \
{ \
size_t mprv = flags; \
type value; \
asm ( \
"csrs mstatus, %1\n" \
STRINGIFY(insn) " %0, 0(%2)\n" \
"csrc mstatus, %1\n" \
: "=&r"(value) : "r"(mprv), "r"(p) : "memory" \
); \
return value; \
}
pte_t value
Definition: mmu.c:91
const char * name
Definition: mmu.c:92
#define STRINGIFY(x)
Definition: helpers.h:132
unsigned int type
Definition: edid.c:57

Definition at line 15 of file vm.h.

◆ DEFINE_MPRV_READ_MXR

#define DEFINE_MPRV_READ_MXR (   name,
  type,
  insn 
)     DEFINE_MPRV_READ_FLAGS(name, type, insn, MSTATUS_MPRV | MSTATUS_MXR)

Definition at line 33 of file vm.h.

◆ DEFINE_MPRV_WRITE

#define DEFINE_MPRV_WRITE (   name,
  type,
  insn 
)
Value:
static inline void name(type *p, type value); \
static inline void name(type *p, type value) \
{ \
size_t mprv = MSTATUS_MPRV; \
asm ( \
"csrs mstatus, %0\n" \
STRINGIFY(insn) " %1, 0(%2)\n" \
"csrc mstatus, %0\n" \
:: "r"(mprv), "r"(value), "r"(p) : "memory" \
); \
}
#define MSTATUS_MPRV
Definition: encoding.h:19

Definition at line 36 of file vm.h.

◆ EXTRACT_FIELD

#define EXTRACT_FIELD (   val,
  which 
)    (((val) & (which)) / ((which) & ~((which)-1)))

Definition at line 10 of file vm.h.

◆ INSERT_FIELD

#define INSERT_FIELD (   val,
  which,
  fieldval 
)    (((val) & ~(which)) | ((fieldval) * ((which) & ~((which)-1))))

Definition at line 11 of file vm.h.

Function Documentation

◆ mstatus_init()

void mstatus_init ( void  )

Definition at line 29 of file virtual_memory.c.

References delegate, MIP_MTIP, MIP_SSIP, MIP_STIP, and supports_extension().

Here is the call graph for this function: