Erhu Feng has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/55063 )

Change subject: arch-riscv: Fix the pmp check for pagetable walker
......................................................................

arch-riscv: Fix the pmp check for pagetable walker

During the page table walking,
MMU will perform the PMP check for each page table page.
However, in the current implementation,
the param:mode used by pmp_Check() is equal to the MMU mode,
which means the page table page has an executable mode
if the target page is executable (during pmp_Check).
As the page table page will never be executable,
the mode for the page table page is either read or write.

Jira Issue: https://gem5.atlassian.net/browse/GEM5-1143

Change-Id: I105f52ef58fe1fbbf7d84c6563e8a8c22cea9ccb
---
M src/arch/riscv/pagetable_walker.cc
1 file changed, 22 insertions(+), 2 deletions(-)



diff --git a/src/arch/riscv/pagetable_walker.cc b/src/arch/riscv/pagetable_walker.cc
index 08767c2..81d1eb2 100644
--- a/src/arch/riscv/pagetable_walker.cc
+++ b/src/arch/riscv/pagetable_walker.cc
@@ -305,7 +305,7 @@
     walker->pma->check(read->req);
     // Effective privilege mode for pmp checks for page table
     // walks is S mode according to specs
-    fault = walker->pmp->pmpCheck(read->req, mode,
+    fault = walker->pmp->pmpCheck(read->req, BaseMMU::Read,
                     RiscvISA::PrivilegeMode::PRV_S, tc, entry.vaddr);

     if (fault == NoFault) {
@@ -357,7 +357,7 @@
                         walker->pma->check(read->req);

                         fault = walker->pmp->pmpCheck(read->req,
-                                            mode, pmode, tc, entry.vaddr);
+ BaseMMU::Write, pmode, tc, entry.vaddr);

                     }
                     // perform step 8 only if pmp checks pass

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/55063
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I105f52ef58fe1fbbf7d84c6563e8a8c22cea9ccb
Gerrit-Change-Number: 55063
Gerrit-PatchSet: 1
Gerrit-Owner: Erhu Feng <fengerhu.ip...@gmail.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to