From 97e3fcfdc0d293f1692fc3344ee3f116b5af6b17 Mon Sep 17 00:00:00 2001 From: Ved Shanbhogue Date: Mon, 27 Nov 2023 20:15:39 -0600 Subject: [PATCH] ELP state is preserved in xStatus by traps --- model/riscv_sys_control.sail | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/model/riscv_sys_control.sail b/model/riscv_sys_control.sail index da90c6ec5..20ae17dd0 100644 --- a/model/riscv_sys_control.sail +++ b/model/riscv_sys_control.sail @@ -392,6 +392,8 @@ val rvfi_trap : unit -> unit function rvfi_trap () = () $endif +val zicfilp_preserve_elp : (Privilege) -> unit + /* handle exceptional ctl flow by updating nextPC and operating privilege */ function trap_handler(del_priv : Privilege, intr : bool, c : exc_code, pc : xlenbits, info : option(xlenbits), ext : option(ext_exception)) @@ -417,6 +419,7 @@ function trap_handler(del_priv : Privilege, intr : bool, c : exc_code, pc : xlen cur_privilege = del_priv; + zicfilp_preserve_elp(del_priv); handle_trap_extension(del_priv, pc, ext); if get_config_print_reg() @@ -442,6 +445,7 @@ function trap_handler(del_priv : Privilege, intr : bool, c : exc_code, pc : xlen cur_privilege = del_priv; + zicfilp_preserve_elp(del_priv); handle_trap_extension(del_priv, pc, ext); if get_config_print_reg() @@ -462,6 +466,7 @@ function trap_handler(del_priv : Privilege, intr : bool, c : exc_code, pc : xlen cur_privilege = del_priv; + zicfilp_preserve_elp(del_priv); handle_trap_extension(del_priv, pc, ext); if get_config_print_reg()