OSDN Git Service

target/riscv: Use g_assert() for the predicate() NULL check
authorBin Meng <bmeng@tinylab.org>
Tue, 28 Feb 2023 10:40:19 +0000 (18:40 +0800)
committerPalmer Dabbelt <palmer@rivosinc.com>
Thu, 2 Mar 2023 00:40:12 +0000 (16:40 -0800)
commit0ee342256af9205e7388efdf193a6d8f1ba1a617
tree124c9b5f95c9ce6118682aa8897d91280b50fc55
parenta5e0f68652fe1ed0231311d6c8aaeaf55c631821
target/riscv: Use g_assert() for the predicate() NULL check

At present riscv_csrrw_check() checks the CSR predicate() against
NULL and throws RISCV_EXCP_ILLEGAL_INST if it is NULL. But this is
a pure software check, and has nothing to do with the emulation of
the hardware behavior, thus it is inappropriate to return illegal
instruction exception when software forgets to install the hook.

Change to use g_assert() instead.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Weiwei Li<liweiwei@iscas.ac.cn>
Message-ID: <20230228104035.1879882-4-bmeng@tinylab.org>
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
target/riscv/csr.c