Page MenuHomeFreeBSD
Paste P398

Masterwork From Distant Lands
ActivePublic

Authored by cem on Jun 24 2020, 12:34 AM.
Tags
None
Referenced Files
F6791322: Masterwork From Distant Lands
Jun 24 2020, 12:34 AM
Subscribers
commit 1e1bdec3985c
Author: Conrad Meyer <cem@FreeBSD.org>
Date: Thu Apr 16 10:17:24 2020 -0700
XXX build using vmm.h out of git working directory instead of system
diff --git a/sys/amd64/vmm/vmm_instruction_emul.c b/sys/amd64/vmm/vmm_instruction_emul.c
index 20c22a8a8818..2dfa53778693 100644
--- a/sys/amd64/vmm/vmm_instruction_emul.c
+++ b/sys/amd64/vmm/vmm_instruction_emul.c
@@ -48,7 +48,7 @@ __FBSDID("$FreeBSD$");
#include <sys/errno.h>
#include <sys/_iovec.h>
-#include <machine/vmm.h>
+#include <amd64/include/vmm.h>
#include <err.h>
#include <assert.h>
@@ -60,7 +60,7 @@ __FBSDID("$FreeBSD$");
#define panic(...) errx(4, __VA_ARGS__)
#endif /* _KERNEL */
-#include <machine/vmm_instruction_emul.h>
+#include <amd64/include/vmm_instruction_emul.h>
#include <x86/psl.h>
#include <x86/specialreg.h>
diff --git a/usr.sbin/bhyve/acpi.c b/usr.sbin/bhyve/acpi.c
index 580bb900dd43..03288b3baf2b 100644
--- a/usr.sbin/bhyve/acpi.c
+++ b/usr.sbin/bhyve/acpi.c
@@ -68,7 +68,7 @@ __FBSDID("$FreeBSD$");
#include <string.h>
#include <unistd.h>
-#include <machine/vmm.h>
+#include <amd64/include/vmm.h>
#include <vmmapi.h>
#include "bhyverun.h"
diff --git a/usr.sbin/bhyve/atkbdc.c b/usr.sbin/bhyve/atkbdc.c
index a08f58f84b22..0309e53fd17f 100644
--- a/usr.sbin/bhyve/atkbdc.c
+++ b/usr.sbin/bhyve/atkbdc.c
@@ -32,8 +32,8 @@ __FBSDID("$FreeBSD$");
#include <sys/types.h>
-#include <machine/vmm.h>
-#include <machine/vmm_snapshot.h>
+#include <amd64/include/vmm.h>
+#include <amd64/include/vmm_snapshot.h>
#include <vmmapi.h>
diff --git a/usr.sbin/bhyve/bhyverun.c b/usr.sbin/bhyve/bhyverun.c
index 2cb375339b41..ff4c44a6cfc0 100644
--- a/usr.sbin/bhyve/bhyverun.c
+++ b/usr.sbin/bhyve/bhyverun.c
@@ -76,10 +76,11 @@ __FBSDID("$FreeBSD$");
#include <libxo/xo.h>
#endif
-#include <machine/vmm.h>
+#include <amd64/include/vmm.h>
#ifndef WITHOUT_CAPSICUM
#include <machine/vmm_dev.h>
#endif
+#include <amd64/include/vmm_instruction_emul.h>
#include <vmmapi.h>
#include "bhyverun.h"
diff --git a/usr.sbin/bhyve/bootrom.c b/usr.sbin/bhyve/bootrom.c
index 38a50490eb0b..02c8556607ad 100644
--- a/usr.sbin/bhyve/bootrom.c
+++ b/usr.sbin/bhyve/bootrom.c
@@ -33,7 +33,7 @@ __FBSDID("$FreeBSD$");
#include <sys/mman.h>
#include <sys/stat.h>
-#include <machine/vmm.h>
+#include <amd64/include/vmm.h>
#include <err.h>
#include <errno.h>
diff --git a/usr.sbin/bhyve/gdb.c b/usr.sbin/bhyve/gdb.c
index 0539c461bdb3..9742ef94f4c9 100644
--- a/usr.sbin/bhyve/gdb.c
+++ b/usr.sbin/bhyve/gdb.c
@@ -39,7 +39,7 @@ __FBSDID("$FreeBSD$");
#include <sys/socket.h>
#include <machine/atomic.h>
#include <machine/specialreg.h>
-#include <machine/vmm.h>
+#include <amd64/include/vmm.h>
#include <netinet/in.h>
#include <assert.h>
#ifndef WITHOUT_CAPSICUM
diff --git a/usr.sbin/bhyve/inout.c b/usr.sbin/bhyve/inout.c
index b460ee2988cc..1ab557c34d99 100644
--- a/usr.sbin/bhyve/inout.c
+++ b/usr.sbin/bhyve/inout.c
@@ -39,8 +39,8 @@ __FBSDID("$FreeBSD$");
#include <x86/psl.h>
#include <x86/segments.h>
-#include <machine/vmm.h>
-#include <machine/vmm_instruction_emul.h>
+#include <amd64/include/vmm.h>
+#include <amd64/include/vmm_instruction_emul.h>
#include <vmmapi.h>
#include <stdio.h>
diff --git a/usr.sbin/bhyve/ioapic.c b/usr.sbin/bhyve/ioapic.c
index acdbb5111b2e..69bae799e0ad 100644
--- a/usr.sbin/bhyve/ioapic.c
+++ b/usr.sbin/bhyve/ioapic.c
@@ -33,7 +33,7 @@ __FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <stdio.h>
-#include <machine/vmm.h>
+#include <amd64/include/vmm.h>
#include <vmmapi.h>
#include "ioapic.h"
diff --git a/usr.sbin/bhyve/mem.c b/usr.sbin/bhyve/mem.c
index 90aefe45c856..a0637f1b2f1d 100644
--- a/usr.sbin/bhyve/mem.c
+++ b/usr.sbin/bhyve/mem.c
@@ -40,8 +40,8 @@ __FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <sys/errno.h>
#include <sys/tree.h>
-#include <machine/vmm.h>
-#include <machine/vmm_instruction_emul.h>
+#include <amd64/include/vmm.h>
+#include <amd64/include/vmm_instruction_emul.h>
#include <assert.h>
#include <err.h>
diff --git a/usr.sbin/bhyve/pci_emul.c b/usr.sbin/bhyve/pci_emul.c
index ec3a45798ddc..83e281bed424 100644
--- a/usr.sbin/bhyve/pci_emul.c
+++ b/usr.sbin/bhyve/pci_emul.c
@@ -44,8 +44,8 @@ __FBSDID("$FreeBSD$");
#include <assert.h>
#include <stdbool.h>
-#include <machine/vmm.h>
-#include <machine/vmm_snapshot.h>
+#include <amd64/include/vmm.h>
+#include <amd64/include/vmm_snapshot.h>
#include <vmmapi.h>
#include "acpi.h"
diff --git a/usr.sbin/bhyve/pci_fbuf.c b/usr.sbin/bhyve/pci_fbuf.c
index 0bd740a0908c..04c86569f9f7 100644
--- a/usr.sbin/bhyve/pci_fbuf.c
+++ b/usr.sbin/bhyve/pci_fbuf.c
@@ -34,8 +34,8 @@ __FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <sys/mman.h>
-#include <machine/vmm.h>
-#include <machine/vmm_snapshot.h>
+#include <amd64/include/vmm.h>
+#include <amd64/include/vmm_snapshot.h>
#include <vmmapi.h>
#include <stdio.h>
diff --git a/usr.sbin/bhyve/pci_irq.c b/usr.sbin/bhyve/pci_irq.c
index 4ecb3eddb07f..2e5b3f06ee63 100644
--- a/usr.sbin/bhyve/pci_irq.c
+++ b/usr.sbin/bhyve/pci_irq.c
@@ -32,7 +32,7 @@
__FBSDID("$FreeBSD$");
#include <sys/param.h>
-#include <machine/vmm.h>
+#include <amd64/include/vmm.h>
#include <assert.h>
#include <pthread.h>
diff --git a/usr.sbin/bhyve/pci_lpc.c b/usr.sbin/bhyve/pci_lpc.c
index 4ebdd7039cbc..296883aedb20 100644
--- a/usr.sbin/bhyve/pci_lpc.c
+++ b/usr.sbin/bhyve/pci_lpc.c
@@ -33,8 +33,8 @@
__FBSDID("$FreeBSD$");
#include <sys/types.h>
-#include <machine/vmm.h>
-#include <machine/vmm_snapshot.h>
+#include <amd64/include/vmm.h>
+#include <amd64/include/vmm_snapshot.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/usr.sbin/bhyve/pci_nvme.c b/usr.sbin/bhyve/pci_nvme.c
index 65e543510e14..d250de6e757d 100644
--- a/usr.sbin/bhyve/pci_nvme.c
+++ b/usr.sbin/bhyve/pci_nvme.c
@@ -71,7 +71,7 @@ __FBSDID("$FreeBSD$");
#include <string.h>
#include <machine/atomic.h>
-#include <machine/vmm.h>
+#include <amd64/include/vmm.h>
#include <vmmapi.h>
#include <dev/nvme/nvme.h>
diff --git a/usr.sbin/bhyve/pci_passthru.c b/usr.sbin/bhyve/pci_passthru.c
index b74f9666f1a3..6f5c638b5ad3 100644
--- a/usr.sbin/bhyve/pci_passthru.c
+++ b/usr.sbin/bhyve/pci_passthru.c
@@ -57,7 +57,7 @@ __FBSDID("$FreeBSD$");
#include <sysexits.h>
#include <unistd.h>
-#include <machine/vmm.h>
+#include <amd64/include/vmm.h>
#include <vmmapi.h>
#include "pci_emul.h"
#include "mem.h"
diff --git a/usr.sbin/bhyve/pm.c b/usr.sbin/bhyve/pm.c
index 5b268850c127..fcffd3e30537 100644
--- a/usr.sbin/bhyve/pm.c
+++ b/usr.sbin/bhyve/pm.c
@@ -31,7 +31,7 @@
__FBSDID("$FreeBSD$");
#include <sys/types.h>
-#include <machine/vmm.h>
+#include <amd64/include/vmm.h>
#include <assert.h>
#include <errno.h>
diff --git a/usr.sbin/bhyve/rtc.c b/usr.sbin/bhyve/rtc.c
index 09ca3f61ae79..237c838a4e5a 100644
--- a/usr.sbin/bhyve/rtc.c
+++ b/usr.sbin/bhyve/rtc.c
@@ -36,7 +36,7 @@ __FBSDID("$FreeBSD$");
#include <time.h>
#include <assert.h>
-#include <machine/vmm.h>
+#include <amd64/include/vmm.h>
#include <vmmapi.h>
#include "acpi.h"
diff --git a/usr.sbin/bhyve/smbiostbl.c b/usr.sbin/bhyve/smbiostbl.c
index 210a1e5bd7e2..c789ca966bed 100644
--- a/usr.sbin/bhyve/smbiostbl.c
+++ b/usr.sbin/bhyve/smbiostbl.c
@@ -39,7 +39,7 @@ __FBSDID("$FreeBSD$");
#include <unistd.h>
#include <uuid.h>
-#include <machine/vmm.h>
+#include <amd64/include/vmm.h>
#include <vmmapi.h>
#include "bhyverun.h"
diff --git a/usr.sbin/bhyve/spinup_ap.c b/usr.sbin/bhyve/spinup_ap.c
index 7c4186f5ed15..1b36b9597503 100644
--- a/usr.sbin/bhyve/spinup_ap.c
+++ b/usr.sbin/bhyve/spinup_ap.c
@@ -34,7 +34,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/types.h>
-#include <machine/vmm.h>
+#include <amd64/include/vmm.h>
#include <vmmapi.h>
#include <stdio.h>
diff --git a/usr.sbin/bhyve/task_switch.c b/usr.sbin/bhyve/task_switch.c
index f1b564d560c5..dbdb6ac437db 100644
--- a/usr.sbin/bhyve/task_switch.c
+++ b/usr.sbin/bhyve/task_switch.c
@@ -36,8 +36,8 @@ __FBSDID("$FreeBSD$");
#include <x86/psl.h>
#include <x86/segments.h>
#include <x86/specialreg.h>
-#include <machine/vmm.h>
-#include <machine/vmm_instruction_emul.h>
+#include <amd64/include/vmm.h>
+#include <amd64/include/vmm_instruction_emul.h>
#include <assert.h>
#include <errno.h>
diff --git a/usr.sbin/bhyve/vga.c b/usr.sbin/bhyve/vga.c
index 24864f32e8b9..6d8d1a30d11d 100644
--- a/usr.sbin/bhyve/vga.c
+++ b/usr.sbin/bhyve/vga.c
@@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$");
#include <stdlib.h>
#include <string.h>
-#include <machine/vmm.h>
+#include <amd64/include/vmm.h>
#include "bhyvegc.h"
#include "console.h"
diff --git a/usr.sbin/bhyve/vmgenc.c b/usr.sbin/bhyve/vmgenc.c
index 7d0b2faf246a..69719db3bf09 100644
--- a/usr.sbin/bhyve/vmgenc.c
+++ b/usr.sbin/bhyve/vmgenc.c
@@ -43,7 +43,7 @@ __FBSDID("$FreeBSD$");
#include <stdbool.h>
#include <unistd.h>
-#include <machine/vmm.h>
+#include <amd64/include/vmm.h>
#include <vmmapi.h>
#include "acpi.h"
diff --git a/usr.sbin/bhyve/xmsr.c b/usr.sbin/bhyve/xmsr.c
index 0b87821836b7..cff8b6be8784 100644
--- a/usr.sbin/bhyve/xmsr.c
+++ b/usr.sbin/bhyve/xmsr.c
@@ -34,7 +34,7 @@ __FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <machine/cpufunc.h>
-#include <machine/vmm.h>
+#include <amd64/include/vmm.h>
#include <machine/specialreg.h>
#include <vmmapi.h>

Event Timeline

cem changed the title of this paste from untitled to Masterwork From Distant Lands.

If you do 'make toolchain' first to get the updated headers into the WORLDTMP sysroot you don't need this workaround. In general in the tree we assume you are building against an up-to-date sysroot rather than using this sort of approach. Note that to be fully correct you'd need to replace every machine/ include with "amd64/include" above which would then also break for arm64 support, etc.

Ah, I was doing tinderbox with -DMAKE_JUST_WORLDS, which I guess skips toolchain bootstrap?

Nope, even without -DMAKE_JUST_WORLDS it fails to find the new header:

_.amd64.amd64.buildworld:

/usr/src/usr.sbin/bhyve/bhyverun.c:763:3: error: implicit declaration of function 'vie_restart' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                vie_restart(vie);
                ^
/usr/src/usr.sbin/bhyve/bhyverun.c:766:9: error: implicit declaration of function 'vmm_decode_instruction' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                (void)vmm_decode_instruction(mode, cs_d, vie);
                      ^
/usr/src/usr.sbin/bhyve/bhyverun.c:766:9: note: did you mean 'vm_restart_instruction'?
/obj/usr/src/amd64.amd64/tmp/usr/include/machine/vmm.h:771:5: note: 'vm_restart_instruction' declared here
int vm_restart_instruction(void *vm, int vcpuid);
    ^
cat /obj/usr/src/amd64.amd64/usr.sbin/bhyve/.depend.bhyverun.o | grep vmm
  /usr/src/sys/amd64/vmm/intel/vmcs.h \
  /obj/usr/src/amd64.amd64/tmp/usr/include/machine/vmm.h \
  /obj/usr/src/amd64.amd64/tmp/usr/include/machine/vmm_dev.h \
  /obj/usr/src/amd64.amd64/tmp/usr/include/vmmapi.h \
$ ls -lhtr /obj/usr/src/amd64.amd64/tmp/usr/include/machine/vmm.h /obj/usr/src/amd64.amd64/tmp/usr/include/machine/vmm_dev.h
lrwxr-xr-x 1 conrad wheel  36 Jun 24 16:51 /obj/usr/src/amd64.amd64/tmp/usr/include/machine/vmm_dev.h -> ../../../sys/amd64/include/vmm_dev.h
lrwxr-xr-x 1 conrad wheel  32 Jun 24 16:51 /obj/usr/src/amd64.amd64/tmp/usr/include/machine/vmm.h -> ../../../sys/amd64/include/vmm.h
$ ls -lhtr /obj/usr/src/amd64.amd64/tmp/sys/amd64/include/vmm.h /obj/usr/src/amd64.amd64/tmp/sys/amd64/include/vmm_dev.h /obj/usr/src/amd64.amd64/tmp/usr/include/vmmapi.h
-rwxr-xr-x 1 conrad wheel 11K May 15 08:54 /obj/usr/src/amd64.amd64/tmp/usr/include/vmmapi.h*
-rw-r--r-- 1 conrad wheel 12K May 20 10:27 /obj/usr/src/amd64.amd64/tmp/sys/amd64/include/vmm_dev.h
-rw-r--r-- 1 conrad wheel 23K Jun 24 16:51 /obj/usr/src/amd64.amd64/tmp/sys/amd64/include/vmm.h

So... the *symlinks* are current, but vmm_dev.h itself hasn't been updated yet.

Oh ffs I'm missing vmm_instruction_emul.h