167d4254dSFrans Kaashoek // Memory layout 267d4254dSFrans Kaashoek 3c3dcf479SFrans Kaashoek #define EXTMEM 0x100000 // Start of extended memory 45f069dcfSFrans Kaashoek #define PHYSTOP 0xE000000 // Top physical memory (too hard to get from E820) 5c3dcf479SFrans Kaashoek #define DEVSPACE 0xFE000000 // Other devices are at high addresses 667d4254dSFrans Kaashoek 7a56c8d60SFrans Kaashoek // Key addresses for address space layout (see kmap in vm.c for the layout) 8*15997d58SRobert Morris #define KERNBASE 0x80000000 // First kernel virtual address 9c3dcf479SFrans Kaashoek #define KERNLINK (KERNBASE+EXTMEM) // Address where kernel is linked 1067d4254dSFrans Kaashoek 1167d4254dSFrans Kaashoek #ifndef __ASSEMBLER__ 1267d4254dSFrans Kaashoek 1367d4254dSFrans Kaashoek static inline uint v2p(void *a) { return (uint) a - KERNBASE; } 1467d4254dSFrans Kaashoek static inline void *p2v(uint a) { return (void *) a + KERNBASE; } 1567d4254dSFrans Kaashoek 1667d4254dSFrans Kaashoek #endif 1767d4254dSFrans Kaashoek 1867d4254dSFrans Kaashoek #define V2P(a) ((uint) a - KERNBASE) 1967d4254dSFrans Kaashoek #define P2V(a) ((void *) a + KERNBASE) 2067d4254dSFrans Kaashoek 21a56c8d60SFrans Kaashoek #define V2P_WO(x) ((x) - KERNBASE) // same as V2P, but without casts 22a56c8d60SFrans Kaashoek #define P2V_WO(x) ((x) + KERNBASE) // same as V2P, but without casts 23