Unverified Commit 6e355849 authored by Fawaz's avatar Fawaz Committed by GitHub
Browse files

Added features to select privilege level (#5)

Currently, the library attempts to execute some semihosting operations
in a completely interrupt-free context. It does this by using
`riscv::interrupt::free`, which saves and restores the `mie` field of
`mstatus`. As a result, attempts to initiate semihosting calls outside
of M mode cause illegal instruction exceptions.

This commit provides a solution, by requiring users to choose one of two
features, "machine-mode" or "user-mode", which will compile different
versions of the functions in src/export.rs that do and do not suspend
interrupts, respectively. Failure to do so will throw a compiler error,
unless the "no-semihosting" feature was enabled.

A "supervisor-mode" feature was left out as the `riscv` crate does not
yet have an equivalent of `interrupt::free` for supervisor mode.

CI now also checks builds with both of these features.
parent 45ac4e86
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment