Changeset 2299914 in mainline for arch/mips32/src/mm/tlb.c
- Timestamp:
- 2006-03-16T12:57:31Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e898a8d7
- Parents:
- b7dcabb
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
arch/mips32/src/mm/tlb.c
rb7dcabb r2299914 88 88 { 89 89 entry_lo_t lo; 90 entry_hi_t hi; 90 entry_hi_t hi; 91 asid_t asid; 91 92 __address badvaddr; 92 93 pte_t *pte; … … 94 95 badvaddr = cp0_badvaddr_read(); 95 96 96 spinlock_lock(&AS->lock); 97 spinlock_lock(&AS->lock); 98 asid = AS->asid; 99 spinlock_unlock(&AS->lock); 100 101 page_table_lock(AS, true); 97 102 98 103 pte = find_mapping_and_check(badvaddr); … … 105 110 pte->a = 1; 106 111 107 prepare_entry_hi(&hi, AS->asid, badvaddr);112 prepare_entry_hi(&hi, asid, badvaddr); 108 113 prepare_entry_lo(&lo, pte->g, pte->p, pte->d, pte->cacheable, pte->pfn); 109 114 … … 123 128 tlbwr(); 124 129 125 spinlock_unlock(&AS->lock);130 page_table_unlock(AS, true); 126 131 return; 127 132 128 133 fail: 129 spinlock_unlock(&AS->lock);134 page_table_unlock(AS, true); 130 135 tlb_refill_fail(istate); 131 136 } … … 155 160 tlbp(); 156 161 index.value = cp0_index_read(); 157 158 spinlock_lock(&AS->lock);162 163 page_table_lock(AS, true); 159 164 160 165 /* … … 192 197 tlbwi(); 193 198 194 spinlock_unlock(&AS->lock);199 page_table_unlock(AS, true); 195 200 return; 196 201 197 202 fail: 198 spinlock_unlock(&AS->lock);203 page_table_unlock(AS, true); 199 204 tlb_invalid_fail(istate); 200 205 } … … 224 229 tlbp(); 225 230 index.value = cp0_index_read(); 226 227 spinlock_lock(&AS->lock);231 232 page_table_lock(AS, true); 228 233 229 234 /* … … 268 273 tlbwi(); 269 274 270 spinlock_unlock(&AS->lock);275 page_table_unlock(AS, true); 271 276 return; 272 277 273 278 fail: 274 spinlock_unlock(&AS->lock);279 page_table_unlock(AS, true); 275 280 tlb_modified_fail(istate); 276 281 } … … 350 355 * Resort to higher-level page fault handler. 351 356 */ 357 page_table_unlock(AS, true); 352 358 if (as_page_fault(badvaddr)) { 353 359 /* … … 355 361 * The mapping ought to be in place. 356 362 */ 363 page_table_lock(AS, true); 357 364 pte = page_mapping_find(AS, badvaddr); 358 365 ASSERT(pte && pte->p); 359 366 return pte; 367 } else { 368 page_table_lock(AS, true); 369 printf("Page fault.\n"); 370 return NULL; 360 371 } 361 } 362 363 /* 364 * Handler cannot succeed if badvaddr has no mapping. 365 */ 366 if (!pte) { 367 printf("No such mapping.\n"); 368 return NULL; 369 } 370 371 /* 372 * Handler cannot succeed if the mapping is marked as invalid. 373 */ 374 if (!pte->p) { 375 printf("Invalid mapping.\n"); 376 return NULL; 377 } 378 379 return pte; 372 373 } 380 374 } 381 375
Note:
See TracChangeset
for help on using the changeset viewer.