#include <physmem.h>
Collaboration diagram for Physical_memory:

Public Member Functions | |
| Size | get_mem_size () const |
| void | init () |
| void | enable_allocator (unsigned &last_available_address) |
| void * | alloc_page (Memory_class mem_class=MEM_CLASS_ABOVE_16MB, Size request_size=PAGE_SIZE) |
| void | free_page (void *page) |
| void * | resize (void *page, Memory_class mem_class, Size new_size) |
| void * | get_allocator_metadata_start () |
| void * | get_allocator_max_metadata_start () |
| void | unit_test () |
| void | print () |
Public Attributes | |
| Page_allocator | page_allocator |
Protected Member Functions | |
| void | calc_memory_size () |
Protected Attributes | |
| Size | mem_size |
| unsigned char * | page_after_kernel |
| bool | allocator_enabled |
|
||||||||||||
|
Allocate a page span of the given alignment. Look for a page in the given memory class, and keep trying successive lower classes until one is found. If the allocator is not yet enabled, then single "allocated" pages are put right after the kernel in memory and page_after_kernel is incremented accordingly. request_size is the number of bytes to allocate, which will be rounded up to a whole page amount. |
|
|
Calculate how much physical memory is available on the system and store it in mem_size.
|
|
|
Enable the physical memory page allocator.
|
|
|
Free the given page. Note that pages "allocated" before the allocator is enabled cannot be freed. |
|
|
Return the start address of the allocator's metadata as if it managed the maximum number of pages allowed by this architecture.
|
|
|
Return the start address of the allocator's metadata.
|
|
|
Return physical system memory size in bytes.
|
|
|
Initialize the physical memory manager.
|
|
|
Print out information on physical memory.
|
|
||||||||||||||||
|
Resize the existing allocated page to a new size.
|
|
|
Perform some basic tests to make sure this works as it should.
|
|
|
is real page allocator enabled?
|
|
|
size of system memory in bytes
|
|
|
page immediately after kernel
|
|
|
|
Torsion Operating System, Copyright (C) 2000-2004 Dan Helfman