Subversion Repositories HelenOS-historic

Compare Revisions

Ignore whitespace Rev 1043 → Rev 1044

/kernel/trunk/arch/ia64/src/mm/tlb.c
423,6 → 423,7
pte_t *t;
va = istate->cr_ifa; /* faulting address */
page_table_lock(AS, true);
t = page_mapping_find(AS, va);
if (t) {
/*
430,11 → 431,14
* Insert it into data translation cache.
*/
itc_pte_copy(t);
page_table_unlock(AS, true);
} else {
/*
* Forward the page fault to address space page fault handler.
*/
page_table_unlock(AS, true);
if (!as_page_fault(va)) {
page_table_unlock(AS, true);
panic("%s: va=%P, rid=%d\n", __FUNCTION__, istate->cr_ifa, rr.map.rid);
}
}
466,6 → 470,7
}
}
 
page_table_lock(AS, true);
t = page_mapping_find(AS, va);
if (t) {
/*
473,10 → 478,12
* Insert it into data translation cache.
*/
dtc_pte_copy(t);
page_table_unlock(AS, true);
} else {
/*
* Forward the page fault to address space page fault handler.
*/
page_table_unlock(AS, true);
if (!as_page_fault(va)) {
panic("%s: va=%P, rid=%d, iip=%P\n", __FUNCTION__, va, rid, istate->cr_iip);
}
504,6 → 511,7
{
pte_t *t;
 
page_table_lock(AS, true);
t = page_mapping_find(AS, istate->cr_ifa);
ASSERT(t && t->p);
if (t && t->p) {
514,6 → 522,7
t->d = true;
dtc_pte_copy(t);
}
page_table_unlock(AS, true);
}
 
/** Instruction access bit fault handler.
525,6 → 534,7
{
pte_t *t;
 
page_table_lock(AS, true);
t = page_mapping_find(AS, istate->cr_ifa);
ASSERT(t && t->p);
if (t && t->p) {
535,6 → 545,7
t->a = true;
itc_pte_copy(t);
}
page_table_unlock(AS, true);
}
 
/** Data access bit fault handler.
546,6 → 557,7
{
pte_t *t;
 
page_table_lock(AS, true);
t = page_mapping_find(AS, istate->cr_ifa);
ASSERT(t && t->p);
if (t && t->p) {
556,6 → 568,7
t->a = true;
dtc_pte_copy(t);
}
page_table_unlock(AS, true);
}
 
/** Page not present fault handler.
570,6 → 583,7
pte_t *t;
va = istate->cr_ifa; /* faulting address */
page_table_lock(AS, true);
t = page_mapping_find(AS, va);
ASSERT(t);
582,7 → 596,9
itc_pte_copy(t);
else
dtc_pte_copy(t);
page_table_unlock(AS, true);
} else {
page_table_unlock(AS, true);
if (!as_page_fault(va)) {
panic("%s: va=%P, rid=%d\n", __FUNCTION__, va, rr.map.rid);
}
/kernel/trunk/arch/mips32/src/mm/tlb.c
87,14 → 87,19
void tlb_refill(istate_t *istate)
{
entry_lo_t lo;
entry_hi_t hi;
entry_hi_t hi;
asid_t asid;
__address badvaddr;
pte_t *pte;
 
badvaddr = cp0_badvaddr_read();
 
spinlock_lock(&AS->lock);
spinlock_lock(&AS->lock);
asid = AS->asid;
spinlock_unlock(&AS->lock);
 
page_table_lock(AS, true);
 
pte = find_mapping_and_check(badvaddr);
if (!pte)
goto fail;
104,7 → 109,7
*/
pte->a = 1;
 
prepare_entry_hi(&hi, AS->asid, badvaddr);
prepare_entry_hi(&hi, asid, badvaddr);
prepare_entry_lo(&lo, pte->g, pte->p, pte->d, pte->cacheable, pte->pfn);
 
/*
122,11 → 127,11
cp0_pagemask_write(TLB_PAGE_MASK_16K);
tlbwr();
 
spinlock_unlock(&AS->lock);
page_table_unlock(AS, true);
return;
fail:
spinlock_unlock(&AS->lock);
page_table_unlock(AS, true);
tlb_refill_fail(istate);
}
 
154,9 → 159,9
cp0_entry_hi_write(hi.value);
tlbp();
index.value = cp0_index_read();
 
page_table_lock(AS, true);
spinlock_lock(&AS->lock);
/*
* Fail if the entry is not in TLB.
*/
191,11 → 196,11
cp0_pagemask_write(TLB_PAGE_MASK_16K);
tlbwi();
 
spinlock_unlock(&AS->lock);
page_table_unlock(AS, true);
return;
fail:
spinlock_unlock(&AS->lock);
page_table_unlock(AS, true);
tlb_invalid_fail(istate);
}
 
223,9 → 228,9
cp0_entry_hi_write(hi.value);
tlbp();
index.value = cp0_index_read();
 
page_table_lock(AS, true);
spinlock_lock(&AS->lock);
/*
* Fail if the entry is not in TLB.
*/
267,11 → 272,11
cp0_pagemask_write(TLB_PAGE_MASK_16K);
tlbwi();
 
spinlock_unlock(&AS->lock);
page_table_unlock(AS, true);
return;
fail:
spinlock_unlock(&AS->lock);
page_table_unlock(AS, true);
tlb_modified_fail(istate);
}
 
349,34 → 354,23
* Mapping not found in page tables.
* Resort to higher-level page fault handler.
*/
page_table_unlock(AS, true);
if (as_page_fault(badvaddr)) {
/*
* The higher-level page fault handler succeeded,
* The mapping ought to be in place.
*/
page_table_lock(AS, true);
pte = page_mapping_find(AS, badvaddr);
ASSERT(pte && pte->p);
return pte;
} else {
page_table_lock(AS, true);
printf("Page fault.\n");
return NULL;
}
}
 
/*
* Handler cannot succeed if badvaddr has no mapping.
*/
if (!pte) {
printf("No such mapping.\n");
return NULL;
}
 
/*
* Handler cannot succeed if the mapping is marked as invalid.
*/
if (!pte->p) {
printf("Invalid mapping.\n");
return NULL;
}
 
return pte;
}
 
void prepare_entry_lo(entry_lo_t *lo, bool g, bool v, bool d, bool cacheable, __address pfn)