#include <pagemap.h>
Inherits Address_map.
Inheritance diagram for Page_map:


Public Member Functions | |
| void | init (unsigned &last_available_address) |
| void | map_page (void *virtual_page, void *physical_page) |
| unsigned * | map_temp_page (unsigned *physical_page) |
| void | unmap_temp_page (unsigned *virtual_page) |
| void | unmap_page (void *virtual_page) |
| Hash_table< void *, void * > & | get_dirty_pages () |
| Hash_table< void *, void * > & | get_dirty_pages_next () |
| void | switch_dirty_pages_hashes () |
| void | free_dirty_pages_next () |
| bool | handle_page_fault () |
| void * | virtual_to_physical_page (void *virtual_addr) |
| bool | is_dirty (void *virtual_addr) |
| void | add_dirty_page (void *dirty_page, void *physical_page=NULL, int index=-1) |
| void | print () |
Static Public Member Functions | |
| unsigned * | table_entry_to_phys (unsigned page_entry) |
Static Public Attributes | |
| const unsigned | PTE_USER = 0x4 |
| const unsigned | PTE_ACCESSED = 0x20 |
| const unsigned | PTE_PAGE_FRAME_ADDRESS = 0xfffff000 |
| const unsigned | DIRTY_PAGE_COPIED = 1 |
| const unsigned | CR0_PAGING = (1 << 31) |
| const unsigned | CR0_RESPECT_READONLY = (1 << 16) |
Protected Attributes | |
| void * | direct_mapped_end |
| unsigned * | temp_mapping_cache |
| unsigned * | first_free_temp_mapping |
| Mapping_cache_info | mapping_cache_usage [MAPPING_CACHE_PAGE_COUNT] |
| Hash_table< void *, Mapping_cache_info * > | mapping_cache_mappings |
| Hash_node< void *, Mapping_cache_info * > | mapping_nodes [MAPPING_CACHE_PAGE_COUNT] |
| Int_handler | handler |
| Hash_table< void *, void * > | dirty_pages [2] |
| int | dirty_pages_index |
| Slab_allocator | dirty_pages_nodes [2] |
Static Protected Attributes | |
| const Size | MAPPING_CACHE_PAGE_COUNT = 1024 |
|
||||||||||||||||
|
Add the given virtual page to the dirty pages map. Normally, calling this function directly isn't necessary, as allocated pages start out read-only and thus end up in the dirty pages map when a write fault occurs. But for pages that don't start out as read-only and should be added to the dirty pages map later, use this function. Provide an optional physical page address for this page if it is already known. An optional index into the dirty_pages list can also be provided. If not specified, then dirty_pages_index is used. |
|
|
Free and clear the next dirty pages hash and prepare it for reuse.
|
|
|
Get a hash of pages that have been dirtied since the last checkpoint. The hash maps virtual addresses of these pages to their current physical addresses. |
|
|
Get a hash of pages that have been dirtied since the beginning of the current checkpoint, which will be written to disk during the next checkpoint. You should only call this function during a checkpoint. |
|
|
Recover gracefully from a page fault interrupt.
|
|
|
Create initial page directory and page tables and enable paging.
|
|
|
Return whether the given address is dirty.
|
|
||||||||||||
|
Create a virtual to physical memory mapping for a single page, making a page table to contain the mapping if necessary. If the virtual page is within the memory managed by the virtual memory allocator, then it will be mapped read-only so that writes to the page cause a write fault, thereby allowing dirtied pages to be logged. |
|
|
Map a page into the temporary mapping cache, a portion of virtual memory set aside specifically for temporarily mapping pages while they are being modified. This avoids wasting virtual address space by keeping them mapped all the time. If the page is already mapped by another caller, then the page's ref count will simply be incremented. Return the virtual mapped address, or NULL if the temporary mapping cache is full. |
|
|
Print out the state of the page map.
|
|
|
Switch the two dirty_pages hash tables. This is called at the end of a checkpoint so that the dirty pages hash that was recording pages dirtied during the checkpoint becomes the main dirty pages hash in use. The other dirty pages hash table then becomes available for use during the next checkpoint. |
|
|
Convert a page table entry into the physical page frame address it contains.
|
|
|
Disable the page table entry for the given virtual page.
|
|
|
Given the physical address of a page already mapped into the temporary mapping cache, decrement its ref count. If the ref count reaches zero, the virtual address will be made available for mappings to other physical pages. |
|
|
Convert a virtual address to its corresponding physical page.
|
|
|
|
|
|
ring 0 faults on read-only pages
|
|
|
end of direct-mapped 1-to-1 memory
|
|
|
dirty page was copied-on-write
|
|
|
map of dirty virtual pages to their corresponding physical pages, this is an array of two hashes because we alternate between the two: at any given time, one hash contains the pages dirtied since the start of the previous checkpoint, and the other hash contains the pages dirtied since the start of the current checkpoint (if one is actually happening now)
|
|
|
index to current dirty pages hash
|
|
|
since the Hash_table class doesn't allocate hash nodes for us, the dirty_pages_nodes allocator serves this purpose
|
|
|
first available temp mapping
|
|
|
page fault interrupt handler
|
|
|
phys addr table for mapping cache
|
|
|
|
|
|
page usage info for mapping cache
|
|
|
nodes of phys addr table
|
|
|
|
|
|
|
|
|
|
|
|
start of temporary mapping cache
|
Torsion Operating System, Copyright (C) 2000-2004 Dan Helfman