diff --git a/riscv/plic.cc b/riscv/plic.cc index aa91939e..d0f1268c 100644 --- a/riscv/plic.cc +++ b/riscv/plic.cc @@ -67,15 +67,12 @@ #define REG_SIZE 0x1000000 plic_t::plic_t(std::vector& procs, bool smode, uint32_t ndev) - : procs(procs), contexts(procs.size() * (smode ? 2 : 1)) + : procs(procs), contexts(procs.size() * (smode ? 2 : 1)), + num_ids(ndev + 1), num_ids_word(((ndev + 1) + (32 - 1)) / 32), + max_prio((1UL << PLIC_PRIO_BITS) - 1) { size_t contexts_per_hart = smode ? 2 : 1; - num_ids = ndev + 1; - num_ids_word = num_ids / 32; - if ((num_ids_word * 32) < num_ids) - num_ids_word++; - max_prio = (1UL << PLIC_PRIO_BITS) - 1; memset(priority, 0, sizeof(priority)); memset(level, 0, sizeof(level));