Skip to content

Commit 4dfba25

Browse files
committed
Performance: processor_t::take_interrupt() should check EXT_SSAIA
The implementation of SMAIA and SSAIA extensions incurs a significant performance penalty. Better check whether EXT_SSAIA is enabled before accessing the considered CSR's Cf. commit # ddc025a commit # a6708d5
1 parent 5cb0a97 commit 4dfba25

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

riscv/processor.cc

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -303,9 +303,15 @@ bool processor_t::is_handled_in_vs()
303303

304304
void processor_t::take_interrupt(reg_t pending_interrupts)
305305
{
306-
const reg_t s_pending_interrupts = state.nonvirtual_sip->read() & state.nonvirtual_sie->read();
307-
const reg_t vstopi = state.vstopi->read();
308-
const reg_t vs_pending_interrupt = vstopi ? (reg_t(1) << get_field(vstopi, MTOPI_IID)) : 0;
306+
reg_t s_pending_interrupts = 0;
307+
reg_t vstopi = 0;
308+
reg_t vs_pending_interrupt = 0;
309+
310+
if (extension_enable_table[EXT_SSAIA]) {
311+
s_pending_interrupts = state.nonvirtual_sip->read() & state.nonvirtual_sie->read();
312+
vstopi = state.vstopi->read();
313+
vs_pending_interrupt = vstopi ? (reg_t(1) << get_field(vstopi, MTOPI_IID)) : 0;
314+
}
309315

310316
// Do nothing if no pending interrupts
311317
if (!pending_interrupts && !s_pending_interrupts && !vs_pending_interrupt) {

0 commit comments

Comments
 (0)