diff options
author | Olof Johansson <olof@lixom.net> | 2019-02-03 18:49:20 -0800 |
---|---|---|
committer | Anup Patel <anup@brainfault.org> | 2019-02-05 18:53:09 +0530 |
commit | c0addfe751e51376a73df71336ce11826e68c939 (patch) | |
tree | 976fd2840382f7be088a47907b2b49e6517071fa /include/sbi/riscv_asm.h | |
parent | 30dfdf6e0e4ac11c80ba6505024481a15f604160 (diff) |
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>
Diffstat (limited to 'include/sbi/riscv_asm.h')
-rw-r--r-- | include/sbi/riscv_asm.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/include/sbi/riscv_asm.h b/include/sbi/riscv_asm.h index e071049..a88c086 100644 --- a/include/sbi/riscv_asm.h +++ b/include/sbi/riscv_asm.h @@ -10,6 +10,8 @@ #ifndef __RISCV_ASM_H__ #define __RISCV_ASM_H__ +#include <sbi/riscv_encoding.h> + #ifdef __ASSEMBLY__ #define __ASM_STR(x) x #else @@ -144,17 +146,17 @@ do { \ static inline int misa_extension(char ext) { - return csr_read(misa) & (1 << (ext - 'A')); + return csr_read(CSR_MISA) & (1 << (ext - 'A')); } static inline int misa_xlen(void) { - return ((long)csr_read(misa) < 0) ? 64 : 32; + return ((long)csr_read(CSR_MISA) < 0) ? 64 : 32; } static inline void misa_string(char *out, unsigned int out_sz) { - unsigned long i, val = csr_read(misa); + unsigned long i, val = csr_read(CSR_MISA); for (i = 0; i < 26; i++) { if (val & (1 << i)) { |