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

 (

13 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one. )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
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/52065
Tested-by: kokoro <noreply+kok...@google.com>
Maintainer: Gabe Black <gabe.bl...@gmail.com>
Reviewed-by: Daniel Carvalho <oda...@yahoo.com.br>
---
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, 27 insertions(+), 8 deletions(-)

Approvals:
  Daniel Carvalho: Looks good to me, approved
  Gabe Black: Looks good to me, approved
  kokoro: Regressions pass




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 3e7b025..415e80d 100644
--- a/src/arch/generic/pcstate.hh
+++ b/src/arch/generic/pcstate.hh
@@ -126,6 +126,8 @@
         _upc = 0;
     }

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

     // Advance the PC.
     void
-    advance()
+    advance() override
     {
         this->_pc = this->_npc;
         this->_npc += InstWidth;
@@ -493,7 +495,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 64b542d..aa34481 100644
--- a/src/cpu/nop_static_inst.cc
+++ b/src/cpu/nop_static_inst.cc
@@ -50,9 +50,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 54bd54b..c53175b 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: 16
Gerrit-Owner: Gabe Black <gabe.bl...@gmail.com>
Gerrit-Reviewer: Daniel Carvalho <oda...@yahoo.com.br>
Gerrit-Reviewer: Gabe Black <gabe.bl...@gmail.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-MessageType: merged
_______________________________________________
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