phys.h 1.2 KB

1234567891011121314151617181920212223242526
  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. /* Highmem: RAM in [MM_MAX_PHYS, MM_HIGH_LIMIT) is tracked by the frame
  18. * allocator but never identity-mapped; it only backs ring-3 pages, which
  19. * the kernel reaches through the owning process's mapping or kmap().
  20. * RAM above 4 GB would need PAE. */
  21. #define MM_HIGH_LIMIT 0x100000000ull
  22. #endif