aboutsummaryrefslogtreecommitdiff
path: root/riscv/insns
diff options
context:
space:
mode:
authorTim Newsome <tim@sifive.com>2016-05-02 18:07:51 -0700
committerTim Newsome <tim@sifive.com>2016-05-23 12:12:11 -0700
commitfdc92ba2c5ad75abf1e86c87ea23fb7d7dd00ca1 (patch)
treeba46567c0ffcc37f0fd3e3e46217f51e071ba6ad /riscv/insns
parent19f33802a18c23765515324167276b2a47ec8e22 (diff)
downloadriscv-isa-sim-fdc92ba2c5ad75abf1e86c87ea23fb7d7dd00ca1.zip
riscv-isa-sim-fdc92ba2c5ad75abf1e86c87ea23fb7d7dd00ca1.tar.gz
riscv-isa-sim-fdc92ba2c5ad75abf1e86c87ea23fb7d7dd00ca1.tar.bz2
Add dret.
Diffstat (limited to 'riscv/insns')
-rw-r--r--riscv/insns/dret.h6
-rw-r--r--riscv/insns/sret.h3
2 files changed, 6 insertions, 3 deletions
diff --git a/riscv/insns/dret.h b/riscv/insns/dret.h
new file mode 100644
index 0000000..6cfd1e2
--- /dev/null
+++ b/riscv/insns/dret.h
@@ -0,0 +1,6 @@
+require_privilege(PRV_M);
+set_pc_and_serialize(STATE.dpc);
+p->set_privilege(STATE.dcsr.prv);
+
+/* We're not in Debug Mode anymore. */
+STATE.dcsr.cause = 0;
diff --git a/riscv/insns/sret.h b/riscv/insns/sret.h
index dc2fee0..f5e89e4 100644
--- a/riscv/insns/sret.h
+++ b/riscv/insns/sret.h
@@ -7,6 +7,3 @@ s = set_field(s, MSTATUS_SPIE, 0);
s = set_field(s, MSTATUS_SPP, PRV_U);
p->set_privilege(prev_prv);
p->set_csr(CSR_MSTATUS, s);
-
-/* We're not in Debug Mode anymore. */
-STATE.dcsr.cause = 0;