Rev 1852 | Rev 1860 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1852 | Rev 1859 | ||
---|---|---|---|
Line 52... | Line 52... | ||
52 | 52 | ||
53 | static void dtlb_pte_copy(pte_t *t, bool ro); |
53 | static void dtlb_pte_copy(pte_t *t, bool ro); |
54 | static void itlb_pte_copy(pte_t *t); |
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); |
55 | static void do_fast_data_access_mmu_miss_fault(istate_t *istate, const char *str); |
56 | static void do_fast_instruction_access_mmu_miss_fault(istate_t *istate, const char *str); |
56 | 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); |
|
57 | 58 | ||
58 | char *context_encoding[] = { |
59 | char *context_encoding[] = { |
59 | "Primary", |
60 | "Primary", |
60 | "Secondary", |
61 | "Secondary", |
61 | "Nucleus", |
62 | "Nucleus", |
Line 243... | Line 244... | ||
243 | } |
244 | } |
244 | 245 | ||
245 | /** DTLB protection fault handler. */ |
246 | /** DTLB protection fault handler. */ |
246 | void fast_data_access_protection(int n, istate_t *istate) |
247 | void fast_data_access_protection(int n, istate_t *istate) |
247 | { |
248 | { |
- | 249 | tlb_tag_access_reg_t tag; |
|
- | 250 | uintptr_t va; |
|
- | 251 | pte_t *t; |
|
- | 252 | ||
- | 253 | tag.value = dtlb_tag_access_read(); |
|
- | 254 | va = tag.vpn * PAGE_SIZE; |
|
- | 255 | ||
- | 256 | page_table_lock(AS, true); |
|
- | 257 | t = page_mapping_find(AS, va); |
|
- | 258 | if (t && PTE_WRITABLE(t)) { |
|
- | 259 | /* |
|
- | 260 | * The mapping was found in the software page hash table and is writable. |
|
- | 261 | * Demap the old mapping and insert an updated mapping into DTLB. |
|
- | 262 | */ |
|
- | 263 | t->a = true; |
|
- | 264 | t->d = true; |
|
- | 265 | dtlb_demap(TLB_DEMAP_PAGE, TLB_DEMAP_SECONDARY, va); |
|
- | 266 | dtlb_pte_copy(t, false); |
|
248 | panic("%s\n", __FUNCTION__); |
267 | page_table_unlock(AS, true); |
- | 268 | } else { |
|
- | 269 | /* |
|
- | 270 | * Forward the page fault to the address space page fault handler. |
|
- | 271 | */ |
|
- | 272 | page_table_unlock(AS, true); |
|
- | 273 | if (as_page_fault(va, PF_ACCESS_WRITE, istate) == AS_PF_FAULT) { |
|
- | 274 | do_fast_data_access_protection_fault(istate, __FUNCTION__); |
|
- | 275 | } |
|
- | 276 | } |
|
249 | } |
277 | } |
250 | 278 | ||
251 | /** Print contents of both TLBs. */ |
279 | /** Print contents of both TLBs. */ |
252 | void tlb_print(void) |
280 | void tlb_print(void) |
253 | { |
281 | { |
Line 287... | Line 315... | ||
287 | { |
315 | { |
288 | tlb_tag_access_reg_t tag; |
316 | tlb_tag_access_reg_t tag; |
289 | uintptr_t va; |
317 | uintptr_t va; |
290 | char *tpc_str = get_symtab_entry(istate->tpc); |
318 | char *tpc_str = get_symtab_entry(istate->tpc); |
291 | 319 | ||
- | 320 | tag.value = dtlb_tag_access_read(); |
|
- | 321 | va = tag.vpn * PAGE_SIZE; |
|
- | 322 | ||
- | 323 | printf("Faulting page: %p, ASID=%d\n", va, tag.context); |
|
- | 324 | printf("TPC=%p, (%s)\n", istate->tpc, tpc_str); |
|
- | 325 | panic("%s\n", str); |
|
- | 326 | } |
|
- | 327 | ||
- | 328 | void do_fast_data_access_protection_fault(istate_t *istate, const char *str) |
|
- | 329 | { |
|
- | 330 | tlb_tag_access_reg_t tag; |
|
- | 331 | uintptr_t va; |
|
- | 332 | char *tpc_str = get_symtab_entry(istate->tpc); |
|
- | 333 | ||
292 | tag.value = dtlb_tag_access_read(); |
334 | tag.value = dtlb_tag_access_read(); |
293 | va = tag.vpn * PAGE_SIZE; |
335 | va = tag.vpn * PAGE_SIZE; |
294 | 336 | ||
295 | printf("Faulting page: %p, ASID=%d\n", va, tag.context); |
337 | printf("Faulting page: %p, ASID=%d\n", va, tag.context); |
296 | printf("TPC=%p, (%s)\n", istate->tpc, tpc_str); |
338 | printf("TPC=%p, (%s)\n", istate->tpc, tpc_str); |