Skip to content

Commit

Permalink
core: riscv: Fix initial value of a0 in "detect_csr" ASM macro
Browse files Browse the repository at this point in the history
To set initial value of the register a0 to 1, the assembly code should
be "li a0, 1" instead of "addi a0, a0, 1".

Signed-off-by: Alvin Chang <alvinga@andestech.com>
Reviewed-by: Yu-Chien Peter Lin <peterlin@andestech.com>
  • Loading branch information
gagachang committed Aug 26, 2024
1 parent 1c32a0e commit 1789a57
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/arch/riscv/kernel/csr_detect.S
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ END_FUNC csr_detect_trap_vect

/* Detect CSR by csrr/csrrw instruction. a0=1 if detected, otherwise a0=0 */
.macro detect_csr csr, op, reg0, reg1, reg2
addi a0, a0, 1
li a0, 1
save_and_disable_xie \reg0
save_and_replace_xtvec \reg1, csr_detect_trap_vect
.if \op == DETECT_OP_CSRR
Expand Down

0 comments on commit 1789a57

Please sign in to comment.