memlayout.h (1128B)
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 #if X64 9 #define KERNBASE 0xFFFFFFFF80000000 // First kernel virtual address 10 #define DEVBASE 0xFFFFFFFF40000000 // First device virtual address 11 #else 12 #define KERNBASE 0x80000000 // First kernel virtual address 13 #define DEVBASE 0xFE000000 // First device virtual address 14 #endif 15 #define KERNLINK (KERNBASE+EXTMEM) // Address where kernel is linked 16 17 #ifndef __ASSEMBLER__ 18 19 static inline uintp v2p(void *a) { return ((uintp) (a)) - ((uintp)KERNBASE); } 20 static inline void *p2v(uintp a) { return (void *) ((a) + ((uintp)KERNBASE)); } 21 22 #endif 23 24 #define V2P(a) (((uintp) (a)) - KERNBASE) 25 #define P2V(a) (((void *) (a)) + KERNBASE) 26 #define IO2V(a) (((void *) (a)) + DEVBASE - DEVSPACE) 27 28 #define V2P_WO(x) ((x) - KERNBASE) // same as V2P, but without casts 29 #define P2V_WO(x) ((x) + KERNBASE) // same as V2P, but without casts