Gabe Black has submitted this change and it was merged. ( https://gem5-review.googlesource.com/c/public/gem5/+/12045 )

Change subject: systemc: Fix a "problem" with kill/reset exceptions.
......................................................................

systemc: Fix a "problem" with kill/reset exceptions.

Despite what it says in the spec, the proc_ctrl compliance test throws
a copy of the reset exception it catches, not the original. Because of
that, the code in the kernel which catches the exception gets the base
class, not the derived class with overridden virtual methods, etc.
This happens to work for the Accellera implementation because they
manipulate members of the base class itself which are preserved despite
this bug. To make the test work, we imitate their implementation, even
though it exposes more implementation details through the header files.

Change-Id: I7ed9818c0552869ec790cb7f7bfbe365ade5e49c
Reviewed-on: https://gem5-review.googlesource.com/12045
Reviewed-by: Gabe Black <[email protected]>
Maintainer: Gabe Black <[email protected]>
---
M src/systemc/core/sc_process_handle.cc
M src/systemc/ext/core/sc_process_handle.hh
2 files changed, 7 insertions(+), 4 deletions(-)

Approvals:
  Gabe Black: Looks good to me, approved; Looks good to me, approved



diff --git a/src/systemc/core/sc_process_handle.cc b/src/systemc/core/sc_process_handle.cc
index e0f6a81..256d649 100644
--- a/src/systemc/core/sc_process_handle.cc
+++ b/src/systemc/core/sc_process_handle.cc
@@ -39,17 +39,19 @@
 const char *
 sc_unwind_exception::what() const throw()
 {
-    panic("%s for base class called.\n", __PRETTY_FUNCTION__);
+    return _isReset ? "RESET" : "KILL";
 }

 bool
 sc_unwind_exception::is_reset() const
 {
-    panic("%s for base class called.\n", __PRETTY_FUNCTION__);
+    return _isReset;
 }

-sc_unwind_exception::sc_unwind_exception() {}
-sc_unwind_exception::sc_unwind_exception(const sc_unwind_exception &) {}
+sc_unwind_exception::sc_unwind_exception() : _isReset(false) {}
+sc_unwind_exception::sc_unwind_exception(const sc_unwind_exception &e) :
+    _isReset(e._isReset)
+{}
 sc_unwind_exception::~sc_unwind_exception() throw() {}


diff --git a/src/systemc/ext/core/sc_process_handle.hh b/src/systemc/ext/core/sc_process_handle.hh
index 2db553b..8186903 100644
--- a/src/systemc/ext/core/sc_process_handle.hh
+++ b/src/systemc/ext/core/sc_process_handle.hh
@@ -108,6 +108,7 @@
     virtual ~sc_unwind_exception() throw();

   protected:
+    bool _isReset;
     sc_unwind_exception();
 };


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

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: I7ed9818c0552869ec790cb7f7bfbe365ade5e49c
Gerrit-Change-Number: 12045
Gerrit-PatchSet: 8
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-Reviewer: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: Matthias Jung <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to