Skip to content

Commit

Permalink
Previous ELP is restored by xRET
Browse files Browse the repository at this point in the history
  • Loading branch information
ved-rivos committed Nov 28, 2023
1 parent 97e3fcf commit 2501abc
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions model/riscv_sys_control.sail
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,10 @@ function trap_handler(del_priv : Privilege, intr : bool, c : exc_code, pc : xlen
};
}

/* Zicfilp : extension to restore elp */
val zicfilp_set_elp_to_mpelp : (unit) -> unit
val zicfilp_set_elp_to_spelp : (unit) -> unit

function exception_handler(cur_priv : Privilege, ctl : ctl_result,
pc: xlenbits) -> xlenbits = {
match (cur_priv, ctl) {
Expand All @@ -496,6 +500,9 @@ function exception_handler(cur_priv : Privilege, ctl : ctl_result,
if cur_privilege != Machine
then mstatus->MPRV() = 0b0;

/* Zicfilp: extension to restore ELP */
zicfilp_set_elp_to_mpelp();

if get_config_print_reg()
then print_reg("CSR mstatus <- " ^ BitStr(mstatus.bits()));
if get_config_print_platform()
Expand All @@ -513,6 +520,9 @@ function exception_handler(cur_priv : Privilege, ctl : ctl_result,
if cur_privilege != Machine
then mstatus->MPRV() = 0b0;

/* Zicfilp: extension to restore ELP */
zicfilp_set_elp_to_spelp();

if get_config_print_reg()
then print_reg("CSR mstatus <- " ^ BitStr(mstatus.bits()));
if get_config_print_platform()
Expand Down

0 comments on commit 2501abc

Please sign in to comment.