Changeset 20d50a1 in mainline for arch/mips32/src/mm/tlb.c
- Timestamp:
- 2006-01-13T13:02:45Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f9425006
- Parents:
- 0369911
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
arch/mips32/src/mm/tlb.c
r0369911 r20d50a1 31 31 #include <mm/tlb.h> 32 32 #include <mm/page.h> 33 #include <mm/ vm.h>33 #include <mm/as.h> 34 34 #include <arch/cp0.h> 35 35 #include <panic.h> … … 93 93 badvaddr = cp0_badvaddr_read(); 94 94 95 spinlock_lock(& VM->lock);95 spinlock_lock(&AS->lock); 96 96 97 97 pte = find_mapping_and_check(badvaddr); … … 104 104 pte->a = 1; 105 105 106 prepare_entry_hi(&hi, VM->asid, badvaddr);106 prepare_entry_hi(&hi, AS->asid, badvaddr); 107 107 prepare_entry_lo(&lo, pte->lo.g, pte->lo.v, pte->lo.d, pte->lo.c, pte->lo.pfn); 108 108 … … 122 122 tlbwr(); 123 123 124 spinlock_unlock(& VM->lock);124 spinlock_unlock(&AS->lock); 125 125 return; 126 126 127 127 fail: 128 spinlock_unlock(& VM->lock);128 spinlock_unlock(&AS->lock); 129 129 tlb_refill_fail(pstate); 130 130 } … … 155 155 index.value = cp0_index_read(); 156 156 157 spinlock_lock(& VM->lock);157 spinlock_lock(&AS->lock); 158 158 159 159 /* … … 191 191 tlbwi(); 192 192 193 spinlock_unlock(& VM->lock);193 spinlock_unlock(&AS->lock); 194 194 return; 195 195 196 196 fail: 197 spinlock_unlock(& VM->lock);197 spinlock_unlock(&AS->lock); 198 198 tlb_invalid_fail(pstate); 199 199 } … … 224 224 index.value = cp0_index_read(); 225 225 226 spinlock_lock(& VM->lock);226 spinlock_lock(&AS->lock); 227 227 228 228 /* … … 267 267 tlbwi(); 268 268 269 spinlock_unlock(& VM->lock);269 spinlock_unlock(&AS->lock); 270 270 return; 271 271 272 272 fail: 273 spinlock_unlock(& VM->lock);273 spinlock_unlock(&AS->lock); 274 274 tlb_modified_fail(pstate); 275 275 } … … 313 313 * 314 314 * Try to find PTE for faulting address. 315 * The VM->lock must be held on entry to this function.315 * The AS->lock must be held on entry to this function. 316 316 * 317 317 * @param badvaddr Faulting virtual address. … … 329 329 * Handler cannot succeed if the ASIDs don't match. 330 330 */ 331 if (hi.asid != VM->asid) {332 printf("EntryHi.asid=%d, VM->asid=%d\n", hi.asid, VM->asid);331 if (hi.asid != AS->asid) { 332 printf("EntryHi.asid=%d, AS->asid=%d\n", hi.asid, AS->asid); 333 333 return NULL; 334 334 } 335 335 336 /* 337 * Check if the mapping exists in page tables. 338 */ 339 pte = page_mapping_find(badvaddr, AS->asid, 0); 340 if (pte && pte->lo.v) { 341 /* 342 * Mapping found in page tables. 343 * Immediately succeed. 344 */ 345 return pte; 346 } else { 347 /* 348 * Mapping not found in page tables. 349 * Resort to higher-level page fault handler. 350 */ 351 if (as_page_fault(badvaddr)) { 352 /* 353 * The higher-level page fault handler succeeded, 354 * The mapping ought to be in place. 355 */ 356 pte = page_mapping_find(badvaddr, AS->asid, 0); 357 ASSERT(pte && pte->lo.v); 358 return pte; 359 } 360 } 361 336 362 /* 337 363 * Handler cannot succeed if badvaddr has no mapping. 338 364 */ 339 pte = page_mapping_find(badvaddr, VM->asid, 0);340 365 if (!pte) { 341 366 printf("No such mapping.\n");
Note:
See TracChangeset
for help on using the changeset viewer.