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


Ignore:
Timestamp:
2006-09-04T19:11:23Z (18 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
fadd381
Parents:
cfa70add
Message:

sparc64 kernel fixes

File:
1 edited

Legend:

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

    rcfa70add rfd85ae5  
    5353static void dtlb_pte_copy(pte_t *t, bool ro);
    5454static void itlb_pte_copy(pte_t *t);
    55 static void do_fast_data_access_mmu_miss_fault(istate_t *istate, const char *str);
    5655static 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);
     56static void do_fast_data_access_mmu_miss_fault(istate_t *istate, tlb_tag_access_reg_t tag, const char *str);
     57static void do_fast_data_access_protection_fault(istate_t *istate, tlb_tag_access_reg_t tag, const char *str);
    5858
    5959char *context_encoding[] = {
     
    214214
    215215        tag.value = dtlb_tag_access_read();
    216         va = tag.vpn * PAGE_SIZE;
     216        va = tag.vpn << PAGE_WIDTH;
     217
    217218        if (tag.context == ASID_KERNEL) {
    218219                if (!tag.vpn) {
    219220                        /* NULL access in kernel */
    220                         do_fast_data_access_mmu_miss_fault(istate, __FUNCTION__);
    221                 }
    222                 do_fast_data_access_mmu_miss_fault(istate, "Unexpected kernel page fault.");
     221                        do_fast_data_access_mmu_miss_fault(istate, tag, __FUNCTION__);
     222                }
     223                do_fast_data_access_mmu_miss_fault(istate, tag, "Unexpected kernel page fault.");
    223224        }
    224225
     
    239240                page_table_unlock(AS, true);
    240241                if (as_page_fault(va, PF_ACCESS_READ, istate) == AS_PF_FAULT) {
    241                         do_fast_data_access_mmu_miss_fault(istate, __FUNCTION__);
     242                        do_fast_data_access_mmu_miss_fault(istate, tag, __FUNCTION__);
    242243                }
    243244        }
     
    252253
    253254        tag.value = dtlb_tag_access_read();
    254         va = tag.vpn * PAGE_SIZE;
     255        va = tag.vpn << PAGE_WIDTH;
    255256
    256257        page_table_lock(AS, true);
     
    272273                page_table_unlock(AS, true);
    273274                if (as_page_fault(va, PF_ACCESS_WRITE, istate) == AS_PF_FAULT) {
    274                         do_fast_data_access_protection_fault(istate, __FUNCTION__);
     275                        do_fast_data_access_protection_fault(istate, tag, __FUNCTION__);
    275276                }
    276277        }
     
    312313}
    313314
    314 void do_fast_data_access_mmu_miss_fault(istate_t *istate, const char *str)
    315 {
    316         tlb_tag_access_reg_t tag;
     315void do_fast_data_access_mmu_miss_fault(istate_t *istate, tlb_tag_access_reg_t tag, const char *str)
     316{
    317317        uintptr_t va;
    318318        char *tpc_str = get_symtab_entry(istate->tpc);
    319319
    320         tag.value = dtlb_tag_access_read();
    321         va = tag.vpn * PAGE_SIZE;
     320        va = tag.vpn << PAGE_WIDTH;
    322321
    323322        printf("Faulting page: %p, ASID=%d\n", va, tag.context);
     
    326325}
    327326
    328 void do_fast_data_access_protection_fault(istate_t *istate, const char *str)
    329 {
    330         tlb_tag_access_reg_t tag;
     327void do_fast_data_access_protection_fault(istate_t *istate, tlb_tag_access_reg_t tag, const char *str)
     328{
    331329        uintptr_t va;
    332330        char *tpc_str = get_symtab_entry(istate->tpc);
    333331
    334         tag.value = dtlb_tag_access_read();
    335         va = tag.vpn * PAGE_SIZE;
     332        va = tag.vpn << PAGE_WIDTH;
    336333
    337334        printf("Faulting page: %p, ASID=%d\n", va, tag.context);
     
    375372void tlb_invalidate_asid(asid_t asid)
    376373{
    377         tlb_context_reg_t sc_save, ctx;
    378        
    379         ctx.v = sc_save.v = mmu_secondary_context_read();
     374        tlb_context_reg_t pc_save, ctx;
     375       
     376        /* switch to nucleus because we are mapped by the primary context */
     377        nucleus_enter();
     378       
     379        ctx.v = pc_save.v = mmu_primary_context_read();
    380380        ctx.context = asid;
    381         mmu_secondary_context_write(ctx.v);
    382        
    383         itlb_demap(TLB_DEMAP_CONTEXT, TLB_DEMAP_SECONDARY, 0);
    384         dtlb_demap(TLB_DEMAP_CONTEXT, TLB_DEMAP_SECONDARY, 0);
    385        
    386         mmu_secondary_context_write(sc_save.v);
     381        mmu_primary_context_write(ctx.v);
     382       
     383        itlb_demap(TLB_DEMAP_CONTEXT, TLB_DEMAP_PRIMARY, 0);
     384        dtlb_demap(TLB_DEMAP_CONTEXT, TLB_DEMAP_PRIMARY, 0);
     385       
     386        mmu_primary_context_write(pc_save.v);
     387       
     388        nucleus_leave();
    387389}
    388390
     
    396398{
    397399        int i;
    398         tlb_context_reg_t sc_save, ctx;
    399        
    400         ctx.v = sc_save.v = mmu_secondary_context_read();
     400        tlb_context_reg_t pc_save, ctx;
     401       
     402        /* switch to nucleus because we are mapped by the primary context */
     403        nucleus_enter();
     404       
     405        ctx.v = pc_save.v = mmu_primary_context_read();
    401406        ctx.context = asid;
    402         mmu_secondary_context_write(ctx.v);
     407        mmu_primary_context_write(ctx.v);
    403408       
    404409        for (i = 0; i < cnt; i++) {
    405                 itlb_demap(TLB_DEMAP_PAGE, TLB_DEMAP_SECONDARY, page + i * PAGE_SIZE);
    406                 dtlb_demap(TLB_DEMAP_PAGE, TLB_DEMAP_SECONDARY, page + i * PAGE_SIZE);
    407         }
    408        
    409         mmu_secondary_context_write(sc_save.v);
     410                itlb_demap(TLB_DEMAP_PAGE, TLB_DEMAP_PRIMARY, page + i * PAGE_SIZE);
     411                dtlb_demap(TLB_DEMAP_PAGE, TLB_DEMAP_PRIMARY, page + i * PAGE_SIZE);
     412        }
     413       
     414        mmu_primary_context_write(pc_save.v);
     415       
     416        nucleus_leave();
    410417}
    411418
Note: See TracChangeset for help on using the changeset viewer.