memlayout.h 1.1 KB

123456789101112131415161718192021222324252627
  1. // Memory layout
  2. #define EXTMEM 0x8000 /* start of kernel code */
  3. #define PHYSTOP 0x8000000 /* assuming 128M RAM; need a fix to find the true RAM size */
  4. #define DEVSPACE 0xFE000000 /* i/o registers */
  5. // Key addresses for address space layout (see kmap in vm.c for layout)
  6. #define KERNBASE 0x80000000 // First kernel virtual address
  7. #define KERNLINK (KERNBASE+EXTMEM) // Address where kernel is linked
  8. #define USERBOUND 0x40000000 // maximum user space due to one page pgd
  9. #define MACHADDR (KERNBASE+0x2000)
  10. #define PA_START 0x0
  11. #define PHYSIO 0x20000000
  12. #define RAMSIZE (128*MByte)
  13. #define IOSIZE (16*MByte)
  14. #define TVSIZE 0x1000
  15. static inline uint v2p(void *a) { return ((uint) (a)) - KERNBASE; }
  16. static inline void *p2v(uint a) { return (void *) ((a) + KERNBASE); }
  17. #define V2P(a) (((uint) (a)) - KERNBASE)
  18. #define P2V(a) (((void *) (a)) + KERNBASE)
  19. #define V2P_WO(x) ((x) - KERNBASE) // same as V2P, but without casts
  20. #define P2V_WO(x) ((x) + KERNBASE) // same as V2P, but without casts