From c11bcb8119273ef91c40a25b8fd9471a887d0ee5 Mon Sep 17 00:00:00 2001 From: Alexandru Dutu Date: Sun, 23 Nov 2014 18:01:09 -0800 Subject: [PATCH] mem: Multi Level Page Table bug fix The multi level page table was giving false positives for already mapped translations. This patch fixes the bogus behavior. --- src/mem/multi_level_page_table_impl.hh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/mem/multi_level_page_table_impl.hh b/src/mem/multi_level_page_table_impl.hh index 063e097c5..3d8cbe75d 100644 --- a/src/mem/multi_level_page_table_impl.hh +++ b/src/mem/multi_level_page_table_impl.hh @@ -151,14 +151,13 @@ MultiLevelPageTable::map(Addr vaddr, Addr paddr, if (walk(vaddr, true, PTE_addr)) { PageTableEntry PTE = p.read(PTE_addr); Addr entry_paddr = pTableISAOps.getPnum(PTE); - if (!clobber && entry_paddr == 0) { - pTableISAOps.setPnum(PTE, paddr >> PageShift); - pTableISAOps.setPTEFields(PTE); - p.write(PTE_addr, PTE); - DPRINTF(MMU, "New mapping: %#x-%#x\n", vaddr, paddr); - } else { + if (!clobber && entry_paddr != 0) { fatal("addr 0x%x already mapped to %x", vaddr, entry_paddr); } + pTableISAOps.setPnum(PTE, paddr >> PageShift); + pTableISAOps.setPTEFields(PTE); + p.write(PTE_addr, PTE); + DPRINTF(MMU, "New mapping: %#x-%#x\n", vaddr, paddr); eraseCacheEntry(vaddr); updateCache(vaddr, TlbEntry(pid, vaddr, paddr)); -- 2.30.2