Changes in kernel/generic/src/mm/page.c [d99c1d2:97bdb4a] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/mm/page.c
rd99c1d2 r97bdb4a 33 33 /** 34 34 * @file 35 * @brief 35 * @brief Virtual Address Translation subsystem. 36 36 * 37 37 * This file contains code for creating, destroying and searching 38 38 * mappings between virtual addresses and physical addresses. 39 39 * Functions here are mere wrappers that call the real implementation. 40 * They however, define the single interface. 40 * They however, define the single interface. 41 * 41 42 */ 42 43 … … 55 56 * will do an implicit serialization by virtue of running the TLB shootdown 56 57 * interrupt handler. 58 * 57 59 */ 58 60 … … 83 85 * of page boundaries. 84 86 * 85 * @param s Address of the structure. 86 * @param size Size of the structure. 87 * @param addr Address of the structure. 88 * @param size Size of the structure. 89 * 87 90 */ 88 void map_structure(uintptr_t s, size_t size)91 void map_structure(uintptr_t addr, size_t size) 89 92 { 90 int i, cnt, length; 91 92 length = size + (s - (s & ~(PAGE_SIZE - 1))); 93 cnt = length / PAGE_SIZE + (length % PAGE_SIZE > 0); 94 93 size_t length = size + (addr - (addr & ~(PAGE_SIZE - 1))); 94 size_t cnt = length / PAGE_SIZE + (length % PAGE_SIZE > 0); 95 96 size_t i; 95 97 for (i = 0; i < cnt; i++) 96 page_mapping_insert(AS_KERNEL, s+ i * PAGE_SIZE,97 s+ i * PAGE_SIZE, PAGE_NOT_CACHEABLE | PAGE_WRITE);98 98 page_mapping_insert(AS_KERNEL, addr + i * PAGE_SIZE, 99 addr + i * PAGE_SIZE, PAGE_NOT_CACHEABLE | PAGE_WRITE); 100 99 101 /* Repel prefetched accesses to the old mapping. */ 100 102 memory_barrier(); … … 106 108 * using flags. Allocate and setup any missing page tables. 107 109 * 108 * The page table must be locked and interrupts must be disabled. 110 * @param as Address space to wich page belongs. 111 * @param page Virtual address of the page to be mapped. 112 * @param frame Physical address of memory frame to which the mapping is 113 * done. 114 * @param flags Flags to be used for mapping. 109 115 * 110 * @param as Address space to wich page belongs.111 * @param page Virtual address of the page to be mapped.112 * @param frame Physical address of memory frame to which the mapping is113 * done.114 * @param flags Flags to be used for mapping.115 116 */ 116 void page_mapping_insert(as_t *as, uintptr_t page, uintptr_t frame, int flags) 117 NO_TRACE void page_mapping_insert(as_t *as, uintptr_t page, uintptr_t frame, 118 unsigned int flags) 117 119 { 120 ASSERT(page_table_locked(as)); 121 118 122 ASSERT(page_mapping_operations); 119 123 ASSERT(page_mapping_operations->mapping_insert); 120 124 121 125 page_mapping_operations->mapping_insert(as, page, frame, flags); 122 126 … … 131 135 * this call visible. 132 136 * 133 * The page table must be locked and interrupts must be disabled. 137 * @param as Address space to wich page belongs. 138 * @param page Virtual address of the page to be demapped. 134 139 * 135 * @param as Address space to wich page belongs.136 * @param page Virtual address of the page to be demapped.137 140 */ 138 void page_mapping_remove(as_t *as, uintptr_t page)141 NO_TRACE void page_mapping_remove(as_t *as, uintptr_t page) 139 142 { 143 ASSERT(page_table_locked(as)); 144 140 145 ASSERT(page_mapping_operations); 141 146 ASSERT(page_mapping_operations->mapping_remove); 142 147 143 148 page_mapping_operations->mapping_remove(as, page); 144 149 145 150 /* Repel prefetched accesses to the old mapping. */ 146 151 memory_barrier(); … … 151 156 * Find mapping for virtual page. 152 157 * 153 * The page table must be locked and interrupts must be disabled. 158 * @param as Address space to wich page belongs. 159 * @param page Virtual page. 154 160 * 155 * @ param as Address space to wich page belongs.156 * @param page Virtual page.161 * @return NULL if there is no such mapping; requested mapping 162 * otherwise. 157 163 * 158 * @return NULL if there is no such mapping; requested mapping159 * otherwise.160 164 */ 161 pte_t *page_mapping_find(as_t *as, uintptr_t page)165 NO_TRACE pte_t *page_mapping_find(as_t *as, uintptr_t page) 162 166 { 167 ASSERT(page_table_locked(as)); 168 163 169 ASSERT(page_mapping_operations); 164 170 ASSERT(page_mapping_operations->mapping_find); 165 171 166 172 return page_mapping_operations->mapping_find(as, page); 167 173 }
Note:
See TracChangeset
for help on using the changeset viewer.