Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/sparc64/src/mm/sun4u/tlb.c

    r59fb782 r0e78394  
    5858static void dtlb_pte_copy(pte_t *, size_t, bool);
    5959static void itlb_pte_copy(pte_t *, size_t);
     60static void do_fast_instruction_access_mmu_miss_fault(istate_t *, uintptr_t,
     61    const char *);
     62static void do_fast_data_access_mmu_miss_fault(istate_t *, tlb_tag_access_reg_t,
     63    const char *);
     64static void do_fast_data_access_protection_fault(istate_t *,
     65    tlb_tag_access_reg_t, const char *);
    6066
    6167const char *context_encoding[] = {
     
    196202void fast_instruction_access_mmu_miss(sysarg_t unused, istate_t *istate)
    197203{
     204        uintptr_t page_16k = ALIGN_DOWN(istate->tpc, PAGE_SIZE);
    198205        size_t index = (istate->tpc >> MMU_PAGE_WIDTH) % MMU_PAGES_PER_PAGE;
    199206        pte_t *t;
    200207
    201         t = page_mapping_find(AS, istate->tpc, true);
     208        t = page_mapping_find(AS, page_16k, true);
    202209        if (t && PTE_EXECUTABLE(t)) {
    203210                /*
     
    215222                 * handler.
    216223                 */
    217                 as_page_fault(istate->tpc, PF_ACCESS_EXEC, istate);
     224                if (as_page_fault(page_16k, PF_ACCESS_EXEC, istate) ==
     225                    AS_PF_FAULT) {
     226                        do_fast_instruction_access_mmu_miss_fault(istate,
     227                            istate->tpc, __func__);
     228                }
    218229        }
    219230}
     
    245256                if (!tag.vpn) {
    246257                        /* NULL access in kernel */
    247                         panic("NULL pointer dereference.");
     258                        do_fast_data_access_mmu_miss_fault(istate, tag,
     259                            "Dereferencing NULL pointer.");
    248260                } else if (page_8k >= end_of_identity) {
    249261                        /* Kernel non-identity. */
    250262                        as = AS_KERNEL;
    251263                } else {
    252                         panic("Unexpected kernel page fault.");
     264                        do_fast_data_access_mmu_miss_fault(istate, tag,
     265                    "Unexpected kernel page fault.");
    253266                }
    254267        }
     
    270283                 * handler.
    271284                 */
    272                 as_page_fault(page_16k, PF_ACCESS_READ, istate);
     285                if (as_page_fault(page_16k, PF_ACCESS_READ, istate) ==
     286                    AS_PF_FAULT) {
     287                        do_fast_data_access_mmu_miss_fault(istate, tag,
     288                            __func__);
     289                }
    273290        }
    274291}
     
    315332                 * handler.
    316333                 */             
    317                 as_page_fault(page_16k, PF_ACCESS_WRITE, istate);
     334                if (as_page_fault(page_16k, PF_ACCESS_WRITE, istate) ==
     335                    AS_PF_FAULT) {
     336                        do_fast_data_access_protection_fault(istate, tag,
     337                            __func__);
     338                }
    318339        }
    319340}
     
    407428
    408429#endif
     430
     431void do_fast_instruction_access_mmu_miss_fault(istate_t *istate,
     432    uintptr_t va, const char *str)
     433{
     434        fault_if_from_uspace(istate, "%s, address=%p.", str, (void *) va);
     435        panic_memtrap(istate, PF_ACCESS_EXEC, va, str);
     436}
     437
     438void do_fast_data_access_mmu_miss_fault(istate_t *istate,
     439    tlb_tag_access_reg_t tag, const char *str)
     440{
     441        uintptr_t va;
     442
     443        va = tag.vpn << MMU_PAGE_WIDTH;
     444        fault_if_from_uspace(istate, "%s, page=%p (asid=%u).", str,
     445            (void *) va, tag.context);
     446        panic_memtrap(istate, PF_ACCESS_UNKNOWN, va, str);
     447}
     448
     449void do_fast_data_access_protection_fault(istate_t *istate,
     450    tlb_tag_access_reg_t tag, const char *str)
     451{
     452        uintptr_t va;
     453
     454        va = tag.vpn << MMU_PAGE_WIDTH;
     455        fault_if_from_uspace(istate, "%s, page=%p (asid=%u).", str,
     456            (void *) va, tag.context);
     457        panic_memtrap(istate, PF_ACCESS_WRITE, va, str);
     458}
    409459
    410460void describe_dmmu_fault(void)
Note: See TracChangeset for help on using the changeset viewer.