Browse Source

Enable vector unit if present (continuation of 77a5df5694)

pull/185/head
Andrew Waterman 6 years ago
parent
commit
6fa3555cc5
  1. 1
      machine/encoding.h
  2. 8
      machine/minit.c
  3. 2
      pk/pk.c

1
machine/encoding.h

@ -33,6 +33,7 @@
#define SSTATUS_UPIE 0x00000010
#define SSTATUS_SPIE 0x00000020
#define SSTATUS_SPP 0x00000100
#define SSTATUS_VS 0x01800000
#define SSTATUS_FS 0x00006000
#define SSTATUS_XS 0x00018000
#define SSTATUS_SUM 0x00040000

8
machine/minit.c

@ -23,13 +23,17 @@ void* kernel_end;
static void mstatus_init()
{
uintptr_t mstatus = 0;
// Enable FPU
if (supports_extension('F'))
write_csr(mstatus, MSTATUS_FS);
mstatus |= MSTATUS_FS;
// Enable vector extension
if (supports_extension('V'))
write_csr(mstatus, MSTATUS_VS);
mstatus |= MSTATUS_VS;
write_csr(mstatus, mstatus);
// Enable user/supervisor use of perf counters
if (supports_extension('S'))

2
pk/pk.c

@ -187,7 +187,7 @@ void boot_loader(uintptr_t dtb)
write_csr(stvec, &trap_entry);
write_csr(sscratch, 0);
write_csr(sie, 0);
set_csr(sstatus, SSTATUS_SUM | SSTATUS_FS);
set_csr(sstatus, SSTATUS_SUM | SSTATUS_FS | SSTATUS_VS);
file_init();
enter_supervisor_mode(rest_of_boot_loader, pk_vm_init(), 0);

Loading…
Cancel
Save