Skip to content

mmu_map_page writes page tables through their physical address, but only the first 4 MB are identity-mapped #110

Description

@kudasaixc

mmu_init() identity-maps only 0x0-0x400000. But mmu_init() and mmu_map_page() access the page directory / page tables via @ptrFromInt(<physical address>). This only works while pmm_alloc_frame() happens to return frames below 4 MB.

Once low memory fills up (heap growth) and a new page table gets a frame >= 0x400000, the @memset on the new table touches unmapped virtual memory and page-faults inside the mapping code itself -- with paging enabled this ends in a double fault and a dead machine.

Possible directions:

  • identity-map all detected RAM at init,
  • keep a dedicated low-memory pool for paging structures, or
  • a recursive page directory mapping.

Can send a PR once a direction is picked.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions