Ignore:
File:
1 edited

Legend:

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

    r560b81c r1dbc43f  
    4646#include <arch.h>
    4747#include <print.h>
    48 #include <log.h>
    4948#include <typedefs.h>
    5049#include <config.h>
     
    208207
    209208/** ITLB miss handler. */
    210 void fast_instruction_access_mmu_miss(unsigned int tt, istate_t *istate)
     209void fast_instruction_access_mmu_miss(sysarg_t unused, istate_t *istate)
    211210{
    212211        uintptr_t va = ALIGN_DOWN(istate->tpc, PAGE_SIZE);
    213         pte_t t;
    214 
    215         bool found = page_mapping_find(AS, va, true, &t);
    216         if (found && PTE_EXECUTABLE(&t)) {
    217                 ASSERT(t.p);
    218 
     212        pte_t *t;
     213
     214        t = page_mapping_find(AS, va, true);
     215
     216        if (t && PTE_EXECUTABLE(t)) {
    219217                /*
    220218                 * The mapping was found in the software page hash table.
    221219                 * Insert it into ITLB.
    222220                 */
    223                 t.a = true;
    224                 itlb_pte_copy(&t);
     221                t->a = true;
     222                itlb_pte_copy(t);
    225223#ifdef CONFIG_TSB
    226                 itsb_pte_copy(&t);
    227 #endif
    228                 page_mapping_update(AS, va, true, &t);
     224                itsb_pte_copy(t);
     225#endif
    229226        } else {
    230227                /*
     
    241238 * low-level, assembly language part of the fast_data_access_mmu_miss handler.
    242239 *
    243  * @param tt            Trap type.
     240 * @param page_and_ctx  A 64-bit value describing the fault. The most
     241 *                      significant 51 bits of the value contain the virtual
     242 *                      address which caused the fault truncated to the page
     243 *                      boundary. The least significant 13 bits of the value
     244 *                      contain the number of the context in which the fault
     245 *                      occurred.
    244246 * @param istate        Interrupted state saved on the stack.
    245247 */
    246 void fast_data_access_mmu_miss(unsigned int tt, istate_t *istate)
    247 {
    248         pte_t t;
    249         uintptr_t va = DMISS_ADDRESS(istate->tlb_tag_access);
    250         uint16_t ctx = DMISS_CONTEXT(istate->tlb_tag_access);
    251         as_t *as = AS;
     248void fast_data_access_mmu_miss(uint64_t page_and_ctx, istate_t *istate)
     249{
     250        pte_t *t;
     251        uintptr_t va = DMISS_ADDRESS(page_and_ctx);
     252        uint16_t ctx = DMISS_CONTEXT(page_and_ctx);
    252253
    253254        if (ctx == ASID_KERNEL) {
     
    255256                        /* NULL access in kernel */
    256257                        panic("NULL pointer dereference.");
    257                 } else if (va >= end_of_identity) {
    258                         /* Kernel non-identity */
    259                         as = AS_KERNEL;
    260                 } else {
    261                         panic("Unexpected kernel page fault.");
    262258                }
    263         }
    264 
    265         bool found = page_mapping_find(as, va, true, &t);
    266         if (found) {
    267                 ASSERT(t.p);
    268 
     259                panic("Unexpected kernel page fault.");
     260        }
     261
     262        t = page_mapping_find(AS, va, true);
     263        if (t) {
    269264                /*
    270265                 * The mapping was found in the software page hash table.
    271266                 * Insert it into DTLB.
    272267                 */
    273                 t.a = true;
    274                 dtlb_pte_copy(&t, true);
     268                t->a = true;
     269                dtlb_pte_copy(t, true);
    275270#ifdef CONFIG_TSB
    276                 dtsb_pte_copy(&t, true);
    277 #endif
    278                 page_mapping_update(as, va, true, &t);
     271                dtsb_pte_copy(t, true);
     272#endif
    279273        } else {
    280274                /*
     
    288282/** DTLB protection fault handler.
    289283 *
    290  * @param tt            Trap type.
     284 * @param page_and_ctx  A 64-bit value describing the fault. The most
     285 *                      significant 51 bits of the value contain the virtual
     286 *                      address which caused the fault truncated to the page
     287 *                      boundary. The least significant 13 bits of the value
     288 *                      contain the number of the context in which the fault
     289 *                      occurred.
    291290 * @param istate        Interrupted state saved on the stack.
    292291 */
    293 void fast_data_access_protection(unsigned int tt, istate_t *istate)
    294 {
    295         pte_t t;
    296         uintptr_t va = DMISS_ADDRESS(istate->tlb_tag_access);
    297         uint16_t ctx = DMISS_CONTEXT(istate->tlb_tag_access);
    298         as_t *as = AS;
    299 
    300         if (ctx == ASID_KERNEL)
    301                 as = AS_KERNEL;
    302 
    303         bool found = page_mapping_find(as, va, true, &t);
    304         if (found && PTE_WRITABLE(&t)) {
    305                 ASSERT(t.p);
    306 
     292void fast_data_access_protection(uint64_t page_and_ctx, istate_t *istate)
     293{
     294        pte_t *t;
     295        uintptr_t va = DMISS_ADDRESS(page_and_ctx);
     296        uint16_t ctx = DMISS_CONTEXT(page_and_ctx);
     297
     298        t = page_mapping_find(AS, va, true);
     299        if (t && PTE_WRITABLE(t)) {
    307300                /*
    308301                 * The mapping was found in the software page hash table and is
     
    310303                 * into DTLB.
    311304                 */
    312                 t.a = true;
    313                 t.d = true;
     305                t->a = true;
     306                t->d = true;
    314307                mmu_demap_page(va, ctx, MMU_FLAG_DTLB);
    315                 dtlb_pte_copy(&t, false);
     308                dtlb_pte_copy(t, false);
    316309#ifdef CONFIG_TSB
    317                 dtsb_pte_copy(&t, false);
    318 #endif
    319                 page_mapping_update(as, va, true, &t);
     310                dtsb_pte_copy(t, false);
     311#endif
    320312        } else {
    321313                /*
     
    334326void tlb_print(void)
    335327{
    336         log(LF_ARCH, LVL_WARN, "Operation not possible on Niagara.");
     328        printf("Operation not possible on Niagara.\n");
    337329}
    338330
     
    391383
    392384        for (i = 0; i < cnt; i++) {
    393                 __hypercall_fast5(MMU_DEMAP_PAGE, 0, 0, page + i * PAGE_SIZE,
    394                     asid, MMU_FLAG_DTLB | MMU_FLAG_ITLB);
     385                __hypercall_fast5(MMU_DEMAP_PAGE, 0, 0, page, asid,
     386                        MMU_FLAG_DTLB | MMU_FLAG_ITLB);
    395387        }
    396388
Note: See TracChangeset for help on using the changeset viewer.