CS318 - Pintos
Pintos source browser for JHU CS318 course
|
Go to the documentation of this file. 1 #ifndef THREADS_VADDR_H
2 #define THREADS_VADDR_H
15 #define BITMASK(SHIFT, CNT) (((1ul << (CNT)) - 1) << (SHIFT))
20 #define PGSIZE (1 << PGBITS)
21 #define PGMASK BITMASK(PGSHIFT, PGBITS)
24 static inline unsigned pg_ofs (
const void *va) {
53 #define PHYS_BASE ((void *) LOADER_PHYS_BASE)
#define PHYS_BASE
Base address of the 1:1 physical-to-virtual mapping.
static uintptr_t vtop(const void *vaddr)
Returns physical address at which kernel virtual address VADDR is mapped.
static void * pg_round_up(const void *va)
Round up to nearest page boundary.
static void * pg_round_down(const void *va)
Round down to nearest page boundary.
static void * ptov(uintptr_t paddr)
Returns kernel virtual address at which physical address PADDR is mapped.
#define PGMASK
Page offset bits (0:12).
#define PGSIZE
Bytes in a page.
#define PGBITS
Number of offset bits.
#define ASSERT(CONDITION)
This is outside the header guard so that debug.h may be included multiple times with different settin...
static bool is_kernel_vaddr(const void *vaddr)
Returns true if VADDR is a kernel virtual address.
static bool is_user_vaddr(const void *vaddr)
Returns true if VADDR is a user virtual address.
static unsigned pg_ofs(const void *va)
Offset within a page.
static uintptr_t pg_no(const void *va)
Virtual page number.