forked from mit-pdos/xv6-public
-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathmemlayout.h
More file actions
24 lines (18 loc) · 783 Bytes
/
memlayout.h
File metadata and controls
24 lines (18 loc) · 783 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Memory layout
#define EXTMEM 0x100000 // Start of extended memory
#define PHYSTOP 0xE000000 // Top physical memory
// Key addresses for address space layout (see kmap in vm.c for layout)
#define KERNBASE 0xFFFF800000000000 // First kernel virtual address
#define KERNLINK (KERNBASE+EXTMEM) // Address where kernel is linked
#ifndef __ASSEMBLER__
static inline addr_t v2p(void *a) {
return ((addr_t) (a)) - ((addr_t)KERNBASE);
}
static inline void *p2v(addr_t a) {
return (void *) ((a) + ((addr_t)KERNBASE));
}
#endif
#define V2P(a) (((addr_t) (a)) - KERNBASE)
#define P2V(a) (((void *) (a)) + KERNBASE)
#define V2P_WO(x) ((x) - KERNBASE) // same as V2P, but without casts
#define P2V_WO(x) ((x) + KERNBASE) // same as P2V, but without casts