diff options
author | Jim Straus <jstraus59@users.noreply.github.com> | 2018-05-15 15:39:02 -0700 |
---|---|---|
committer | Wesley W. Terpstra <wesley@sifive.com> | 2018-05-15 15:39:02 -0700 |
commit | 94bcafff6abe9d17e3f4d99680f0e6488c4acc15 (patch) | |
tree | 5a7d440520235adcf505bf9e4a7a24bee006190e | |
parent | 9d0911092df8e9bd483edf495a9a780e5f0e660f (diff) | |
download | riscv-pk-94bcafff6abe9d17e3f4d99680f0e6488c4acc15.zip riscv-pk-94bcafff6abe9d17e3f4d99680f0e6488c4acc15.tar.gz riscv-pk-94bcafff6abe9d17e3f4d99680f0e6488c4acc15.tar.bz2 |
Fix for missing supervisor mode when running on E51 (#96)
The E51 core on the U54-MC lacks supervisor mode, thus the plic_s_ie and plic_s_thresh are NULL when running on this core. This adds checks for this case.
-rw-r--r-- | machine/minit.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/machine/minit.c b/machine/minit.c index cd909f3..0a87633 100644 --- a/machine/minit.c +++ b/machine/minit.c @@ -124,10 +124,17 @@ static void hart_plic_init() return; size_t ie_words = plic_ndevs / sizeof(uintptr_t) + 1; - for (size_t i = 0; i < ie_words; i++) - HLS()->plic_s_ie[i] = ULONG_MAX; + for (size_t i = 0; i < ie_words; i++) { + if (HLS()->plic_s_ie) { + // Supervisor not always present + HLS()->plic_s_ie[i] = ULONG_MAX; + } + } *HLS()->plic_m_thresh = 1; - *HLS()->plic_s_thresh = 0; + if (HLS()->plic_s_thresh) { + // Supervisor not always present + *HLS()->plic_s_thresh = 0; + } } static void wake_harts() |