MOS Source Code
|
Allocate/free the physical memory, in the form of physical frames. More...
Classes | |
struct | phyframe_t |
struct | pmm_region_t |
Macros | |
#define | phyframe_pfn(frame) |
#define | pfn_phyframe(pfn) |
#define | pmm_reserve_address(paddr) |
#define | pmm_reserve_addresses(paddr, npages) |
#define | pmm_ref(thing, npages) |
#define | pmm_unref(thing, npages) |
#define | pmm_ref_one(thing) |
#define | pmm_unref_one(thing) |
Typedefs | |
typedef struct phyframe | phyframe_t |
Enumerations | |
enum | pmm_allocation_flags_t { PMM_ALLOC_NORMAL = 0 } |
Functions | |
MOS_STATIC_ASSERT (sizeof(phyframe_t)==32, "update phyframe_t struct size") | |
void | pmm_dump_lists (void) |
Dump the physical memory manager's state, (i.e. the free list and the allocated list). | |
void | pmm_init () |
phyframe_t * | pmm_allocate_frames (size_t n_frames, pmm_allocation_flags_t flags) |
Allocate n_frames of contiguous physical memory. | |
void | pmm_free_frames (phyframe_t *start_frame, size_t n_pages) |
pfn_t | pmm_reserve_frames (pfn_t pfn, size_t npages) |
Mark a range of physical memory as reserved. | |
pmm_region_t * | pmm_find_reserved_region (ptr_t needle) |
Find a region in the physical memory manager. | |
phyframe_t * | _pmm_ref_phyframes (phyframe_t *frame, size_t npages) |
void | _pmm_unref_phyframes (phyframe_t *frame, size_t npages) |
should_inline pfn_t | _pmm_ref_pfn_range (pfn_t pfn_start, size_t npages) |
should_inline void | _pmm_unref_pfn_range (pfn_t pfn_start, size_t npages) |
Variables | |
phyframe_t * | phyframes |
size_t | pmm_total_frames |
size_t | pmm_allocated_frames |
size_t | pmm_reserved_frames |
Allocate/free the physical memory, in the form of physical frames.
The physical memory manager is responsible for allocating and freeing physical memory.
#define phyframe_pfn | ( | frame | ) |
Definition at line 80 of file pmm.h.
Referenced by _pmm_ref_phyframes(), _pmm_unref_phyframes(), acpi_sysfs_mmap(), break_the_order(), buddy_alloc_n_exact(), dmabuf_do_allocate(), dump_list(), extract_exact_range(), mm_handle_fault(), mm_resolve_cow_fault(), pmm_allocate_frames(), and pmm_free_frames().
#define pfn_phyframe | ( | pfn | ) |
Definition at line 81 of file pmm.h.
Referenced by _pmm_ref_pfn_range(), _pmm_ref_phyframes(), _pmm_unref_pfn_range(), _pmm_unref_phyframes(), break_the_order(), break_this_pfn(), buddy_alloc_n_exact(), buddy_free_n(), dmabuf_unshare(), extract_exact_range(), mm_handle_fault(), mmstat_sysfs_phyframe_stat_show(), pmm_allocate_frames(), pmm_free_frames(), populate_freelist(), and try_merge().
#define pmm_reserve_address | ( | paddr | ) |
Definition at line 116 of file pmm.h.
Referenced by ioapic_init(), and lapic_memory_setup().
#define pmm_reserve_addresses | ( | paddr, | |
npages ) |
#define pmm_ref | ( | thing, | |
npages ) |
Definition at line 143 of file pmm.h.
Referenced by dmabuf_do_allocate(), mos_start_kernel(), register_sysfs_acpi_node(), and register_sysfs_acpi_rsdp().
#define pmm_unref | ( | thing, | |
npages ) |
#define pmm_ref_one | ( | thing | ) |
Definition at line 146 of file pmm.h.
Referenced by cpio_fill_cache(), mm_replace_page_locked(), pml1e_do_copy_callback(), pml1e_do_map_callback(), tmpfs_fill_cache(), userfs_inode_cache_fill_cache(), and zero_page().
#define pmm_unref_one | ( | thing | ) |
Definition at line 147 of file pmm.h.
Referenced by do_flush_and_drop_cached_page(), mm_replace_page_locked(), pml1e_do_copy_callback(), and pml1e_do_unmap_callback().
MOS_STATIC_ASSERT | ( | sizeof(phyframe_t) | = =32, |
"update phyframe_t struct size" | ) |
void pmm_init | ( | ) |
Definition at line 20 of file pmm.c.
Referenced by mos_start_kernel().
phyframe_t * pmm_allocate_frames | ( | size_t | n_frames, |
pmm_allocation_flags_t | flags ) |
Allocate n_frames of contiguous physical memory.
n_frames | Number of frames to allocate. |
flags | Allocation flags. |
Definition at line 92 of file pmm.c.
Referenced by dmabuf_do_allocate(), mm_get_free_page_raw(), and mm_get_free_pages().
void pmm_free_frames | ( | phyframe_t * | start_frame, |
size_t | n_pages ) |
Definition at line 108 of file pmm.c.
Referenced by _pmm_unref_phyframes(), and dmabuf_unshare().
Mark a range of physical memory as reserved.
pfn | Physical frame number of the block to reserve. |
npages | Number of pages to reserve. |
PMM_REGION_RESERVED
and will be moved to the allocated list.Definition at line 122 of file pmm.c.
Referenced by pmm_init().
pmm_region_t * pmm_find_reserved_region | ( | ptr_t | needle | ) |
Find a region in the physical memory manager.
needle | One address in the region to find. |
Definition at line 131 of file pmm.c.
Referenced by ioapic_init(), lapic_memory_setup(), and platform_startup_late().
phyframe_t * _pmm_ref_phyframes | ( | phyframe_t * | frame, |
size_t | npages ) |
Definition at line 151 of file pmm.c.
Referenced by _pmm_ref_pfn_range().
void _pmm_unref_phyframes | ( | phyframe_t * | frame, |
size_t | npages ) |
Definition at line 162 of file pmm.c.
Referenced by _pmm_unref_pfn_range().
should_inline pfn_t _pmm_ref_pfn_range | ( | pfn_t | pfn_start, |
size_t | npages ) |
should_inline void _pmm_unref_pfn_range | ( | pfn_t | pfn_start, |
size_t | npages ) |
|
extern |
Definition at line 15 of file pmm.c.
Referenced by pmm_init().
|
extern |
Definition at line 16 of file pmm.c.
Referenced by _pmm_ref_phyframes(), _pmm_unref_phyframes(), extract_exact_range(), mmstat_sysfs_phyframe_stat_show(), mmstat_sysfs_phyframe_stat_store(), mmstat_sysfs_stat(), pmm_init(), pmm_reserve_frames(), and try_merge().
size_t pmm_allocated_frames |
Definition at line 83 of file pmm.h.
Referenced by mmstat_sysfs_stat().
size_t pmm_reserved_frames |
Definition at line 83 of file pmm.h.
Referenced by mmstat_sysfs_stat().