phys.h 1.4 KB

123456789101112131415161718192021222324252627282930
  1. /* Physical address limits shared by the 32-bit kernel and the UEFI loader. */
  2. #ifndef PHYS_H
  3. #define PHYS_H
  4. /* Lowmem: the kernel identity-maps [0, MM_MAX_PHYS) with 4 MB pages and
  5. * dereferences physical addresses there directly. Ring-3 address space
  6. * starts at USER_BASE (0x40000000), so lowmem ends at 1 GB. Everything the
  7. * kernel touches through a physical pointer (page tables, DMA buffers,
  8. * canvases, kernel stacks, kmalloc) must be lowmem. */
  9. #define MM_MAX_PHYS 0x40000000u
  10. /* The kmap window: one 4 MB page-directory slot in the unused gap between
  11. * the ring-3 program/stack window and USER_WIN_BASE (0x50000000). Its
  12. * supervisor page table holds per-CPU temporary mappings of arbitrary frames
  13. * and is shared by every process directory. Not the last lowmem slot
  14. * (firmware puts the ACPI tables at the top of RAM) and not the top of the
  15. * address space (a VBE LFB may sit at 0xFF000000). */
  16. #define MM_KMAP_VA 0x4FC00000u
  17. /* The ioremap window: kernel-only virtual space for MMIO, firmware tables
  18. * and the LFB above lowmem. Ring-3 space may use [USER_BASE, IOMAP_BASE). */
  19. #define IOMAP_BASE 0xC0000000u
  20. /* Highmem: RAM in [MM_MAX_PHYS, MM_HIGH_LIMIT) is tracked by the frame
  21. * allocator but never identity-mapped; it only backs ring-3 pages, which
  22. * the kernel reaches through the owning process's mapping or kmap().
  23. * RAM above 4 GB would need PAE. */
  24. #define MM_HIGH_LIMIT 0x100000000ull
  25. #endif