memlayout.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /*****************************************************************
  2. * memlayout.h
  3. * by Zhiyi Huang, [email protected]
  4. * University of Otago
  5. *
  6. ********************************************************************/
  7. // Memory layout
  8. #define EXTMEM 0x8000 /* start of kernel code */
  9. #define PHYSTOP 0xC000000 /* assuming 128M RAM; need a fix to find the true RAM size */
  10. #define DEVSPACE 0xFE000000 /* i/o registers */
  11. // Key addresses for address space layout (see kmap in vm.c for layout)
  12. #define KERNBASE 0x80000000 // First kernel virtual address
  13. #define KERNLINK (KERNBASE+EXTMEM) // Address where kernel is linked
  14. #define USERBOUND 0x40000000 // maximum user space due to one page pgd
  15. #define GPUMEMBASE 0x40000000
  16. #define GPUMEMSIZE (1024*MBYTE)
  17. #define PA_START 0x0
  18. #define PHYSIO 0x20000000
  19. #define RAMSIZE 0xC000000
  20. #define IOSIZE (16*MBYTE)
  21. #define TVSIZE 0x1000
  22. static inline uint v2p(void *a) { return ((uint) (a)) - KERNBASE; }
  23. static inline void *p2v(uint a) { return (void *) ((a) + KERNBASE); }
  24. #define V2P(a) (((uint) (a)) - KERNBASE)
  25. #define P2V(a) (((void *) (a)) + KERNBASE)
  26. #define V2P_WO(x) ((x) - KERNBASE) // same as V2P, but without casts
  27. #define P2V_WO(x) ((x) + KERNBASE) // same as V2P, but without casts