Skip to content

Commit

Permalink
bhyve/aarch64: Handle unknown exceptions
Browse files Browse the repository at this point in the history
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
  • Loading branch information
zxombie committed Oct 14, 2024
1 parent 224930e commit 0c7df63
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions usr.sbin/bhyve/aarch64/vmexit.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,15 +263,15 @@ vmexit_smccc(struct vmctx *ctx, struct vcpu *vcpu, struct vm_run *vmrun)
}

static int
vmexit_hyp(struct vmctx *ctx __unused, struct vcpu *vcpu __unused,
struct vm_run *vmrun)
vmexit_hyp(struct vmctx *ctx __unused, struct vcpu *vcpu, struct vm_run *vmrun)
{
struct vm_exit *vme;
/* Raise an unknown reason exception */
if (vm_inject_exception(vcpu,
(EXCP_UNKNOWN << ESR_ELx_EC_SHIFT) | ESR_ELx_IL,
vmrun->vm_exit->u.hyp.far_el2) != 0)
return (VMEXIT_ABORT);

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

static int
Expand Down

0 comments on commit 0c7df63

Please sign in to comment.