lib: fix csr detect support
authorXiang W <wxjstz@126.com>
Thu, 1 Apr 2021 07:59:40 +0000 (15:59 +0800)
committerAnup Patel <anup@brainfault.org>
Mon, 5 Apr 2021 08:13:08 +0000 (13:43 +0530)
commit3d8a952737935dd98200b05b68dacb5e94071877
tree0e641519f65664f3f05deada0cf547c64037e08c
parent4ef2f5d3e6b25356a8fab19574bed76ce60edeee
lib: fix csr detect support

csr_read_allowed/csr_read_allowed requires trap.case to detect the results,
but if no exception occurs, the value of trap.case will remain unchanged,
which makes the detection results unreliable. Add code to initialize
trap.case to 0.

Signed-off-by: Xiang W <wxjstz@126.com>
Reviewed-by: Anup Patel <anup.patel@wdc.com>
include/sbi/sbi_csr_detect.h
lib/sbi/sbi_hart.c