Skip to content

Commit 0c7df63

Browse files
committed
bhyve/aarch64: Handle unknown exceptions
When an exception class is unhandled by the kernel we handle it in userspace by exiting the process. Rather than exiting raise an unknown reason exception in the guest. The guest can then handle the exception as it wishes. Reviewed by: markj Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D46511
1 parent 224930e commit 0c7df63

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

usr.sbin/bhyve/aarch64/vmexit.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -263,15 +263,15 @@ vmexit_smccc(struct vmctx *ctx, struct vcpu *vcpu, struct vm_run *vmrun)
263263
}
264264

265265
static int
266-
vmexit_hyp(struct vmctx *ctx __unused, struct vcpu *vcpu __unused,
267-
struct vm_run *vmrun)
266+
vmexit_hyp(struct vmctx *ctx __unused, struct vcpu *vcpu, struct vm_run *vmrun)
268267
{
269-
struct vm_exit *vme;
268+
/* Raise an unknown reason exception */
269+
if (vm_inject_exception(vcpu,
270+
(EXCP_UNKNOWN << ESR_ELx_EC_SHIFT) | ESR_ELx_IL,
271+
vmrun->vm_exit->u.hyp.far_el2) != 0)
272+
return (VMEXIT_ABORT);
270273

271-
vme = vmrun->vm_exit;
272-
printf("unhandled exception: esr %#lx, far %#lx\n",
273-
vme->u.hyp.esr_el2, vme->u.hyp.far_el2);
274-
return (VMEXIT_ABORT);
274+
return (VMEXIT_CONTINUE);
275275
}
276276

277277
static int

0 commit comments

Comments
 (0)