git: 8f485cac6302 - stable/14 - bhyve: Move the vm_inject_fault() implementation to vmexit.c

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Wed, 11 Oct 2023 13:25:23 UTC
The branch stable/14 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=8f485cac63024e1bd3a5328cdb2ccc08df364666

commit 8f485cac63024e1bd3a5328cdb2ccc08df364666
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2023-10-04 16:29:07 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2023-10-11 13:24:41 +0000

    bhyve: Move the vm_inject_fault() implementation to vmexit.c
    
    This function isn't generic and has a different signature on arm64.  No
    functional change intended.
    
    Reviewed by:    corvink, jhb
    MFC after:      1 week
    Sponsored by:   Innovate UK
    Differential Revision:  https://reviews.freebsd.org/D40991
    
    (cherry picked from commit 7228ad8da93bcce820c85b733972d0d9cc767d27)
---
 usr.sbin/bhyve/amd64/vmexit.c | 13 +++++++++++++
 usr.sbin/bhyve/bhyverun.c     | 13 -------------
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/usr.sbin/bhyve/amd64/vmexit.c b/usr.sbin/bhyve/amd64/vmexit.c
index 152fecaf424c..5d903d98f277 100644
--- a/usr.sbin/bhyve/amd64/vmexit.c
+++ b/usr.sbin/bhyve/amd64/vmexit.c
@@ -56,6 +56,19 @@
 #include "vmexit.h"
 #include "xmsr.h"
 
+void
+vm_inject_fault(struct vcpu *vcpu, int vector, int errcode_valid,
+    int errcode)
+{
+	int error, restart_instruction;
+
+	restart_instruction = 1;
+
+	error = vm_inject_exception(vcpu, vector, errcode_valid, errcode,
+	    restart_instruction);
+	assert(error == 0);
+}
+
 static int
 vmexit_inout(struct vmctx *ctx, struct vcpu *vcpu, struct vm_run *vmrun)
 {
diff --git a/usr.sbin/bhyve/bhyverun.c b/usr.sbin/bhyve/bhyverun.c
index e3b297cfccca..eda9711bccb8 100644
--- a/usr.sbin/bhyve/bhyverun.c
+++ b/usr.sbin/bhyve/bhyverun.c
@@ -380,19 +380,6 @@ build_vcpumaps(void)
 	}
 }
 
-void
-vm_inject_fault(struct vcpu *vcpu, int vector, int errcode_valid,
-    int errcode)
-{
-	int error, restart_instruction;
-
-	restart_instruction = 1;
-
-	error = vm_inject_exception(vcpu, vector, errcode_valid, errcode,
-	    restart_instruction);
-	assert(error == 0);
-}
-
 void *
 paddr_guest2host(struct vmctx *ctx, uintptr_t gaddr, size_t len)
 {