Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/52065 )

Change subject: arch: Make the advance() method virtual and in PCStateBase.
......................................................................

arch: Make the advance() method virtual and in PCStateBase.

It's occasionally necessary to advance the PC to the next instruction
without having an instruction to do it with. This makes it available
without having to cast to a PCState subclass.

Change-Id: I3b7d94afdfb27b34279e58158782e87ab5066a37
---
M src/arch/x86/pcstate.hh
M src/arch/generic/pcstate.hh
M src/cpu/nop_static_inst.cc
M src/arch/arm/pcstate.hh
M src/sim/syscall_emul.hh
5 files changed, 23 insertions(+), 8 deletions(-)



diff --git a/src/arch/arm/pcstate.hh b/src/arch/arm/pcstate.hh
index 122cd9b..f2d85d2 100644
--- a/src/arch/arm/pcstate.hh
+++ b/src/arch/arm/pcstate.hh
@@ -288,7 +288,7 @@
     }

     void
-    advance()
+    advance() override
     {
         Base::advance();
         flags = nextFlags;
diff --git a/src/arch/generic/pcstate.hh b/src/arch/generic/pcstate.hh
index 2367244..b41c9c3 100644
--- a/src/arch/generic/pcstate.hh
+++ b/src/arch/generic/pcstate.hh
@@ -125,6 +125,8 @@
         _upc = 0;
     }

+    virtual void advance() = 0;
+
     void
     serialize(CheckpointOut &cp) const override
     {
@@ -372,7 +374,7 @@

     // Advance the PC.
     void
-    advance()
+    advance() override
     {
         this->_pc = this->_npc;
         this->_npc += InstWidth;
@@ -495,7 +497,7 @@

     // Advance the PC.
     void
-    advance()
+    advance() override
     {
         this->_pc = this->_npc;
         this->_npc = this->_nnpc;
diff --git a/src/arch/x86/pcstate.hh b/src/arch/x86/pcstate.hh
index 8d74806..bfc7d4f 100644
--- a/src/arch/x86/pcstate.hh
+++ b/src/arch/x86/pcstate.hh
@@ -95,7 +95,7 @@
     }

     void
-    advance()
+    advance() override
     {
         Base::advance();
         _size = 0;
diff --git a/src/cpu/nop_static_inst.cc b/src/cpu/nop_static_inst.cc
index b9a69dc..6833fe2 100644
--- a/src/cpu/nop_static_inst.cc
+++ b/src/cpu/nop_static_inst.cc
@@ -49,9 +49,9 @@
     }

     void
-    advancePC(PCStateBase &pcState) const override
+    advancePC(PCStateBase &pc) const override
     {
-        pcState.as<TheISA::PCState>().advance();
+        pc.advance();
     }

     std::string
diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh
index f27e37a..373aeac 100644
--- a/src/sim/syscall_emul.hh
+++ b/src/sim/syscall_emul.hh
@@ -1662,7 +1662,7 @@
     desc->returnInto(ctc, 0);

     std::unique_ptr<PCStateBase> cpc(tc->pcState().clone());
-    cpc->as<TheISA::PCState>().advance();
+    cpc->advance();
     ctc->pcState(*cpc);
     ctc->activate();

@@ -2226,7 +2226,7 @@
     new_p->initState();
     tc->activate();
     std::unique_ptr<PCStateBase> pc_state(tc->pcState().clone());
-    pc_state->as<TheISA::PCState>().advance();
+    pc_state->advance();
     tc->pcState(*pc_state);

     return SyscallReturn();

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/52065
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: I3b7d94afdfb27b34279e58158782e87ab5066a37
Gerrit-Change-Number: 52065
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
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