Fixed tight coupling of host and target page size
authorAndrew Waterman <waterman@s144.Millennium.Berkeley.EDU>
Tue, 1 Nov 2011 22:32:49 +0000 (15:32 -0700)
committerAndrew Waterman <waterman@s144.Millennium.Berkeley.EDU>
Tue, 1 Nov 2011 22:32:49 +0000 (15:32 -0700)
riscv/mmu.cc
riscv/mmu.h

index b2c8c9864082689954a4ca25dc28e736a934e1e8..489aeeee028a16a2bb8d8259ebe11e066217ccc5 100644 (file)
@@ -53,7 +53,7 @@ void* mmu_t::refill(reg_t addr, bool store, bool fetch)
   tlb_insn_tag[idx] = (pte_perm & PTE_UX) ? expected_tag : -1;
   tlb_data[idx] = (long)(pte >> PTE_PPN_SHIFT << PGSHIFT) + (long)mem;
 
-  return (void*)(((long)addr & (PGSIZE-1)) | tlb_data[idx]);
+  return (void*)(((long)addr & (PGSIZE-1)) + tlb_data[idx]);
 }
 
 pte_t mmu_t::walk(reg_t addr)
index d9a1ce3540f7138f99b0d5a891822180678a7966..9d648ef4de657d9d52a12e0c57fed6b2993d7477 100644 (file)
@@ -179,7 +179,7 @@ private:
     reg_t* tlb_tag = fetch ? tlb_insn_tag : store ? tlb_store_tag :tlb_load_tag;
     reg_t expected_tag = addr & ~(PGSIZE-1);
     if(likely(tlb_tag[idx] == expected_tag))
-      return (void*)(((long)addr & (PGSIZE-1)) | tlb_data[idx]);
+      return (void*)(((long)addr & (PGSIZE-1)) + tlb_data[idx]);
 
     return refill(addr, store, fetch);
   }