From 05704402ac85e0864eda63cecc20eb7810ecb503 Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Tue, 4 Jun 2024 15:06:42 -0400 Subject: [PATCH] bhyve: Add a stub VM_EXITCODE_REG_EMUL handler This lets us print a few fields of interest before aborting the VM loop. No functional change intended. Reviewed by: corvink, andrew Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D44741 --- usr.sbin/bhyve/aarch64/vmexit.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/usr.sbin/bhyve/aarch64/vmexit.c b/usr.sbin/bhyve/aarch64/vmexit.c index 03fc2f8b21e..a47df27e54f 100644 --- a/usr.sbin/bhyve/aarch64/vmexit.c +++ b/usr.sbin/bhyve/aarch64/vmexit.c @@ -84,6 +84,21 @@ fail: return (VMEXIT_ABORT); } +static int +vmexit_reg_emul(struct vmctx *ctx __unused, struct vcpu *vcpu __unused, + struct vm_run *vmrun) +{ + struct vm_exit *vme; + struct vre *vre; + + vme = vmrun->vm_exit; + vre = &vme->u.reg_emul.vre; + + EPRINTLN("Unhandled register access: pc %#lx syndrome %#x reg %d\n", + vme->pc, vre->inst_syndrome, vre->reg); + return (VMEXIT_ABORT); +} + static int vmexit_suspend(struct vmctx *ctx, struct vcpu *vcpu, struct vm_run *vmrun) { @@ -269,6 +284,7 @@ vmexit_ss(struct vmctx *ctx __unused, struct vcpu *vcpu, struct vm_run *vmrun) const vmexit_handler_t vmexit_handlers[VM_EXITCODE_MAX] = { [VM_EXITCODE_BOGUS] = vmexit_bogus, [VM_EXITCODE_INST_EMUL] = vmexit_inst_emul, + [VM_EXITCODE_REG_EMUL] = vmexit_reg_emul, [VM_EXITCODE_SUSPENDED] = vmexit_suspend, [VM_EXITCODE_DEBUG] = vmexit_debug, [VM_EXITCODE_SMCCC] = vmexit_smccc,