Changeset 5e53e02 in mainline
- Timestamp:
- 2009-12-06T19:02:16Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 77f65df
- Parents:
- ba50a34
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/sparc64/src/mm/sun4v/tlb.c
rba50a34 r5e53e02 60 60 #endif 61 61 62 //static void dtlb_pte_copy(pte_t *, size_t, bool);62 void dtlb_pte_copy(pte_t *t, bool ro); 63 63 static void itlb_pte_copy(pte_t *); 64 64 static void do_fast_instruction_access_mmu_miss_fault(istate_t *, const char *); 65 //static void do_fast_data_access_mmu_miss_fault(istate_t *, uint64_t, 66 // const char *); 67 //static void do_fast_data_access_protection_fault(istate_t *, 68 // uint64_t, const char *); 65 void do_fast_data_access_mmu_miss_fault(istate_t *istate, 66 uint64_t page_and_ctx, const char *str); 67 static void do_fast_data_access_protection_fault(istate_t *, 68 uint64_t, const char *); 69 70 /* 71 * The assembly language routine passes a 64-bit parameter to the Data Access 72 * MMU Miss and Data Access protection handlers, the parameter encapsulates 73 * a virtual address of the faulting page and the faulting context. The most 74 * significant 51 bits represent the VA of the faulting page and the least 75 * significant 13 vits represent the faulting context. The following macros 76 * extract the page and context out of the 64-bit parameter: 77 */ 78 79 /* extracts the VA of the faulting page */ 80 #define DMISS_ADDRESS(page_and_ctx) (((page_and_ctx) >> 13) << 13) 81 82 /* extracts the faulting context */ 83 #define DMISS_CONTEXT(page_and_ctx) ((page_and_ctx) & 0x1fff) 69 84 70 85 char *context_encoding[] = { … … 132 147 } 133 148 134 #if 0135 149 /** Copy PTE to TLB. 136 150 * 137 151 * @param t Page Table Entry to be copied. 138 * @param index Zero if lower 8K-subpage, one if higher 8K-subpage.139 152 * @param ro If true, the entry will be created read-only, regardless 140 153 * of its w field. 141 154 */ 142 void dtlb_pte_copy(pte_t *t, size_t index, bool ro) 143 { 144 tlb_tag_access_reg_t tag; 145 tlb_data_t data; 146 page_address_t pg; 147 frame_address_t fr; 148 149 pg.address = t->page + (index << MMU_PAGE_WIDTH); 150 fr.address = t->frame + (index << MMU_PAGE_WIDTH); 151 152 tag.value = 0; 153 tag.context = t->as->asid; 154 tag.vpn = pg.vpn; 155 156 dtlb_tag_access_write(tag.value); 157 155 void dtlb_pte_copy(pte_t *t, bool ro) 156 { 157 tte_data_t data; 158 158 159 data.value = 0; 159 160 data.v = true; 160 data.size = PAGESIZE_8K; 161 data.pfn = fr.pfn; 162 data.l = false; 161 data.nfo = false; 162 data.ra = (t->frame) >> FRAME_WIDTH; 163 data.ie = false; 164 data.e = false; 163 165 data.cp = t->c; 164 166 #ifdef CONFIG_VIRT_IDX_DCACHE 165 167 data.cv = t->c; 166 #endif /* CONFIG_VIRT_IDX_DCACHE */ 167 data.p = t->k; /* p like privileged */ 168 #endif 169 data.p = t->k; 170 data.x = false; 168 171 data.w = ro ? false : t->w; 169 data.g = t->g; 170 171 dtlb_data_in_write(data.value); 172 } 173 #endif 172 data.size = PAGESIZE_8K; 173 174 __hypercall_hyperfast( 175 t->page, t->as->asid, data.value, MMU_FLAG_DTLB, 0, MMU_MAP_ADDR); 176 } 177 174 178 175 179 /** Copy PTE to ITLB. … … 246 250 void fast_data_access_mmu_miss(uint64_t page_and_ctx, istate_t *istate) 247 251 { 248 #if 0249 252 pte_t *t; 250 253 uintptr_t va = DMISS_ADDRESS(page_and_ctx); … … 285 288 } 286 289 } 287 #endif 290 asm volatile ("sethi 0x41941, %g0"); 288 291 } 289 292 290 293 /** DTLB protection fault handler. 291 294 * 292 * @param tag Content of the TLB Tag Access register as it existed 293 * when the trap happened. This is to prevent confusion 294 * created by clobbered Tag Access register during a nested 295 * DTLB miss. 295 * @param page_and_ctx A 64-bit value describing the fault. The most 296 * significant 51 bits of the value contain the virtual 297 * address which caused the fault truncated to the page 298 * boundary. The least significant 13 bits of the value 299 * contain the number of the context in which the fault 300 * occurred. 296 301 * @param istate Interrupted state saved on the stack. 297 302 */ 298 303 void fast_data_access_protection(uint64_t page_and_ctx, istate_t *istate) 299 304 { 300 #if 0301 305 pte_t *t; 302 303 306 uintptr_t va = DMISS_ADDRESS(page_and_ctx); 304 307 uint16_t ctx = DMISS_CONTEXT(page_and_ctx); … … 326 329 */ 327 330 page_table_unlock(AS, true); 328 if (as_page_fault(page_16k, PF_ACCESS_WRITE, istate) == 329 AS_PF_FAULT) { 330 do_fast_data_access_protection_fault(istate, tag, 331 if (as_page_fault(va, PF_ACCESS_WRITE, istate) == AS_PF_FAULT) { 332 do_fast_data_access_protection_fault(istate, page_and_ctx, 331 333 __func__); 332 334 } 333 335 } 334 #endif 335 } 336 } 337 336 338 337 339 /** Print TLB entry (for debugging purposes). … … 357 359 } 358 360 359 #if 0360 361 void do_fast_data_access_mmu_miss_fault(istate_t *istate, 361 362 uint64_t page_and_ctx, const char *str) … … 366 367 } 367 368 dump_istate(istate); 368 printf("Faulting page: %p, ASID=%d.\n", va, tag.context); 369 panic("%s.", str); 370 } 371 #endif 372 373 #if 0 369 printf("Faulting page: %p, ASID=%d\n", DMISS_ADDRESS(page_and_ctx), DMISS_CONTEXT(page_and_ctx)); 370 panic("%s\n", str); 371 } 372 374 373 void do_fast_data_access_protection_fault(istate_t *istate, 375 374 uint64_t page_and_ctx, const char *str) … … 381 380 printf("Faulting page: %p, ASID=%d\n", DMISS_ADDRESS(page_and_ctx), DMISS_CONTEXT(page_and_ctx)); 382 381 dump_istate(istate); 383 panic("%s.", str); 384 } 385 #endif 382 panic("%s\n", str); 383 } 386 384 387 385 /**
Note:
See TracChangeset
for help on using the changeset viewer.