diff options
author | Ming-Yi Lai <ming-yi.lai@mediatek.com> | 2024-01-05 14:06:27 +0800 |
---|---|---|
committer | Ming-Yi Lai <ming-yi.lai@mediatek.com> | 2024-03-06 17:21:00 +0800 |
commit | b2a867f78e4aa53fb49629acb5eb2d3519c65899 (patch) | |
tree | 43ab5692b38a28943a2d4c4ef3ac13daf91e7a10 | |
parent | b618c694d6d039925bb972641737c51d5b6577e1 (diff) | |
download | spike-b2a867f78e4aa53fb49629acb5eb2d3519c65899.zip spike-b2a867f78e4aa53fb49629acb5eb2d3519c65899.tar.gz spike-b2a867f78e4aa53fb49629acb5eb2d3519c65899.tar.bz2 |
Zicfilp: Add software_check(x) macro to throw a software check exception
-rw-r--r-- | riscv/decode_macros.h | 1 | ||||
-rw-r--r-- | riscv/trap.h | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/riscv/decode_macros.h b/riscv/decode_macros.h index 1795a87..4050000 100644 --- a/riscv/decode_macros.h +++ b/riscv/decode_macros.h @@ -322,6 +322,7 @@ inline long double to_f(float128_t f) { long double r; memcpy(&r, &f, sizeof(r)) #endif +#define software_check(x, tval) (unlikely(!(x)) ? throw trap_software_check(tval) : (void) 0) #define ZICFILP_xLPE(v, prv) \ ({ \ reg_t lpe = 0ULL; \ diff --git a/riscv/trap.h b/riscv/trap.h index 54948fd..5eb62cf 100644 --- a/riscv/trap.h +++ b/riscv/trap.h @@ -119,5 +119,6 @@ DECLARE_MEM_GVA_TRAP(CAUSE_FETCH_GUEST_PAGE_FAULT, instruction_guest_page_fault) DECLARE_MEM_GVA_TRAP(CAUSE_LOAD_GUEST_PAGE_FAULT, load_guest_page_fault) DECLARE_INST_TRAP(CAUSE_VIRTUAL_INSTRUCTION, virtual_instruction) DECLARE_MEM_GVA_TRAP(CAUSE_STORE_GUEST_PAGE_FAULT, store_guest_page_fault) +DECLARE_INST_TRAP(CAUSE_SOFTWARE_CHECK_FAULT, software_check) #endif |