Changes in / [eaeb056:9ea8fdb4] in mainline
- Location:
- kernel
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/ia64/src/mm/tlb.c
reaeb056 r9ea8fdb4 481 481 482 482 page_table_lock(AS, true); 483 t = page_mapping_find(AS, va , true);483 t = page_mapping_find(AS, va); 484 484 if (t) { 485 485 /* … … 599 599 600 600 page_table_lock(AS, true); 601 pte_t *entry = page_mapping_find(AS, va , true);601 pte_t *entry = page_mapping_find(AS, va); 602 602 if (entry) { 603 603 /* … … 651 651 652 652 page_table_lock(AS, true); 653 t = page_mapping_find(AS, va , true);653 t = page_mapping_find(AS, va); 654 654 ASSERT((t) && (t->p)); 655 655 if ((t) && (t->p) && (t->w)) { … … 684 684 685 685 page_table_lock(AS, true); 686 t = page_mapping_find(AS, va , true);686 t = page_mapping_find(AS, va); 687 687 ASSERT((t) && (t->p)); 688 688 if ((t) && (t->p) && (t->x)) { … … 717 717 718 718 page_table_lock(AS, true); 719 t = page_mapping_find(AS, va , true);719 t = page_mapping_find(AS, va); 720 720 ASSERT((t) && (t->p)); 721 721 if ((t) && (t->p)) { … … 753 753 */ 754 754 page_table_lock(AS, true); 755 t = page_mapping_find(AS, va , true);755 t = page_mapping_find(AS, va); 756 756 ASSERT((t) && (t->p)); 757 757 ASSERT(!t->w); … … 778 778 779 779 page_table_lock(AS, true); 780 t = page_mapping_find(AS, va , true);780 t = page_mapping_find(AS, va); 781 781 ASSERT(t); 782 782 -
kernel/arch/mips32/src/mm/tlb.c
reaeb056 r9ea8fdb4 100 100 mutex_unlock(&AS->lock); 101 101 102 page_table_lock(AS, true); 103 102 104 pte = find_mapping_and_check(badvaddr, PF_ACCESS_READ, istate, &pfrc); 103 105 if (!pte) { … … 111 113 * or copy_to_uspace(). 112 114 */ 115 page_table_unlock(AS, true); 113 116 return; 114 117 default: … … 141 144 tlbwr(); 142 145 146 page_table_unlock(AS, true); 143 147 return; 144 148 145 149 fail: 150 page_table_unlock(AS, true); 146 151 tlb_refill_fail(istate); 147 152 } … … 171 176 index.value = cp0_index_read(); 172 177 178 page_table_lock(AS, true); 179 173 180 /* 174 181 * Fail if the entry is not in TLB. … … 190 197 * or copy_to_uspace(). 191 198 */ 199 page_table_unlock(AS, true); 192 200 return; 193 201 default: … … 219 227 tlbwi(); 220 228 229 page_table_unlock(AS, true); 221 230 return; 222 231 223 232 fail: 233 page_table_unlock(AS, true); 224 234 tlb_invalid_fail(istate); 225 235 } … … 249 259 index.value = cp0_index_read(); 250 260 261 page_table_lock(AS, true); 262 251 263 /* 252 264 * Fail if the entry is not in TLB. … … 268 280 * or copy_to_uspace(). 269 281 */ 282 page_table_unlock(AS, true); 270 283 return; 271 284 default: … … 298 311 tlbwi(); 299 312 313 page_table_unlock(AS, true); 300 314 return; 301 315 302 316 fail: 317 page_table_unlock(AS, true); 303 318 tlb_modified_fail(istate); 304 319 } … … 349 364 pte_t *pte; 350 365 366 ASSERT(mutex_locked(&AS->lock)); 367 351 368 hi.value = cp0_entry_hi_read(); 352 369 … … 362 379 * Check if the mapping exists in page tables. 363 380 */ 364 pte = page_mapping_find(AS, badvaddr , true);381 pte = page_mapping_find(AS, badvaddr); 365 382 if (pte && pte->p && (pte->w || access != PF_ACCESS_WRITE)) { 366 383 /* … … 376 393 * Resort to higher-level page fault handler. 377 394 */ 395 page_table_unlock(AS, true); 378 396 switch (rc = as_page_fault(badvaddr, access, istate)) { 379 397 case AS_PF_OK: … … 382 400 * The mapping ought to be in place. 383 401 */ 384 pte = page_mapping_find(AS, badvaddr, true); 402 page_table_lock(AS, true); 403 pte = page_mapping_find(AS, badvaddr); 385 404 ASSERT(pte && pte->p); 386 405 ASSERT(pte->w || access != PF_ACCESS_WRITE); … … 388 407 break; 389 408 case AS_PF_DEFER: 409 page_table_lock(AS, true); 390 410 *pfrc = AS_PF_DEFER; 391 411 return NULL; 392 412 break; 393 413 case AS_PF_FAULT: 414 page_table_lock(AS, true); 394 415 *pfrc = AS_PF_FAULT; 395 416 return NULL; -
kernel/arch/ppc32/src/mm/tlb.c
reaeb056 r9ea8fdb4 49 49 * 50 50 * @param as Address space. 51 * @param lock Lock/unlock the address space. 51 52 * @param badvaddr Faulting virtual address. 52 53 * @param access Access mode that caused the fault. … … 61 62 istate_t *istate, int *pfrc) 62 63 { 64 ASSERT(mutex_locked(&as->lock)); 65 63 66 /* 64 67 * Check if the mapping exists in page tables. 65 68 */ 66 pte_t *pte = page_mapping_find(as, badvaddr , true);69 pte_t *pte = page_mapping_find(as, badvaddr); 67 70 if ((pte) && (pte->present)) { 68 71 /* … … 76 79 * Resort to higher-level page fault handler. 77 80 */ 81 page_table_unlock(as, true); 82 78 83 int rc = as_page_fault(badvaddr, access, istate); 79 84 switch (rc) { … … 83 88 * The mapping ought to be in place. 84 89 */ 85 pte = page_mapping_find(as, badvaddr, true); 90 page_table_lock(as, true); 91 pte = page_mapping_find(as, badvaddr); 86 92 ASSERT((pte) && (pte->present)); 87 93 *pfrc = 0; 88 94 return pte; 89 95 case AS_PF_DEFER: 96 page_table_lock(as, true); 90 97 *pfrc = rc; 91 98 return NULL; 92 99 case AS_PF_FAULT: 100 page_table_lock(as, true); 93 101 *pfrc = rc; 94 102 return NULL; … … 206 214 badvaddr = istate->pc; 207 215 216 page_table_lock(as, true); 217 208 218 int pfrc; 209 219 pte_t *pte = find_mapping_and_check(as, badvaddr, … … 213 223 switch (pfrc) { 214 224 case AS_PF_FAULT: 225 page_table_unlock(as, true); 215 226 pht_refill_fail(badvaddr, istate); 216 227 return; … … 220 231 * or copy_to_uspace(). 221 232 */ 233 page_table_unlock(as, true); 222 234 return; 223 235 default: … … 229 241 pte->accessed = 1; 230 242 pht_insert(badvaddr, pte); 243 244 page_table_unlock(as, true); 231 245 } 232 246 -
kernel/arch/sparc64/src/mm/sun4u/tlb.c
reaeb056 r9ea8fdb4 207 207 208 208 page_table_lock(AS, true); 209 t = page_mapping_find(AS, page_16k , true);209 t = page_mapping_find(AS, page_16k); 210 210 if (t && PTE_EXECUTABLE(t)) { 211 211 /* … … 275 275 276 276 page_table_lock(AS, true); 277 t = page_mapping_find(AS, page_16k , true);277 t = page_mapping_find(AS, page_16k); 278 278 if (t) { 279 279 /* … … 319 319 320 320 page_table_lock(AS, true); 321 t = page_mapping_find(AS, page_16k , true);321 t = page_mapping_find(AS, page_16k); 322 322 if (t && PTE_WRITABLE(t)) { 323 323 /* -
kernel/arch/sparc64/src/mm/sun4v/tlb.c
reaeb056 r9ea8fdb4 219 219 220 220 page_table_lock(AS, true); 221 t = page_mapping_find(AS, va , true);221 t = page_mapping_find(AS, va); 222 222 223 223 if (t && PTE_EXECUTABLE(t)) { … … 275 275 276 276 page_table_lock(AS, true); 277 t = page_mapping_find(AS, va , true);277 t = page_mapping_find(AS, va); 278 278 if (t) { 279 279 /* … … 317 317 318 318 page_table_lock(AS, true); 319 t = page_mapping_find(AS, va , true);319 t = page_mapping_find(AS, va); 320 320 if (t && PTE_WRITABLE(t)) { 321 321 /* -
kernel/genarch/include/mm/page_pt.h
reaeb056 r9ea8fdb4 129 129 130 130 extern void page_mapping_insert_pt(as_t *, uintptr_t, uintptr_t, unsigned int); 131 extern pte_t *page_mapping_find_pt(as_t *, uintptr_t , bool);131 extern pte_t *page_mapping_find_pt(as_t *, uintptr_t); 132 132 133 133 #endif -
kernel/genarch/src/mm/page_ht.c
reaeb056 r9ea8fdb4 58 58 static void ht_mapping_insert(as_t *, uintptr_t, uintptr_t, unsigned int); 59 59 static void ht_mapping_remove(as_t *, uintptr_t); 60 static pte_t *ht_mapping_find(as_t *, uintptr_t , bool);60 static pte_t *ht_mapping_find(as_t *, uintptr_t); 61 61 62 62 /** … … 214 214 * this call visible. 215 215 * 216 * @param as Address space to w hich page belongs.216 * @param as Address space to wich page belongs. 217 217 * @param page Virtual address of the page to be demapped. 218 218 * … … 237 237 /** Find mapping for virtual page in page hash table. 238 238 * 239 * @param as Address space to which page belongs. 240 * @param page Virtual page. 241 * @param nolock True if the page tables need not be locked. 239 * Find mapping for virtual page. 240 * 241 * @param as Address space to wich page belongs. 242 * @param page Virtual page. 242 243 * 243 244 * @return NULL if there is no such mapping; requested mapping otherwise. 244 245 * 245 246 */ 246 pte_t *ht_mapping_find(as_t *as, uintptr_t page , bool nolock)247 pte_t *ht_mapping_find(as_t *as, uintptr_t page) 247 248 { 248 249 sysarg_t key[2] = { … … 251 252 }; 252 253 253 ASSERT( nolock ||page_table_locked(as));254 ASSERT(page_table_locked(as)); 254 255 255 256 link_t *cur = hash_table_find(&page_ht, key); -
kernel/genarch/src/mm/page_pt.c
reaeb056 r9ea8fdb4 48 48 static void pt_mapping_insert(as_t *, uintptr_t, uintptr_t, unsigned int); 49 49 static void pt_mapping_remove(as_t *, uintptr_t); 50 static pte_t *pt_mapping_find(as_t *, uintptr_t , bool);50 static pte_t *pt_mapping_find(as_t *, uintptr_t); 51 51 52 52 page_mapping_operations_t pt_mapping_operations = { … … 238 238 /** Find mapping for virtual page in hierarchical page tables. 239 239 * 240 * @param as Address space to which page belongs. 241 * @param page Virtual page. 242 * @param nolock True if the page tables need not be locked. 240 * Find mapping for virtual page. 241 * 242 * @param as Address space to which page belongs. 243 * @param page Virtual page. 243 244 * 244 245 * @return NULL if there is no such mapping; entry from PTL3 describing … … 246 247 * 247 248 */ 248 pte_t *pt_mapping_find(as_t *as, uintptr_t page , bool nolock)249 pte_t *pt_mapping_find(as_t *as, uintptr_t page) 249 250 { 250 ASSERT( nolock ||page_table_locked(as));251 ASSERT(page_table_locked(as)); 251 252 252 253 pte_t *ptl0 = (pte_t *) PA2KA((uintptr_t) as->genarch.page_table); -
kernel/generic/include/mm/page.h
reaeb056 r9ea8fdb4 47 47 void (* mapping_insert)(as_t *, uintptr_t, uintptr_t, unsigned int); 48 48 void (* mapping_remove)(as_t *, uintptr_t); 49 pte_t *(* mapping_find)(as_t *, uintptr_t , bool);49 pte_t *(* mapping_find)(as_t *, uintptr_t); 50 50 } page_mapping_operations_t; 51 51 … … 58 58 extern void page_mapping_insert(as_t *, uintptr_t, uintptr_t, unsigned int); 59 59 extern void page_mapping_remove(as_t *, uintptr_t); 60 extern pte_t *page_mapping_find(as_t *, uintptr_t , bool);60 extern pte_t *page_mapping_find(as_t *, uintptr_t); 61 61 extern pte_t *page_table_create(unsigned int); 62 62 extern void page_table_destroy(pte_t *); -
kernel/generic/src/mm/as.c
reaeb056 r9ea8fdb4 649 649 for (; i < size; i++) { 650 650 pte_t *pte = page_mapping_find(as, 651 ptr + P2SZ(i) , false);651 ptr + P2SZ(i)); 652 652 653 653 ASSERT(pte); … … 798 798 for (size = 0; size < (size_t) node->value[i]; size++) { 799 799 pte_t *pte = page_mapping_find(as, 800 ptr + P2SZ(size) , false);800 ptr + P2SZ(size)); 801 801 802 802 ASSERT(pte); … … 1105 1105 for (size = 0; size < (size_t) node->value[i]; size++) { 1106 1106 pte_t *pte = page_mapping_find(as, 1107 ptr + P2SZ(size) , false);1107 ptr + P2SZ(size)); 1108 1108 1109 1109 ASSERT(pte); … … 1241 1241 */ 1242 1242 pte_t *pte; 1243 if ((pte = page_mapping_find(AS, page , false))) {1243 if ((pte = page_mapping_find(AS, page))) { 1244 1244 if (PTE_PRESENT(pte)) { 1245 1245 if (((access == PF_ACCESS_READ) && PTE_READABLE(pte)) || -
kernel/generic/src/mm/backend_anon.c
reaeb056 r9ea8fdb4 122 122 page_table_lock(area->as, false); 123 123 pte = page_mapping_find(area->as, 124 base + P2SZ(j), false);124 base + j * PAGE_SIZE); 125 125 ASSERT(pte && PTE_VALID(pte) && 126 126 PTE_PRESENT(pte)); 127 127 btree_insert(&area->sh_info->pagemap, 128 (base + P2SZ(j)) - area->base,128 (base + j * PAGE_SIZE) - area->base, 129 129 (void *) PTE_GET_FRAME(pte), NULL); 130 130 page_table_unlock(area->as, false); -
kernel/generic/src/mm/backend_elf.c
reaeb056 r9ea8fdb4 170 170 if (!(area->flags & AS_AREA_WRITE)) 171 171 if (base >= entry->p_vaddr && 172 base + P2SZ(count)<= start_anon)172 base + count * PAGE_SIZE <= start_anon) 173 173 continue; 174 174 … … 182 182 if (!(area->flags & AS_AREA_WRITE)) 183 183 if (base >= entry->p_vaddr && 184 base + P2SZ(j + 1) <= start_anon) 184 base + (j + 1) * PAGE_SIZE <= 185 start_anon) 185 186 continue; 186 187 187 188 page_table_lock(area->as, false); 188 189 pte = page_mapping_find(area->as, 189 base + P2SZ(j), false);190 base + j * PAGE_SIZE); 190 191 ASSERT(pte && PTE_VALID(pte) && 191 192 PTE_PRESENT(pte)); 192 193 btree_insert(&area->sh_info->pagemap, 193 (base + P2SZ(j)) - area->base,194 (base + j * PAGE_SIZE) - area->base, 194 195 (void *) PTE_GET_FRAME(pte), NULL); 195 196 page_table_unlock(area->as, false); -
kernel/generic/src/mm/page.c
reaeb056 r9ea8fdb4 108 108 * using flags. Allocate and setup any missing page tables. 109 109 * 110 * @param as Address space to w hich page belongs.110 * @param as Address space to wich page belongs. 111 111 * @param page Virtual address of the page to be mapped. 112 112 * @param frame Physical address of memory frame to which the mapping is … … 135 135 * this call visible. 136 136 * 137 * @param as Address space to w hich page belongs.137 * @param as Address space to wich page belongs. 138 138 * @param page Virtual address of the page to be demapped. 139 139 * … … 152 152 } 153 153 154 /** Find mapping for virtual page .154 /** Find mapping for virtual page 155 155 * 156 * @param as Address space to which page belongs. 157 * @param page Virtual page. 158 * @param nolock True if the page tables need not be locked. 156 * Find mapping for virtual page. 157 * 158 * @param as Address space to wich page belongs. 159 * @param page Virtual page. 159 160 * 160 161 * @return NULL if there is no such mapping; requested mapping … … 162 163 * 163 164 */ 164 NO_TRACE pte_t *page_mapping_find(as_t *as, uintptr_t page , bool nolock)165 NO_TRACE pte_t *page_mapping_find(as_t *as, uintptr_t page) 165 166 { 166 ASSERT( nolock ||page_table_locked(as));167 ASSERT(page_table_locked(as)); 167 168 168 169 ASSERT(page_mapping_operations); 169 170 ASSERT(page_mapping_operations->mapping_find); 170 171 171 return page_mapping_operations->mapping_find(as, page , nolock);172 return page_mapping_operations->mapping_find(as, page); 172 173 } 173 174 -
kernel/generic/src/synch/futex.c
reaeb056 r9ea8fdb4 119 119 */ 120 120 page_table_lock(AS, true); 121 t = page_mapping_find(AS, ALIGN_DOWN(uaddr, PAGE_SIZE) , false);121 t = page_mapping_find(AS, ALIGN_DOWN(uaddr, PAGE_SIZE)); 122 122 if (!t || !PTE_VALID(t) || !PTE_PRESENT(t)) { 123 123 page_table_unlock(AS, true); … … 155 155 */ 156 156 page_table_lock(AS, true); 157 t = page_mapping_find(AS, ALIGN_DOWN(uaddr, PAGE_SIZE) , false);157 t = page_mapping_find(AS, ALIGN_DOWN(uaddr, PAGE_SIZE)); 158 158 if (!t || !PTE_VALID(t) || !PTE_PRESENT(t)) { 159 159 page_table_unlock(AS, true);
Note:
See TracChangeset
for help on using the changeset viewer.