Ignore:
File:
1 edited

Legend:

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

    r1dbc43f r9aed144  
    6262static void itlb_pte_copy(pte_t *);
    6363static void dtlb_pte_copy(pte_t *, bool);
     64static void do_fast_instruction_access_mmu_miss_fault(istate_t *, uintptr_t,
     65    const char *);
     66static void do_fast_data_access_mmu_miss_fault(istate_t *, uint64_t,
     67    const char *);
     68static void do_fast_data_access_protection_fault(istate_t *,
     69    uint64_t, const char *);
    6470
    6571/*
     
    229235                 * handler.
    230236                 */
    231                 as_page_fault(va, PF_ACCESS_EXEC, istate);
     237                if (as_page_fault(va, PF_ACCESS_EXEC, istate) == AS_PF_FAULT) {
     238                        do_fast_instruction_access_mmu_miss_fault(istate,
     239                            istate->tpc, __func__);
     240                }
    232241        }
    233242}
     
    255264                if (va == 0) {
    256265                        /* NULL access in kernel */
    257                         panic("NULL pointer dereference.");
     266                        do_fast_data_access_mmu_miss_fault(istate, page_and_ctx,
     267                            __func__);
    258268                }
    259                 panic("Unexpected kernel page fault.");
     269                do_fast_data_access_mmu_miss_fault(istate, page_and_ctx, "Unexpected "
     270                    "kernel page fault.");
    260271        }
    261272
     
    276287                 * handler.
    277288                 */             
    278                 as_page_fault(va, PF_ACCESS_READ, istate);
     289                if (as_page_fault(va, PF_ACCESS_READ, istate) == AS_PF_FAULT) {
     290                        do_fast_data_access_mmu_miss_fault(istate, page_and_ctx,
     291                            __func__);
     292                }
    279293        }
    280294}
     
    315329                 * handler.
    316330                 */             
    317                 as_page_fault(va, PF_ACCESS_WRITE, istate);
     331                if (as_page_fault(va, PF_ACCESS_WRITE, istate) == AS_PF_FAULT) {
     332                        do_fast_data_access_protection_fault(istate, page_and_ctx,
     333                            __func__);
     334                }
    318335        }
    319336}
     
    329346}
    330347
     348void do_fast_instruction_access_mmu_miss_fault(istate_t *istate, uintptr_t va,
     349    const char *str)
     350{
     351        fault_if_from_uspace(istate, "%s, address=%p.", str,
     352            (void *) va);
     353        panic_memtrap(istate, PF_ACCESS_EXEC, va, str);
     354}
     355
     356void do_fast_data_access_mmu_miss_fault(istate_t *istate,
     357    uint64_t page_and_ctx, const char *str)
     358{
     359        fault_if_from_uspace(istate, "%s, page=%p (asid=%" PRId64 ").", str,
     360            (void *) DMISS_ADDRESS(page_and_ctx), DMISS_CONTEXT(page_and_ctx));
     361        panic_memtrap(istate, PF_ACCESS_UNKNOWN, DMISS_ADDRESS(page_and_ctx),
     362            str);
     363}
     364
     365void do_fast_data_access_protection_fault(istate_t *istate,
     366    uint64_t page_and_ctx, const char *str)
     367{
     368        fault_if_from_uspace(istate, "%s, page=%p (asid=%" PRId64 ").", str,
     369            (void *) DMISS_ADDRESS(page_and_ctx), DMISS_CONTEXT(page_and_ctx));
     370        panic_memtrap(istate, PF_ACCESS_WRITE, DMISS_ADDRESS(page_and_ctx),
     371            str);
     372}
     373
    331374/**
    332375 * Describes the exact condition which caused the last DMMU fault.
Note: See TracChangeset for help on using the changeset viewer.