aboutsummaryrefslogtreecommitdiff
path: root/qtmips_machine
diff options
context:
space:
mode:
authorPavel Pisa <pisa@cmp.felk.cvut.cz>2019-03-24 22:21:01 +0100
committerPavel Pisa <pisa@cmp.felk.cvut.cz>2019-03-24 22:21:01 +0100
commit742d48d1462523c89087551e683e824f922bb629 (patch)
treef08d132f2e87e6810fd960cb1d8d3f4e4aeba8ab /qtmips_machine
parentf7d222b7399e1d3b93541a278f55022fcbf8eaec (diff)
downloadqtmips-742d48d1462523c89087551e683e824f922bb629.tar.gz
qtmips-742d48d1462523c89087551e683e824f922bb629.tar.bz2
qtmips-742d48d1462523c89087551e683e824f922bb629.zip
Extend qtmips_cli to recognize break and report final state.
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Diffstat (limited to 'qtmips_machine')
-rw-r--r--qtmips_machine/qtmipsmachine.cpp11
-rw-r--r--qtmips_machine/qtmipsmachine.h1
2 files changed, 12 insertions, 0 deletions
diff --git a/qtmips_machine/qtmipsmachine.cpp b/qtmips_machine/qtmipsmachine.cpp
index e047167..35843f4 100644
--- a/qtmips_machine/qtmipsmachine.cpp
+++ b/qtmips_machine/qtmipsmachine.cpp
@@ -332,3 +332,14 @@ bool QtMipsMachine::get_step_over_exception(enum ExceptionCause excause) const {
return cr->get_step_over_exception(excause);
return false;
}
+
+enum ExceptionCause QtMipsMachine::get_exception_cause() const {
+ std::uint32_t val;
+ if (cop0st == nullptr)
+ return EXCAUSE_NONE;
+ val = (cop0st->read_cop0reg(Cop0State::Cause) >> 2) & 0x3f;
+ if (val == 0)
+ return EXCAUSE_INT;
+ else
+ return (ExceptionCause)val;
+}
diff --git a/qtmips_machine/qtmipsmachine.h b/qtmips_machine/qtmipsmachine.h
index b90b96e..5cb4100 100644
--- a/qtmips_machine/qtmipsmachine.h
+++ b/qtmips_machine/qtmipsmachine.h
@@ -97,6 +97,7 @@ public:
bool get_stop_on_exception(enum ExceptionCause excause) const;
void set_step_over_exception(enum ExceptionCause excause, bool value);
bool get_step_over_exception(enum ExceptionCause excause) const;
+ enum ExceptionCause get_exception_cause() const;
public slots:
void play();