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