Ignore:
File:
1 edited

Legend:

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

    r59fb782 r560b81c  
    194194
    195195/** ITLB miss handler. */
    196 void fast_instruction_access_mmu_miss(sysarg_t unused, istate_t *istate)
     196void fast_instruction_access_mmu_miss(unsigned int tt, istate_t *istate)
    197197{
    198198        size_t index = (istate->tpc >> MMU_PAGE_WIDTH) % MMU_PAGES_PER_PAGE;
    199         pte_t *t;
    200 
    201         t = page_mapping_find(AS, istate->tpc, true);
    202         if (t && PTE_EXECUTABLE(t)) {
     199        pte_t t;
     200
     201        bool found = page_mapping_find(AS, istate->tpc, true, &t);
     202        if (found && PTE_EXECUTABLE(&t)) {
     203                ASSERT(t.p);
     204
    203205                /*
    204206                 * The mapping was found in the software page hash table.
    205207                 * Insert it into ITLB.
    206208                 */
    207                 t->a = true;
    208                 itlb_pte_copy(t, index);
     209                t.a = true;
     210                itlb_pte_copy(&t, index);
    209211#ifdef CONFIG_TSB
    210                 itsb_pte_copy(t, index);
    211 #endif
     212                itsb_pte_copy(&t, index);
     213#endif
     214                page_mapping_update(AS, istate->tpc, true, &t);
    212215        } else {
    213216                /*
     
    224227 * low-level, assembly language part of the fast_data_access_mmu_miss handler.
    225228 *
    226  * @param tag           Content of the TLB Tag Access register as it existed
    227  *                      when the trap happened. This is to prevent confusion
    228  *                      created by clobbered Tag Access register during a nested
    229  *                      DTLB miss.
     229 * @param tt            Trap type.
    230230 * @param istate        Interrupted state saved on the stack.
    231231 */
    232 void fast_data_access_mmu_miss(tlb_tag_access_reg_t tag, istate_t *istate)
    233 {
     232void fast_data_access_mmu_miss(unsigned int tt, istate_t *istate)
     233{
     234        tlb_tag_access_reg_t tag;
    234235        uintptr_t page_8k;
    235236        uintptr_t page_16k;
    236237        size_t index;
    237         pte_t *t;
     238        pte_t t;
    238239        as_t *as = AS;
    239240
     241        tag.value = istate->tlb_tag_access;
    240242        page_8k = (uint64_t) tag.vpn << MMU_PAGE_WIDTH;
    241243        page_16k = ALIGN_DOWN(page_8k, PAGE_SIZE);
     
    254256        }
    255257
    256         t = page_mapping_find(as, page_16k, true);
    257         if (t) {
     258        bool found = page_mapping_find(as, page_16k, true, &t);
     259        if (found) {
     260                ASSERT(t.p);
     261
    258262                /*
    259263                 * The mapping was found in the software page hash table.
    260264                 * Insert it into DTLB.
    261265                 */
    262                 t->a = true;
    263                 dtlb_pte_copy(t, index, true);
     266                t.a = true;
     267                dtlb_pte_copy(&t, index, true);
    264268#ifdef CONFIG_TSB
    265                 dtsb_pte_copy(t, index, true);
    266 #endif
     269                dtsb_pte_copy(&t, index, true);
     270#endif
     271                page_mapping_update(as, page_16k, true, &t);
    267272        } else {
    268273                /*
     
    276281/** DTLB protection fault handler.
    277282 *
    278  * @param tag           Content of the TLB Tag Access register as it existed
    279  *                      when the trap happened. This is to prevent confusion
    280  *                      created by clobbered Tag Access register during a nested
    281  *                      DTLB miss.
     283 * @param tt            Trap type.
    282284 * @param istate        Interrupted state saved on the stack.
    283285 */
    284 void fast_data_access_protection(tlb_tag_access_reg_t tag, istate_t *istate)
    285 {
     286void fast_data_access_protection(unsigned int tt, istate_t *istate)
     287{
     288        tlb_tag_access_reg_t tag;
    286289        uintptr_t page_16k;
    287290        size_t index;
    288         pte_t *t;
     291        pte_t t;
    289292        as_t *as = AS;
    290293
     294        tag.value = istate->tlb_tag_access;
    291295        page_16k = ALIGN_DOWN((uint64_t) tag.vpn << MMU_PAGE_WIDTH, PAGE_SIZE);
    292296        index = tag.vpn % MMU_PAGES_PER_PAGE;   /* 16K-page emulation */
     
    295299                as = AS_KERNEL;
    296300
    297         t = page_mapping_find(as, page_16k, true);
    298         if (t && PTE_WRITABLE(t)) {
     301        bool found = page_mapping_find(as, page_16k, true, &t);
     302        if (found && PTE_WRITABLE(&t)) {
     303                ASSERT(t.p);
     304
    299305                /*
    300306                 * The mapping was found in the software page hash table and is
     
    302308                 * into DTLB.
    303309                 */
    304                 t->a = true;
    305                 t->d = true;
     310                t.a = true;
     311                t.d = true;
    306312                dtlb_demap(TLB_DEMAP_PAGE, TLB_DEMAP_SECONDARY,
    307313                    page_16k + index * MMU_PAGE_SIZE);
    308                 dtlb_pte_copy(t, index, false);
     314                dtlb_pte_copy(&t, index, false);
    309315#ifdef CONFIG_TSB
    310                 dtsb_pte_copy(t, index, false);
    311 #endif
     316                dtsb_pte_copy(&t, index, false);
     317#endif
     318                page_mapping_update(as, page_16k, true, &t);
    312319        } else {
    313320                /*
Note: See TracChangeset for help on using the changeset viewer.