Changeset 2299914 in mainline for arch


Ignore:
Timestamp:
2006-03-16T12:57:31Z (20 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e898a8d7
Parents:
b7dcabb
Message:

Page table locking.

Location:
arch
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • arch/ia64/src/mm/tlb.c

    rb7dcabb r2299914  
    424424       
    425425        va = istate->cr_ifa;    /* faulting address */
     426        page_table_lock(AS, true);
    426427        t = page_mapping_find(AS, va);
    427428        if (t) {
     
    431432                 */
    432433                itc_pte_copy(t);
     434                page_table_unlock(AS, true);
    433435        } else {
    434436                /*
    435437                 * Forward the page fault to address space page fault handler.
    436438                 */
     439                page_table_unlock(AS, true);
    437440                if (!as_page_fault(va)) {
     441                        page_table_unlock(AS, true);
    438442                        panic("%s: va=%P, rid=%d\n", __FUNCTION__, istate->cr_ifa, rr.map.rid);
    439443                }
     
    467471        }
    468472
     473        page_table_lock(AS, true);
    469474        t = page_mapping_find(AS, va);
    470475        if (t) {
     
    474479                 */
    475480                dtc_pte_copy(t);
     481                page_table_unlock(AS, true);
    476482        } else {
    477483                /*
    478484                 * Forward the page fault to address space page fault handler.
    479485                 */
     486                page_table_unlock(AS, true);
    480487                if (!as_page_fault(va)) {
    481488                        panic("%s: va=%P, rid=%d, iip=%P\n", __FUNCTION__, va, rid, istate->cr_iip);
     
    505512        pte_t *t;
    506513
     514        page_table_lock(AS, true);
    507515        t = page_mapping_find(AS, istate->cr_ifa);
    508516        ASSERT(t && t->p);
     
    515523                dtc_pte_copy(t);
    516524        }
     525        page_table_unlock(AS, true);
    517526}
    518527
     
    526535        pte_t *t;
    527536
     537        page_table_lock(AS, true);
    528538        t = page_mapping_find(AS, istate->cr_ifa);
    529539        ASSERT(t && t->p);
     
    536546                itc_pte_copy(t);
    537547        }
     548        page_table_unlock(AS, true);
    538549}
    539550
     
    547558        pte_t *t;
    548559
     560        page_table_lock(AS, true);
    549561        t = page_mapping_find(AS, istate->cr_ifa);
    550562        ASSERT(t && t->p);
     
    557569                dtc_pte_copy(t);
    558570        }
     571        page_table_unlock(AS, true);
    559572}
    560573
     
    571584       
    572585        va = istate->cr_ifa;    /* faulting address */
     586        page_table_lock(AS, true);
    573587        t = page_mapping_find(AS, va);
    574588        ASSERT(t);
     
    583597                else
    584598                        dtc_pte_copy(t);
     599                page_table_unlock(AS, true);
    585600        } else {
     601                page_table_unlock(AS, true);
    586602                if (!as_page_fault(va)) {
    587603                        panic("%s: va=%P, rid=%d\n", __FUNCTION__, va, rr.map.rid);
  • arch/mips32/src/mm/tlb.c

    rb7dcabb r2299914  
    8888{
    8989        entry_lo_t lo;
    90         entry_hi_t hi; 
     90        entry_hi_t hi;
     91        asid_t asid;
    9192        __address badvaddr;
    9293        pte_t *pte;
     
    9495        badvaddr = cp0_badvaddr_read();
    9596
    96         spinlock_lock(&AS->lock);               
     97        spinlock_lock(&AS->lock);
     98        asid = AS->asid;
     99        spinlock_unlock(&AS->lock);
     100
     101        page_table_lock(AS, true);
    97102
    98103        pte = find_mapping_and_check(badvaddr);
     
    105110        pte->a = 1;
    106111
    107         prepare_entry_hi(&hi, AS->asid, badvaddr);
     112        prepare_entry_hi(&hi, asid, badvaddr);
    108113        prepare_entry_lo(&lo, pte->g, pte->p, pte->d, pte->cacheable, pte->pfn);
    109114
     
    123128        tlbwr();
    124129
    125         spinlock_unlock(&AS->lock);
     130        page_table_unlock(AS, true);
    126131        return;
    127132       
    128133fail:
    129         spinlock_unlock(&AS->lock);
     134        page_table_unlock(AS, true);
    130135        tlb_refill_fail(istate);
    131136}
     
    155160        tlbp();
    156161        index.value = cp0_index_read();
    157        
    158         spinlock_lock(&AS->lock);       
     162
     163        page_table_lock(AS, true);     
    159164       
    160165        /*
     
    192197        tlbwi();
    193198
    194         spinlock_unlock(&AS->lock);     
     199        page_table_unlock(AS, true);
    195200        return;
    196201       
    197202fail:
    198         spinlock_unlock(&AS->lock);
     203        page_table_unlock(AS, true);
    199204        tlb_invalid_fail(istate);
    200205}
     
    224229        tlbp();
    225230        index.value = cp0_index_read();
    226        
    227         spinlock_lock(&AS->lock);       
     231
     232        page_table_lock(AS, true);     
    228233       
    229234        /*
     
    268273        tlbwi();
    269274
    270         spinlock_unlock(&AS->lock);     
     275        page_table_unlock(AS, true);
    271276        return;
    272277       
    273278fail:
    274         spinlock_unlock(&AS->lock);
     279        page_table_unlock(AS, true);
    275280        tlb_modified_fail(istate);
    276281}
     
    350355                 * Resort to higher-level page fault handler.
    351356                 */
     357                page_table_unlock(AS, true);
    352358                if (as_page_fault(badvaddr)) {
    353359                        /*
     
    355361                         * The mapping ought to be in place.
    356362                         */
     363                        page_table_lock(AS, true);
    357364                        pte = page_mapping_find(AS, badvaddr);
    358365                        ASSERT(pte && pte->p);
    359366                        return pte;
     367                } else {
     368                        page_table_lock(AS, true);
     369                        printf("Page fault.\n");
     370                        return NULL;
    360371                }
    361         }
    362 
    363         /*
    364          * Handler cannot succeed if badvaddr has no mapping.
    365          */
    366         if (!pte) {
    367                 printf("No such mapping.\n");
    368                 return NULL;
    369         }
    370 
    371         /*
    372          * Handler cannot succeed if the mapping is marked as invalid.
    373          */
    374         if (!pte->p) {
    375                 printf("Invalid mapping.\n");
    376                 return NULL;
    377         }
    378 
    379         return pte;
     372               
     373        }
    380374}
    381375
Note: See TracChangeset for help on using the changeset viewer.