git: 013da5d9c415 - stable/14 - bhyve: Move kernemu to amd64/

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

URL: https://cgit.FreeBSD.org/src/commit/?id=013da5d9c4156a2a6128d184f2e5464e0146cbae

commit 013da5d9c4156a2a6128d184f2e5464e0146cbae
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2023-10-04 16:22:41 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2023-10-11 13:21:54 +0000

    bhyve: Move kernemu to amd64/
    
    This code handles instruction emulation for accesses to various
    amd64-specific MMIO regions.
    
    No functional change intended.
    
    Reviewed by:    corvink, jhb, emaste
    MFC after:      1 week
    Sponsored by:   Innovate UK
    Differential Revision:  https://reviews.freebsd.org/D40554
    
    (cherry picked from commit a1642451ce25bb0e2d01765a8dedda69c5029d48)
---
 usr.sbin/bhyve/Makefile                  | 3 ---
 usr.sbin/bhyve/amd64/Makefile.inc        | 4 +++-
 usr.sbin/bhyve/{ => amd64}/kernemu_dev.c | 0
 usr.sbin/bhyve/{ => amd64}/kernemu_dev.h | 0
 usr.sbin/bhyve/bhyverun.c                | 6 +++++-
 5 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/usr.sbin/bhyve/Makefile b/usr.sbin/bhyve/Makefile
index 499c0d1bb89d..c2ccd60790ae 100644
--- a/usr.sbin/bhyve/Makefile
+++ b/usr.sbin/bhyve/Makefile
@@ -33,7 +33,6 @@ SRCS=	\
 	inout.c			\
 	ioapic.c		\
 	iov.c			\
-	kernemu_dev.c		\
 	mem.c			\
 	mevent.c		\
 	net_backends.c		\
@@ -85,8 +84,6 @@ SRCS+=	snapshot.c
 
 .include "${MACHINE_CPUARCH}/Makefile.inc"
 
-CFLAGS.kernemu_dev.c+=	-I${SRCTOP}/sys/amd64
-
 CFLAGS+=-I${.CURDIR}		\
 	-I${.CURDIR}/../../contrib/lib9p \
 	-I${SRCTOP}/sys
diff --git a/usr.sbin/bhyve/amd64/Makefile.inc b/usr.sbin/bhyve/amd64/Makefile.inc
index e0cb84e32b85..6843cec4919f 100644
--- a/usr.sbin/bhyve/amd64/Makefile.inc
+++ b/usr.sbin/bhyve/amd64/Makefile.inc
@@ -2,14 +2,16 @@ SRCS+=	\
 	atkbdc.c	\
 	e820.c		\
 	fwctl.c		\
+	kernemu_dev.c	\
 	mptbl.c		\
 	post.c		\
 	ps2kbd.c	\
 	ps2mouse.c	\
 	task_switch.c
 
-
 .PATH:  ${BHYVE_SYSDIR}/sys/amd64/vmm
 SRCS+=	vmm_instruction_emul.c
 
+CFLAGS.kernemu_dev.c+=	-I${SRCTOP}/sys/amd64
+
 SUBDIR+=	kbdlayout
diff --git a/usr.sbin/bhyve/kernemu_dev.c b/usr.sbin/bhyve/amd64/kernemu_dev.c
similarity index 100%
rename from usr.sbin/bhyve/kernemu_dev.c
rename to usr.sbin/bhyve/amd64/kernemu_dev.c
diff --git a/usr.sbin/bhyve/kernemu_dev.h b/usr.sbin/bhyve/amd64/kernemu_dev.h
similarity index 100%
rename from usr.sbin/bhyve/kernemu_dev.h
rename to usr.sbin/bhyve/amd64/kernemu_dev.h
diff --git a/usr.sbin/bhyve/bhyverun.c b/usr.sbin/bhyve/bhyverun.c
index a61ebcda0003..7088f11f63eb 100644
--- a/usr.sbin/bhyve/bhyverun.c
+++ b/usr.sbin/bhyve/bhyverun.c
@@ -95,7 +95,9 @@
 #endif
 #include "gdb.h"
 #include "ioapic.h"
-#include "kernemu_dev.h"
+#ifdef __amd64__
+#include "amd64/kernemu_dev.h"
+#endif
 #include "mem.h"
 #include "mevent.h"
 #ifdef __amd64__
@@ -1453,7 +1455,9 @@ main(int argc, char *argv[])
 
 	init_mem(guest_ncpus);
 	init_inout();
+#ifdef __amd64__
 	kernemu_dev_init();
+#endif
 	init_bootrom(ctx);
 #ifdef __amd64__
 	atkbdc_init(ctx);