Skip to content

Commit f3b87e3

Browse files
committed
feat(arch/exception_handler): enable exception handlers to suspend vCPU
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]>
1 parent 66bcb7b commit f3b87e3

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/arch/armv8/aborts.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,9 @@ void aborts_sync_handler(void)
195195
abort_handler_t handler = abort_handlers[ec];
196196
if (handler) {
197197
handler(iss, ipa_fault_addr, il, ec);
198+
if (cpu()->vcpu->active == false) {
199+
cpu_idle();
200+
}
198201
} else {
199202
ERROR("no handler for abort ec = 0x%x", ec); // unknown guest exception
200203
}

src/arch/riscv/sync_exceptions.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,4 +153,7 @@ void sync_exception_handler(void)
153153
}
154154

155155
vcpu_writepc(cpu()->vcpu, vcpu_readpc(cpu()->vcpu) + pc_step);
156+
if (cpu()->vcpu->active == false) {
157+
cpu_idle();
158+
}
156159
}

0 commit comments

Comments
 (0)