diff options
author | edgar_igl <edgar_igl@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-09-03 14:31:11 +0000 |
---|---|---|
committer | edgar_igl <edgar_igl@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-09-03 14:31:11 +0000 |
commit | b23761f959166cb2320086bf1ea875ddb2fc4f09 (patch) | |
tree | 504aa98371940808a9acfa19858105259fcf0b3c | |
parent | 7d5099d5a4d9e9b3ac7b3f8accc402a13c4d2da1 (diff) |
CRIS: Avoid a few unecessary steps in the mmu.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5146 c046a42c-6fe2-441c-8c8c-71466251a162
-rw-r--r-- | target-cris/mmu.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/target-cris/mmu.c b/target-cris/mmu.c index 122e652e4a..5d21eaa5f4 100644 --- a/target-cris/mmu.c +++ b/target-cris/mmu.c @@ -127,7 +127,7 @@ static int cris_mmu_translate_page(struct cris_mmu_result_t *res, { unsigned int vpage; unsigned int idx; - uint32_t lo, hi; + uint32_t pid, lo, hi; uint32_t tlb_vpn, tlb_pfn = 0; int tlb_pid, tlb_g, tlb_v, tlb_k, tlb_w, tlb_x; int cfg_v, cfg_k, cfg_w, cfg_x; @@ -140,6 +140,7 @@ static int cris_mmu_translate_page(struct cris_mmu_result_t *res, r_cause = env->sregs[SFR_R_MM_CAUSE]; r_cfg = env->sregs[SFR_RW_MM_CFG]; + pid = env->pregs[PR_PID]; switch (rw) { case 2: rwcause = CRIS_MMU_ERR_EXEC; mmu = 0; break; @@ -175,15 +176,14 @@ static int cris_mmu_translate_page(struct cris_mmu_result_t *res, lo = env->tlbsets[mmu][set][idx].lo; hi = env->tlbsets[mmu][set][idx].hi; - tlb_vpn = EXTRACT_FIELD(hi, 13, 31); + tlb_vpn = hi >> 13; tlb_pid = EXTRACT_FIELD(hi, 0, 7); - tlb_pfn = EXTRACT_FIELD(lo, 13, 31); tlb_g = EXTRACT_FIELD(lo, 4, 4); D(fprintf(logfile, - "TLB[%d][%d][%d] v=%x vpage=%x->pfn=%x lo=%x hi=%x\n", - mmu, set, idx, tlb_vpn, vpage, tlb_pfn, lo, hi)); - if ((tlb_g || (tlb_pid == (env->pregs[PR_PID] & 0xff))) + "TLB[%d][%d][%d] v=%x vpage=%x lo=%x hi=%x\n", + mmu, set, idx, tlb_vpn, vpage, lo, hi)); + if ((tlb_g || (tlb_pid == pid)) && tlb_vpn == vpage) { match = 1; break; @@ -245,9 +245,6 @@ static int cris_mmu_translate_page(struct cris_mmu_result_t *res, } else D(dump_tlb(env, mmu)); - - env->sregs[SFR_RW_MM_TLB_HI] = hi; - env->sregs[SFR_RW_MM_TLB_LO] = lo; } else { /* If refill, provide a randomized set. */ set = env->mmu_rand_lfsr & 3; @@ -278,7 +275,6 @@ static int cris_mmu_translate_page(struct cris_mmu_result_t *res, D(printf("refill vaddr=%x pc=%x\n", vaddr, env->pc)); } - D(printf ("%s rw=%d mtch=%d pc=%x va=%x vpn=%x tlbvpn=%x pfn=%x pid=%x" " %x cause=%x sel=%x sp=%x %x %x\n", __func__, rw, match, env->pc, @@ -348,7 +344,7 @@ int cris_mmu_translate(struct cris_mmu_result_t *res, if (!cris_mmu_enabled(env->sregs[SFR_RW_GC_CFG])) { res->phy = vaddr; - res->prot = PAGE_BITS; + res->prot = PAGE_BITS; goto done; } @@ -361,7 +357,7 @@ int cris_mmu_translate(struct cris_mmu_result_t *res, base = cris_mmu_translate_seg(env, seg); phy = base | (0x0fffffff & vaddr); res->phy = phy; - res->prot = PAGE_BITS; + res->prot = PAGE_BITS; } else { |