From d392463e5c8e47cfa030eb4640585302f800207f Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Wed, 1 Feb 2017 22:33:38 -0800 Subject: [PATCH] Set xPIE=1 on xRET Resolves #88. --- riscv/insns/mret.h | 2 +- riscv/insns/sret.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/riscv/insns/mret.h b/riscv/insns/mret.h index fa97b2c..f3c4414 100644 --- a/riscv/insns/mret.h +++ b/riscv/insns/mret.h @@ -3,7 +3,7 @@ set_pc_and_serialize(p->get_state()->mepc); reg_t s = STATE.mstatus; reg_t prev_prv = get_field(s, MSTATUS_MPP); s = set_field(s, MSTATUS_UIE << prev_prv, get_field(s, MSTATUS_MPIE)); -s = set_field(s, MSTATUS_MPIE, 0); +s = set_field(s, MSTATUS_MPIE, 1); s = set_field(s, MSTATUS_MPP, PRV_U); p->set_privilege(prev_prv); p->set_csr(CSR_MSTATUS, s); diff --git a/riscv/insns/sret.h b/riscv/insns/sret.h index f5e89e4..b593198 100644 --- a/riscv/insns/sret.h +++ b/riscv/insns/sret.h @@ -3,7 +3,7 @@ set_pc_and_serialize(p->get_state()->sepc); reg_t s = STATE.mstatus; reg_t prev_prv = get_field(s, MSTATUS_SPP); s = set_field(s, MSTATUS_UIE << prev_prv, get_field(s, MSTATUS_SPIE)); -s = set_field(s, MSTATUS_SPIE, 0); +s = set_field(s, MSTATUS_SPIE, 1); s = set_field(s, MSTATUS_SPP, PRV_U); p->set_privilege(prev_prv); p->set_csr(CSR_MSTATUS, s); -- 2.30.2