summaryrefslogtreecommitdiff
path: root/lib/sbi_trap.c
diff options
context:
space:
mode:
authorAtish Patra <[email protected]>2019-02-12 18:32:06 -0800
committerAnup Patel <[email protected]>2019-02-14 09:31:18 +0530
commit70a474d2c24dc3e0c8841e6ef5cc96797deadbf5 (patch)
tree0c1456134e4815aadea0f523d7fb570454e23d0d /lib/sbi_trap.c
parent4cb4d46875dd0f0dd01d3ff1fee4f0d6cefb857a (diff)
lib: Use CSR_<FOO> instead of <foo> for csr_*()
Some older toolchains may not have all the csr's defined. Update all the csr functions to use the CSR_ #define values instead of the toolchain defined values. Suggested-by: Olof Johansson <[email protected]> Signed-off-by: Atish Patra <[email protected]>
Diffstat (limited to 'lib/sbi_trap.c')
-rw-r--r--lib/sbi_trap.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/sbi_trap.c b/lib/sbi_trap.c
index fb9ca4fa..ba597d8e 100644
--- a/lib/sbi_trap.c
+++ b/lib/sbi_trap.c
@@ -94,7 +94,7 @@ int sbi_trap_redirect(struct sbi_trap_regs *regs,
csr_write(CSR_SCAUSE, cause);
/* Set MEPC to S-mode exception vector base */
- regs->mepc = csr_read(stvec);
+ regs->mepc = csr_read(CSR_STVEC);
/* Initial value of new MSTATUS */
new_mstatus = regs->mstatus;
@@ -141,7 +141,7 @@ void sbi_trap_handler(struct sbi_trap_regs *regs,
int rc = SBI_ENOTSUPP;
const char *msg = "trap handler failed";
u32 hartid = sbi_current_hartid();
- ulong mcause = csr_read(mcause);
+ ulong mcause = csr_read(CSR_MCAUSE);
if (mcause & (1UL << (__riscv_xlen - 1))) {
mcause &= ~(1UL << (__riscv_xlen - 1));