summaryrefslogtreecommitdiff
path: root/src/arch/riscv
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/riscv')
-rw-r--r--src/arch/riscv/include/arch/cpu.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/arch/riscv/include/arch/cpu.h b/src/arch/riscv/include/arch/cpu.h
index 6008c75122..d2f42a8665 100644
--- a/src/arch/riscv/include/arch/cpu.h
+++ b/src/arch/riscv/include/arch/cpu.h
@@ -51,5 +51,11 @@ static inline int supports_extension(char ext)
return read_csr(misa) & (1 << (ext - 'A'));
}
+static inline int machine_xlen(void)
+{
+ int mxl = (read_csr(misa) >> (__riscv_xlen - 2)) & 3;
+ return (1 << mxl) * 16;
+}
+
struct cpu_info *cpu_info(void);
#endif /* __ARCH_CPU_H__ */