Skip to content
Snippets Groups Projects
memlayout.h 844 B
Newer Older
Frans Kaashoek's avatar
Frans Kaashoek committed
// Memory layout

Frans Kaashoek's avatar
Frans Kaashoek committed
#define EXTMEM  0x100000            // Start of extended memory
#define PHYSTOP 0xE000000           // Top physical memory (too hard to get from E820)
Frans Kaashoek's avatar
Frans Kaashoek committed
#define DEVSPACE 0xFE000000         // Other devices are at high addresses
Frans Kaashoek's avatar
Frans Kaashoek committed

// Key addresses for address space layout (see kmap in vm.c for the layout)
Frans Kaashoek's avatar
Frans Kaashoek committed
#define KERNBASE 0xF0000000         // First kernel virtual address
#define KERNLINK (KERNBASE+EXTMEM)  // Address where kernel is linked
Frans Kaashoek's avatar
Frans Kaashoek committed

#ifndef __ASSEMBLER__

static inline uint v2p(void *a) { return (uint) a  - KERNBASE; }
static inline void *p2v(uint a) { return (void *) a + KERNBASE; }

#endif

#define V2P(a) ((uint) 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 V2P, but without casts