Changeset fd85ae5 in mainline for kernel/arch/sparc64/src/mm/tlb.c
- Timestamp:
- 2006-09-04T19:11:23Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- fadd381
- Parents:
- cfa70add
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/sparc64/src/mm/tlb.c
rcfa70add rfd85ae5 53 53 static void dtlb_pte_copy(pte_t *t, bool ro); 54 54 static void itlb_pte_copy(pte_t *t); 55 static void do_fast_data_access_mmu_miss_fault(istate_t *istate, const char *str);56 55 static void do_fast_instruction_access_mmu_miss_fault(istate_t *istate, const char *str); 57 static void do_fast_data_access_protection_fault(istate_t *istate, const char *str); 56 static void do_fast_data_access_mmu_miss_fault(istate_t *istate, tlb_tag_access_reg_t tag, const char *str); 57 static void do_fast_data_access_protection_fault(istate_t *istate, tlb_tag_access_reg_t tag, const char *str); 58 58 59 59 char *context_encoding[] = { … … 214 214 215 215 tag.value = dtlb_tag_access_read(); 216 va = tag.vpn * PAGE_SIZE; 216 va = tag.vpn << PAGE_WIDTH; 217 217 218 if (tag.context == ASID_KERNEL) { 218 219 if (!tag.vpn) { 219 220 /* NULL access in kernel */ 220 do_fast_data_access_mmu_miss_fault(istate, __FUNCTION__);221 } 222 do_fast_data_access_mmu_miss_fault(istate, "Unexpected kernel page fault.");221 do_fast_data_access_mmu_miss_fault(istate, tag, __FUNCTION__); 222 } 223 do_fast_data_access_mmu_miss_fault(istate, tag, "Unexpected kernel page fault."); 223 224 } 224 225 … … 239 240 page_table_unlock(AS, true); 240 241 if (as_page_fault(va, PF_ACCESS_READ, istate) == AS_PF_FAULT) { 241 do_fast_data_access_mmu_miss_fault(istate, __FUNCTION__);242 do_fast_data_access_mmu_miss_fault(istate, tag, __FUNCTION__); 242 243 } 243 244 } … … 252 253 253 254 tag.value = dtlb_tag_access_read(); 254 va = tag.vpn * PAGE_SIZE;255 va = tag.vpn << PAGE_WIDTH; 255 256 256 257 page_table_lock(AS, true); … … 272 273 page_table_unlock(AS, true); 273 274 if (as_page_fault(va, PF_ACCESS_WRITE, istate) == AS_PF_FAULT) { 274 do_fast_data_access_protection_fault(istate, __FUNCTION__);275 do_fast_data_access_protection_fault(istate, tag, __FUNCTION__); 275 276 } 276 277 } … … 312 313 } 313 314 314 void do_fast_data_access_mmu_miss_fault(istate_t *istate, const char *str) 315 { 316 tlb_tag_access_reg_t tag; 315 void do_fast_data_access_mmu_miss_fault(istate_t *istate, tlb_tag_access_reg_t tag, const char *str) 316 { 317 317 uintptr_t va; 318 318 char *tpc_str = get_symtab_entry(istate->tpc); 319 319 320 tag.value = dtlb_tag_access_read(); 321 va = tag.vpn * PAGE_SIZE; 320 va = tag.vpn << PAGE_WIDTH; 322 321 323 322 printf("Faulting page: %p, ASID=%d\n", va, tag.context); … … 326 325 } 327 326 328 void do_fast_data_access_protection_fault(istate_t *istate, const char *str) 329 { 330 tlb_tag_access_reg_t tag; 327 void do_fast_data_access_protection_fault(istate_t *istate, tlb_tag_access_reg_t tag, const char *str) 328 { 331 329 uintptr_t va; 332 330 char *tpc_str = get_symtab_entry(istate->tpc); 333 331 334 tag.value = dtlb_tag_access_read(); 335 va = tag.vpn * PAGE_SIZE; 332 va = tag.vpn << PAGE_WIDTH; 336 333 337 334 printf("Faulting page: %p, ASID=%d\n", va, tag.context); … … 375 372 void tlb_invalidate_asid(asid_t asid) 376 373 { 377 tlb_context_reg_t sc_save, ctx; 378 379 ctx.v = sc_save.v = mmu_secondary_context_read(); 374 tlb_context_reg_t pc_save, ctx; 375 376 /* switch to nucleus because we are mapped by the primary context */ 377 nucleus_enter(); 378 379 ctx.v = pc_save.v = mmu_primary_context_read(); 380 380 ctx.context = asid; 381 mmu_secondary_context_write(ctx.v); 382 383 itlb_demap(TLB_DEMAP_CONTEXT, TLB_DEMAP_SECONDARY, 0); 384 dtlb_demap(TLB_DEMAP_CONTEXT, TLB_DEMAP_SECONDARY, 0); 385 386 mmu_secondary_context_write(sc_save.v); 381 mmu_primary_context_write(ctx.v); 382 383 itlb_demap(TLB_DEMAP_CONTEXT, TLB_DEMAP_PRIMARY, 0); 384 dtlb_demap(TLB_DEMAP_CONTEXT, TLB_DEMAP_PRIMARY, 0); 385 386 mmu_primary_context_write(pc_save.v); 387 388 nucleus_leave(); 387 389 } 388 390 … … 396 398 { 397 399 int i; 398 tlb_context_reg_t sc_save, ctx; 399 400 ctx.v = sc_save.v = mmu_secondary_context_read(); 400 tlb_context_reg_t pc_save, ctx; 401 402 /* switch to nucleus because we are mapped by the primary context */ 403 nucleus_enter(); 404 405 ctx.v = pc_save.v = mmu_primary_context_read(); 401 406 ctx.context = asid; 402 mmu_ secondary_context_write(ctx.v);407 mmu_primary_context_write(ctx.v); 403 408 404 409 for (i = 0; i < cnt; i++) { 405 itlb_demap(TLB_DEMAP_PAGE, TLB_DEMAP_SECONDARY, page + i * PAGE_SIZE); 406 dtlb_demap(TLB_DEMAP_PAGE, TLB_DEMAP_SECONDARY, page + i * PAGE_SIZE); 407 } 408 409 mmu_secondary_context_write(sc_save.v); 410 itlb_demap(TLB_DEMAP_PAGE, TLB_DEMAP_PRIMARY, page + i * PAGE_SIZE); 411 dtlb_demap(TLB_DEMAP_PAGE, TLB_DEMAP_PRIMARY, page + i * PAGE_SIZE); 412 } 413 414 mmu_primary_context_write(pc_save.v); 415 416 nucleus_leave(); 410 417 } 411 418
Note:
See TracChangeset
for help on using the changeset viewer.