Changeset da1bafb in mainline for kernel/generic/src/mm/page.c
- Timestamp:
- 2010-05-24T18:57:31Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0095368
- Parents:
- 666f492
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/mm/page.c
r666f492 rda1bafb 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 … … 39 39 * Functions here are mere wrappers that call the real implementation. 40 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(); … … 108 110 * The page table must be locked and interrupts must be disabled. 109 111 * 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. 112 * @param as Address space to wich page belongs. 113 * @param page Virtual address of the page to be mapped. 114 * @param frame Physical address of memory frame to which the mapping is 115 * done. 116 * @param flags Flags to be used for mapping. 117 * 115 118 */ 116 void page_mapping_insert(as_t *as, uintptr_t page, uintptr_t frame, int flags) 119 void page_mapping_insert(as_t *as, uintptr_t page, uintptr_t frame, 120 unsigned int flags) 117 121 { 118 122 ASSERT(page_mapping_operations); … … 133 137 * The page table must be locked and interrupts must be disabled. 134 138 * 135 * @param as Address space to wich page belongs. 136 * @param page Virtual address of the page to be demapped. 139 * @param as Address space to wich page belongs. 140 * @param page Virtual address of the page to be demapped. 141 * 137 142 */ 138 143 void page_mapping_remove(as_t *as, uintptr_t page) … … 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(); … … 153 158 * The page table must be locked and interrupts must be disabled. 154 159 * 155 * @param as 156 * @param page 160 * @param as Address space to wich page belongs. 161 * @param page Virtual page. 157 162 * 158 * @return NULL if there is no such mapping; requested mapping 159 * otherwise. 163 * @return NULL if there is no such mapping; requested mapping 164 * otherwise. 165 * 160 166 */ 161 167 pte_t *page_mapping_find(as_t *as, uintptr_t page) … … 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.