forked from Mirrors/opensbi
riscv_asm.h: Use CSR_<FOO> instead of <foo> for csr_read()
Some toolchains might not have all the CSRs available (as seen with GCC 7.2). So, instead use the defined CSR_ values. Signed-off-by: Olof Johansson <olof@lixom.net>
This commit is contained in:

committed by
Anup Patel

parent
30dfdf6e0e
commit
c0addfe751
@@ -89,9 +89,9 @@ int sbi_trap_redirect(struct sbi_trap_regs *regs,
|
||||
return SBI_ENOTSUPP;
|
||||
|
||||
/* Update S-mode exception info */
|
||||
csr_write(stval, tval);
|
||||
csr_write(sepc, epc);
|
||||
csr_write(scause, cause);
|
||||
csr_write(CSR_STVAL, tval);
|
||||
csr_write(CSR_SEPC, epc);
|
||||
csr_write(CSR_SCAUSE, cause);
|
||||
|
||||
/* Set MEPC to S-mode exception vector base */
|
||||
regs->mepc = csr_read(stvec);
|
||||
@@ -183,6 +183,6 @@ void sbi_trap_handler(struct sbi_trap_regs *regs,
|
||||
|
||||
trap_error:
|
||||
if (rc) {
|
||||
sbi_trap_error(msg, rc, hartid, mcause, csr_read(mtval), regs);
|
||||
sbi_trap_error(msg, rc, hartid, mcause, csr_read(CSR_MTVAL), regs);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user