Lines Matching full:page
25 * - A page frame is a page-sized physical memory region in RAM. It is a
26 * container where a data page may be placed. It is always referred to by
29 * every page frame.
31 * - A data page is a page-sized region of data. It may exist in a page frame,
33 * up in the CPU's page tables (or equivalent) by virtual address.
38 /* Spinlock to protect any globals in this file and serialize page table
44 * General page frame management
47 /* Database of all RAM page frames */
57 /* Add colors to page table dumps to indicate mapping type */
147 * purposes and does not otherwise affect page frame accounting or flags;
173 * | Reserved | <- special purpose virtual page(s) of size Z_VM_RESERVED
177 /* Bitmap of virtual addresses where one bit corresponds to one page.
362 * Free page frames management
367 /* Linked list of unused and available page frames.
369 * TODO: This is very simple and treats all free page frames as being equal.
372 * may require a more complex ontology which prefers page frames in RAM banks
376 * pages. Each page frame will still just have one snode link.
380 /* Number of unused and available free page frames */
384 __ASSERT(expr, "page frame 0x%lx: " fmt, z_page_frame_to_phys(pf), \
387 /* Get an unused page frame. don't care which one, or NULL if there are none */
404 /* Release a page frame back into the list of free pages */
408 "unavailable page put on free list"); in free_page_frame_list_put()
437 "attempted to map a reserved page frame"); in frame_mapped_set()
439 /* We do allow multiple mappings for pinned page frames in frame_mapped_set()
452 /* Go through page frames to find the physical address mapped
492 /* Allocate a free page frame, and map it to a specified virtual address
494 * TODO: Add optional support for copy-on-write mappings to a zero page instead
495 * of allocating, in which case page frames will be allocated lazily as
496 * the mappings to the zero page get touched. This will avoid expensive
497 * page-ins as memory is mapped and physical RAM or backing store storage will
499 * page of zeroes.
516 __ASSERT(pf != NULL, "failed to get a page frame"); in map_anon_page()
540 LOG_DBG("memory mapping anon page %p -> 0x%lx", addr, phys); in map_anon_page()
544 * zero page, won't need this step in map_anon_page()
590 /* Skip over the "before" guard page in returned address. */ in k_mem_map()
599 * page as well. in k_mem_map()
619 /* Need space for the "before" guard page */ in k_mem_unmap()
638 "%s: cannot find preceding guard page for (%p, %zu)", in k_mem_unmap()
646 "%s: cannot find succeeding guard page for (%p, %zu)", in k_mem_unmap()
663 "%s: 0x%lx is not a page frame", __func__, phys); in k_mem_unmap()
665 /* Physical address has no corresponding page frame in k_mem_unmap()
666 * description in the page frame array. in k_mem_unmap()
672 /* Grab the corresponding page frame from physical address */ in k_mem_unmap()
676 "%s: 0x%lx is not a mapped page frame", __func__, phys); in k_mem_unmap()
678 /* Page frame is not marked mapped. in k_mem_unmap()
686 /* Put the page frame back into free list */ in k_mem_unmap()
723 /* Get the default virtual region alignment, here the default MMU page size
861 /* The actual mapped region must be page-aligned. Round down the in k_mem_region_align()
910 /* If some page frames are unavailable for use as memory, arch in z_mem_manage_init()
932 * structures, and any code used to perform page fault in z_mem_manage_init()
933 * handling, page-ins, etc. in z_mem_manage_init()
947 /* Pin the page frames correspondng to the pinned symbols */ in z_mem_manage_init()
959 LOG_DBG("free page frames: %zu", z_free_page_count); in z_mem_manage_init()
1065 /* Current implementation relies on interrupt locking to any prevent page table
1085 * Perform some preparatory steps before paging out. The provided page frame
1088 * a data page.
1090 * - Map page frame to scratch area if requested. This always is true if we're
1091 * doing a page fault, but is only set on manual evictions if the page is
1095 * - Update page tables with location
1096 * - Mark page frame as busy
1108 __ASSERT(!z_page_frame_is_pinned(pf), "page frame 0x%lx is pinned", in page_frame_prepare_locked()
1111 /* If the backing store doesn't have a copy of the page, even if it in page_frame_prepare_locked()
1114 * 1) Page has never been swapped out before, and the backing store in page_frame_prepare_locked()
1115 * wasn't pre-populated with this data page. in page_frame_prepare_locked()
1116 * 2) Page was swapped out before, but the page contents were not in page_frame_prepare_locked()
1118 * 3) Page contents were preserved when swapped back in, but were later in page_frame_prepare_locked()
1140 __ASSERT(!dirty, "un-mapped page determined to be dirty"); in page_frame_prepare_locked()
1144 __ASSERT(!z_page_frame_is_busy(pf), "page frame 0x%lx is already busy", in page_frame_prepare_locked()
1182 __ASSERT(pf->addr == addr, "page frame address mismatch"); in do_mem_evict()
1188 __ASSERT(ret == 0, "failed to prepare page frame"); in do_mem_evict()
1238 * data page to page-in, see comments in that function. in z_page_frame_evict()
1250 /* Nothing to do, free page */ in z_page_frame_evict()
1256 __ASSERT((flags & ARCH_DATA_PAGE_LOADED) != 0, "data page not loaded"); in z_page_frame_evict()
1384 __ASSERT(page_frames_initialized, "page fault at %p happened too early", in do_page_fault()
1387 LOG_DBG("page fault at %p", addr); in do_page_fault()
1397 * during the page-in/out operation. in do_page_fault()
1399 * We do however re-enable interrupts during the page-in/page-out in do_page_fault()
1401 * in this configuration page faults in an ISR are a bug; all their in do_page_fault()
1410 * but requires less pinned pages and ISRs may also take page faults. in do_page_fault()
1417 * sleep on a contended page fault operation will break scheduling in do_page_fault()
1422 __ASSERT(!k_is_in_isr(), "ISR page faults are forbidden"); in do_page_fault()
1443 /* This if-block is to pin the page if it is in do_page_fault()
1457 /* Need to evict a page frame */ in do_page_fault()
1459 __ASSERT(pf != NULL, "failed to get a page frame"); in do_page_fault()
1466 __ASSERT(ret == 0, "failed to prepare page frame"); in do_page_fault()
1550 "invalid data page at %p", addr); in do_mem_unpin()