Some work on CSR

This commit is contained in:
2024-05-13 00:04:44 +02:00
parent f9541157b6
commit f95a85de00
12 changed files with 403 additions and 227 deletions

View File

@ -0,0 +1,21 @@
#include "emulator/csr.h"
#include "emulator/hart.h"
static uint32_t csr_minfo_zero(Hart* hart, uint32_t v, enum CsrAction a)
{
return 0;
}
static uint32_t csr_mhartid(Hart* hart, uint32_t v, enum CsrAction a)
{
return hart->hartid;
}
void csr_init_machine_information(Hart* hart)
{
hart->csrs[CSR_MVENDORID].action = csr_minfo_zero;
hart->csrs[CSR_MARCHID].action = csr_minfo_zero;
hart->csrs[CSR_MIMPID].action = csr_minfo_zero;
hart->csrs[CSR_MHARTID].action = csr_mhartid;
}