From 77a5df569451571d608650a34183d53df99790ec Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Sat, 11 Jan 2020 14:48:52 -0800 Subject: Enable vector unit if present --- machine/encoding.h | 1 + machine/minit.c | 4 ++++ 2 files changed, 5 insertions(+) (limited to 'machine') diff --git a/machine/encoding.h b/machine/encoding.h index c109ce1..20c44b9 100644 --- a/machine/encoding.h +++ b/machine/encoding.h @@ -14,6 +14,7 @@ #define MSTATUS_SPP 0x00000100 #define MSTATUS_HPP 0x00000600 #define MSTATUS_MPP 0x00001800 +#define MSTATUS_VS 0x01800000 #define MSTATUS_FS 0x00006000 #define MSTATUS_XS 0x00018000 #define MSTATUS_MPRV 0x00020000 diff --git a/machine/minit.c b/machine/minit.c index 963010d..8c98e2b 100644 --- a/machine/minit.c +++ b/machine/minit.c @@ -27,6 +27,10 @@ static void mstatus_init() if (supports_extension('F')) write_csr(mstatus, MSTATUS_FS); + // Enable vector extension + if (supports_extension('V')) + write_csr(mstatus, MSTATUS_VS); + // Enable user/supervisor use of perf counters if (supports_extension('S')) write_csr(scounteren, -1); -- cgit v1.1