mirror of
https://github.com/Fishwaldo/opensbi.git
synced 2025-06-28 09:08:24 +00:00
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:
parent
30dfdf6e0e
commit
c0addfe751
3 changed files with 11 additions and 9 deletions
|
@ -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)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue