* same with xv6
[mascara-docs.git] / i386 / MIT / src.xv6 / memlayout.h
blob6a62cd73123695f86c4d769047d3ed3f9128baa2
1 // Memory layout
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
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
11 #ifndef __ASSEMBLER__
13 static inline uint v2p(void *a) { return ((uint) (a)) - KERNBASE; }
14 static inline void *p2v(uint a) { return (void *) ((a) + KERNBASE); }
16 #endif
18 #define V2P(a) (((uint) (a)) - KERNBASE)
19 #define P2V(a) (((void *) (a)) + KERNBASE)
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