diff options
author | Andrew Waterman <andrew@sifive.com> | 2023-02-04 17:52:48 -0800 |
---|---|---|
committer | Andrew Waterman <andrew@sifive.com> | 2023-02-04 17:52:48 -0800 |
commit | b04229ee59cbe5286478b7cfa930b9995d2bdd93 (patch) | |
tree | e6f0e7c9640d9fc19b9fb10e980a4f57d0ee9352 /riscv | |
parent | 655788426bbe23cf0c6112c0365422fa709f8270 (diff) | |
download | spike-b04229ee59cbe5286478b7cfa930b9995d2bdd93.zip spike-b04229ee59cbe5286478b7cfa930b9995d2bdd93.tar.gz spike-b04229ee59cbe5286478b7cfa930b9995d2bdd93.tar.bz2 |
Simplify plic_context_t initialization
Diffstat (limited to 'riscv')
-rw-r--r-- | riscv/plic.cc | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/riscv/plic.cc b/riscv/plic.cc index 4d22ebc..e070c9e 100644 --- a/riscv/plic.cc +++ b/riscv/plic.cc @@ -81,16 +81,9 @@ plic_t::plic_t(std::vector<processor_t*>& procs, bool smode, uint32_t ndev) for (size_t i = 0; i < contexts.size(); i++) { plic_context_t* c = &contexts[i]; + memset(c, 0, sizeof(*c)); c->proc = procs[i / contexts_per_hart]; - if (smode) { - c->mmode = (i % contexts_per_hart == 0); - } else { - c->mmode = true; - } - memset(&c->enable, 0, sizeof(c->enable)); - memset(&c->pending, 0, sizeof(c->pending)); - memset(&c->pending_priority, 0, sizeof(c->pending_priority)); - memset(&c->claimed, 0, sizeof(c->claimed)); + c->mmode = (i % contexts_per_hart == 0); } } |