#include <pagealloc.h>
Collaboration diagram for Page_allocator:

Public Member Functions | |
| void | init (void *start, Size memory_size, unsigned max_alignment, void *metadata_end=NULL, bool managed_pages_are_physical=false) |
| Page * | alloc_page_within (unsigned alignment, void *owner, unsigned begin, unsigned end) |
| Page * | alloc_page_above (unsigned alignment, void *owner, unsigned begin) |
| Page * | alloc_page_below (unsigned alignment, void *owner, unsigned end) |
| Page * | alloc_page (unsigned alignment, void *owner) |
| void | free_page (Page *page) |
| Page * | get_page_info (void *memory) const |
| void * | get_metadata_start () |
| void * | get_max_metadata_start () |
| bool | manages (void *memory) |
| void | print () |
Protected Member Functions | |
| Page * | find_free_page (unsigned alignment, unsigned begin, unsigned end) |
| Page * | try_to_split_page (unsigned requested_alignment, unsigned begin, unsigned end) |
| Page * | split_page (Page *page, unsigned requested_alignment, unsigned begin, unsigned end) |
| Page * | try_to_coalesce_page (unsigned requested_alignment, unsigned begin, unsigned end) |
| Page * | coalesce_page (Page *page, unsigned requested_alignment, unsigned begin, unsigned end) |
Protected Attributes | |
| unsigned | memory_begin |
| unsigned | memory_end |
| Page * | pages |
| unsigned | page_count |
| unsigned | free_list_count |
| List< Page > * | free_lists |
It can be used to manage either virtual or physical pages.
The original page allocator was generously contributed by Lee Salzman.
|
||||||||||||
|
Allocate a page.
|
|
||||||||||||||||
|
Allocate a page greater than or equal to an address. begin is a page address shifted right by PAGE_ALIGNMENT. |
|
||||||||||||||||
|
Allocate a page less than an address. end is a page address shifted right by PAGE_ALIGNMENT. |
|
||||||||||||||||||||
|
Allocate a page within an address range. The range values are page addresses shifted right by PAGE_ALIGNMENT. |
|
||||||||||||||||||||
|
Coalesce a page to a desired alignment so that it is within the given begin and end range. The range values are page addresses shifted right by PAGE_ALIGNMENT. |
|
||||||||||||||||
|
Attempt to find and allocate a free page in one of the free lists. The range values are page addresses shifted right by PAGE_ALIGNMENT. |
|
|
Return a page to the allocator.
|
|
|
Return the start address of this allocator's metadata as if it managed the maximum number of pages allowed by this architecture.
|
|
|
Return the start address of this allocator's metadata.
|
|
|
Get the page metadata for a given page address.
|
|
||||||||||||||||||||||||
|
Initialize this allocator to manage pages from the given memory start address to start + memory_size. Page spans can be at most of max_alignment. Put allocator metadata in a contiguous range of memory ending at metadata_end or at the end of the managed memory range if metadata_end is NULL. |
|
|
Return whether this page allocator manages the given page.
|
|
|
Print out basic info on this allocator.
|
|
||||||||||||||||||||
|
Split a page to a desired alignment so that it is within the given begin and end range. The range values are page addresses shifted right by PAGE_ALIGNMENT. |
|
||||||||||||||||
|
Attempt to find a candidate for coalescing pages and if found, do it within the given begin and end range. The range values are page addresses shifted right by PAGE_ALIGNMENT. |
|
||||||||||||||||
|
Attempt to find a candidate for splitting pages and if found, do a split within the given begin and end range. The range values are page addresses shifted right by PAGE_ALIGNMENT. |
|
|
number of free lists maintained
|
|
|
array of free page lists for alignments 0 to free_lists_count - 1
|
|
|
address of first managed page, shifted right by PAGE_ALIGNMENT
|
|
|
address of last managed page, shifted right by PAGE_ALIGNMENT
|
|
|
number of managed pages
|
|
|
array of Pages this manages
|
Torsion Operating System, Copyright (C) 2000-2004 Dan Helfman