Changeset e0b241f in mainline for kernel/arch/sparc64/src/mm/tlb.c


Ignore:
Timestamp:
2006-08-31T11:55:19Z (18 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ed166f7
Parents:
beb3926a
Message:

sparc64 work.

  • Convert interrupt_vector trap handler and some mm related trap handlers to

use preemptibe_handler(), which is essential for traps coming from userspace.

  • Add fast_data_access_protection() handler.
File:
1 edited

Legend:

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

    rbeb3926a re0b241f  
    5555static void do_fast_data_access_mmu_miss_fault(istate_t *istate, const char *str);
    5656static void do_fast_instruction_access_mmu_miss_fault(istate_t *istate, const char *str);
     57static void do_fast_data_access_protection_fault(istate_t *istate, const char *str);
    5758
    5859char *context_encoding[] = {
     
    246247void fast_data_access_protection(int n, istate_t *istate)
    247248{
    248         panic("%s\n", __FUNCTION__);
     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);
     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        }
    249277}
    250278
     
    298326}
    299327
     328void 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
     334        tag.value = dtlb_tag_access_read();
     335        va = tag.vpn * PAGE_SIZE;
     336
     337        printf("Faulting page: %p, ASID=%d\n", va, tag.context);
     338        printf("TPC=%p, (%s)\n", istate->tpc, tpc_str);
     339        panic("%s\n", str);
     340}
     341
    300342/** Invalidate all unlocked ITLB and DTLB entries. */
    301343void tlb_invalidate_all(void)
Note: See TracChangeset for help on using the changeset viewer.