diff --git a/machine/minit.c b/machine/minit.c index b8c9eac..4eee256 100644 --- a/machine/minit.c +++ b/machine/minit.c @@ -129,7 +129,8 @@ static void hart_plic_init() if (!plic_ndevs) return; - size_t ie_words = plic_ndevs / sizeof(uintptr_t) + 1; + size_t ie_words = (plic_ndevs + 8 * sizeof(uintptr_t) - 1) / + (8 * sizeof(uintptr_t)); for (size_t i = 0; i < ie_words; i++) { if (HLS()->plic_s_ie) { // Supervisor not always present