Skip to content

Commit

Permalink
feat(arch/exception_handler): enable exception handlers to suspend vCPU
Browse files Browse the repository at this point in the history
Implemented support for abort and exception handlers to suspend the
current vCPU based on the vCPU active flag.

Signed-off-by: João Peixoto <[email protected]>
  • Loading branch information
joaopeixoto13 committed Sep 19, 2024
1 parent 66bcb7b commit f3b87e3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/arch/armv8/aborts.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@ void aborts_sync_handler(void)
abort_handler_t handler = abort_handlers[ec];
if (handler) {
handler(iss, ipa_fault_addr, il, ec);
if (cpu()->vcpu->active == false) {
cpu_idle();
}
} else {
ERROR("no handler for abort ec = 0x%x", ec); // unknown guest exception
}
Expand Down
3 changes: 3 additions & 0 deletions src/arch/riscv/sync_exceptions.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,4 +153,7 @@ void sync_exception_handler(void)
}

vcpu_writepc(cpu()->vcpu, vcpu_readpc(cpu()->vcpu) + pc_step);
if (cpu()->vcpu->active == false) {
cpu_idle();
}
}

0 comments on commit f3b87e3

Please sign in to comment.