root/memlayout.h
/* [<][>][^][v][top][bottom][index][help] */
DEFINITIONS
This source file includes following definitions.
- v2p
- p2v
1 // Memory layout
2
3 #define EXTMEM 0x100000 // Start of extended memory
4 #define PHYSTOP 0xE000000 // Top physical memory
5 #define DEVSPACE 0xFE000000 // Other devices are at high addresses
6
7 // Key addresses for address space layout (see kmap in vm.c for layout)
8 #define KERNBASE 0x80000000 // First kernel virtual address
9 #define KERNLINK (KERNBASE+EXTMEM) // Address where kernel is linked
10
11 #ifndef __ASSEMBLER__
12
13 static inline uint v2p(void *a) { return ((uint) (a)) - KERNBASE; }
14 static inline void *p2v(uint a) { return (void *) ((a) + KERNBASE); }
15
16 #endif
17
18 #define V2P(a) (((uint) (a)) - KERNBASE)
19 #define P2V(a) (((void *) (a)) + KERNBASE)
20
21 #define V2P_WO(x) ((x) - KERNBASE) // same as V2P, but without casts
22 #define P2V_WO(x) ((x) + KERNBASE) // same as V2P, but without casts