Line 36... |
Line 36... |
int i;
|
int i;
|
unsigned long tagaddr;
|
unsigned long tagaddr;
|
unsigned long vpn, ppn;
|
unsigned long vpn, ppn;
|
extern int mem_cycles;
|
extern int mem_cycles;
|
|
|
if (!(mfspr(SPR_SR) & SPR_SR_IME) || !(testsprbits(SPR_UPR, SPR_UPR_IMP)))
|
if (!(mfspr(SPR_SR) & SPR_SR_IME) || !(testsprbits(SPR_UPR, SPR_UPR_IMP))) {
|
|
insn_ci = (virtaddr >= 0x80000000);
|
return virtaddr;
|
return virtaddr;
|
|
}
|
|
|
/* Which set to check out? */
|
/* Which set to check out? */
|
set = (virtaddr / config.immu.pagesize) % config.immu.nsets;
|
set = (virtaddr / config.immu.pagesize) % config.immu.nsets;
|
tagaddr = (virtaddr / config.immu.pagesize) / config.immu.nsets;
|
tagaddr = (virtaddr / config.immu.pagesize) / config.immu.nsets;
|
vpn = virtaddr / (config.immu.pagesize * config.immu.nsets);
|
vpn = virtaddr / (config.immu.pagesize * config.immu.nsets);
|
Line 70... |
Line 72... |
for (i = 0; i < config.immu.nways; i++)
|
for (i = 0; i < config.immu.nways; i++)
|
if (testsprbits(SPR_ITLBMR_BASE(i) + set, SPR_ITLBMR_LRU))
|
if (testsprbits(SPR_ITLBMR_BASE(i) + set, SPR_ITLBMR_LRU))
|
setsprbits(SPR_ITLBMR_BASE(i) + set, SPR_ITLBMR_LRU, getsprbits(SPR_ITLBMR_BASE(i) + set, SPR_ITLBMR_LRU) - 1);
|
setsprbits(SPR_ITLBMR_BASE(i) + set, SPR_ITLBMR_LRU, getsprbits(SPR_ITLBMR_BASE(i) + set, SPR_ITLBMR_LRU) - 1);
|
setsprbits(SPR_ITLBMR_BASE(way) + set, SPR_ITLBMR_LRU, config.immu.ustates - 1);
|
setsprbits(SPR_ITLBMR_BASE(way) + set, SPR_ITLBMR_LRU, config.immu.ustates - 1);
|
|
|
|
/* Check if page is cache inhibited */
|
|
insn_ci = (mfspr(SPR_ITLBTR_BASE(way) + set) & SPR_ITLBTR_CI) == SPR_ITLBTR_CI;
|
|
|
mem_cycles += config.immu.hitdelay;
|
mem_cycles += config.immu.hitdelay;
|
ppn = mfspr(SPR_ITLBTR_BASE(way) + set) / config.immu.pagesize;
|
ppn = mfspr(SPR_ITLBTR_BASE(way) + set) / config.immu.pagesize;
|
return (ppn * config.immu.pagesize) + (virtaddr % config.immu.pagesize);
|
return (ppn * config.immu.pagesize) + (virtaddr % config.immu.pagesize);
|
}
|
}
|
else { /* No, we didn't. */
|
else { /* No, we didn't. */
|