aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md5
-rw-r--r--machine/minit.c8
2 files changed, 9 insertions, 4 deletions
diff --git a/README.md b/README.md
index 2c96b2a..3a7038a 100644
--- a/README.md
+++ b/README.md
@@ -32,8 +32,11 @@ Alternatively, the GNU/Linux toolchain may be used to build this package,
by setting `--host=riscv64-unknown-linux-gnu`.
By default, 64-bit (RV64) versions of `pk` and `bbl` are built. To
-built 32-bit (RV32) versions, supply a `--with-arch=rv32i` flag to the
+built 32-bit (RV32) versions, supply a `--with-arch=rv32i_zicsr_zifencei` flag to the
configure command.
+To process RVC binaries, supply a `--with-arch=rv32ic_zicsr_zifencei` flag, because the
+emulation code (floating point and miss-aligned load and store) is different in
+the RVC case.
The `install` step installs 64-bit build products into a directory
matching your host (e.g. `$RISCV/riscv64-unknown-elf`). 32-bit versions
diff --git a/machine/minit.c b/machine/minit.c
index 55f50cb..cee11da 100644
--- a/machine/minit.c
+++ b/machine/minit.c
@@ -73,19 +73,21 @@ static void delegate_traps()
return;
uintptr_t interrupts = MIP_SSIP | MIP_STIP | MIP_SEIP;
- uintptr_t exceptions =
+ uintptr_t mandatorily_delegable_exceptions =
(1U << CAUSE_MISALIGNED_FETCH) |
(1U << CAUSE_FETCH_PAGE_FAULT) |
(1U << CAUSE_BREAKPOINT) |
(1U << CAUSE_LOAD_PAGE_FAULT) |
(1U << CAUSE_STORE_PAGE_FAULT) |
- (1U << CAUSE_USER_ECALL) |
+ (1U << CAUSE_USER_ECALL);
+ uintptr_t exceptions =
+ mandatorily_delegable_exceptions |
(1U << CAUSE_SOFTWARE_CHECK_FAULT);
write_csr(mideleg, interrupts);
write_csr(medeleg, exceptions);
assert((read_csr(mideleg) & interrupts) == interrupts);
- assert(read_csr(medeleg) == exceptions);
+ assert((~read_csr(medeleg) & mandatorily_delegable_exceptions) == 0);
}
static void fp_init()