Expand description
The page-memory manager model of MOS. Core functions are provided here.
Structs§
- The only page data needed to maintain.
Constants§
- The page size is 4 KB.
Statics§
- Current env’s page directary address.
- The kernel heap start. Used by the buddy system.
- The the count of all the pages available.
- The kernel array for all pages.
- The list of free pages.
Functions§
- alloc 🔒Alloc needed memorys in kernel mode. Only use it before the page-manager is ready to use.
- Calculate the NPAGE and validate it.
- Alloc memories needed for the PAGES and reserve 512 * 4KB spaces for the buddy system to alloc.
- Alloc a page. Return the page’s address or an error if no free pages available.
- Decrease the page’s
pp_ref. If all reference is removed, the page will be freed. - Free a page. The
pp_refshall be zero before freeing it. - Init all the pages. Mark the pages below the
freememas used. - Map the physical
pageto the virtual addressva. The permission bits will be set toperm | PTE_C_CACHEABLE | PTE_V. - Look up the Page that virtual address
vamap to. Return the page and the page table entry together if the page is found and is valid. - Unmap the physical page at virtual address
va. - Walk the current page table to find the virtual address
va’s page table entry (Pte).
Type Aliases§
- Page list, for the ‘free_list’. See Also: PAGE_FREE_LIST.
- Node in the page list.
- The page directory entry type alias.
- The page table entry type alias.