Luming Wang has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/53184 )

Change subject: arch-riscv: fix inUserMode
......................................................................

arch-riscv: fix inUserMode

The original inUserMode() simply returns true. However, it should
check whether the processor's current privilege level is PRV_U.

Change-Id: Iba74ccc6ff459e7d8c421ae9fe004c6c09920763
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/53184
Reviewed-by: Jason Lowe-Power <[email protected]>
Reviewed-by: Ayaz Akram <[email protected]>
Maintainer: Jason Lowe-Power <[email protected]>
Tested-by: kokoro <[email protected]>
---
M src/arch/riscv/isa.cc
M src/arch/riscv/isa.hh
2 files changed, 23 insertions(+), 1 deletion(-)

Approvals:
Jason Lowe-Power: Looks good to me, but someone else must approve; Looks good to me, approved
  Ayaz Akram: Looks good to me, approved
  kokoro: Regressions pass




diff --git a/src/arch/riscv/isa.cc b/src/arch/riscv/isa.cc
index e26b6fa..0358889 100644
--- a/src/arch/riscv/isa.cc
+++ b/src/arch/riscv/isa.cc
@@ -205,6 +205,11 @@
     clear();
 }

+bool ISA::inUserMode() const
+{
+    return miscRegFile[MISCREG_PRV] == PRV_U;
+}
+
 void
 ISA::copyRegsFrom(ThreadContext *src)
 {
diff --git a/src/arch/riscv/isa.hh b/src/arch/riscv/isa.hh
index 6435b74..143cc69 100644
--- a/src/arch/riscv/isa.hh
+++ b/src/arch/riscv/isa.hh
@@ -98,7 +98,7 @@
     int flattenCCIndex(int reg) const { return reg; }
     int flattenMiscIndex(int reg) const { return reg; }

-    bool inUserMode() const override { return true; }
+    bool inUserMode() const override;
     void copyRegsFrom(ThreadContext *src) override;

     void serialize(CheckpointOut &cp) const override;

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/53184
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: Iba74ccc6ff459e7d8c421ae9fe004c6c09920763
Gerrit-Change-Number: 53184
Gerrit-PatchSet: 3
Gerrit-Owner: Luming Wang <[email protected]>
Gerrit-Reviewer: Ayaz Akram <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: Luming Wang <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to