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


Ignore:
Timestamp:
2006-12-16T19:07:02Z (18 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7e7c8747
Parents:
1ecdbb0
Message:

Formatting and indentation changes.

File:
1 edited

Legend:

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

    r1ecdbb0 r771cd22  
    5858static void dtlb_pte_copy(pte_t *t, bool ro);
    5959static void itlb_pte_copy(pte_t *t);
    60 static void do_fast_instruction_access_mmu_miss_fault(istate_t *istate, const char *str);
    61 static void do_fast_data_access_mmu_miss_fault(istate_t *istate, tlb_tag_access_reg_t tag, const char *str);
    62 static void do_fast_data_access_protection_fault(istate_t *istate, tlb_tag_access_reg_t tag, const char *str);
     60static void do_fast_instruction_access_mmu_miss_fault(istate_t *istate, const
     61        char *str);
     62static void do_fast_data_access_mmu_miss_fault(istate_t *istate,
     63         tlb_tag_access_reg_t tag, const char *str);
     64static void do_fast_data_access_protection_fault(istate_t *istate,
     65        tlb_tag_access_reg_t tag, const char *str);
    6366
    6467char *context_encoding[] = {
     
    9194 * @param cacheable True if the mapping is cacheable, false otherwise.
    9295 */
    93 void dtlb_insert_mapping(uintptr_t page, uintptr_t frame, int pagesize, bool locked, bool cacheable)
     96void dtlb_insert_mapping(uintptr_t page, uintptr_t frame, int pagesize, bool
     97        locked, bool cacheable)
    9498{
    9599        tlb_tag_access_reg_t tag;
     
    125129 *
    126130 * @param t Page Table Entry to be copied.
    127  * @param ro If true, the entry will be created read-only, regardless of its w field.
     131 * @param ro If true, the entry will be created read-only, regardless of its w
     132 *      field.
    128133 */
    129134void dtlb_pte_copy(pte_t *t, bool ro)
     
    213218        } else {
    214219                /*
    215                  * Forward the page fault to the address space page fault handler.
     220                 * Forward the page fault to the address space page fault
     221                 * handler.
    216222                 */             
    217223                page_table_unlock(AS, true);
    218224                if (as_page_fault(va, PF_ACCESS_EXEC, istate) == AS_PF_FAULT) {
    219                         do_fast_instruction_access_mmu_miss_fault(istate, __FUNCTION__);
     225                        do_fast_instruction_access_mmu_miss_fault(istate,
     226                                __FUNCTION__);
    220227                }
    221228        }
     
    224231/** DTLB miss handler.
    225232 *
    226  * Note that some faults (e.g. kernel faults) were already resolved
    227  * by the low-level, assembly language part of the fast_data_access_mmu_miss
    228  * handler.
     233 * Note that some faults (e.g. kernel faults) were already resolved by the
     234 * low-level, assembly language part of the fast_data_access_mmu_miss handler.
    229235 */
    230236void fast_data_access_mmu_miss(int n, istate_t *istate)
     
    240246                if (!tag.vpn) {
    241247                        /* NULL access in kernel */
    242                         do_fast_data_access_mmu_miss_fault(istate, tag, __FUNCTION__);
    243                 }
    244                 do_fast_data_access_mmu_miss_fault(istate, tag, "Unexpected kernel page fault.");
     248                        do_fast_data_access_mmu_miss_fault(istate, tag,
     249                                __FUNCTION__);
     250                }
     251                do_fast_data_access_mmu_miss_fault(istate, tag, "Unexpected "
     252                        "kernel page fault.");
    245253        }
    246254
     
    264272                page_table_unlock(AS, true);
    265273                if (as_page_fault(va, PF_ACCESS_READ, istate) == AS_PF_FAULT) {
    266                         do_fast_data_access_mmu_miss_fault(istate, tag, __FUNCTION__);
     274                        do_fast_data_access_mmu_miss_fault(istate, tag,
     275                                __FUNCTION__);
    267276                }
    268277        }
     
    283292        if (t && PTE_WRITABLE(t)) {
    284293                /*
    285                  * The mapping was found in the software page hash table and is writable.
    286                  * Demap the old mapping and insert an updated mapping into DTLB.
     294                 * The mapping was found in the software page hash table and is
     295                 * writable. Demap the old mapping and insert an updated mapping
     296                 * into DTLB.
    287297                 */
    288298                t->a = true;
     
    296306        } else {
    297307                /*
    298                  * Forward the page fault to the address space page fault handler.
     308                 * Forward the page fault to the address space page fault
     309                 * handler.
    299310                 */             
    300311                page_table_unlock(AS, true);
    301312                if (as_page_fault(va, PF_ACCESS_WRITE, istate) == AS_PF_FAULT) {
    302                         do_fast_data_access_protection_fault(istate, tag, __FUNCTION__);
     313                        do_fast_data_access_protection_fault(istate, tag,
     314                                __FUNCTION__);
    303315                }
    304316        }
     
    317329                t.value = itlb_tag_read_read(i);
    318330               
    319                 printf("%d: vpn=%#llx, context=%d, v=%d, size=%d, nfo=%d, ie=%d, soft2=%#x, diag=%#x, pfn=%#x, soft=%#x, l=%d, cp=%d, cv=%d, e=%d, p=%d, w=%d, g=%d\n",
    320                         i, t.vpn, t.context, d.v, d.size, d.nfo, d.ie, d.soft2, d.diag, d.pfn, d.soft, d.l, d.cp, d.cv, d.e, d.p, d.w, d.g);
     331                printf("%d: vpn=%#llx, context=%d, v=%d, size=%d, nfo=%d, "
     332                        "ie=%d, soft2=%#x, diag=%#x, pfn=%#x, soft=%#x, l=%d, "
     333                        "cp=%d, cv=%d, e=%d, p=%d, w=%d, g=%d\n", i, t.vpn,
     334                        t.context, d.v, d.size, d.nfo, d.ie, d.soft2, d.diag,
     335                        d.pfn, d.soft, d.l, d.cp, d.cv, d.e, d.p, d.w, d.g);
    321336        }
    322337
     
    326341                t.value = dtlb_tag_read_read(i);
    327342               
    328                 printf("%d: vpn=%#llx, context=%d, v=%d, size=%d, nfo=%d, ie=%d, soft2=%#x, diag=%#x, pfn=%#x, soft=%#x, l=%d, cp=%d, cv=%d, e=%d, p=%d, w=%d, g=%d\n",
    329                         i, t.vpn, t.context, d.v, d.size, d.nfo, d.ie, d.soft2, d.diag, d.pfn, d.soft, d.l, d.cp, d.cv, d.e, d.p, d.w, d.g);
    330         }
    331 
    332 }
    333 
    334 void do_fast_instruction_access_mmu_miss_fault(istate_t *istate, const char *str)
     343                printf("%d: vpn=%#llx, context=%d, v=%d, size=%d, nfo=%d, "
     344                        "ie=%d, soft2=%#x, diag=%#x, pfn=%#x, soft=%#x, l=%d, "
     345                        "cp=%d, cv=%d, e=%d, p=%d, w=%d, g=%d\n", i, t.vpn,
     346                        t.context, d.v, d.size, d.nfo, d.ie, d.soft2, d.diag,
     347                        d.pfn, d.soft, d.l, d.cp, d.cv, d.e, d.p, d.w, d.g);
     348        }
     349
     350}
     351
     352void do_fast_instruction_access_mmu_miss_fault(istate_t *istate, const char
     353        *str)
    335354{
    336355        fault_if_from_uspace(istate, "%s\n", str);
     
    339358}
    340359
    341 void do_fast_data_access_mmu_miss_fault(istate_t *istate, tlb_tag_access_reg_t tag, const char *str)
     360void do_fast_data_access_mmu_miss_fault(istate_t *istate, tlb_tag_access_reg_t
     361        tag, const char *str)
    342362{
    343363        uintptr_t va;
     
    345365        va = tag.vpn << PAGE_WIDTH;
    346366
    347         fault_if_from_uspace(istate, "%s, Page=%p (ASID=%d)\n", str, va, tag.context);
     367        fault_if_from_uspace(istate, "%s, Page=%p (ASID=%d)\n", str, va,
     368                tag.context);
    348369        dump_istate(istate);
    349370        printf("Faulting page: %p, ASID=%d\n", va, tag.context);
     
    351372}
    352373
    353 void do_fast_data_access_protection_fault(istate_t *istate, tlb_tag_access_reg_t tag, const char *str)
     374void do_fast_data_access_protection_fault(istate_t *istate, tlb_tag_access_reg_t
     375        tag, const char *str)
    354376{
    355377        uintptr_t va;
     
    357379        va = tag.vpn << PAGE_WIDTH;
    358380
    359         fault_if_from_uspace(istate, "%s, Page=%p (ASID=%d)\n", str, va, tag.context);
     381        fault_if_from_uspace(istate, "%s, Page=%p (ASID=%d)\n", str, va,
     382                tag.context);
    360383        printf("Faulting page: %p, ASID=%d\n", va, tag.context);
    361384        dump_istate(istate);
     
    371394        sfar = dtlb_sfar_read();
    372395       
    373         printf("DTLB SFSR: asi=%#x, ft=%#x, e=%d, ct=%d, pr=%d, w=%d, ow=%d, fv=%d\n",
    374                 sfsr.asi, sfsr.ft, sfsr.e, sfsr.ct, sfsr.pr, sfsr.w, sfsr.ow, sfsr.fv);
     396        printf("DTLB SFSR: asi=%#x, ft=%#x, e=%d, ct=%d, pr=%d, w=%d, ow=%d, "
     397                "fv=%d\n", sfsr.asi, sfsr.ft, sfsr.e, sfsr.ct, sfsr.pr, sfsr.w,
     398                sfsr.ow, sfsr.fv);
    375399        printf("DTLB SFAR: address=%p\n", sfar);
    376400       
     
    407431}
    408432
    409 /** Invalidate all ITLB and DTLB entries that belong to specified ASID (Context).
     433/** Invalidate all ITLB and DTLB entries that belong to specified ASID
     434 * (Context).
    410435 *
    411436 * @param asid Address Space ID.
     
    430455}
    431456
    432 /** Invalidate all ITLB and DTLB entries for specified page range in specified address space.
     457/** Invalidate all ITLB and DTLB entries for specified page range in specified
     458 * address space.
    433459 *
    434460 * @param asid Address Space ID.
     
    449475       
    450476        for (i = 0; i < cnt; i++) {
    451                 itlb_demap(TLB_DEMAP_PAGE, TLB_DEMAP_PRIMARY, page + i * PAGE_SIZE);
    452                 dtlb_demap(TLB_DEMAP_PAGE, TLB_DEMAP_PRIMARY, page + i * PAGE_SIZE);
     477                itlb_demap(TLB_DEMAP_PAGE, TLB_DEMAP_PRIMARY, page + i *
     478                        PAGE_SIZE);
     479                dtlb_demap(TLB_DEMAP_PAGE, TLB_DEMAP_PRIMARY, page + i *
     480                        PAGE_SIZE);
    453481        }
    454482       
Note: See TracChangeset for help on using the changeset viewer.