--- devel/kBuild/Makefile (revision 520061) +++ devel/kBuild/Makefile (working copy) @@ -3,10 +3,10 @@ PORTNAME= kBuild DISTVERSION= ${KBUILD_VERSION} -PORTREVISION= 13 +PORTREVISION= 14 CATEGORIES= devel MASTER_SITES= LOCAL/jkim -DISTNAME= ${PORTNAME}-${DISTVERSION}r3127-src +DISTNAME= ${PORTNAME}-${DISTVERSION}r${KBUILD_SVN_REV}-src MAINTAINER= vbox@FreeBSD.org COMMENT= Makefile framework @@ -29,6 +29,8 @@ KBUILD_ENV= AUTORECONF=${AUTORECONF} \ AUTOPOINT=true \ CC="${CC}" CFLAGS="${CFLAGS}" CPPFLAGS="${CPPFLAGS}" \ LDFLAGS="${LDFLAGS}" MAKE="${MAKE_CMD}" +KBUILD_SVN_URL= https://www.virtualbox.org/svn/kbuild-mirror/trunk +KBUILD_SVN_REV= 3301 KBUILD_TARGET= ${OPSYS:tl} KBUILD_BINS= kDepIDB kDepObj kDepPre kObjCache kmk kmk_append kmk_ash \ @@ -42,12 +44,11 @@ PORTDOCS= QuickReference-kmk.html \ ENV= .export ENV -OPTIONS_DEFINE= DOCS GCC -OPTIONS_DEFAULT=GCC -GCC_DESC= Build with GCC (should almost always be enabled) -GCC_USE= GCC=yes +OPTIONS_DEFINE= DOCS post-patch: + @${ECHO_CMD} 'KBUILD_SVN_URL := ${KBUILD_SVN_URL}' > ${WRKSRC}/SvnInfo.kmk + @${ECHO_CMD} 'KBUILD_SVN_REV := ${KBUILD_SVN_REV}' >> ${WRKSRC}/SvnInfo.kmk @${REINPLACE_CMD} 's|gcc|${CC}|g' ${WRKSRC}/kBuild/tools/*.kmk do-build: --- devel/kBuild/distinfo (revision 520061) +++ devel/kBuild/distinfo (working copy) @@ -1,3 +1,3 @@ -TIMESTAMP = 1511906864 -SHA256 (kBuild-0.1.9998r3127-src.tar.xz) = b98fced9ba0ddae5a080463db43003b8f963d04da3bd588c86025cbf6dda7c61 -SIZE (kBuild-0.1.9998r3127-src.tar.xz) = 2144704 +TIMESTAMP = 1575421238 +SHA256 (kBuild-0.1.9998r3301-src.tar.xz) = e02550adb4939d47fdfd3b9ccd5602b80f59bd38b9a84865a6f3c91ffd1f4450 +SIZE (kBuild-0.1.9998r3301-src.tar.xz) = 2291292 --- devel/kBuild/pkg-help (revision 520061) +++ devel/kBuild/pkg-help (nonexistent) @@ -1,3 +0,0 @@ -The only time that the GCC option can be disabled (to build with clang -instead) is if you're building ONLY emulators/virtualbox-ose-additions, -without X11, and only on amd64/i386. --- emulators/virtualbox-ose/Makefile (revision 520061) +++ emulators/virtualbox-ose/Makefile (working copy) @@ -2,9 +2,9 @@ # $FreeBSD$ PORTNAME= virtualbox-ose -PORTVERSION= 5.2.34 +PORTVERSION= 6.1.0 CATEGORIES= emulators -MASTER_SITES= https://download.oracle.com/virtualbox/${PORTVERSION}/ +MASTER_SITES= https://download.virtualbox.org/virtualbox/${PORTVERSION}/ DISTFILES= VirtualBox-${PORTVERSION}${EXTRACT_SUFX} ${GUESTADDITIONS} EXTRACT_ONLY= VirtualBox-${PORTVERSION}${EXTRACT_SUFX} @@ -16,7 +16,7 @@ LICENSE_FILE= ${WRKSRC}/COPYING BUILD_DEPENDS= yasm:devel/yasm \ xsltproc:textproc/libxslt \ - kmk:devel/kBuild \ + kBuild>=0.1.9998_14:devel/kBuild \ gtar:archivers/gtar LIB_DEPENDS= libpng.so:graphics/png \ libxslt.so:textproc/libxslt \ @@ -40,8 +40,6 @@ CONFLICTS_INSTALL= virtualbox-ose-additions-* \ virtualbox-ose-legacy-[0-9]* \ virtualbox-ose-lite-[0-9]* -LDFLAGS= -lpthread - VBOXUSER?= vboxusers VBOXWSUSER?= vboxusers VBOXGROUP?= vboxusers @@ -49,13 +47,13 @@ USERS= ${VBOXUSER} GROUPS= ${VBOXGROUP} VBOX_DIR= ${PREFIX}/${VBOX_DIR_REL} VBOX_DIR_REL= lib/virtualbox -VBOX_LINKS= VBoxVRDP +VBOX_LINKS= VBoxVRDP vbox-img VBOX_PROGS= VBoxAutostart VBoxBalloonCtrl VBoxBugReport VBoxHeadless \ VBoxManage VBOX_UTILS= VBoxExtPackHelperApp VBoxNetAdpCtl VBoxNetDHCP VBoxNetNAT \ - VBoxSVC VBoxXPCOMIPCD + VBoxSVC VBoxXPCOMIPCD vbox-img -OPTIONS_DEFINE= ALSA DBUS DEBUG GUESTADDITIONS MANUAL NLS PULSEAUDIO \ +OPTIONS_DEFINE= ALSA DBUS DEBUG GUESTADDITIONS MANUAL NLS OPUS PULSEAUDIO \ PYTHON QT5 R0LOGGING UDPTUNNEL VDE VNC WEBSERVICE VPX X11 OPTIONS_DEFAULT= DBUS QT5 UDPTUNNEL VNC WEBSERVICE X11 OPTIONS_SUB= yes @@ -64,6 +62,7 @@ DEBUG_DESC= Debug symbols, additional logs and ass GUESTADDITIONS_DESC= Build with Guest Additions MANUAL_DESC= Build with user manual NLS_DESC= Native language support (requires QT5) +OPUS_DESC= Use libvpx for audio recording (requires VPX) QT5_DESC= Build with QT5 frontend (requires X11) R0LOGGING_DESC= Enable R0 logging (requires DEBUG) UDPTUNNEL_DESC= Build with UDP tunnel support @@ -80,6 +79,9 @@ DEBUG_CONFIGURE_ON= --build-debug MANUAL_BUILD_DEPENDS= ${LOCALBASE}/share/xml/docbook/4.4/docbookx.dtd:textproc/docbook-xml MANUAL_CONFIGURE_OFF= --disable-docs NLS_IMPLIES= QT5 +OPUS_CONFIGURE_OFF= --disable-libopus +OPUS_LIB_DEPENDS= libopus.so:audio/opus +OPUS_IMPLIES= VPX PULSEAUDIO_CONFIGURE_OFF= --disable-pulse PULSEAUDIO_LIB_DEPENDS= libpulse.so:audio/pulseaudio PYTHON_CONFIGURE_OFF= --disable-python @@ -139,12 +141,12 @@ USE_TEX= dvipsk:build formats:build .endif .if ${PORT_OPTIONS:MPYTHON} -USES+= python:2.7 +USES+= python USE_PYTHON= distutils noegginfo noflavors PYDISTUTILS_PKGNAME= vboxapi PYDISTUTILS_PKGVERSION= 1.0 .else -USES+= python:2.7,build +USES+= python:build .endif .if ${PORT_OPTIONS:MQT5} @@ -156,7 +158,7 @@ USE_QT= buildtools_build core dbus gui linguistto USE_QT+= printsupport widgets x11extras USE_XORG= xcb INSTALLS_ICONS= yes -VBOX_PROGS+= VirtualBox +VBOX_PROGS+= VirtualBox VirtualBoxVM VBOX_UTILS+= VBoxTestOGL VBOX_WITH_QT= 1 .else @@ -208,10 +210,8 @@ CC= ${LOCALBASE}/bin/clang${VBOX_LLVM_VER} CXX= ${LOCALBASE}/bin/clang++${VBOX_LLVM_VER} VBOX_LLVM_VER?= 70 .endif -PATCH_DEPENDS+= ${LOCALBASE}/share/kBuild/tools/GXX3.kmk:devel/kBuild EXTRA_PATCHES+= ${PATCHDIR}/extrapatch-Config.kmk \ - ${PATCHDIR}/extrapatch-src-VBox-Devices-PC-ipxe-Makefile.kmk \ - ${PATCHDIR}/extrapatch-src-recompiler-Makefile.kmk + ${PATCHDIR}/extrapatch-src_VBox_Devices_PC_ipxe_Makefile.kmk .endif .if ${PYTHON_MAJOR_VER} >= 3 @@ -250,6 +250,8 @@ post-patch: ${WRKSRC}/LocalConfig.kmk @${ECHO_CMD} 'VBOX_WITH_RUNPATH = ${VBOX_DIR}' >> \ ${WRKSRC}/LocalConfig.kmk + @${ECHO_CMD} 'VBOX_WITH_VBOX_IMG = ${VBOX_DIR}' >> \ + ${WRKSRC}/LocalConfig.kmk @${ECHO_CMD} 'VBOX_PATH_APP_PRIVATE = ${DATADIR}' >> \ ${WRKSRC}/LocalConfig.kmk @${ECHO_CMD} 'VBOX_PATH_APP_DOCS = ${DOCSDIR}' >> ${WRKSRC}/LocalConfig.kmk @@ -285,15 +287,17 @@ post-patch: @${ECHO_CMD} 'VBOX_GCC_PEDANTIC_CXX = -Wshadow $$(VBOX_GCC_WARN) -Wno-long-long' >> \ ${WRKSRC}/LocalConfig.kmk .endif +.if empty(PORT_OPTIONS:MX11) + @${ECHO} 'VBOX_WITH_VMSVGA3D =' >> ${WRKSRC}/LocalConfig.kmk +.endif .if ${COMPILER_TYPE} == clang - @${REINPLACE_CMD} -e 's| -finline-limit=8000||' \ - -e 's| -mpreferred-stack-boundary=2||' ${WRKSRC}/Config.kmk + @${REINPLACE_CMD} -e 's| -mno-align-long-strings||' \ + ${WRKSRC}/Config.kmk + @${REINPLACE_CMD} -e 's|-mpreferred-stack-boundary=2 ||' \ + ${WRKSRC}/Config.kmk \ + ${WRKSRC}/src/VBox/Devices/PC/ipxe/Makefile.kmk @${REINPLACE_CMD} -e 's| -fpermissive||' ${WRKSRC}/Config.kmk \ ${WRKSRC}/src/VBox/Main/webservice/Makefile.kmk - @${ECHO_CMD} 'TOOL_VBoxGccFreeBSD_LD = ${CXX}' >> ${WRKSRC}/LocalConfig.kmk - @${SED} -e 's|GXX3|VBoxGccFreeBSD|g' \ - ${LOCALBASE}/share/kBuild/tools/GXX3.kmk > \ - ${WRKSRC}/tools/kBuildTools/VBoxGccFreeBSD.kmk .endif @${REINPLACE_CMD} -e 's|/usr/local|${LOCALBASE}|g' \ ${WRKSRC}/Config.kmk ${WRKSRC}/configure \ @@ -337,7 +341,7 @@ do-install: ${MKDIR} ${STAGEDIR}${VBOX_DIR} cd ${KMK_BUILDDIR}/bin && ${COPYTREE_SHARE} \ - "*.fd *.r0 *.rc *.so components" ${STAGEDIR}${VBOX_DIR} + "*.fd *.r0 *.so components" ${STAGEDIR}${VBOX_DIR} .if ${PORT_OPTIONS:MPYTHON} || ${PORT_OPTIONS:MWEBSERVICE} ${RLN} ${STAGEDIR}${DATADIR}/sdk ${STAGEDIR}${VBOX_DIR} .endif --- emulators/virtualbox-ose/distinfo (revision 520061) +++ emulators/virtualbox-ose/distinfo (working copy) @@ -1,5 +1,5 @@ -TIMESTAMP = 1571257463 -SHA256 (VirtualBox-5.2.34.tar.bz2) = 9abff37330bba46b97aa836bc886397ba9cfb06cb75be5d60ac31f5ae9c2f2e1 -SIZE (VirtualBox-5.2.34.tar.bz2) = 118268064 -SHA256 (VBoxGuestAdditions_5.2.34.iso) = d1b63891abca37fd78f5c8af1764e10e5754b1eecabd1fcfe7599c29a93ba007 -SIZE (VBoxGuestAdditions_5.2.34.iso) = 49661952 +TIMESTAMP = 1576163196 +SHA256 (VirtualBox-6.1.0.tar.bz2) = 49005ed94454f893fc3955e1e2b9607e85c300235cb983b39d1df2cfcf29f039 +SIZE (VirtualBox-6.1.0.tar.bz2) = 165322453 +SHA256 (VBoxGuestAdditions_6.1.0.iso) = 00ac2e01c18a5bd629919032eb69c6d0d13e6cc5d9b432fe00df520c1acd8dfe +SIZE (VBoxGuestAdditions_6.1.0.iso) = 59516928 --- emulators/virtualbox-ose/files/extrapatch-Config.kmk (revision 520061) +++ emulators/virtualbox-ose/files/extrapatch-Config.kmk (working copy) @@ -1,22 +1,22 @@ ---- Config.kmk.orig 2016-07-18 11:50:32 UTC +--- Config.kmk.orig 2019-11-21 16:51:26 UTC +++ Config.kmk -@@ -3537,6 +3537,7 @@ ifdef VBOX_WITH_RAW_MODE +@@ -4291,6 +4291,7 @@ ifdef VBOX_WITH_RAW_MODE TEMPLATE_VBoxRc_TOOL = $(VBOX_GCC32_TOOL) TEMPLATE_VBoxRc_CXXFLAGS = -fno-pie -nostdinc -g $(VBOX_GCC_pipe) $(VBOX_GCC_WERR) $(VBOX_GCC_PEDANTIC_CXX) $(VBOX_GCC32_Wno-variadic-macros) -fno-exceptions $(VBOX_GCC_GC_OPT) $(VBOX_GCC_GC_FP) -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fno-strict-aliasing $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_fvisibility-hidden) $(VBOX_GCC_fvisibility-inlines-hidden) -fno-rtti $(VBOX_GCC_IPRT_FMT_CHECK) TEMPLATE_VBoxRc_CFLAGS = -fno-pie -nostdinc -g $(VBOX_GCC_pipe) $(VBOX_GCC_WERR) $(VBOX_GCC_PEDANTIC_C) $(VBOX_GCC32_Wno-variadic-macros) -fno-exceptions $(VBOX_GCC_GC_OPT) $(VBOX_GCC_GC_FP) -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fno-strict-aliasing $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_fvisibility-hidden) $(VBOX_GCC_IPRT_FMT_CHECK) + TEMPLATE_VBoxRc_CXXFLAGS.freebsd = -fno-builtin - ifeq ($(KBUILD_TARGET),solaris) - TEMPLATE_VBoxRc_LDFLAGS = -r - else -@@ -3677,6 +3678,7 @@ ifeq ($(VBOX_LDR_FMT),elf) + if $(VBOX_GCC32_VERSION_CC) < 30400 + TEMPLATE_VBoxRc_DEFS += RT_WITHOUT_PRAGMA_ONCE + endif +@@ -4438,6 +4439,7 @@ ifeq ($(VBOX_LDR_FMT),elf) TEMPLATE_VBoxR0_TOOL = $(VBOX_GCC_TOOL) TEMPLATE_VBoxR0_CFLAGS = -fno-pie -nostdinc -g $(VBOX_GCC_pipe) $(VBOX_GCC_WERR) $(VBOX_GCC_PEDANTIC_C) $(VBOX_GCC_Wno-variadic-macros) $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) -fno-strict-aliasing -fno-exceptions $(VBOX_GCC_fno-stack-protector) -fno-common $(VBOX_GCC_fvisibility-hidden) -std=gnu99 $(VBOX_GCC_IPRT_FMT_CHECK) TEMPLATE_VBoxR0_CXXFLAGS = -fno-pie -nostdinc -g $(VBOX_GCC_pipe) $(VBOX_GCC_WERR) $(VBOX_GCC_PEDANTIC_CXX) $(VBOX_GCC_Wno-variadic-macros) $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) -fno-strict-aliasing -fno-exceptions $(VBOX_GCC_fno-stack-protector) -fno-common $(VBOX_GCC_fvisibility-inlines-hidden) $(VBOX_GCC_fvisibility-hidden) -fno-rtti $(VBOX_GCC_IPRT_FMT_CHECK) +TEMPLATE_VBoxR0_CXXFLAGS.freebsd = -fno-builtin - TEMPLATE_VBoxR0_CFLAGS.amd64 = -m64 -mno-red-zone -mcmodel=kernel -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fno-asynchronous-unwind-tables -ffreestanding - TEMPLATE_VBoxR0_CXXFLAGS.amd64 = -m64 -mno-red-zone -mcmodel=kernel -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fno-asynchronous-unwind-tables - ifeq ($(KBUILD_TARGET),solaris) -@@ -3945,7 +3947,7 @@ define TOOL_FREEBSDKMODLD_LINK_SYSMOD_CM + TEMPLATE_VBoxR0_CFLAGS.amd64 = -m64 -mno-red-zone -mcmodel=kernel -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fasynchronous-unwind-tables -ffreestanding + TEMPLATE_VBoxR0_CXXFLAGS.amd64 = -m64 -mno-red-zone -mcmodel=kernel -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fasynchronous-unwind-tables + TEMPLATE_VBoxR0_CXXFLAGS.freebsd = -ffreestanding +@@ -4860,7 +4862,7 @@ define TOOL_FREEBSDKMODLD_LINK_SYSMOD_CMDS | xargs -J% objcopy % $(out) ## Strip debug info (comment out if debugging or something). --- emulators/virtualbox-ose/files/extrapatch-src-VBox-Additions-x11-VBoxClient-Makefile.kmk (revision 520061) +++ emulators/virtualbox-ose/files/extrapatch-src-VBox-Additions-x11-VBoxClient-Makefile.kmk (nonexistent) @@ -1,11 +0,0 @@ ---- src/VBox/Additions/x11/VBoxClient/Makefile.kmk.orig 2013-11-29 14:20:43.000000000 -0500 -+++ src/VBox/Additions/x11/VBoxClient/Makefile.kmk 2013-12-16 14:03:08.000000000 -0500 -@@ -50,7 +50,7 @@ - # Xtst - # These are static replacements for gcc-specific parts of libstdc++ - VBoxClient_LIBS += \ -- supc++ \ -+ cxxrt \ - gcc_eh - ifdef VBOX_X11_SEAMLESS_GUEST - VBoxClient_DEFS += SEAMLESS_GUEST DYNAMIC_RESIZE --- emulators/virtualbox-ose/files/extrapatch-src-VBox-Devices-PC-ipxe-Makefile.kmk (revision 520061) +++ emulators/virtualbox-ose/files/extrapatch-src-VBox-Devices-PC-ipxe-Makefile.kmk (nonexistent) @@ -1,11 +0,0 @@ ---- src/VBox/Devices/PC/ipxe/Makefile.kmk.orig 2013-11-29 14:23:32.000000000 -0500 -+++ src/VBox/Devices/PC/ipxe/Makefile.kmk 2013-12-13 15:06:45.000000000 -0500 -@@ -35,7 +35,7 @@ - iPxeBiosBin_CLEAN = \ - $(iPxeBiosBin_0_OUTDIR)/iPxeBiosBin.c \ - --if1of ($(KBUILD_TARGET), darwin os2 solaris win) -+if1of ($(KBUILD_TARGET), darwin freebsd os2 solaris win) - $$(iPxeBiosBin_0_OUTDIR)/iPxeBiosBin.c: $(PATH_SUB_CURRENT)/iPxeBiosBin.rom $(VBOX_BIN2C) | $$(dir $$@) - $(call MSG_TOOL,bin2c,iPxeBiosBin,$<,$@) - $(QUIET)$(VBOX_BIN2C) -min 32 -max 56 -mask 0x1ff -export NetBiosBinary $< $@ --- emulators/virtualbox-ose/files/extrapatch-src-VBox-HostDrivers-Support-freebsd-Makefile (revision 520061) +++ emulators/virtualbox-ose/files/extrapatch-src-VBox-HostDrivers-Support-freebsd-Makefile (nonexistent) @@ -1,11 +0,0 @@ ---- src/VBox/HostDrivers/Support/freebsd/Makefile.orig 2012-10-18 16:23:16.000000000 +0200 -+++ src/VBox/HostDrivers/Support/freebsd/Makefile 2012-10-20 08:13:07.301179212 +0200 -@@ -27,7 +27,7 @@ - - KMOD = vboxdrv - --CFLAGS += -DRT_OS_FREEBSD -DIN_RING0 -DIN_RT_R0 -DIN_SUP_R0 -DSUPDRV_WITH_RELEASE_LOGGER -DVBOX -DRT_WITH_VBOX -Iinclude -I. -Ir0drv -w -DVBOX_WITH_HARDENING -DVBOX_WITH_64_BITS_GUESTS -+CFLAGS += -DRT_OS_FREEBSD -DIN_RING0 -DIN_RT_R0 -DIN_SUP_R0 -DSUPDRV_WITH_RELEASE_LOGGER -DVBOX -DRT_WITH_VBOX -Iinclude -I. -Ir0drv -w -DVBOX_WITH_HARDENING -DVBOX_WITH_64_BITS_GUESTS -DDEBUG - - .if (${MACHINE_ARCH} == "i386") - CFLAGS += -DRT_ARCH_X86 --- emulators/virtualbox-ose/files/extrapatch-src-recompiler-Makefile.kmk (revision 520061) +++ emulators/virtualbox-ose/files/extrapatch-src-recompiler-Makefile.kmk (nonexistent) @@ -1,10 +0,0 @@ ---- src/recompiler/Makefile.kmk.orig 2013-11-29 14:25:09.000000000 -0500 -+++ src/recompiler/Makefile.kmk 2013-12-13 14:23:11.000000000 -0500 -@@ -41,6 +41,7 @@ - # - ifneq ($(KBUILD_TARGET),win) - VBoxRemPrimary_TEMPLATE = VBOXR3NP -+ VBoxRemPrimary_TOOL.freebsd = VBoxGccFreeBSD - # workaround the regparm bug in gcc <= 3.3 - VBoxRemPrimary_DEFS = $(if $(VBOX_GCC_BUGGY_REGPARM),GCC_WITH_BUGGY_REGPARM,) - else --- emulators/virtualbox-ose/files/extrapatch-src_VBox_Devices_PC_ipxe_Makefile.kmk (nonexistent) +++ emulators/virtualbox-ose/files/extrapatch-src_VBox_Devices_PC_ipxe_Makefile.kmk (working copy) @@ -0,0 +1,11 @@ +--- src/VBox/Devices/PC/ipxe/Makefile.kmk.orig 2019-11-21 17:00:10 UTC ++++ src/VBox/Devices/PC/ipxe/Makefile.kmk +@@ -35,7 +35,7 @@ iPxeBiosBin_SOURCES = $(iPxeBiosBin_0_OUTDIR)/iPxeBio + iPxeBiosBin_CLEAN = \ + $(iPxeBiosBin_0_OUTDIR)/iPxeBiosBin.c \ + +-if1of ($(KBUILD_TARGET), darwin os2 solaris win) ++if1of ($(KBUILD_TARGET), darwin freebsd os2 solaris win) + $$(iPxeBiosBin_0_OUTDIR)/iPxeBiosBin.c: $(PATH_SUB_CURRENT)/iPxeBiosBin.rom $(VBOX_BIN2C) | $$(dir $$@) + $(call MSG_TOOL,bin2c,iPxeBiosBin,$<,$@) + $(QUIET)$(VBOX_BIN2C) -min 32 -max 56 -mask 0x1ff -export NetBiosBinary $< $@ --- emulators/virtualbox-ose/files/extrapatch-src_VBox_Frontends_VirtualBox_src_net_UIDownloaderAdditions.cpp (revision 520061) +++ emulators/virtualbox-ose/files/extrapatch-src_VBox_Frontends_VirtualBox_src_net_UIDownloaderAdditions.cpp (nonexistent) @@ -1,11 +0,0 @@ ---- src/VBox/Frontends/VirtualBox/src/net/UIDownloaderAdditions.cpp.orig 2017-01-17 07:26:50 UTC -+++ src/VBox/Frontends/VirtualBox/src/net/UIDownloaderAdditions.cpp -@@ -143,7 +143,7 @@ void UIDownloaderAdditions::handleVerifi - { - const QString strFileName = strRecord.section(" *", 1); - const QString strDownloadedSumm = strRecord.section(" *", 0, 0); -- if (strFileName == source().fileName()) -+ if (strFileName == QFileInfo(source().toString()).fileName()) - { - /* Calc the SHA-256 on the bytes, creating a string: */ - uint8_t abHash[RTSHA256_HASH_SIZE]; --- emulators/virtualbox-ose/files/extrapatch-src_VBox_Frontends_VirtualBox_src_net_UIDownloaderExtensionPack.cpp (revision 520061) +++ emulators/virtualbox-ose/files/extrapatch-src_VBox_Frontends_VirtualBox_src_net_UIDownloaderExtensionPack.cpp (nonexistent) @@ -1,11 +0,0 @@ ---- src/VBox/Frontends/VirtualBox/src/net/UIDownloaderExtensionPack.cpp.orig 2017-01-17 07:26:50 UTC -+++ src/VBox/Frontends/VirtualBox/src/net/UIDownloaderExtensionPack.cpp -@@ -127,7 +127,7 @@ void UIDownloaderExtensionPack::handleVe - { - const QString strFileName = strRecord.section(" *", 1); - const QString strDownloadedSumm = strRecord.section(" *", 0, 0); -- if (strFileName == source().fileName()) -+ if (strFileName == QFileInfo(source().toString()).fileName()) - { - /* Calc the SHA-256 on the bytes, creating a string: */ - uint8_t abHash[RTSHA256_HASH_SIZE]; --- emulators/virtualbox-ose/files/extrapatch-src_VBox_Frontends_VirtualBox_src_settings_global_UIGlobalSettingsNetworkDetailsHost.cpp (revision 520061) +++ emulators/virtualbox-ose/files/extrapatch-src_VBox_Frontends_VirtualBox_src_settings_global_UIGlobalSettingsNetworkDetailsHost.cpp (nonexistent) @@ -1,10 +0,0 @@ ---- src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetworkDetailsHost.cpp.orig 2017-03-08 17:19:57 UTC -+++ src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetworkDetailsHost.cpp -@@ -243,6 +243,6 @@ QString UIGlobalSettingsNetworkDetailsHo - address.prepend(QString::number(uPart)); - uAddress = uAddress >> 8; - } -- return address.join('.'); -+ return address.join("."); - } - --- emulators/virtualbox-ose/files/extrapatch-src_VBox_HostDrivers_Support_freebsd_Makefile (nonexistent) +++ emulators/virtualbox-ose/files/extrapatch-src_VBox_HostDrivers_Support_freebsd_Makefile (working copy) @@ -0,0 +1,11 @@ +--- src/VBox/HostDrivers/Support/freebsd/Makefile.orig 2019-11-21 17:02:00 UTC ++++ src/VBox/HostDrivers/Support/freebsd/Makefile +@@ -26,7 +26,7 @@ + + KMOD = vboxdrv + +-CFLAGS += -DRT_OS_FREEBSD -DIN_RING0 -DIN_RT_R0 -DIN_SUP_R0 -DSUPDRV_WITH_RELEASE_LOGGER -DVBOX -DRT_WITH_VBOX -Iinclude -I. -Ir0drv -w -DVBOX_WITH_HARDENING -DVBOX_WITH_64_BITS_GUESTS ++CFLAGS += -DRT_OS_FREEBSD -DIN_RING0 -DIN_RT_R0 -DIN_SUP_R0 -DSUPDRV_WITH_RELEASE_LOGGER -DVBOX -DRT_WITH_VBOX -Iinclude -I. -Ir0drv -w -DVBOX_WITH_HARDENING -DVBOX_WITH_64_BITS_GUESTS -DDEBUG + + .if (${MACHINE_ARCH} == "i386") + CFLAGS += -DRT_ARCH_X86 --- emulators/virtualbox-ose/files/patch-Config.kmk (revision 520061) +++ emulators/virtualbox-ose/files/patch-Config.kmk (working copy) @@ -1,6 +1,6 @@ ---- Config.kmk.orig 2019-05-13 13:12:00 UTC +--- Config.kmk.orig 2019-11-21 16:51:26 UTC +++ Config.kmk -@@ -445,11 +445,11 @@ ifn1of ($(KBUILD_TARGET), win darwin) +@@ -465,11 +465,11 @@ ifn1of ($(KBUILD_TARGET), win darwin) # Enable OSS audio support. VBOX_WITH_AUDIO_OSS = 1 endif @@ -14,7 +14,7 @@ # Enable PulseAudio audio support. VBOX_WITH_AUDIO_PULSE = 1 endif -@@ -464,11 +464,11 @@ VBOX_WITH_AUDIO_MMNOTIFICATION_CLIENT = 1 +@@ -484,11 +484,11 @@ VBOX_WITH_AUDIO_MMNOTIFICATION_CLIENT = 1 # Enable PCI passthrough support. VBOX_WITH_PCI_PASSTHROUGH = 1 # Enable statically linked dbus support. @@ -28,16 +28,25 @@ VBOX_WITH_PAM = 1 endif # Enable internal networking. -@@ -664,7 +664,7 @@ VBOX_WITH_TESTCASES = 1 - VBOX_WITH_VDITOOL = - # Enable this to build vbox-img even if VBOX_WITH_TESTCASES is disabled - VBOX_WITH_VBOX_IMG = --if1of ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH), darwin.x86 darwin.amd64 linux.x86 linux.amd64 solaris.amd64 win.x86 win.amd64) -+if1of ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH), darwin.x86 darwin.amd64 freebsd.x86 freebsd.amd64 linux.x86 linux.amd64 solaris.amd64 win.x86 win.amd64) - # Enables the video capturing support. - VBOX_WITH_VIDEOREC = 1 - # Enable VPX (VP8 / VP9 codec), used for video capturing. -@@ -992,10 +992,6 @@ ifeq ($(KBUILD_TARGET),darwin) +@@ -496,7 +496,7 @@ VBOX_WITH_INTERNAL_NETWORKING = 1 + # Enable vmsvga (svga2) graphics device variant, 2D part + VBOX_WITH_VMSVGA = 1 + # Enable vmsvga (svga2) graphics device variant, 3D part +-if1of ($(KBUILD_TARGET), darwin linux win) ++if1of ($(KBUILD_TARGET), darwin freebsd linux win) + VBOX_WITH_VMSVGA3D = 1 + endif + # Enable the generic 3D settings support if at least one 3D capable solution is enabled +@@ -641,7 +641,7 @@ VBOX_WITH_MAIN_USB_ID_DATABASE = 1 + #endif + # Set this to prefix all C symbols in XPCOM, to avoid dynamic linking problems + # caused by our XPCOM library polluting the symbol namespace for system libs. +-if1of ($(KBUILD_TARGET), linux solaris) ++if1of ($(KBUILD_TARGET), freebsd linux solaris) + VBOX_WITH_XPCOM_NAMESPACE_CLEANUP = 1 + endif + # The webservices api. +@@ -1062,10 +1062,6 @@ ifeq ($(KBUILD_TARGET),darwin) VBOX_WITH_VBOXSDL= endif @@ -48,7 +57,7 @@ ifeq ($(KBUILD_TARGET),haiku) # Don't bother with SDL ttf for now. VBOX_WITH_SECURELABEL= -@@ -1155,7 +1151,7 @@ ifdef VBOX_OSE +@@ -1228,7 +1224,7 @@ ifdef VBOX_OSE VBOX_WITH_KCHMVIEWER= VBOX_WITH_PLUGIN_CRYPT= VBOX_WITH_DRAG_AND_DROP_PROMISES= @@ -57,33 +66,7 @@ VBOX_WITH_DOCS= VBOX_WITH_DOCS_PACKING= endif -@@ -1176,14 +1172,14 @@ ifdef VBOX_OSE - ifn1of ($(KBUILD_TARGET), darwin linux solaris win) - VBOX_WITH_INSTALLER= - endif -- if1of ($(KBUILD_TARGET), win) -+ # if1of ($(KBUILD_TARGET), win) - # Undefine codec libraries which are not needed. - VBOX_WITH_LIBVPX= - VBOX_WITH_LIBOPUS= - # Disable video recording (with audio support). - VBOX_WITH_VIDEOREC= - VBOX_WITH_AUDIO_VIDEOREC= -- endif -+ # endif - # branding - VBOX_BRAND_LICENSE_HTML := $(PATH_ROOT)/doc/License-gpl-2.0.html - VBOX_BRAND_LICENSE_RTF := $(PATH_ROOT)/doc/License-gpl-2.0.rtf -@@ -4575,7 +4571,7 @@ TEMPLATE_VBOXR0DRV_CFLAGS = \ - -O2 -ffreestanding -fno-strict-aliasing -fno-common -finline-limit=8000 \ - $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) \ - -nostdinc -std=c99 --TEMPLATE_VBOXR0DRV_CFLAGS.x86 = -m32 -mno-align-long-strings -mpreferred-stack-boundary=2 -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -+TEMPLATE_VBOXR0DRV_CFLAGS.x86 = -m32 -mpreferred-stack-boundary=2 -mno-mmx -mno-3dnow -mno-sse -mno-sse2 - TEMPLATE_VBOXR0DRV_CFLAGS.amd64 = -m64 --param inline-unit-growth=100 --param large-function-growth=1000 \ - -fno-omit-frame-pointer -mcmodel=kernel -mno-red-zone -mfpmath=387 -mno-sse -mno-sse2 -mno-mmx \ - -mno-3dnow -msoft-float -fno-asynchronous-unwind-tables -Wundef -@@ -4622,7 +4618,7 @@ define TOOL_FREEBSDKMODLD_LINK_SYSMOD_CMDS +@@ -4874,7 +4870,7 @@ define TOOL_FREEBSDKMODLD_LINK_SYSMOD_CMDS | xargs -J% objcopy % $(outbase).kld # Link the final .ko (a shared object). @@ -92,7 +75,7 @@ endef endif # x86 -@@ -4908,10 +4904,18 @@ TEMPLATE_VBOXR3EXE_LIBPATH += \ +@@ -5184,10 +5180,18 @@ TEMPLATE_VBOXR3EXE_LIBPATH += \ TEMPLATE_VBOXR3EXE_CFLAGS += -fno-pic TEMPLATE_VBOXR3EXE_CXXFLAGS += -fno-pic TEMPLATE_VBOXR3EXE_LDFLAGS += -fno-pic @@ -112,16 +95,60 @@ /usr/include \ /usr/X11R6/include \ /usr/local/include -@@ -5202,7 +5206,7 @@ ifeq ($(KBUILD_TARGET),win) # No CRT! - TEMPLATE_VBOXR3HARDENEDEXE_LDFLAGS.win.amd64 = $(TEMPLATE_VBOXR3EXE_LDFLAGS.win.amd64) /entry:suplibHardenedWindowsMain - TEMPLATE_VBOXR3HARDENEDEXE_LIBS.x86 = $(NOT_SUCH_VARIABLE) - TEMPLATE_VBOXR3HARDENEDEXE_LIBS.amd64 = $(NOT_SUCH_VARIABLE) --else ifn1of ($(KBUILD_TARGET), os2 solaris) -+else ifn1of ($(KBUILD_TARGET), freebsd os2 solaris) +@@ -5219,6 +5223,7 @@ TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile = $(TEMPLATE_VB + TEMPLATE_VBOXR3EXE_LDFLAGS += '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RELATIVE_RUNPATH)' + endif + ifdef VBOX_WITH_ORIGIN ++ TEMPLATE_VBOXR3EXE_LDFLAGS.freebsd += $(VBOX_GCC_ORIGIN_OPT) + TEMPLATE_VBOXR3EXE_LDFLAGS.linux += $(VBOX_GCC_ORIGIN_OPT) + endif + endif +@@ -5358,7 +5363,7 @@ ifeq ($(KBUILD_TARGET),win) + $(PATH_TOOL_$(TEMPLATE_VBOXR3STATIC_TOOL.win.amd64)_LIB)/libcmt$(VBOX_VCC_CRT_TYPE).lib \ + $(PATH_TOOL_$(TEMPLATE_VBOXR3STATIC_TOOL.win.amd64)_LIB)/libcpmt$(VBOX_VCC_CRT_TYPE).lib \ + $(PATH_TOOL_$(TEMPLATE_VBOXR3STATIC_TOOL.win.amd64)_LIB)/oldnames.lib +-else ifn1of ($(KBUILD_TARGET), darwin linux solaris) ++else ifn1of ($(KBUILD_TARGET), darwin freebsd linux solaris) + # The gcc guys sans darwin, linux and solaris (don't depend on statically compiled system libs there) + TEMPLATE_VBOXR3STATIC_CFLAGS = $(TEMPLATE_VBOXR3EXE_CFLAGS) -static + TEMPLATE_VBOXR3STATIC_CXXFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS) -static +@@ -5406,8 +5411,10 @@ else + TEMPLATE_VBoxR3Static_LIBS += \ + $(PATH_STAGE_LIB)/VBox-liblzf$(VBOX_SUFF_LIB) \ + $(SDK_VBOX_ZLIB_LIBS) +- if1of ($(KBUILD_TARGET),darwin freebsd) ++ ifeq ($(KBUILD_TARGET),darwin) + TEMPLATE_VBoxR3Static_LIBS += iconv ++ else ifeq ($(KBUILD_TARGET),freebsd) ++ TEMPLATE_VBoxR3Static_LIBS += crypt iconv + else ifeq ($(KBUILD_TARGET),solaris) + TEMPLATE_VBoxR3Static_LIBS += kstat + endif +@@ -5503,6 +5510,7 @@ ifeq ($(KBUILD_TARGET),win) # No CRT! + else ifn1of ($(KBUILD_TARGET), os2 solaris) # We want to keep the RPATH on Solaris to be able to find libgcc_1/libstdc++ within $(VBOX_WITH_RUNPATH) TEMPLATE_VBOXR3HARDENEDEXE_LDFLAGS = $(filter-out '$(VBOX_GCC_RPATH_OPT)%,$(TEMPLATE_VBOXR3EXE_LDFLAGS)) ++ TEMPLATE_VBOXR3HARDENEDEXE_LDFLAGS.freebsd = $(filter-out $(VBOX_GCC_ORIGIN_OPT),$(TEMPLATE_VBOXR3EXE_LDFLAGS.freebsd)) TEMPLATE_VBOXR3HARDENEDEXE_LDFLAGS.linux = $(filter-out $(VBOX_GCC_ORIGIN_OPT),$(TEMPLATE_VBOXR3EXE_LDFLAGS.linux)) -@@ -5729,10 +5733,18 @@ TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTI + endif + +@@ -5530,6 +5538,7 @@ TEMPLATE_VBoxR3HardenedTstDll_INST = $(INST_TESTCASE) + TEMPLATE_VBoxR3HardenedTstDll_LDFLAGS.win = $(TEMPLATE_VBoxR3TstDll_LDFLAGS.win) -IntegrityCheck + ifn1of ($(KBUILD_TARGET), win os2) + TEMPLATE_VBoxR3HardenedTstDll_LDFLAGS = $(filter-out '$(VBOX_GCC_RPATH_OPT)%,$(TEMPLATE_VBoxR3TstDll_LDFLAGS)) ++ TEMPLATE_VBoxR3HardenedTstDll_LDFLAGS.freebsd = $(filter-out $(VBOX_GCC_ORIGIN_OPT),$(TEMPLATE_VBoxR3TstDll_LDFLAGS.freebsd)) + TEMPLATE_VBoxR3HardenedTstDll_LDFLAGS.linux = $(filter-out $(VBOX_GCC_ORIGIN_OPT),$(TEMPLATE_VBoxR3TstDll_LDFLAGS.linux)) + endif + +@@ -5552,6 +5561,7 @@ ifndef VBOX_WITH_HARDENING + TEMPLATE_VBoxR3SetUidToRoot_LDFLAGS += '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RELATIVE_RUNPATH)' + endif + ifdef VBOX_WITH_ORIGIN ++ TEMPLATE_VBoxR3SetUidToRoot_LDFLAGS.freebsd += $(VBOX_GCC_ORIGIN_OPT) + TEMPLATE_VBoxR3SetUidToRoot_LDFLAGS.linux += $(VBOX_GCC_ORIGIN_OPT) + endif + endif +@@ -6078,10 +6088,18 @@ TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTI else ifeq ($(KBUILD_TARGET),haiku) TEMPLATE_VBOXMAINEXE_TOOL = GXX3 TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME) network stdc++ supc++ @@ -141,7 +168,15 @@ /usr/include \ /usr/X11R6/include \ /usr/local/include -@@ -6271,13 +6283,10 @@ ifdef VBOX_WITH_QTGUI +@@ -6113,6 +6131,7 @@ TEMPLATE_VBOXMAINEXE_LDFLAGS += '$(VBOX_GCC + TEMPLATE_VBOXMAINEXE_LDFLAGS += '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RELATIVE_RUNPATH)' + endif + ifdef VBOX_WITH_ORIGIN ++TEMPLATE_VBOXMAINEXE_LDFLAGS.freebsd += $(VBOX_GCC_ORIGIN_OPT) + TEMPLATE_VBOXMAINEXE_LDFLAGS.linux += $(VBOX_GCC_ORIGIN_OPT) + endif + +@@ -6670,13 +6689,10 @@ ifdef VBOX_WITH_QTGUI TEMPLATE_VBOXQTGUIEXE_LIBPATH += \ $(VBOX_LIBPATH_X11) ifeq ($(KBUILD_TARGET),freebsd) @@ -156,20 +191,68 @@ /usr/local/lib endif ifeq ($(KBUILD_TARGET),solaris) -@@ -6500,12 +6509,8 @@ TEMPLATE_VBoxBldProg_LIBPATH += \ +@@ -6917,10 +6933,17 @@ TEMPLATE_VBoxBldProg_TOOL = GXX3 + TEMPLATE_VBoxBldProg_LIBS = network iconv + TEMPLATE_VBoxBldProg_LIBPATH += \ + /boot/common/lib +- else if1of ($(KBUILD_HOST), freebsd openbsd) ++ else ifeq ($(KBUILD_HOST),freebsd) TEMPLATE_VBoxBldProg_TOOL = GXX3 TEMPLATE_VBoxBldProg_LIBS = pthread TEMPLATE_VBoxBldProg_INCS += \ -- /usr/include \ -- /usr/X11R6/include \ ++ /usr/local/include ++TEMPLATE_VBoxBldProg_LIBPATH += \ ++ /usr/local/lib ++ else ifeq ($(KBUILD_HOST),openbsd) ++TEMPLATE_VBoxBldProg_TOOL = GXX3 ++TEMPLATE_VBoxBldProg_LIBS = pthread ++TEMPLATE_VBoxBldProg_INCS += \ + /usr/include \ + /usr/X11R6/include \ /usr/local/include - TEMPLATE_VBoxBldProg_LIBPATH += \ -- /usr/lib \ -- /usr/X11R6/lib \ - /usr/local/lib - else ifeq ($(KBUILD_HOST),netbsd) - TEMPLATE_VBoxBldProg_TOOL = GXX3 -@@ -6906,6 +6911,7 @@ TEMPLATE_VBOXCROGLR3HOSTDLL_LDFLAGS.darwin += \ +@@ -6969,6 +6992,7 @@ TEMPLATE_VBoxAdvBldProg_LIBS.darwin = \ + $(TEMPLATE_VBoxBldProg_LIBS.darwin) + TEMPLATE_VBoxAdvBldProg_LIBS.freebsd = \ + $(TEMPLATE_VBoxAdvBldProg_LIBS) \ ++ crypt \ + iconv \ + rt \ + $(TEMPLATE_VBoxBldProg_LIBS.freebsd) +@@ -7044,6 +7068,7 @@ else # the gcc guys + # Do not inherit sanitizer flags from VBOXR3EXE in guest executables. Deal with them separately. + TEMPLATE_VBOXGUESTR3EXE_CXXFLAGS.debug = $(NO_SUCH_VARIABLE) + TEMPLATE_VBOXGUESTR3EXE_CFLAGS.debug = $(NO_SUCH_VARIABLE) ++ TEMPLATE_VBOXGUESTR3EXE_LDFLAGS.freebsd = $(filter-out $(VBOX_GCC_ORIGIN_OPT),$(TEMPLATE_VBOXR3EXE_LDFLAGS.freebsd)) + TEMPLATE_VBOXGUESTR3EXE_LDFLAGS.linux = $(filter-out $(VBOX_GCC_ORIGIN_OPT),$(TEMPLATE_VBOXR3EXE_LDFLAGS.linux)) + TEMPLATE_VBOXGUESTR3EXE_LDFLAGS.debug = $(NO_SUCH_VARIABLE) + TEMPLATE_VBOXGUESTR3EXE_LDFLAGS = $(filter-out '$(VBOX_GCC_RPATH_OPT)%,$(TEMPLATE_VBOXR3EXE_LDFLAGS)) +@@ -7067,6 +7092,7 @@ TEMPLATE_VBOXGUESTR3EXE_CXXFLAGS.linux = \ + $(VBOX_GCC_fno-stack-protector) + TEMPLATE_VBOXGUESTR3EXE_CFLAGS.linux = $(TEMPLATE_VBOXGUESTR3EXE_CXXFLAGS.linux) + # The GNU_HASH ELF tag is not supported by older systems. ++TEMPLATE_VBOXGUESTR3EXE_LDFLAGS.freebsd += $(VBOX_LD_hash_style_sysv) + TEMPLATE_VBOXGUESTR3EXE_LDFLAGS.linux += $(VBOX_LD_hash_style_sysv) + + # +@@ -7079,6 +7105,9 @@ TEMPLATE_NewVBoxGuestR3Exe_LIBS = \ + $(VBOX_LIB_VBGL_R3) \ + $(VBOX_LIB_IPRT_GUEST_R3) \ + $(TEMPLATE_VBOXGUESTR3EXE_LIBS) ++ifeq ($(KBUILD_TARGET),freebsd) ++TEMPLATE_NewVBoxGuestR3Exe_LIBS += crypt ++endif + ifeq ($(KBUILD_TARGET),solaris) + TEMPLATE_NewVBoxGuestR3Exe_LIBS += contract + endif +@@ -7274,6 +7303,7 @@ TEMPLATE_VBOXGUESTR3XF86MOD_LIBS.$(KBUILD_TYPE) = + TEMPLATE_VBOXGUESTR3XF86MOD_LIBS.$(KBUILD_TARGET) = $(NO_SUCH_VARIABLE) + TEMPLATE_VBOXGUESTR3XF86MOD_LDFLAGS.$(KBUILD_TARGET) = $(NO_SUCH_VARIABLE) + # The GNU_HASH ELF tag is not supported by older glibc dynamic linkers. ++TEMPLATE_VBOXGUESTR3XF86MOD_LDFLAGS.freebsd = $(subst -Wl$(COMMA),,$(VBOX_LD_hash_style_sysv)) + TEMPLATE_VBOXGUESTR3XF86MOD_LDFLAGS.linux = $(subst -Wl$(COMMA),,$(VBOX_LD_hash_style_sysv)) + TEMPLATE_VBOXGUESTR3XF86MOD_LDFLAGS.$(KBUILD_TYPE) = $(NO_SUCH_VARIABLE) + TEMPLATE_VBOXGUESTR3XF86MOD_LDFLAGS = -r +@@ -7383,6 +7413,7 @@ TEMPLATE_VBOXCROGLR3HOSTDLL_LDFLAGS.darwin += \ -current_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \ -compatibility_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) TEMPLATE_VBOXCROGLR3HOSTDLL_LDFLAGS.linux = -Wl,--no-as-needed --- emulators/virtualbox-ose/files/patch-configure (revision 520061) +++ emulators/virtualbox-ose/files/patch-configure (working copy) @@ -1,4 +1,4 @@ ---- configure.orig 2018-07-16 14:56:48 UTC +--- configure.orig 2019-11-21 16:51:26 UTC +++ configure @@ -138,10 +138,14 @@ CXX_FLAGS="" if [ "$OS" = "freebsd" ]; then @@ -15,17 +15,7 @@ else INCCURL="" LIBCURL="-lcurl" -@@ -436,6 +440,9 @@ check_gcc() - elif [ $cc_maj -eq 4 -a $cc_min -eq 0 -a "$OS" = "darwin" ]; then - log_success "found version $cc_ver" - # gcc-4.0 is allowed for Darwin only -+ elif [ $cc_maj -eq 4 -a $cc_min -eq 2 -a "$OS" = "freebsd" ]; then -+ log_success "found version $cc_ver" -+ # gcc-4.2 is allowed for FreeBSD only - elif [ $cc_maj -lt 4 \ - -o \( $cc_maj -eq 4 -a $cc_min -lt 4 -a "$OS" != "darwin" \) \ - -o \( $cc_maj -eq 4 -a $cc_min -lt 2 -a "$OS" = "darwin" \) \ -@@ -1204,7 +1211,7 @@ extern "C" int main(void) +@@ -1221,7 +1225,7 @@ extern "C" int main(void) #endif } EOF @@ -34,7 +24,7 @@ test_execute fi } -@@ -1504,8 +1511,7 @@ EOF +@@ -1527,8 +1531,7 @@ EOF if [ $? -eq 0 ]; then echo "(Qt5 from pkg-config)" >> $LOG FLGQT5=`pkg-config Qt5Core --cflags` @@ -44,7 +34,7 @@ INCQT5=`strip_I "$FLGQT5"` LIBDIR5=`pkg-config Qt5Core --variable=libdir` LIBQT5=`pkg-config Qt5Core --libs` -@@ -1644,7 +1650,7 @@ check_libopus() +@@ -1667,7 +1670,7 @@ check_libopus() fi cat > $ODIR.tmp_src.cc << EOF #include @@ -53,7 +43,7 @@ extern "C" int main(void) { OpusEncoder *test; -@@ -1976,8 +1982,8 @@ EOF +@@ -1999,8 +2002,8 @@ EOF echo "compiling the following source file:" >> $LOG cat $ODIR.tmp_src.cc >> $LOG echo "using the following command line:" >> $LOG @@ -64,7 +54,7 @@ if [ $? -eq 0 ]; then found=1 break -@@ -2449,7 +2455,7 @@ for option in "$@"; do +@@ -2476,7 +2479,7 @@ for option in "$@"; do --with-openssl-dir=*) OPENSSLDIR=`echo $option | cut -d'=' -f2` INCCRYPTO="-I${OPENSSLDIR}/include" @@ -73,38 +63,7 @@ ;; --with-ow-dir=*) WATCOM=`echo $option | cut -d'=' -f2` -@@ -2763,7 +2769,7 @@ if [ $ONLY_ADDITIONS -eq 0 ]; then - check_ssl - check_curl - [ $WITH_LIBVPX -eq 1 ] && check_vpx -- check_libopus -+ [ $OSE -eq 0 -a "$OS" != "win" ] && check_libopus - [ "$OS" != "darwin" ] && check_z - [ "$OS" != "darwin" ] && check_png - [ $OSE -eq 0 -a "$OS" = "linux" ] && check_pam -@@ -2784,13 +2790,20 @@ if [ $ONLY_ADDITIONS -eq 0 ]; then - [ $WITH_PYTHON -eq 1 ] && check_python - [ $WITH_JAVA -eq 1 ] && check_java - -- # PulseAudio - if [ "$OS" = "linux" -o "$OS" = "freebsd" -o "$OS" = "netbsd" ]; then -+ if [ $WITH_ALSA -eq 1 ]; then -+ check_alsa -+ else -+ cnf_append "VBOX_WITH_AUDIO_ALSA" "" -+ fi - if [ $WITH_PULSE -eq 1 ]; then - check_pulse - elif [ $WITH_PULSE -eq 0 ]; then - cnf_append "VBOX_WITH_AUDIO_PULSE" "" - fi -+ if [ $WITH_DBUS -eq 0 ]; then -+ cnf_append "VBOX_WITH_DBUS" "" -+ fi - fi - fi - -@@ -2806,14 +2819,6 @@ if [ "$OS" = "linux" ]; then +@@ -2840,14 +2843,6 @@ if [ "$OS" = "linux" ]; then cnf_append "VBOX_WITHOUT_LINUX_TEST_BUILDS" "1" fi if [ $ONLY_ADDITIONS -eq 0 ]; then --- emulators/virtualbox-ose/files/patch-include-VBox-vmm-cpumctx.h (revision 520061) +++ emulators/virtualbox-ose/files/patch-include-VBox-vmm-cpumctx.h (nonexistent) @@ -1,11 +0,0 @@ ---- include/VBox/vmm/cpumctx.h.orig 2015-03-12 18:53:45.762704000 -0400 -+++ include/VBox/vmm/cpumctx.h 2015-03-12 18:56:23.765105000 -0400 -@@ -84,7 +84,7 @@ - # define CPUMSELREG_ARE_HIDDEN_PARTS_VALID(a_pVCpu, a_pSelReg) \ - ( ((a_pSelReg)->fFlags & CPUMSELREG_FLAGS_VALID) \ - && ( (a_pSelReg)->ValidSel == (a_pSelReg)->Sel \ -- || ( (a_pVCpu) /*!= NULL*/ \ -+ || ( ((a_pVCpu) != NULL) \ - && (a_pSelReg)->ValidSel == ((a_pSelReg)->Sel & X86_SEL_MASK_OFF_RPL) \ - && ((a_pSelReg)->Sel & X86_SEL_RPL) == 1 \ - && ((a_pSelReg)->ValidSel & X86_SEL_RPL) == 0 \ --- emulators/virtualbox-ose/files/patch-include-iprt-x86.h (revision 520061) +++ emulators/virtualbox-ose/files/patch-include-iprt-x86.h (nonexistent) @@ -1,19 +0,0 @@ ---- include/iprt/x86.h.orig 2014-02-25 11:59:50.000000000 -0500 -+++ include/iprt/x86.h 2014-03-11 16:46:08.000000000 -0400 -@@ -35,6 +35,16 @@ - # pragma D depends_on library vbox-types.d - #endif - -+/* Workaround for FreeBSD machine/specialreg.h defining MSRs */ -+#ifdef RT_OS_FREEBSD -+# undef MSR_P5_MC_ADDR -+# undef MSR_P5_MC_TYPE -+# undef MSR_IA32_PLATFORM_ID -+# undef MSR_BBL_CR_CTL3 -+# undef MSR_IA32_MISC_ENABLE -+# undef MSR_IA32_FEATURE_CONTROL -+#endif -+ - /* Workaround for Solaris sys/regset.h defining CS, DS */ - #ifdef RT_OS_SOLARIS - # undef CS --- emulators/virtualbox-ose/files/patch-include_VBox_VBoxGL2D.h (revision 520061) +++ emulators/virtualbox-ose/files/patch-include_VBox_VBoxGL2D.h (working copy) @@ -1,11 +1,6 @@ -Fix build with Qt5 5.13, which defined GLsizeiptr already. - -Obtained from: - https://www.mail-archive.com/pld-cvs-commit@lists.pld-linux.org/msg436220.html - ---- include/VBox/VBoxGL2D.h.orig 2019-09-29 14:31:16 UTC +--- include/VBox/VBoxGL2D.h.orig 2019-11-21 16:51:31 UTC +++ include/VBox/VBoxGL2D.h -@@ -107,7 +107,7 @@ typedef GLvoid (APIENTRY *PFNVBOXVHWA_UNIFORM3I)(GLint +@@ -111,7 +111,7 @@ typedef GLvoid (APIENTRY *PFNVBOXVHWA_UNIFORM3I)(GLint typedef GLvoid (APIENTRY *PFNVBOXVHWA_UNIFORM4I)(GLint location, GLint v0, GLint v1, GLint v2, GLint v3); /* GL_ARB_pixel_buffer_object*/ --- emulators/virtualbox-ose/files/patch-include_VBox_com_array.h (revision 520061) +++ emulators/virtualbox-ose/files/patch-include_VBox_com_array.h (working copy) @@ -1,6 +1,6 @@ ---- include/VBox/com/array.h.orig 2019-04-12 15:47:42 UTC +--- include/VBox/com/array.h.orig 2019-11-21 16:51:32 UTC +++ include/VBox/com/array.h -@@ -168,7 +168,7 @@ +@@ -171,7 +171,7 @@ #include "VBox/com/defs.h" @@ -9,28 +9,3 @@ /** @def VBOX_WITH_TYPE_TRAITS * Type traits are a C++ 11 feature, so not available everywhere (yet). * Only GCC 4.6 or newer and MSVC++ 16.0 (Visual Studio 2010) or newer. -@@ -940,12 +940,12 @@ class SafeArray : public Traits (public) - */ - T &operator[] (size_t aIdx) - { -- AssertReturn(m.arr != NULL, *((T *)NULL)); -- AssertReturn(aIdx < size(), *((T *)NULL)); -+ AssertReturn(m.arr != NULL, *((T *)1)); -+ AssertReturn(aIdx < size(), *((T *)1)); - #ifdef VBOX_WITH_XPCOM - return m.arr[aIdx]; - #else -- AssertReturn(m.raw != NULL, *((T *)NULL)); -+ AssertReturn(m.raw != NULL, *((T *)1)); - return m.raw[aIdx]; - #endif - } -@@ -960,7 +960,7 @@ class SafeArray : public Traits (public) - #ifdef VBOX_WITH_XPCOM - return m.arr[aIdx]; - #else -- AssertReturn(m.raw != NULL, *((T *)NULL)); -+ AssertReturn(m.raw != NULL, *((T *)1)); - return m.raw[aIdx]; - #endif - } --- emulators/virtualbox-ose/files/patch-include_iprt_assertcompile.h (revision 520061) +++ emulators/virtualbox-ose/files/patch-include_iprt_assertcompile.h (nonexistent) @@ -1,15 +0,0 @@ ---- include/iprt/assertcompile.h.orig 2018-01-15 14:49:42 UTC -+++ include/iprt/assertcompile.h -@@ -104,7 +104,11 @@ RT_C_DECLS_END - * @param expr Expression which should be true. - */ - #ifdef RTASSERT_HAVE_STATIC_ASSERT --# define AssertCompile(expr) static_assert(!!(expr), #expr) -+# ifdef __cplusplus -+# define AssertCompile(expr) static_assert(!!(expr), #expr) -+# else -+# define AssertCompile(expr) _Static_assert(!!(expr), #expr) -+# endif - #else - # define AssertCompile(expr) AssertCompileNS(expr) - #endif --- emulators/virtualbox-ose/files/patch-include_iprt_cdefs.h (revision 520061) +++ emulators/virtualbox-ose/files/patch-include_iprt_cdefs.h (nonexistent) @@ -1,39 +0,0 @@ ---- include/iprt/cdefs.h.orig 2018-10-15 14:24:52 UTC -+++ include/iprt/cdefs.h -@@ -2611,28 +2611,28 @@ - - /** @def RT_BYTE1 - * Gets the first byte of something. */ --#define RT_BYTE1(a) ( (a) & 0xff ) -+#define RT_BYTE1(a) ( (uint8_t)((a) & 0xff) ) - /** @def RT_BYTE2 - * Gets the second byte of something. */ --#define RT_BYTE2(a) ( ((a) >> 8) & 0xff ) -+#define RT_BYTE2(a) ( (uint8_t)(((a) >> 8) & 0xff) ) - /** @def RT_BYTE3 - * Gets the second byte of something. */ --#define RT_BYTE3(a) ( ((a) >> 16) & 0xff ) -+#define RT_BYTE3(a) ( (uint8_t)(((a) >> 16) & 0xff) ) - /** @def RT_BYTE4 - * Gets the fourth byte of something. */ --#define RT_BYTE4(a) ( ((a) >> 24) & 0xff ) -+#define RT_BYTE4(a) ( (uint8_t)(((a) >> 24) & 0xff) ) - /** @def RT_BYTE5 - * Gets the fifth byte of something. */ --#define RT_BYTE5(a) ( ((a) >> 32) & 0xff ) -+#define RT_BYTE5(a) ( (uint8_t)(((a) >> 32) & 0xff) ) - /** @def RT_BYTE6 - * Gets the sixth byte of something. */ --#define RT_BYTE6(a) ( ((a) >> 40) & 0xff ) -+#define RT_BYTE6(a) ( (uint8_t)(((a) >> 40) & 0xff) ) - /** @def RT_BYTE7 - * Gets the seventh byte of something. */ --#define RT_BYTE7(a) ( ((a) >> 48) & 0xff ) -+#define RT_BYTE7(a) ( (uint8_t)(((a) >> 48) & 0xff) ) - /** @def RT_BYTE8 - * Gets the eight byte of something. */ --#define RT_BYTE8(a) ( ((a) >> 56) & 0xff ) -+#define RT_BYTE8(a) ( (uint8_t)(((a) >> 56) & 0xff) ) - - - /** @def RT_LODWORD --- emulators/virtualbox-ose/files/patch-include_iprt_string.h (revision 520061) +++ emulators/virtualbox-ose/files/patch-include_iprt_string.h (working copy) @@ -1,6 +1,6 @@ ---- include/iprt/string.h.orig 2018-06-29 13:08:03 UTC +--- include/iprt/string.h.orig 2019-11-21 16:51:44 UTC +++ include/iprt/string.h -@@ -43,6 +43,11 @@ +@@ -46,6 +46,11 @@ #elif defined(RT_OS_FREEBSD) && defined(_KERNEL) RT_C_DECLS_BEGIN # include --- emulators/virtualbox-ose/files/patch-include_iprt_types.h (revision 520061) +++ emulators/virtualbox-ose/files/patch-include_iprt_types.h (nonexistent) @@ -1,26 +0,0 @@ ---- include/iprt/types.h.orig 2018-05-09 16:32:07 UTC -+++ include/iprt/types.h -@@ -56,22 +56,9 @@ RT_C_DECLS_END - # include - - # elif defined(RT_OS_FREEBSD) && defined(_KERNEL) -- /* -- * Kludge for the FreeBSD kernel: -- * stddef.h and sys/types.h have slightly different offsetof definitions -- * when compiling in kernel mode. This is just to make GCC shut up. -- */ --# ifndef _STDDEF_H_ --# undef offsetof --# endif -+ - # include --# ifndef _SYS_TYPES_H_ --# undef offsetof --# endif - # include --# ifndef offsetof --# error "offsetof is not defined!" --# endif - - # elif defined(RT_OS_FREEBSD) && HC_ARCH_BITS == 64 && defined(RT_ARCH_X86) - /* --- emulators/virtualbox-ose/files/patch-include_iprt_x86.h (nonexistent) +++ emulators/virtualbox-ose/files/patch-include_iprt_x86.h (working copy) @@ -0,0 +1,19 @@ +--- include/iprt/x86.h.orig 2019-11-21 16:51:45 UTC ++++ include/iprt/x86.h +@@ -38,6 +38,16 @@ + # pragma D depends_on library vbox-types.d + #endif + ++/* Workaround for FreeBSD machine/specialreg.h defining MSRs */ ++#ifdef RT_OS_FREEBSD ++# undef MSR_P5_MC_ADDR ++# undef MSR_P5_MC_TYPE ++# undef MSR_IA32_PLATFORM_ID ++# undef MSR_BBL_CR_CTL3 ++# undef MSR_IA32_MISC_ENABLE ++# undef MSR_IA32_FEATURE_CONTROL ++#endif ++ + /* Workaround for Solaris sys/regset.h defining CS, DS */ + #ifdef RT_OS_SOLARIS + # undef CS --- emulators/virtualbox-ose/files/patch-src-VBox-Additions-common-VBoxGuest-VBoxGuest-freebsd.c (revision 520061) +++ emulators/virtualbox-ose/files/patch-src-VBox-Additions-common-VBoxGuest-VBoxGuest-freebsd.c (nonexistent) @@ -1,257 +0,0 @@ ---- src/VBox/Additions/common/VBoxGuest/VBoxGuest-freebsd.c.orig 2017-10-18 07:06:43 UTC -+++ src/VBox/Additions/common/VBoxGuest/VBoxGuest-freebsd.c -@@ -93,8 +93,6 @@ struct VBoxGuestDeviceState - struct resource *pIrqRes; - /** Pointer to the IRQ handler. */ - void *pfnIrqHandler; -- /** VMMDev version */ -- uint32_t u32Version; - }; - - -@@ -104,8 +102,7 @@ struct VBoxGuestDeviceState - /* - * Character device file handlers. - */ --static d_fdopen_t vgdrvFreeBSDOpen; --static d_close_t vgdrvFreeBSDClose; -+static d_open_t vgdrvFreeBSDOpen; - static d_ioctl_t vgdrvFreeBSDIOCtl; - static int vgdrvFreeBSDIOCtlSlow(PVBOXGUESTSESSION pSession, u_long ulCmd, caddr_t pvData, struct thread *pTd); - static d_write_t vgdrvFreeBSDWrite; -@@ -136,8 +133,7 @@ static struct cdevsw g_vgdrvFreeBSDCh - { - .d_version = D_VERSION, - .d_flags = D_TRACKCLOSE | D_NEEDMINOR, -- .d_fdopen = vgdrvFreeBSDOpen, -- .d_close = vgdrvFreeBSDClose, -+ .d_open = vgdrvFreeBSDOpen, - .d_ioctl = vgdrvFreeBSDIOCtl, - .d_read = vgdrvFreeBSDRead, - .d_write = vgdrvFreeBSDWrite, -@@ -145,81 +141,28 @@ static struct cdevsw g_vgdrvFreeBSDCh - .d_name = "vboxguest" - }; - -+/** Device structure. */ -+static struct cdev *g_pDev; -+ - /** Device extention & session data association structure. */ - static VBOXGUESTDEVEXT g_DevExt; - --/** List of cloned device. Managed by the kernel. */ --static struct clonedevs *g_pvgdrvFreeBSDClones; --/** The dev_clone event handler tag. */ --static eventhandler_tag g_vgdrvFreeBSDEHTag; - /** Reference counter */ - static volatile uint32_t cUsers; - /** selinfo structure used for polling. */ - static struct selinfo g_SelInfo; - --/** -- * DEVFS event handler. -- */ --static void vgdrvFreeBSDClone(void *pvArg, struct ucred *pCred, char *pszName, int cchName, struct cdev **ppDev) -+static void vgdrvFreeBSDDtr(void *pSession) - { -- int iUnit; -- int rc; -- -- Log(("vgdrvFreeBSDClone: pszName=%s ppDev=%p\n", pszName, ppDev)); -- -- /* -- * One device node per user, si_drv1 points to the session. -- * /dev/vboxguest where N = {0...255}. -- */ -- if (!ppDev) -- return; -- if (strcmp(pszName, "vboxguest") == 0) -- iUnit = -1; -- else if (dev_stdclone(pszName, NULL, "vboxguest", &iUnit) != 1) -- return; -- if (iUnit >= 256) -- { -- Log(("vgdrvFreeBSDClone: iUnit=%d >= 256 - rejected\n", iUnit)); -- return; -- } -- -- Log(("vgdrvFreeBSDClone: pszName=%s iUnit=%d\n", pszName, iUnit)); -- -- rc = clone_create(&g_pvgdrvFreeBSDClones, &g_vgdrvFreeBSDChrDevSW, &iUnit, ppDev, 0); -- Log(("vgdrvFreeBSDClone: clone_create -> %d; iUnit=%d\n", rc, iUnit)); -- if (rc) -- { -- *ppDev = make_dev(&g_vgdrvFreeBSDChrDevSW, -- iUnit, -- UID_ROOT, -- GID_WHEEL, -- 0664, -- "vboxguest%d", iUnit); -- if (*ppDev) -- { -- dev_ref(*ppDev); -- (*ppDev)->si_flags |= SI_CHEAPCLONE; -- Log(("vgdrvFreeBSDClone: Created *ppDev=%p iUnit=%d si_drv1=%p si_drv2=%p\n", -- *ppDev, iUnit, (*ppDev)->si_drv1, (*ppDev)->si_drv2)); -- (*ppDev)->si_drv1 = (*ppDev)->si_drv2 = NULL; -- } -- else -- Log(("vgdrvFreeBSDClone: make_dev iUnit=%d failed\n", iUnit)); -- } -- else -- Log(("vgdrvFreeBSDClone: Existing *ppDev=%p iUnit=%d si_drv1=%p si_drv2=%p\n", -- *ppDev, iUnit, (*ppDev)->si_drv1, (*ppDev)->si_drv2)); -+ VGDrvCommonCloseSession(&g_DevExt, pSession); -+ ASMAtomicDecU32(&cUsers); - } - - /** - * File open handler - * - */ --#if __FreeBSD_version >= 700000 --static int vgdrvFreeBSDOpen(struct cdev *pDev, int fOpen, struct thread *pTd, struct file *pFd) --#else --static int vgdrvFreeBSDOpen(struct cdev *pDev, int fOpen, struct thread *pTd) --#endif -+static int vgdrvFreeBSDOpen(struct cdev *pDev, int fOpen, int DevType, struct thread *pTd) - { - int rc; - PVBOXGUESTSESSION pSession; -@@ -227,25 +170,18 @@ static int vgdrvFreeBSDOpen(struct cdev - LogFlow(("vgdrvFreeBSDOpen:\n")); - - /* -- * Try grab it (we don't grab the giant, remember). -- */ -- if (!ASMAtomicCmpXchgPtr(&pDev->si_drv1, (void *)0x42, NULL)) -- return EBUSY; -- -- /* - * Create a new session. - */ - rc = VGDrvCommonCreateUserSession(&g_DevExt, &pSession); - if (RT_SUCCESS(rc)) - { -- if (ASMAtomicCmpXchgPtr(&pDev->si_drv1, pSession, (void *)0x42)) -- { -- Log(("vgdrvFreeBSDOpen: success - g_DevExt=%p pSession=%p rc=%d pid=%d\n", &g_DevExt, pSession, rc, (int)RTProcSelf())); -+ Log(("vgdrvFreeBSDOpen: success - g_DevExt=%p pSession=%p rc=%d pid=%d\n", &g_DevExt, pSession, rc, (int)RTProcSelf())); -+ rc = devfs_set_cdevpriv(pSession, vgdrvFreeBSDDtr); -+ if (rc) -+ VGDrvCommonCloseSession(&g_DevExt, pSession); -+ else - ASMAtomicIncU32(&cUsers); -- return 0; -- } -- -- VGDrvCommonCloseSession(&g_DevExt, pSession); -+ return rc; - } - - LogRel(("vgdrvFreeBSDOpen: failed. rc=%d\n", rc)); -@@ -253,33 +189,6 @@ static int vgdrvFreeBSDOpen(struct cdev - } - - /** -- * File close handler -- * -- */ --static int vgdrvFreeBSDClose(struct cdev *pDev, int fFile, int DevType, struct thread *pTd) --{ -- PVBOXGUESTSESSION pSession = (PVBOXGUESTSESSION)pDev->si_drv1; -- Log(("vgdrvFreeBSDClose: fFile=%#x pSession=%p\n", fFile, pSession)); -- -- /* -- * Close the session if it's still hanging on to the device... -- */ -- if (VALID_PTR(pSession)) -- { -- VGDrvCommonCloseSession(&g_DevExt, pSession); -- if (!ASMAtomicCmpXchgPtr(&pDev->si_drv1, NULL, pSession)) -- Log(("vgdrvFreeBSDClose: si_drv1=%p expected %p!\n", pDev->si_drv1, pSession)); -- ASMAtomicDecU32(&cUsers); -- /* Don't use destroy_dev here because it may sleep resulting in a hanging user process. */ -- destroy_dev_sched(pDev); -- } -- else -- Log(("vgdrvFreeBSDClose: si_drv1=%p!\n", pSession)); -- return 0; --} -- -- --/** - * I/O control request. - * - * @returns depends... -@@ -292,7 +201,11 @@ static int vgdrvFreeBSDClose(struct cdev - static int vgdrvFreeBSDIOCtl(struct cdev *pDev, u_long ulCmd, caddr_t pvData, int fFile, struct thread *pTd) - { - PVBOXGUESTSESSION pSession; -- devfs_get_cdevpriv((void **)&pSession); -+ int rc; -+ -+ rc = devfs_get_cdevpriv((void **)&pSession); -+ if (rc) -+ return rc; - - /* - * Deal with the fast ioctl path first. -@@ -488,12 +401,14 @@ int VBOXCALL VBoxGuestIDC(void *pvSessio - - static int vgdrvFreeBSDPoll(struct cdev *pDev, int fEvents, struct thread *td) - { -- int fEventsProcessed; -+ PVBOXGUESTSESSION pSession; -+ int fEventsProcessed, rc; - - LogFlow(("vgdrvFreeBSDPoll: fEvents=%d\n", fEvents)); - -- PVBOXGUESTSESSION pSession = (PVBOXGUESTSESSION)pDev->si_drv1; -- if (RT_UNLIKELY(!VALID_PTR(pSession))) { -+ rc = devfs_get_cdevpriv((void **)&pSession); -+ if (rc) -+ { - Log(("vgdrvFreeBSDPoll: no state data for %s\n", devtoname(pDev))); - return (fEvents & (POLLHUP|POLLIN|POLLRDNORM|POLLOUT|POLLWRNORM)); - } -@@ -534,10 +449,7 @@ static int vgdrvFreeBSDDetach(device_t p - /* - * Reverse what we did in vgdrvFreeBSDAttach. - */ -- if (g_vgdrvFreeBSDEHTag != NULL) -- EVENTHANDLER_DEREGISTER(dev_clone, g_vgdrvFreeBSDEHTag); -- -- clone_cleanup(&g_pvgdrvFreeBSDClones); -+ destroy_dev(g_pDev); - - vgdrvFreeBSDRemoveIRQ(pDevice, pState); - -@@ -689,18 +601,21 @@ static int vgdrvFreeBSDAttach(device_t p - if (RT_SUCCESS(rc)) - { - /* -- * Configure device cloning. -+ * Configure device. - */ -- clone_setup(&g_pvgdrvFreeBSDClones); -- g_vgdrvFreeBSDEHTag = EVENTHANDLER_REGISTER(dev_clone, vgdrvFreeBSDClone, 0, 1000); -- if (g_vgdrvFreeBSDEHTag) -+ g_pDev = make_dev(&g_vgdrvFreeBSDChrDevSW, -+ 0, -+ UID_ROOT, -+ GID_WHEEL, -+ 0664, -+ "vboxguest"); -+ if (g_pDev) - { - printf(DEVICE_NAME ": loaded successfully\n"); - return 0; - } - -- printf(DEVICE_NAME ": EVENTHANDLER_REGISTER(dev_clone,,,) failed\n"); -- clone_cleanup(&g_pvgdrvFreeBSDClones); -+ printf(DEVICE_NAME ": make_dev failed\n"); - vgdrvFreeBSDRemoveIRQ(pDevice, pState); - } - else --- emulators/virtualbox-ose/files/patch-src-VBox-Additions-common-VBoxGuest-freebsd-Makefile (revision 520061) +++ emulators/virtualbox-ose/files/patch-src-VBox-Additions-common-VBoxGuest-freebsd-Makefile (nonexistent) @@ -1,18 +0,0 @@ ---- src/VBox/Additions/common/VBoxGuest/freebsd/Makefile.orig 2017-10-18 07:06:43 UTC -+++ src/VBox/Additions/common/VBoxGuest/freebsd/Makefile -@@ -70,6 +70,7 @@ SRCS += \ - handletable.c \ - handletablectx.c \ - once.c \ -+ term.c \ - thread.c - - .PATH: ${.CURDIR}/common/string -@@ -128,6 +129,7 @@ SRCS += \ - - .PATH: ${.CURDIR}/r0drv - SRCS += \ -+ alloc-ef-r0drv.c \ - alloc-r0drv.c \ - initterm-r0drv.c \ - memobj-r0drv.c \ --- emulators/virtualbox-ose/files/patch-src-VBox-Additions-common-VBoxGuest-freebsd-files_vboxguest (revision 520061) +++ emulators/virtualbox-ose/files/patch-src-VBox-Additions-common-VBoxGuest-freebsd-files_vboxguest (nonexistent) @@ -1,26 +0,0 @@ ---- src/VBox/Additions/common/VBoxGuest/freebsd/files_vboxguest.orig 2017-10-18 07:06:43 UTC -+++ src/VBox/Additions/common/VBoxGuest/freebsd/files_vboxguest -@@ -99,6 +99,7 @@ FILES_VBOXGUEST_NOBIN=" \ - ${PATH_ROOT}/src/VBox/Runtime/common/misc/handletable.h=>common/misc/handletable.h \ - ${PATH_ROOT}/src/VBox/Runtime/common/misc/handletablectx.cpp=>common/misc/handletablectx.c \ - ${PATH_ROOT}/src/VBox/Runtime/common/misc/once.cpp=>common/misc/once.c \ -+ ${PATH_ROOT}/src/VBox/Runtime/common/misc/term.cpp=>common/misc/term.c \ - ${PATH_ROOT}/src/VBox/Runtime/common/misc/thread.cpp=>common/misc/thread.c \ - ${PATH_ROOT}/src/VBox/Runtime/common/misc/RTAssertMsg1Weak.cpp=>common/misc/RTAssertMsg1Weak.c \ - ${PATH_ROOT}/src/VBox/Runtime/common/misc/RTAssertMsg2.cpp=>common/misc/RTAssertMsg2.c \ -@@ -160,6 +161,7 @@ FILES_VBOXGUEST_NOBIN=" \ - ${PATH_ROOT}/src/VBox/Runtime/generic/errvars-generic.cpp=>generic/errvars-generic.c \ - ${PATH_ROOT}/src/VBox/Runtime/generic/timer-generic.cpp=>generic/timer-generic.c \ - ${PATH_ROOT}/src/VBox/Runtime/generic/mppresent-generic.cpp=>generic/mppresent-generic.c \ -+ ${PATH_ROOT}/src/VBox/Runtime/r0drv/alloc-ef-r0drv.cpp=>r0drv/alloc-ef-r0drv.c \ - ${PATH_ROOT}/src/VBox/Runtime/r0drv/alloc-r0drv.cpp=>r0drv/alloc-r0drv.c \ - ${PATH_ROOT}/src/VBox/Runtime/r0drv/alloc-r0drv.h=>r0drv/alloc-r0drv.h \ - ${PATH_ROOT}/src/VBox/Runtime/r0drv/initterm-r0drv.cpp=>r0drv/initterm-r0drv.c \ -@@ -186,6 +188,7 @@ FILES_VBOXGUEST_NOBIN=" \ - ${PATH_ROOT}/src/VBox/Runtime/r0drv/freebsd/sleepqueue-r0drv-freebsd.h=>r0drv/freebsd/sleepqueue-r0drv-freebsd.h \ - ${PATH_ROOT}/src/VBox/Runtime/r0drv/generic/semspinmutex-r0drv-generic.c=>r0drv/generic/semspinmutex-r0drv-generic.c \ - ${PATH_ROOT}/src/VBox/Runtime/r0drv/generic/mpnotification-r0drv-generic.cpp=>r0drv/generic/mpnotification-r0drv-generic.c \ -+ ${PATH_ROOT}/src/VBox/Runtime/r0drv/generic/threadctxhooks-r0drv-generic.cpp=>r0drv/generic/threadctxhooks-r0drv-generic.c \ - ${PATH_ROOT}/src/VBox/Runtime/r0drv/generic/RTMpIsCpuWorkPending-r0drv-generic.cpp=>r0drv/generic/RTMpIsCpuWorkPending-r0drv-generic.c \ - ${PATH_ROOT}/src/VBox/Runtime/r0drv/memobj-r0drv.cpp=>r0drv/memobj-r0drv.c \ - ${PATH_ROOT}/src/VBox/Runtime/VBox/log-vbox.cpp=>VBox/log-vbox.c \ --- emulators/virtualbox-ose/files/patch-src-VBox-Additions-common-crOpenGL-FreeBSD_i386_exports.py (revision 520061) +++ emulators/virtualbox-ose/files/patch-src-VBox-Additions-common-crOpenGL-FreeBSD_i386_exports.py (nonexistent) @@ -1,98 +0,0 @@ ---- src/VBox/Additions/common/crOpenGL/FreeBSD_i386_exports.py.orig 2014-12-19 16:58:04.474417000 -0500 -+++ src/VBox/Additions/common/crOpenGL/FreeBSD_i386_exports.py 2014-11-21 10:16:35.000000000 -0500 -@@ -0,0 +1,95 @@ -+# Copyright (c) 2001, Stanford University -+# All rights reserved. -+# -+# See the file LICENSE.txt for information on redistributing this software. -+ -+ -+import sys -+ -+import apiutil -+ -+ -+def GenerateEntrypoints(): -+ -+ #apiutil.CopyrightC() -+ -+ # Get sorted list of dispatched functions. -+ # The order is very important - it must match cr_opcodes.h -+ # and spu_dispatch_table.h -+ print '%include "iprt/asmdefs.mac"' -+ print "" -+ print "%ifdef RT_ARCH_AMD64" -+ print "extern glim" -+ print "%else ; X86" -+ print "extern glim" -+ print "%endif" -+ print "" -+ -+ keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt") -+ -+ for index in range(len(keys)): -+ func_name = keys[index] -+ if apiutil.Category(func_name) == "Chromium": -+ continue -+ if apiutil.Category(func_name) == "VBox": -+ continue -+ -+ print "BEGINPROC_EXPORTED gl%s" % func_name -+ print "%ifdef RT_ARCH_AMD64" -+ print "\tmov \trax, qword glim+%d" % (8*index) -+ print "\tjmp \t[rax]" -+ print "%else ; X86" -+ print "\tmov \teax, dword glim+%d" % (4*index) -+ print "\tjmp \t[eax]" -+ print "%endif" -+ print "ENDPROC gl%s" % func_name -+ print "" -+ -+ -+ print ';' -+ print '; Aliases' -+ print ';' -+ -+ # Now loop over all the functions and take care of any aliases -+ allkeys = apiutil.GetAllFunctions(sys.argv[1]+"/APIspec.txt") -+ for func_name in allkeys: -+ if "omit" in apiutil.ChromiumProps(func_name): -+ continue -+ -+ if func_name in keys: -+ # we already processed this function earlier -+ continue -+ -+ # alias is the function we're aliasing -+ alias = apiutil.Alias(func_name) -+ if alias: -+ # this dict lookup should never fail (raise an exception)! -+ index = keys.index(alias) -+ print "BEGINPROC_EXPORTED gl%s" % func_name -+ print "%ifdef RT_ARCH_AMD64" -+ print "\tmov \trax, qword glim+%d" % (8*index) -+ print "\tjmp \t[rax]" -+ print "%else ; X86" -+ print "\tmov \teax, dword glim+%d" % (4*index) -+ print "\tjmp \t[eax]" -+ print "%endif" -+ print "ENDPROC gl%s" % func_name -+ print "" -+ -+ -+ print ';' -+ print '; No-op stubs' -+ print ';' -+ -+ # Now generate no-op stub functions -+ for func_name in allkeys: -+ if "stub" in apiutil.ChromiumProps(func_name): -+ print "BEGINPROC_EXPORTED gl%s" % func_name -+ print "\tleave" -+ print "\tret" -+ print "ENDPROC gl%s" % func_name -+ print "" -+ -+ -+GenerateEntrypoints() -+ --- emulators/virtualbox-ose/files/patch-src-VBox-Additions-common-crOpenGL-FreeBSD_i386_exports_dri.py (revision 520061) +++ emulators/virtualbox-ose/files/patch-src-VBox-Additions-common-crOpenGL-FreeBSD_i386_exports_dri.py (nonexistent) @@ -1,98 +0,0 @@ ---- src/VBox/Additions/common/crOpenGL/FreeBSD_i386_exports_dri.py.orig 2014-12-19 16:58:04.474417000 -0500 -+++ src/VBox/Additions/common/crOpenGL/FreeBSD_i386_exports_dri.py 2014-11-21 10:16:35.000000000 -0500 -@@ -0,0 +1,95 @@ -+# Copyright (c) 2001, Stanford University -+# All rights reserved. -+# -+# See the file LICENSE.txt for information on redistributing this software. -+ -+ -+import sys -+ -+import apiutil -+ -+ -+def GenerateEntrypoints(): -+ -+ #apiutil.CopyrightC() -+ -+ # Get sorted list of dispatched functions. -+ # The order is very important - it must match cr_opcodes.h -+ # and spu_dispatch_table.h -+ print '%include "iprt/asmdefs.mac"' -+ print "" -+ print "%ifdef RT_ARCH_AMD64" -+ print "extern glim" -+ print "%else ; X86" -+ print "extern glim" -+ print "%endif" -+ print "" -+ -+ keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt") -+ -+ for index in range(len(keys)): -+ func_name = keys[index] -+ if apiutil.Category(func_name) == "Chromium": -+ continue -+ if apiutil.Category(func_name) == "VBox": -+ continue -+ -+ print "BEGINPROC_EXPORTED cr_gl%s" % func_name -+ print "%ifdef RT_ARCH_AMD64" -+ print "\tmov \trax, qword glim+%d" % (8*index) -+ print "\tjmp \t[rax]" -+ print "%else ; X86" -+ print "\tmov \teax, dword glim+%d" % (4*index) -+ print "\tjmp \t[eax]" -+ print "%endif" -+ print "ENDPROC cr_gl%s" % func_name -+ print "" -+ -+ -+ print ';' -+ print '; Aliases' -+ print ';' -+ -+ # Now loop over all the functions and take care of any aliases -+ allkeys = apiutil.GetAllFunctions(sys.argv[1]+"/APIspec.txt") -+ for func_name in allkeys: -+ if "omit" in apiutil.ChromiumProps(func_name): -+ continue -+ -+ if func_name in keys: -+ # we already processed this function earlier -+ continue -+ -+ # alias is the function we're aliasing -+ alias = apiutil.Alias(func_name) -+ if alias: -+ # this dict lookup should never fail (raise an exception)! -+ index = keys.index(alias) -+ print "BEGINPROC_EXPORTED cr_gl%s" % func_name -+ print "%ifdef RT_ARCH_AMD64" -+ print "\tmov \trax, qword glim+%d" % (8*index) -+ print "\tjmp \t[rax]" -+ print "%else ; X86" -+ print "\tmov \teax, dword glim+%d" % (4*index) -+ print "\tjmp \t[eax]" -+ print "%endif" -+ print "ENDPROC cr_gl%s" % func_name -+ print "" -+ -+ -+ print ';' -+ print '; No-op stubs' -+ print ';' -+ -+ # Now generate no-op stub functions -+ for func_name in allkeys: -+ if "stub" in apiutil.ChromiumProps(func_name): -+ print "BEGINPROC_EXPORTED cr_gl%s" % func_name -+ print "\tleave" -+ print "\tret" -+ print "ENDPROC cr_gl%s" % func_name -+ print "" -+ -+ -+GenerateEntrypoints() -+ --- emulators/virtualbox-ose/files/patch-src-VBox-Additions-common-crOpenGL-FreeBSD_i386_glxapi_exports.py (revision 520061) +++ emulators/virtualbox-ose/files/patch-src-VBox-Additions-common-crOpenGL-FreeBSD_i386_glxapi_exports.py (nonexistent) @@ -1,107 +0,0 @@ ---- src/VBox/Additions/common/crOpenGL/FreeBSD_i386_glxapi_exports.py.orig 2014-12-19 16:58:04.474417000 -0500 -+++ src/VBox/Additions/common/crOpenGL/FreeBSD_i386_glxapi_exports.py 2014-11-21 10:16:35.000000000 -0500 -@@ -0,0 +1,104 @@ -+""" -+Copyright (C) 2009-2012 Oracle Corporation -+ -+This file is part of VirtualBox Open Source Edition (OSE), as -+available from http://www.virtualbox.org. This file is free software; -+you can redistribute it and/or modify it under the terms of the GNU -+General Public License (GPL) as published by the Free Software -+Foundation, in version 2 as it comes in the "COPYING" file of the -+VirtualBox OSE distribution. VirtualBox OSE is distributed in the -+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. -+""" -+ -+import sys -+ -+#Note, this should match the fakedri_glxfuncsList.h order -+glx_functions = [ -+"CopyContext", -+"UseXFont", -+#"GetDriverConfig", -+"GetProcAddress", -+"QueryExtension", -+"IsDirect", -+"DestroyGLXPbufferSGIX", -+"QueryGLXPbufferSGIX", -+"CreateGLXPixmap", -+"CreateGLXPixmapWithConfigSGIX", -+"QueryContext", -+"CreateContextWithConfigSGIX", -+"SwapBuffers", -+"CreateNewContext", -+"SelectEventSGIX", -+"GetCurrentDrawable", -+"ChooseFBConfig", -+"WaitGL", -+"GetFBConfigs", -+"CreatePixmap", -+"GetSelectedEventSGIX", -+"GetCurrentReadDrawable", -+"GetCurrentDisplay", -+"QueryServerString", -+"CreateWindow", -+"SelectEvent", -+"GetVisualFromFBConfigSGIX", -+"GetFBConfigFromVisualSGIX", -+"QueryDrawable", -+"CreateContext", -+"GetConfig", -+"CreateGLXPbufferSGIX", -+"CreatePbuffer", -+"ChooseFBConfigSGIX", -+"WaitX", -+"GetVisualFromFBConfig", -+#"GetScreenDriver", -+"GetFBConfigAttrib", -+"GetCurrentContext", -+"GetClientString", -+"DestroyPixmap", -+"MakeCurrent", -+"DestroyContext", -+"GetProcAddressARB", -+"GetSelectedEvent", -+"DestroyPbuffer", -+"DestroyWindow", -+"DestroyGLXPixmap", -+"QueryVersion", -+"ChooseVisual", -+"MakeContextCurrent", -+"QueryExtensionsString", -+"GetFBConfigAttribSGIX", -+"FreeMemoryMESA", -+"QueryContextInfoEXT", -+"ImportContextEXT", -+"GetContextIDEXT", -+"MakeCurrentReadSGI", -+"AllocateMemoryMESA", -+"GetMemoryOffsetMESA", -+"CreateGLXPixmapMESA", -+"GetCurrentDisplayEXT", -+"FreeContextEXT" -+]; -+ -+print '%include "iprt/asmdefs.mac"' -+print "" -+print "%ifdef RT_ARCH_AMD64" -+print "extern glxim" -+print "%else ; X86" -+print "extern glxim" -+print "%endif" -+print "" -+ -+for index in range(len(glx_functions)): -+ func_name = glx_functions[index] -+ -+ print "BEGINPROC_EXPORTED vbox_glX%s" % func_name -+ print "%ifdef RT_ARCH_AMD64" -+ print "\tmov \trax, qword glxim+%d" % (8*index) -+ print "\tjmp \t[rax]" -+ print "%else ; X86" -+ print "\tmov \teax, dword glxim+%d" % (4*index) -+ print "\tjmp \t[eax]" -+ print "%endif" -+ print "ENDPROC vbox_glX%s" % func_name -+ print "" -+ --- emulators/virtualbox-ose/files/patch-src-VBox-Additions-common-crOpenGL-Makefile.kmk (revision 520061) +++ emulators/virtualbox-ose/files/patch-src-VBox-Additions-common-crOpenGL-Makefile.kmk (nonexistent) @@ -1,79 +0,0 @@ ---- src/VBox/Additions/common/crOpenGL/Makefile.kmk.orig 2016-07-18 11:50:43 UTC -+++ src/VBox/Additions/common/crOpenGL/Makefile.kmk -@@ -47,9 +47,7 @@ endif - if1of ($(KBUILD_TARGET), linux solaris freebsd) - #VBoxOGL_DRI = 1 - DLLS += VBoxEGL -- ifn1of ($(KBUILD_TARGET),linux solaris) # No DRI on Solaris yet -- VBoxOGL_FAKEDRI = 1 -- endif -+ #VBoxOGL_FAKEDRI = 1 - - # Only Solaris right now needs C stubs because I can't figure out how to - # generate the GOT based relocation ASM yet. -@@ -184,10 +182,12 @@ VBoxOGL_CLEAN.linux += \ - $(VBOX_PATH_CROGL_GENFILES)/linux_exports.c - VBoxOGL_CLEAN.solaris += \ - $(VBOX_PATH_CROGL_GENFILES)/solaris_exports.c -+VBoxOGL_CLEAN.freebsd += \ -+ $(VBOX_PATH_CROGL_GENFILES)/freebsd_exports.c - VBoxOGL_CLEAN.win = \ - $(VBOX_PATH_CROGL_GENFILES)/windows_exports.asm \ - $(VBOX_PATH_CROGL_GENFILES)/cropengl.def --if1of ($(KBUILD_TARGET), linux solaris) -+if1of ($(KBUILD_TARGET), linux solaris freebsd) - ifdef VBoxOGL_DRI - VBoxOGL_CLEAN += \ - $(VBOX_PATH_CROGL_GENFILES)/cr_gl.h \ -@@ -200,6 +200,8 @@ if1of ($(KBUILD_TARGET), linux solaris) - $(VBOX_PATH_CROGL_GENFILES)/linux_glxapi_exports.asm - VBoxOGL_CLEAN.solaris += \ - $(VBOX_PATH_CROGL_GENFILES)/solaris_glxapi_exports.asm -+ VBoxOGL_CLEAN.freebsd += \ -+ $(VBOX_PATH_CROGL_GENFILES)/freebsd_glxapi_exports.asm - endif - endif - VBoxOGL_LIBS = \ -@@ -229,6 +231,8 @@ if1of ($(KBUILD_TARGET), linux solaris f - else - VBoxOGL_SONAME.linux = libGL.so.1 - VBoxOGL_LDFLAGS.linux += -Wl,-e,LibMain -+ VBoxOGL_SONAME.freebsd = libGL.so.1 -+ VBoxOGL_LDFLAGS.freebsd += -Wl,-e,LibMain - endif - endif - ifdef VBOX_WITH_CRHGSMI -@@ -237,7 +241,7 @@ endif - ifdef VBOX_WITH_WDDM - VBoxOGL_DEFS.win += VBOX_WITH_WDDM - endif --if1of ($(KBUILD_TARGET), linux) -+if1of ($(KBUILD_TARGET), linux freebsd) - VBoxOGL_LDFLAGS += -Wl,-z,nodelete - endif - ifdef VBOX_WITH_WDDM -@@ -395,6 +399,16 @@ $(VBOX_PATH_CROGL_GENFILES)/solaris_expo - $(VBOX_PATH_CROGL_GENFILES)/solaris_glxapi_exports.asm: $(PATH_SUB_CURRENT)/SunOS_i386_glxapi_exports.py | $$(dir $$@) - $(call MSG_GENERATE,python,$@,$<) - $(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< -+ else ifeq ($(KBUILD_TARGET),freebsd) -+$(VBOX_PATH_CROGL_GENFILES)/freebsd_exports_dri.asm: \ -+ $(PATH_SUB_CURRENT)/FreeBSD_i386_exports_dri.py \ -+ $(VBOX_CROGL_API_FILES) $(PATH_SUB_CURRENT)/entrypoints.py \ -+ | $$(dir $$@) -+ $(call MSG_GENERATE,python,$@,$<) -+ $(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< $(VBOX_PATH_CROGL_GLAPI) -+$(VBOX_PATH_CROGL_GENFILES)/freebsd_glxapi_exports.asm: $(PATH_SUB_CURRENT)/FreeBSD_i386_glxapi_exports.py | $$(dir $$@) -+ $(call MSG_GENERATE,python,$@,$<) -+ $(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< - - else - $(VBOX_PATH_CROGL_GENFILES)/linux_exports_dri.asm: \ -@@ -712,6 +726,7 @@ VBoxEGL_SOURCES = egl.c - VBoxEGL_INCS = $(VBOX_PATH_X11_ROOT)/mesa-11.0.7 - VBoxEGL_LIBS = $(VBOX_LIB_OGL) $(VBOX_LIB_IPRT_GUEST_R3_SHARED) - VBoxEGL_SONAME.linux = libEGL.so.1 -+VBoxEGL_SONAME.freebsd = libEGL.so.1 - - include $(FILE_KBUILD_SUB_FOOTER) - --- emulators/virtualbox-ose/files/patch-src-VBox-Additions-x11-Installer-98vboxadd-xclient (revision 520061) +++ emulators/virtualbox-ose/files/patch-src-VBox-Additions-x11-Installer-98vboxadd-xclient (nonexistent) @@ -1,17 +0,0 @@ ---- src/VBox/Additions/x11/Installer/98vboxadd-xclient.orig 2015-02-12 11:08:13.000000000 -0500 -+++ src/VBox/Additions/x11/Installer/98vboxadd-xclient 2015-02-12 14:38:40.689104000 -0500 -@@ -28,9 +28,9 @@ - # This script can also be triggered by a connection over SSH, which is not - # what we had in mind, so we do not start VBoxClient in that case. We do - # not use "exit" here as this script is "source"d, not executed. -- /usr/bin/VBoxClient --clipboard -- /usr/bin/VBoxClient --checkhostversion -- /usr/bin/VBoxClient --display -- /usr/bin/VBoxClient --seamless -- /usr/bin/VBoxClient --draganddrop -+ /usr/local/bin/VBoxClient --clipboard -+ /usr/local/bin/VBoxClient --checkhostversion -+ /usr/local/bin/VBoxClient --display -+ /usr/local/bin/VBoxClient --seamless -+ /usr/local/bin/VBoxClient --draganddrop - fi --- emulators/virtualbox-ose/files/patch-src-VBox-Additions-x11-Installer-vboxclient.desktop (revision 520061) +++ emulators/virtualbox-ose/files/patch-src-VBox-Additions-x11-Installer-vboxclient.desktop (nonexistent) @@ -1,10 +0,0 @@ ---- src/VBox/Additions/x11/Installer/vboxclient.desktop.orig 2009-06-12 12:34:57.000000000 +0000 -+++ src/VBox/Additions/x11/Installer/vboxclient.desktop 2011-01-13 22:07:37.000000000 +0000 -@@ -8,6 +8,6 @@ - Comment=VirtualBox User Session Services - Comment[it]=Servizi di sessione utente di VirtualBox - Comment[pl]=Usługi sesji użytkownika VirtualBox --Exec=/usr/bin/VBoxClient-all -+Exec=/usr/local/bin/VBoxClient-all - X-GNOME-Autostart-enabled=true - X-KDE-autostart-after=panel --- emulators/virtualbox-ose/files/patch-src-VBox-Devices-Network-slirp-bsd-sys-mbuf.h (revision 520061) +++ emulators/virtualbox-ose/files/patch-src-VBox-Devices-Network-slirp-bsd-sys-mbuf.h (nonexistent) @@ -1,12 +0,0 @@ ---- src/VBox/Devices/Network/slirp/bsd/sys/mbuf.h.orig 2015-03-02 10:09:19.000000000 -0500 -+++ src/VBox/Devices/Network/slirp/bsd/sys/mbuf.h 2015-03-02 19:42:56.808020000 -0500 -@@ -241,6 +241,9 @@ - #define M_FRAG 0x00000800 /* packet is a fragment of a larger packet */ - #define M_FIRSTFRAG 0x00001000 /* packet is first fragment */ - #define M_LASTFRAG 0x00002000 /* packet is last fragment */ -+#ifdef M_SKIP_FIREWALL -+#undef M_SKIP_FIREWALL -+#endif - #define M_SKIP_FIREWALL 0x00004000 /* skip firewall processing */ - #define M_FREELIST 0x00008000 /* mbuf is on the free list */ - #define M_VLANTAG 0x00010000 /* ether_vtag is valid */ --- emulators/virtualbox-ose/files/patch-src-VBox-GuestHost-OpenGL-Makefile.kmk (revision 520061) +++ emulators/virtualbox-ose/files/patch-src-VBox-GuestHost-OpenGL-Makefile.kmk (nonexistent) @@ -1,20 +0,0 @@ ---- src/VBox/GuestHost/OpenGL/Makefile.kmk.orig 2019-07-12 08:49:27 UTC -+++ src/VBox/GuestHost/OpenGL/Makefile.kmk -@@ -94,7 +94,7 @@ VBoxOGLcrutil_DEFS.win += CR_DEBUG_BACKDOOR_ENABLE - VBoxOGLcrutil_INCS.win += $(PATH_ROOT)/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm - VBoxOGLcrutil_LIBS.win += $(VBOX_PATH_ADDITIONS_LIB)/VBoxDispMpLogger$(VBOX_SUFF_LIB) - endif --if1of ($(KBUILD_TARGET), linux) -+if1of ($(KBUILD_TARGET), linux freebsd) - VBoxOGLcrutil_LDFLAGS += -Wl,-z,nodelete - endif - -@@ -140,7 +140,7 @@ VBoxOGLhostcrutil_TEMPLATE = VBOXCROGLR3HOSTLIB - if defined(VBOX_SIGNING_MODE) && defined(VBOX_WITH_WDDM) - VBoxOGLhostcrutil_INSTTYPE.win = both - endif --if1of ($(KBUILD_TARGET), linux) -+if1of ($(KBUILD_TARGET), linux freebsd) - VBoxOGLhostcrutil_LDFLAGS = $(NO_SUCH_VARIABLE) - endif - VBoxOGLhostcrutil_LIBS.win = \ --- emulators/virtualbox-ose/files/patch-src-VBox-HostDrivers-Support-freebsd-Makefile (revision 520061) +++ emulators/virtualbox-ose/files/patch-src-VBox-HostDrivers-Support-freebsd-Makefile (nonexistent) @@ -1,27 +0,0 @@ ---- src/VBox/HostDrivers/Support/freebsd/Makefile.orig 2016-07-18 11:56:20 UTC -+++ src/VBox/HostDrivers/Support/freebsd/Makefile -@@ -81,6 +81,7 @@ SRCS += \ - assert.c \ - handletable.c \ - handletablectx.c \ -+ handletablesimple.c \ - once.c \ - term.c \ - thread.c -@@ -92,13 +93,14 @@ SRCS += \ - RTStrCopy.c \ - RTStrCopyEx.c \ - RTStrCopyP.c \ -+ memchr.c \ - strformat.c \ - strformatrt.c \ - strformattype.c \ -+ stringalloc.c \ - strprintf.c \ - strtonum.c \ -- memchr.c \ -- stringalloc.c -+ utf-8.c - - .PATH: ${.CURDIR}/common/rand - SRCS += \ --- emulators/virtualbox-ose/files/patch-src-VBox-HostDrivers-Support-freebsd-files_vboxdrv (revision 520061) +++ emulators/virtualbox-ose/files/patch-src-VBox-HostDrivers-Support-freebsd-files_vboxdrv (nonexistent) @@ -1,27 +0,0 @@ ---- src/VBox/HostDrivers/Support/freebsd/files_vboxdrv.orig 2016-07-18 11:56:20 UTC -+++ src/VBox/HostDrivers/Support/freebsd/files_vboxdrv -@@ -116,6 +116,7 @@ FILES_VBOXDRV_NOBIN=" \ - ${PATH_ROOT}/src/VBox/Runtime/common/misc/handletable.cpp=>common/misc/handletable.c \ - ${PATH_ROOT}/src/VBox/Runtime/common/misc/handletable.h=>common/misc/handletable.h \ - ${PATH_ROOT}/src/VBox/Runtime/common/misc/handletablectx.cpp=>common/misc/handletablectx.c \ -+ ${PATH_ROOT}/src/VBox/Runtime/common/misc/handletablesimple.cpp=>common/misc/handletablesimple.c \ - ${PATH_ROOT}/src/VBox/Runtime/common/misc/once.cpp=>common/misc/once.c \ - ${PATH_ROOT}/src/VBox/Runtime/common/misc/term.cpp=>common/misc/term.c \ - ${PATH_ROOT}/src/VBox/Runtime/common/misc/thread.cpp=>common/misc/thread.c \ -@@ -124,13 +125,14 @@ FILES_VBOXDRV_NOBIN=" \ - ${PATH_ROOT}/src/VBox/Runtime/common/string/RTStrCopyEx.cpp=>common/string/RTStrCopyEx.c \ - ${PATH_ROOT}/src/VBox/Runtime/common/string/RTStrNCmp.cpp=>common/string/RTStrNCmp.c \ - ${PATH_ROOT}/src/VBox/Runtime/common/string/RTStrNLen.cpp=>common/string/RTStrNLen.c \ -+ ${PATH_ROOT}/src/VBox/Runtime/common/string/memchr.cpp=>common/string/memchr.c \ - ${PATH_ROOT}/src/VBox/Runtime/common/string/strformat.cpp=>common/string/strformat.c \ - ${PATH_ROOT}/src/VBox/Runtime/common/string/strformatrt.cpp=>common/string/strformatrt.c \ - ${PATH_ROOT}/src/VBox/Runtime/common/string/strformattype.cpp=>common/string/strformattype.c \ -+ ${PATH_ROOT}/src/VBox/Runtime/common/string/stringalloc.cpp=>common/string/stringalloc.c \ - ${PATH_ROOT}/src/VBox/Runtime/common/string/strprintf.cpp=>common/string/strprintf.c \ - ${PATH_ROOT}/src/VBox/Runtime/common/string/strtonum.cpp=>common/string/strtonum.c \ -- ${PATH_ROOT}/src/VBox/Runtime/common/string/memchr.cpp=>common/string/memchr.c \ -- ${PATH_ROOT}/src/VBox/Runtime/common/string/stringalloc.cpp=>common/string/stringalloc.c \ -+ ${PATH_ROOT}/src/VBox/Runtime/common/string/utf-8.cpp=>common/string/utf-8.c \ - ${PATH_ROOT}/src/VBox/Runtime/common/rand/rand.cpp=>common/rand/rand.c \ - ${PATH_ROOT}/src/VBox/Runtime/common/rand/randadv.cpp=>common/rand/randadv.c \ - ${PATH_ROOT}/src/VBox/Runtime/common/rand/randparkmiller.cpp=>common/rand/randparkmiller.c \ --- emulators/virtualbox-ose/files/patch-src-VBox-HostDrivers-VBoxNetAdp-Makefile.kmk (revision 520061) +++ emulators/virtualbox-ose/files/patch-src-VBox-HostDrivers-VBoxNetAdp-Makefile.kmk (nonexistent) @@ -1,25 +0,0 @@ -Fix kmod panic when VIMAGE is disabled in the kernel and port - -Submitted by: Gleb Kurtsou ---- src/VBox/HostDrivers/VBoxNetAdp/Makefile.kmk.orig 2013-04-12 03:38:10.000000000 -0700 -+++ src/VBox/HostDrivers/VBoxNetAdp/Makefile.kmk 2013-06-11 21:24:05.000000000 -0700 -@@ -143,12 +143,15 @@ - $$(if $$(eq $$(VBoxNetAdp/freebsd/Makefile_VBOX_HARDENED),$$(VBOX_WITH_HARDENING)),,FORCE) \ - | $$(dir $$@) - $(QUIET)$(RM) -f -- $@ -- ifndef VBOX_WITH_HARDENING -- $(QUIET)$(SED) -e "s;-DVBOX_WITH_HARDENING;;g" --output $@ $< -- else - $(QUIET)$(CP) -f $< $@ -+ ifndef VBOX_WITH_HARDENING -+ $(QUIET)$(SED) -e "s;-DVBOX_WITH_HARDENING;;g" --output $@.tmp $@ -+ ${QUIET}$(MV) -f $@.tmp $@ -+ endif -+ ifndef VBOX_WITH_NETFLT_VIMAGE -+ $(QUIET)$(SED) -e "s;-DVIMAGE;;g" --output $@.tmp $@ -+ ${QUIET}$(MV) -f $@.tmp $@ - endif -- - endif # freebsd - - include $(FILE_KBUILD_SUB_FOOTER) --- emulators/virtualbox-ose/files/patch-src-VBox-HostDrivers-VBoxNetAdp-freebsd-VBoxNetAdp-freebsd.c (revision 520061) +++ emulators/virtualbox-ose/files/patch-src-VBox-HostDrivers-VBoxNetAdp-freebsd-VBoxNetAdp-freebsd.c (nonexistent) @@ -1,14 +0,0 @@ ---- src/VBox/HostDrivers/VBoxNetAdp/freebsd/VBoxNetAdp-freebsd.c.orig 2014-09-09 15:54:30.000000000 -0400 -+++ src/VBox/HostDrivers/VBoxNetAdp/freebsd/VBoxNetAdp-freebsd.c 2014-09-30 15:36:06.000000000 -0400 -@@ -234,7 +234,11 @@ - ifp->if_drv_flags |= IFF_DRV_OACTIVE; - while (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) - { -+#if __FreeBSD_version >= 1100036 -+ if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); -+#else - ifp->if_opackets++; -+#endif - IFQ_DRV_DEQUEUE(&ifp->if_snd, m); - BPF_MTAP(ifp, m); - m_freem(m); --- emulators/virtualbox-ose/files/patch-src-VBox-HostDrivers-VBoxNetFlt-freebsd-VBoxNetFlt-freebsd.c (revision 520061) +++ emulators/virtualbox-ose/files/patch-src-VBox-HostDrivers-VBoxNetFlt-freebsd-VBoxNetFlt-freebsd.c (nonexistent) @@ -1,273 +0,0 @@ ---- src/VBox/HostDrivers/VBoxNetFlt/freebsd/VBoxNetFlt-freebsd.c.orig 2018-10-15 14:30:58 UTC -+++ src/VBox/HostDrivers/VBoxNetFlt/freebsd/VBoxNetFlt-freebsd.c -@@ -52,6 +52,7 @@ - #include - #include - #include -+#include - - #include - #include -@@ -73,6 +74,7 @@ - - #define VBOXNETFLT_OS_SPECFIC 1 - #include "../VBoxNetFltInternal.h" -+#include "freebsd/the-freebsd-kernel.h" - - static int vboxnetflt_modevent(struct module *, int, void *); - static ng_constructor_t ng_vboxnetflt_constructor; -@@ -370,7 +372,11 @@ static int ng_vboxnetflt_rcvdata(hook_p hook, item_p i - mtx_lock_spin(&pThis->u.s.inq.ifq_mtx); - _IF_ENQUEUE(&pThis->u.s.inq, m); - mtx_unlock_spin(&pThis->u.s.inq.ifq_mtx); -+#if __FreeBSD_version >= 1100100 -+ taskqueue_enqueue(taskqueue_fast, &pThis->u.s.tskin); -+#else - taskqueue_enqueue_fast(taskqueue_fast, &pThis->u.s.tskin); -+#endif - } - /* - * Handle mbufs on the outgoing hook, frames going to the interface -@@ -388,7 +394,11 @@ static int ng_vboxnetflt_rcvdata(hook_p hook, item_p i - mtx_lock_spin(&pThis->u.s.outq.ifq_mtx); - _IF_ENQUEUE(&pThis->u.s.outq, m); - mtx_unlock_spin(&pThis->u.s.outq.ifq_mtx); -+#if __FreeBSD_version >= 1100100 -+ taskqueue_enqueue(taskqueue_fast, &pThis->u.s.tskout); -+#else - taskqueue_enqueue_fast(taskqueue_fast, &pThis->u.s.tskout); -+#endif - } - else - { -@@ -428,6 +438,8 @@ static void vboxNetFltFreeBSDinput(void *arg, int pend - struct ifnet *ifp = pThis->u.s.ifp; - unsigned int cSegs = 0; - bool fDropIt = false, fActive; -+ bool is_vl_tagged = false; -+ uint16_t vl_tag; - PINTNETSG pSG; - - VBOXCURVNET_SET(ifp->if_vnet); -@@ -440,6 +452,19 @@ static void vboxNetFltFreeBSDinput(void *arg, int pend - if (m == NULL) - break; - -+ /* Prepend a VLAN header for consumption by the virtual switch */ -+ if (m->m_flags & M_VLANTAG) { -+ vl_tag = m->m_pkthdr.ether_vtag; -+ is_vl_tagged = true; -+ -+ m = ether_vlanencap(m, m->m_pkthdr.ether_vtag); -+ if (m == NULL) { -+ printf("vboxflt: unable to prepend VLAN header\n"); -+ break; -+ } -+ m->m_flags &= ~M_VLANTAG; -+ } -+ - for (m0 = m; m0 != NULL; m0 = m0->m_next) - if (m0->m_len > 0) - cSegs++; -@@ -454,6 +479,27 @@ static void vboxNetFltFreeBSDinput(void *arg, int pend - vboxNetFltFreeBSDMBufToSG(pThis, m, pSG, cSegs, 0); - fDropIt = pThis->pSwitchPort->pfnRecv(pThis->pSwitchPort, NULL /* pvIf */, pSG, INTNETTRUNKDIR_WIRE); - RTMemTmpFree(pSG); -+ -+ /* Restore the VLAN flags before re-injecting the packet */ -+ if (is_vl_tagged && !fDropIt) { -+ struct ether_vlan_header *vl_hdr; -+ -+ /* This shouldn't fail, as the header was just prepended */ -+ if (m->m_len < sizeof(*vl_hdr) && (m = m_pullup(m, sizeof(*vl_hdr))) == NULL) { -+ printf("vboxflt: unable to pullup VLAN header\n"); -+ m_freem(m); -+ break; -+ } -+ -+ /* Copy the MAC dhost/shost over the 802.1q field */ -+ vl_hdr = mtod(m, struct ether_vlan_header *); -+ bcopy((char *)vl_hdr, (char *)vl_hdr + ETHER_VLAN_ENCAP_LEN, ETHER_HDR_LEN - ETHER_TYPE_LEN); -+ m_adj(m, ETHER_VLAN_ENCAP_LEN); -+ -+ m->m_pkthdr.ether_vtag = vl_tag; -+ m->m_flags |= M_VLANTAG; -+ } -+ - if (fDropIt) - m_freem(m); - else -@@ -513,6 +559,7 @@ static void vboxNetFltFreeBSDoutput(void *arg, int pen - */ - int vboxNetFltPortOsXmit(PVBOXNETFLTINS pThis, void *pvIfData, PINTNETSG pSG, uint32_t fDst) - { -+ IPRT_FREEBSD_SAVE_EFL_AC(); - NOREF(pvIfData); - - void (*input_f)(struct ifnet *, struct mbuf *); -@@ -529,10 +576,16 @@ int vboxNetFltPortOsXmit(PVBOXNETFLTINS pThis, void *p - { - m = vboxNetFltFreeBSDSGMBufFromSG(pThis, pSG); - if (m == NULL) -+ { -+ IPRT_FREEBSD_RESTORE_EFL_AC(); - return VERR_NO_MEMORY; -+ } - m = m_pullup(m, ETHER_HDR_LEN); - if (m == NULL) -+ { -+ IPRT_FREEBSD_RESTORE_EFL_AC(); - return VERR_NO_MEMORY; -+ } - - m->m_flags |= M_PKTHDR; - ether_output_frame(ifp, m); -@@ -542,10 +595,16 @@ int vboxNetFltPortOsXmit(PVBOXNETFLTINS pThis, void *p - { - m = vboxNetFltFreeBSDSGMBufFromSG(pThis, pSG); - if (m == NULL) -+ { -+ IPRT_FREEBSD_RESTORE_EFL_AC(); - return VERR_NO_MEMORY; -+ } - m = m_pullup(m, ETHER_HDR_LEN); - if (m == NULL) -+ { -+ IPRT_FREEBSD_RESTORE_EFL_AC(); - return VERR_NO_MEMORY; -+ } - /* - * Delivering packets to the host will be captured by the - * input hook. Tag the packet with a mbuf tag so that we -@@ -556,6 +615,7 @@ int vboxNetFltPortOsXmit(PVBOXNETFLTINS pThis, void *p - if (mtag == NULL) - { - m_freem(m); -+ IPRT_FREEBSD_RESTORE_EFL_AC(); - return VERR_NO_MEMORY; - } - -@@ -566,6 +626,7 @@ int vboxNetFltPortOsXmit(PVBOXNETFLTINS pThis, void *p - ifp->if_input(ifp, m); - } - VBOXCURVNET_RESTORE(); -+ IPRT_FREEBSD_RESTORE_EFL_AC(); - return VINF_SUCCESS; - } - -@@ -578,6 +639,7 @@ static bool vboxNetFltFreeBsdIsPromiscuous(PVBOXNETFLT - - int vboxNetFltOsInitInstance(PVBOXNETFLTINS pThis, void *pvContext) - { -+ IPRT_FREEBSD_SAVE_EFL_AC(); - char nam[NG_NODESIZ]; - struct ifnet *ifp; - node_p node; -@@ -586,7 +648,10 @@ int vboxNetFltOsInitInstance(PVBOXNETFLTINS pThis, voi - NOREF(pvContext); - ifp = ifunit(pThis->szName); - if (ifp == NULL) -+ { -+ IPRT_FREEBSD_RESTORE_EFL_AC(); - return VERR_INTNET_FLT_IF_NOT_FOUND; -+ } - - /* Create a new netgraph node for this instance */ - if (ng_make_node_common(&ng_vboxnetflt_typestruct, &node) != 0) -@@ -630,12 +695,14 @@ int vboxNetFltOsInitInstance(PVBOXNETFLTINS pThis, voi - vboxNetFltRelease(pThis, true /*fBusy*/); - } - VBOXCURVNET_RESTORE(); -+ IPRT_FREEBSD_RESTORE_EFL_AC(); - - return VINF_SUCCESS; - } - - bool vboxNetFltOsMaybeRediscovered(PVBOXNETFLTINS pThis) - { -+ IPRT_FREEBSD_SAVE_EFL_AC(); - struct ifnet *ifp, *ifp0; - - ifp = ASMAtomicUoReadPtrT(&pThis->u.s.ifp, struct ifnet *); -@@ -652,6 +719,7 @@ bool vboxNetFltOsMaybeRediscovered(PVBOXNETFLTINS pThi - pThis->u.s.node = NULL; - } - VBOXCURVNET_RESTORE(); -+ IPRT_FREEBSD_RESTORE_EFL_AC(); - - if (ifp0 != NULL) - { -@@ -664,6 +732,7 @@ bool vboxNetFltOsMaybeRediscovered(PVBOXNETFLTINS pThi - - void vboxNetFltOsDeleteInstance(PVBOXNETFLTINS pThis) - { -+ IPRT_FREEBSD_SAVE_EFL_AC(); - - taskqueue_drain(taskqueue_fast, &pThis->u.s.tskin); - taskqueue_drain(taskqueue_fast, &pThis->u.s.tskout); -@@ -676,6 +745,7 @@ void vboxNetFltOsDeleteInstance(PVBOXNETFLTINS pThis) - ng_rmnode_self(pThis->u.s.node); - VBOXCURVNET_RESTORE(); - pThis->u.s.node = NULL; -+ IPRT_FREEBSD_RESTORE_EFL_AC(); - } - - int vboxNetFltOsPreInitInstance(PVBOXNETFLTINS pThis) -@@ -689,6 +759,7 @@ int vboxNetFltOsPreInitInstance(PVBOXNETFLTINS pThis) - - void vboxNetFltPortOsSetActive(PVBOXNETFLTINS pThis, bool fActive) - { -+ IPRT_FREEBSD_SAVE_EFL_AC(); - struct ifnet *ifp; - struct ifreq ifreq; - int error; -@@ -722,7 +793,10 @@ void vboxNetFltPortOsSetActive(PVBOXNETFLTINS pThis, b - NG_MKMESSAGE(msg, NGM_GENERIC_COOKIE, NGM_CONNECT, - sizeof(struct ngm_connect), M_NOWAIT); - if (msg == NULL) -+ { -+ IPRT_FREEBSD_RESTORE_EFL_AC(); - return; -+ } - con = (struct ngm_connect *)msg->data; - snprintf(con->path, NG_PATHSIZ, "vboxnetflt_%s:", ifp->if_xname); - strlcpy(con->ourhook, "lower", NG_HOOKSIZ); -@@ -736,7 +810,10 @@ void vboxNetFltPortOsSetActive(PVBOXNETFLTINS pThis, b - NG_MKMESSAGE(msg, NGM_GENERIC_COOKIE, NGM_CONNECT, - sizeof(struct ngm_connect), M_NOWAIT); - if (msg == NULL) -+ { -+ IPRT_FREEBSD_RESTORE_EFL_AC(); - return; -+ } - con = (struct ngm_connect *)msg->data; - snprintf(con->path, NG_PATHSIZ, "vboxnetflt_%s:", - ifp->if_xname); -@@ -759,7 +836,10 @@ void vboxNetFltPortOsSetActive(PVBOXNETFLTINS pThis, b - NG_MKMESSAGE(msg, NGM_GENERIC_COOKIE, NGM_RMHOOK, - sizeof(struct ngm_rmhook), M_NOWAIT); - if (msg == NULL) -+ { -+ IPRT_FREEBSD_RESTORE_EFL_AC(); - return; -+ } - rm = (struct ngm_rmhook *)msg->data; - strlcpy(rm->ourhook, "input", NG_HOOKSIZ); - NG_SEND_MSG_PATH(error, node, msg, path, 0); -@@ -770,12 +850,16 @@ void vboxNetFltPortOsSetActive(PVBOXNETFLTINS pThis, b - NG_MKMESSAGE(msg, NGM_GENERIC_COOKIE, NGM_RMHOOK, - sizeof(struct ngm_rmhook), M_NOWAIT); - if (msg == NULL) -+ { -+ IPRT_FREEBSD_RESTORE_EFL_AC(); - return; -+ } - rm = (struct ngm_rmhook *)msg->data; - strlcpy(rm->ourhook, "output", NG_HOOKSIZ); - NG_SEND_MSG_PATH(error, node, msg, path, 0); - } - VBOXCURVNET_RESTORE(); -+ IPRT_FREEBSD_RESTORE_EFL_AC(); - } - - int vboxNetFltOsDisconnectIt(PVBOXNETFLTINS pThis) --- emulators/virtualbox-ose/files/patch-src-VBox-HostDrivers-VBoxNetFlt-freebsd-files_vboxnetflt (revision 520061) +++ emulators/virtualbox-ose/files/patch-src-VBox-HostDrivers-VBoxNetFlt-freebsd-files_vboxnetflt (nonexistent) @@ -1,10 +0,0 @@ ---- src/VBox/HostDrivers/VBoxNetFlt/freebsd/files_vboxnetflt.orig 2018-10-15 14:30:58 UTC -+++ src/VBox/HostDrivers/VBoxNetFlt/freebsd/files_vboxnetflt -@@ -61,6 +61,7 @@ VBOX_VBOXNETFLT_SOURCES=" \ - ${PATH_ROOT}/include/iprt/uni.h=>include/iprt/uni.h \ - ${PATH_ROOT}/include/iprt/utf16.h=>include/iprt/utf16.h \ - ${PATH_ROOT}/include/iprt/uuid.h=>include/iprt/uuid.h \ -+ ${PATH_ROOT}/include/iprt/x86.h=>include/iprt/x86.h \ - ${PATH_ROOT}/include/iprt/nocrt/limits.h=>include/iprt/nocrt/limits.h \ - ${PATH_ROOT}/include/VBox/cdefs.h=>include/VBox/cdefs.h \ - ${PATH_ROOT}/include/VBox/err.h=>include/VBox/err.h \ --- emulators/virtualbox-ose/files/patch-src-VBox-Installer-Makefile.kmk (revision 520061) +++ emulators/virtualbox-ose/files/patch-src-VBox-Installer-Makefile.kmk (nonexistent) @@ -1,15 +0,0 @@ ---- src/VBox/Installer/Makefile.kmk.orig 2009-10-05 14:31:40.000000000 +0200 -+++ src/VBox/Installer/Makefile.kmk 2009-10-05 14:32:09.000000000 +0200 -@@ -38,10 +38,12 @@ - if "$(KBUILD_TARGET)" == "win" && "$(KBUILD_HOST)" == "win" - include $(PATH_SUB_CURRENT)/win/Makefile.kmk - endif -+if 0 - if "$(KBUILD_TARGET)" == "freebsd" && "$(KBUILD_HOST)" == "freebsd" - include $(PATH_SUB_CURRENT)/freebsd/Makefile.kmk - endif - endif -+endif - - include $(PATH_SUB_CURRENT)/common/Makefile.kmk - --- emulators/virtualbox-ose/files/patch-src-VBox-Installer-freebsd-VBox.sh (revision 520061) +++ emulators/virtualbox-ose/files/patch-src-VBox-Installer-freebsd-VBox.sh (nonexistent) @@ -1,67 +0,0 @@ ---- src/VBox/Installer/freebsd/VBox.sh.orig 2016-08-27 05:10:34 UTC -+++ src/VBox/Installer/freebsd/VBox.sh -@@ -0,0 +1,64 @@ -+#!/bin/sh -+# -+# Oracle VM VirtualBox startup script, FreeBSD hosts. -+# -+# Copyright (C) 2006-2012 Oracle Corporation -+# -+# This file is part of VirtualBox Open Source Edition (OSE), as -+# available from http://www.virtualbox.org. This file is free software; -+# you can redistribute it and/or modify it under the terms of the GNU -+# General Public License (GPL) as published by the Free Software -+# Foundation, in version 2 as it comes in the "COPYING" file of the -+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the -+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. -+# -+ -+PATH="/usr/bin:/bin:/usr/sbin:/sbin" -+CONFIG="/usr/local/etc/vbox/vbox.cfg" -+ -+test -r "${CONFIG}" && -+ . "${CONFIG}" -+test -z "${INSTALL_DIR}" && -+ if test -d /usr/local/lib/virtualbox && -+ test -f /usr/local/lib/virtualbox/VBoxRT.so; then -+ INSTALL_DIR=/usr/local/lib/virtualbox -+ else -+ echo "Could not find VirtualBox installation. Please reinstall." -+ exit 1 -+ fi -+ -+# workaround for the KDE dialog problem -+KDE_FORK_SLAVES=1; export KDE_FORK_SLAVES -+ -+APP=`basename $0` -+case "$APP" in -+ VirtualBox|virtualbox) -+ exec "$INSTALL_DIR/VirtualBox" "$@" -+ ;; -+ VBoxManage|vboxmanage) -+ exec "$INSTALL_DIR/VBoxManage" "$@" -+ ;; -+ VBoxSDL|vboxsdl) -+ exec "$INSTALL_DIR/VBoxSDL" "$@" -+ ;; -+ VBoxVRDP|VBoxHeadless|vboxheadless) -+ exec "$INSTALL_DIR/VBoxHeadless" "$@" -+ ;; -+ VBoxAutostart|vboxautostart) -+ exec "$INSTALL_DIR/VBoxAutostart" "$@" -+ ;; -+ VBoxBalloonCtrl|vboxballoonctrl) -+ exec "$INSTALL_DIR/VBoxBalloonCtrl" "$@" -+ ;; -+ VBoxBugReport|vboxbugreport) -+ exec "$INSTALL_DIR/VBoxBugReport" "$@" -+ ;; -+ vboxwebsrv) -+ exec "$INSTALL_DIR/vboxwebsrv" "$@" -+ ;; -+ *) -+ echo "Unknown application - $APP" -+ exit 1 -+ ;; -+esac -+exit 0 --- emulators/virtualbox-ose/files/patch-src-VBox-Installer-freebsd-virtualbox.desktop (revision 520061) +++ emulators/virtualbox-ose/files/patch-src-VBox-Installer-freebsd-virtualbox.desktop (nonexistent) @@ -1,10 +0,0 @@ ---- src/VBox/Installer/freebsd/virtualbox.desktop.orig 2010-10-07 10:42:04.000000000 +0200 -+++ src/VBox/Installer/freebsd/virtualbox.desktop 2010-10-07 10:43:20.000000000 +0200 -@@ -7,7 +7,6 @@ - Type=Application - Exec=VirtualBox - TryExec=VirtualBox --DocPath=file://$VBOX_DOC_PATH/UserManual.pdf - Icon=VBox - Categories=Emulator;System; - Comment=Run several virtual systems on a single host computer --- emulators/virtualbox-ose/files/patch-src-VBox-Main-src-server-VirtualBoxImpl.cpp (revision 520061) +++ emulators/virtualbox-ose/files/patch-src-VBox-Main-src-server-VirtualBoxImpl.cpp (nonexistent) @@ -1,11 +0,0 @@ ---- src/VBox/Main/src-server/VirtualBoxImpl.cpp.orig 2015-04-01 12:15:14.000000000 -0400 -+++ src/VBox/Main/src-server/VirtualBoxImpl.cpp 2015-04-07 12:25:59.226583000 -0400 -@@ -2172,7 +2172,7 @@ - if (aCiphertextSize < 32) - return VERR_INVALID_PARAMETER; - -- AssertCompile(sizeof(m->SettingsCipherKey) >= 32); -+ // AssertCompile(sizeof(m->SettingsCipherKey) >= 32); - - /* store the first 8 bytes of the cipherkey for verification */ - for (i = 0, j = 0; i < 8; i++, j++) --- emulators/virtualbox-ose/files/patch-src-VBox-Main-src-server-freebsd-HostHardwareFreeBSD.cpp (revision 520061) +++ emulators/virtualbox-ose/files/patch-src-VBox-Main-src-server-freebsd-HostHardwareFreeBSD.cpp (nonexistent) @@ -1,14 +0,0 @@ ---- src/VBox/Main/src-server/freebsd/HostHardwareFreeBSD.cpp.orig 2015-04-14 15:41:25.000000000 -0400 -+++ src/VBox/Main/src-server/freebsd/HostHardwareFreeBSD.cpp 2015-04-14 18:25:23.156536000 -0400 -@@ -251,8 +251,9 @@ - PeriphMatchPattern.pattern.periph_pattern.path_id = paMatches[i].result.device_result.path_id; - PeriphMatchPattern.pattern.periph_pattern.target_id = paMatches[i].result.device_result.target_id; - PeriphMatchPattern.pattern.periph_pattern.target_lun = paMatches[i].result.device_result.target_lun; -- PeriphMatchPattern.pattern.periph_pattern.flags = PERIPH_MATCH_PATH | PERIPH_MATCH_TARGET | -- PERIPH_MATCH_LUN; -+ PeriphMatchPattern.pattern.periph_pattern.flags = static_cast -+ (PERIPH_MATCH_PATH | PERIPH_MATCH_TARGET | -+ PERIPH_MATCH_LUN); - PeriphCCB.cdm.num_patterns = 1; - PeriphCCB.cdm.pattern_buf_len = sizeof(struct dev_match_result); - PeriphCCB.cdm.patterns = &PeriphMatchPattern; --- emulators/virtualbox-ose/files/patch-src-VBox-Main-webservice-Makefile.kmk (revision 520061) +++ emulators/virtualbox-ose/files/patch-src-VBox-Main-webservice-Makefile.kmk (nonexistent) @@ -1,39 +0,0 @@ ---- src/VBox/Main/webservice/Makefile.kmk.orig 2015-10-15 13:59:24 UTC -+++ src/VBox/Main/webservice/Makefile.kmk -@@ -159,7 +159,6 @@ VBOX_PATH_IDL := $(abspa - RECOMPILE_ON_MAKEFILE_CURRENT := $(MAKEFILE_CURRENT) - - PATH_TARGET_SOAPDEMOXML := $(VBOXWEB_OUT_DIR)/demo_soapxml --PATH_TARGET_SOAPDEMOHEADERS := $(VBOXWEB_OUT_DIR)/demo_headers - PATH_TARGET_SOAPDEMONSMAPS := $(VBOXWEB_OUT_DIR)/demo_namespacemaps - PATH_TARGET_WEBTEST := $(VBOXWEB_OUT_DIR)/webtest - -@@ -515,8 +514,6 @@ $$(VBOX_JWSSRC_JAR): $$(VBOX_JWS_JAR) | - $(VBOXWEB_OUT_DIR)/gsoap_copy_all_ts \ - $(wildcard $(PATH_TARGET_SOAPDEMOXML)/*) \ - $(PATH_TARGET_SOAPDEMOXML)/dummy_file \ -- $(wildcard $(PATH_TARGET_SOAPDEMOHEADERS)/*) \ -- $(PATH_TARGET_SOAPDEMOHEADERS)/dummy_file \ - $(wildcard $(PATH_TARGET_SOAPDEMONSMAPS)/*) \ - $(PATH_TARGET_SOAPDEMONSMAPS)/dummy_file - -@@ -695,17 +692,14 @@ $(VBOXWEB_OUT_DIR)/gsoap_generate_all_ts - # any more. Ignoring the exit code is the simple solution, accepting the error. - $(VBOXWEB_OUT_DIR)/gsoap_copy_all_ts: $(VBOXWEB_OUT_DIR)/gsoap_generate_all_ts | $$(dir $$@) - $(RM) -f $@ -- $(MKDIR) -p $(PATH_TARGET_SOAPDEMOXML) $(PATH_TARGET_SOAPDEMOHEADERS) $(PATH_TARGET_SOAPDEMONSMAPS) -+ $(MKDIR) -p $(PATH_TARGET_SOAPDEMOXML) $(PATH_TARGET_SOAPDEMONSMAPS) - ifdef VBOX_GSOAP_VERBOSE - $(MV_EXT) -f -- $(VBOXWEB_OUT_DIR)/*.req.xml $(VBOXWEB_OUT_DIR)/*.res.xml $(PATH_TARGET_SOAPDEMOXML)/ - endif -- -$(MV_EXT) -f -- $(VBOXWEB_OUT_DIR)/soapvbox*.h $(PATH_TARGET_SOAPDEMOHEADERS)/ - $(MV_EXT) -f -- $(VBOXWEB_OUT_DIR)/vboxBinding.nsmap $(PATH_TARGET_SOAPDEMONSMAPS)/ - $(APPEND) $@ done - --$(PATH_TARGET_SOAPDEMONSMAPS) \ --$(PATH_TARGET_SOAPDEMOHEADERS)/soapvboxBindingProxy.h \ --$(PATH_TARGET_SOAPDEMOHEADERS)/soapvboxBindingObject.h: $(VBOXWEB_OUT_DIR)/gsoap_copy_all_ts -+$(PATH_TARGET_SOAPDEMONSMAPS): $(VBOXWEB_OUT_DIR)/gsoap_copy_all_ts - - # soapcpp2 -2: generate SOAP 1.2 calls - # soapcpp2 -S: server-side code only --- emulators/virtualbox-ose/files/patch-src-VBox-Runtime-Makefile.kmk (revision 520061) +++ emulators/virtualbox-ose/files/patch-src-VBox-Runtime-Makefile.kmk (nonexistent) @@ -1,14 +0,0 @@ ---- src/VBox/Runtime/Makefile.kmk.orig 2014-07-15 13:25:15.000000000 -0400 -+++ src/VBox/Runtime/Makefile.kmk 2014-07-16 17:15:58.000000000 -0400 -@@ -146,6 +146,11 @@ - IPRT_BLDCFG_TYPE=\"$(KBUILD_TYPE)\" - - # -+# Set the defines that utf8-posix.cpp needs. It's used by several targets. -+# -+r3/posix/utf8-posix.cpp_DEFS.freebsd = $(VBOX_ICONV_DEFS) -+ -+# - # Unicode Specification reader used to regenerate unidata-*.cpp. - # - uniread_TEMPLATE = VBoxBldProg --- emulators/virtualbox-ose/files/patch-src-VBox-Runtime-r0drv-freebsd-sleepqueue-r0drv-freebsd.h (revision 520061) +++ emulators/virtualbox-ose/files/patch-src-VBox-Runtime-r0drv-freebsd-sleepqueue-r0drv-freebsd.h (nonexistent) @@ -1,20 +0,0 @@ -Without this patch any waits for periods shorter than a single tick return -immediately leading to a lot of unnecessary spinning. For example, I observe that -my guest's idle loop does a lot of sleeps with periods slightly shorter than 1 ms -(1/hz), e.g. 900us. All that waiting turns into pure spinning and VirtualBox eats -100% of a core. -The patch improves the situation significantly. Also, it (approximately) follows -what tvtohz does. - -Submitted by: Andriy Gapon ---- src/VBox/Runtime/r0drv/freebsd/sleepqueue-r0drv-freebsd.h.orig 2012-12-19 19:27:29.000000000 +0100 -+++ src/VBox/Runtime/r0drv/freebsd/sleepqueue-r0drv-freebsd.h 2012-12-20 12:07:48.941861966 +0100 -@@ -82,6 +82,8 @@ - uint64_t cTicks = ASMMultU64ByU32DivByU32(uTimeout, hz, UINT32_C(1000000000)); - if (cTicks >= INT_MAX) - return RTSEMWAIT_FLAGS_INDEFINITE; -+ else if (cTicks == 0 && uTimeout > 0) -+ pWait->iTimeout = 1; - else - pWait->iTimeout = (int)cTicks; - #endif --- emulators/virtualbox-ose/files/patch-src-recompiler-Sun-testmath.c (revision 520061) +++ emulators/virtualbox-ose/files/patch-src-recompiler-Sun-testmath.c (nonexistent) @@ -1,22 +0,0 @@ ---- src/recompiler/Sun/testmath.c.orig 2011-01-14 21:15:07.000000000 +0100 -+++ src/recompiler/Sun/testmath.c 2011-08-05 13:54:49.000000000 +0200 -@@ -261,8 +261,6 @@ - #endif - set_cw(0x27f); - -- CHECK(logl(2.7182818284590452353602874713526625L), 1.0); -- - CHECK(remainderl(1.0L, 1.0L), 0.0); - CHECK(remainderl(1.0L, 1.5L), -0.5); - CHECK(remainderl(42.0L, 34.25L), 7.75); -@@ -315,10 +313,6 @@ - CHECK(tanl(0.0L), 0.0); - CHECK(tanl(0.7853981633974483096156608458198757L), 1.0); - -- CHECK(powl(0.0, 0.0), 1.0); -- CHECK(powl(2.0, 2.0), 4.0); -- CHECK(powl(3.0, 3.0), 27.0); -- - return cErrors; - } - --- emulators/virtualbox-ose/files/patch-src_VBox_Additions_common_VBoxGuest_VBoxGuest-freebsd.c (nonexistent) +++ emulators/virtualbox-ose/files/patch-src_VBox_Additions_common_VBoxGuest_VBoxGuest-freebsd.c (working copy) @@ -0,0 +1,277 @@ +--- src/VBox/Additions/common/VBoxGuest/VBoxGuest-freebsd.c.orig 2019-11-21 16:54:06 UTC ++++ src/VBox/Additions/common/VBoxGuest/VBoxGuest-freebsd.c +@@ -45,6 +45,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -61,6 +62,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -102,8 +104,6 @@ struct VBoxGuestDeviceState + struct resource *pIrqRes; + /** Pointer to the IRQ handler. */ + void *pfnIrqHandler; +- /** VMMDev version */ +- uint32_t u32Version; + }; + + +@@ -113,8 +113,7 @@ struct VBoxGuestDeviceState + /* + * Character device file handlers. + */ +-static d_fdopen_t vgdrvFreeBSDOpen; +-static d_close_t vgdrvFreeBSDClose; ++static d_open_t vgdrvFreeBSDOpen; + static d_ioctl_t vgdrvFreeBSDIOCtl; + static int vgdrvFreeBSDIOCtlSlow(PVBOXGUESTSESSION pSession, u_long ulCmd, caddr_t pvData, struct thread *pTd); + static d_write_t vgdrvFreeBSDWrite; +@@ -145,8 +144,7 @@ static struct cdevsw g_vgdrvFreeBSDChrDevSW = + { + .d_version = D_VERSION, + .d_flags = D_TRACKCLOSE | D_NEEDMINOR, +- .d_fdopen = vgdrvFreeBSDOpen, +- .d_close = vgdrvFreeBSDClose, ++ .d_open = vgdrvFreeBSDOpen, + .d_ioctl = vgdrvFreeBSDIOCtl, + .d_read = vgdrvFreeBSDRead, + .d_write = vgdrvFreeBSDWrite, +@@ -154,81 +152,28 @@ static struct cdevsw g_vgdrvFreeBSDChrDevSW = + .d_name = "vboxguest" + }; + ++/** Device structure. */ ++static struct cdev *g_pDev; ++ + /** Device extention & session data association structure. */ + static VBOXGUESTDEVEXT g_DevExt; + +-/** List of cloned device. Managed by the kernel. */ +-static struct clonedevs *g_pvgdrvFreeBSDClones; +-/** The dev_clone event handler tag. */ +-static eventhandler_tag g_vgdrvFreeBSDEHTag; + /** Reference counter */ + static volatile uint32_t cUsers; + /** selinfo structure used for polling. */ + static struct selinfo g_SelInfo; + +-/** +- * DEVFS event handler. +- */ +-static void vgdrvFreeBSDClone(void *pvArg, struct ucred *pCred, char *pszName, int cchName, struct cdev **ppDev) ++static void vgdrvFreeBSDDtr(void *pSession) + { +- int iUnit; +- int rc; +- +- Log(("vgdrvFreeBSDClone: pszName=%s ppDev=%p\n", pszName, ppDev)); +- +- /* +- * One device node per user, si_drv1 points to the session. +- * /dev/vboxguest where N = {0...255}. +- */ +- if (!ppDev) +- return; +- if (strcmp(pszName, "vboxguest") == 0) +- iUnit = -1; +- else if (dev_stdclone(pszName, NULL, "vboxguest", &iUnit) != 1) +- return; +- if (iUnit >= 256) +- { +- Log(("vgdrvFreeBSDClone: iUnit=%d >= 256 - rejected\n", iUnit)); +- return; +- } +- +- Log(("vgdrvFreeBSDClone: pszName=%s iUnit=%d\n", pszName, iUnit)); +- +- rc = clone_create(&g_pvgdrvFreeBSDClones, &g_vgdrvFreeBSDChrDevSW, &iUnit, ppDev, 0); +- Log(("vgdrvFreeBSDClone: clone_create -> %d; iUnit=%d\n", rc, iUnit)); +- if (rc) +- { +- *ppDev = make_dev(&g_vgdrvFreeBSDChrDevSW, +- iUnit, +- UID_ROOT, +- GID_WHEEL, +- 0664, +- "vboxguest%d", iUnit); +- if (*ppDev) +- { +- dev_ref(*ppDev); +- (*ppDev)->si_flags |= SI_CHEAPCLONE; +- Log(("vgdrvFreeBSDClone: Created *ppDev=%p iUnit=%d si_drv1=%p si_drv2=%p\n", +- *ppDev, iUnit, (*ppDev)->si_drv1, (*ppDev)->si_drv2)); +- (*ppDev)->si_drv1 = (*ppDev)->si_drv2 = NULL; +- } +- else +- Log(("vgdrvFreeBSDClone: make_dev iUnit=%d failed\n", iUnit)); +- } +- else +- Log(("vgdrvFreeBSDClone: Existing *ppDev=%p iUnit=%d si_drv1=%p si_drv2=%p\n", +- *ppDev, iUnit, (*ppDev)->si_drv1, (*ppDev)->si_drv2)); ++ VGDrvCommonCloseSession(&g_DevExt, pSession); ++ ASMAtomicDecU32(&cUsers); + } + + /** + * File open handler + * + */ +-#if __FreeBSD_version >= 700000 +-static int vgdrvFreeBSDOpen(struct cdev *pDev, int fOpen, struct thread *pTd, struct file *pFd) +-#else +-static int vgdrvFreeBSDOpen(struct cdev *pDev, int fOpen, struct thread *pTd) +-#endif ++static int vgdrvFreeBSDOpen(struct cdev *pDev, int fOpen, int DevType, struct thread *pTd) + { + int rc; + PVBOXGUESTSESSION pSession; +@@ -240,12 +185,6 @@ static int vgdrvFreeBSDOpen(struct cdev *pDev, int fOp + LogFlow(("vgdrvFreeBSDOpen:\n")); + + /* +- * Try grab it (we don't grab the giant, remember). +- */ +- if (!ASMAtomicCmpXchgPtr(&pDev->si_drv1, (void *)0x42, NULL)) +- return EBUSY; +- +- /* + * Create a new session. + */ + fRequestor = VMMDEV_REQUESTOR_USERMODE | VMMDEV_REQUESTOR_TRUST_NOT_GIVEN; +@@ -262,14 +201,13 @@ static int vgdrvFreeBSDOpen(struct cdev *pDev, int fOp + rc = VGDrvCommonCreateUserSession(&g_DevExt, fRequestor, &pSession); + if (RT_SUCCESS(rc)) + { +- if (ASMAtomicCmpXchgPtr(&pDev->si_drv1, pSession, (void *)0x42)) +- { +- Log(("vgdrvFreeBSDOpen: success - g_DevExt=%p pSession=%p rc=%d pid=%d\n", &g_DevExt, pSession, rc, (int)RTProcSelf())); ++ Log(("vgdrvFreeBSDOpen: success - g_DevExt=%p pSession=%p rc=%d pid=%d\n", &g_DevExt, pSession, rc, (int)RTProcSelf())); ++ rc = devfs_set_cdevpriv(pSession, vgdrvFreeBSDDtr); ++ if (rc) ++ VGDrvCommonCloseSession(&g_DevExt, pSession); ++ else + ASMAtomicIncU32(&cUsers); +- return 0; +- } +- +- VGDrvCommonCloseSession(&g_DevExt, pSession); ++ return rc; + } + + LogRel(("vgdrvFreeBSDOpen: failed. rc=%d\n", rc)); +@@ -277,33 +215,6 @@ static int vgdrvFreeBSDOpen(struct cdev *pDev, int fOp + } + + /** +- * File close handler +- * +- */ +-static int vgdrvFreeBSDClose(struct cdev *pDev, int fFile, int DevType, struct thread *pTd) +-{ +- PVBOXGUESTSESSION pSession = (PVBOXGUESTSESSION)pDev->si_drv1; +- Log(("vgdrvFreeBSDClose: fFile=%#x pSession=%p\n", fFile, pSession)); +- +- /* +- * Close the session if it's still hanging on to the device... +- */ +- if (VALID_PTR(pSession)) +- { +- VGDrvCommonCloseSession(&g_DevExt, pSession); +- if (!ASMAtomicCmpXchgPtr(&pDev->si_drv1, NULL, pSession)) +- Log(("vgdrvFreeBSDClose: si_drv1=%p expected %p!\n", pDev->si_drv1, pSession)); +- ASMAtomicDecU32(&cUsers); +- /* Don't use destroy_dev here because it may sleep resulting in a hanging user process. */ +- destroy_dev_sched(pDev); +- } +- else +- Log(("vgdrvFreeBSDClose: si_drv1=%p!\n", pSession)); +- return 0; +-} +- +- +-/** + * I/O control request. + * + * @returns depends... +@@ -316,8 +227,12 @@ static int vgdrvFreeBSDClose(struct cdev *pDev, int fF + static int vgdrvFreeBSDIOCtl(struct cdev *pDev, u_long ulCmd, caddr_t pvData, int fFile, struct thread *pTd) + { + PVBOXGUESTSESSION pSession; +- devfs_get_cdevpriv((void **)&pSession); ++ int rc; + ++ rc = devfs_get_cdevpriv((void **)&pSession); ++ if (rc) ++ return rc; ++ + /* + * Deal with the fast ioctl path first. + */ +@@ -512,12 +427,14 @@ int VBOXCALL VBoxGuestIDC(void *pvSession, uintptr_t u + + static int vgdrvFreeBSDPoll(struct cdev *pDev, int fEvents, struct thread *td) + { +- int fEventsProcessed; ++ PVBOXGUESTSESSION pSession; ++ int fEventsProcessed, rc; + + LogFlow(("vgdrvFreeBSDPoll: fEvents=%d\n", fEvents)); + +- PVBOXGUESTSESSION pSession = (PVBOXGUESTSESSION)pDev->si_drv1; +- if (RT_UNLIKELY(!VALID_PTR(pSession))) { ++ rc = devfs_get_cdevpriv((void **)&pSession); ++ if (rc) ++ { + Log(("vgdrvFreeBSDPoll: no state data for %s\n", devtoname(pDev))); + return (fEvents & (POLLHUP|POLLIN|POLLRDNORM|POLLOUT|POLLWRNORM)); + } +@@ -558,11 +475,8 @@ static int vgdrvFreeBSDDetach(device_t pDevice) + /* + * Reverse what we did in vgdrvFreeBSDAttach. + */ +- if (g_vgdrvFreeBSDEHTag != NULL) +- EVENTHANDLER_DEREGISTER(dev_clone, g_vgdrvFreeBSDEHTag); ++ destroy_dev(g_pDev); + +- clone_cleanup(&g_pvgdrvFreeBSDClones); +- + vgdrvFreeBSDRemoveIRQ(pDevice, pState); + + if (pState->pVMMDevMemRes) +@@ -727,18 +641,21 @@ static int vgdrvFreeBSDAttach(device_t pDevice) + VGDrvCommonProcessOptionsFromHost(&g_DevExt); + + /* +- * Configure device cloning. ++ * Configure device. + */ +- clone_setup(&g_pvgdrvFreeBSDClones); +- g_vgdrvFreeBSDEHTag = EVENTHANDLER_REGISTER(dev_clone, vgdrvFreeBSDClone, 0, 1000); +- if (g_vgdrvFreeBSDEHTag) ++ g_pDev = make_dev(&g_vgdrvFreeBSDChrDevSW, ++ 0, ++ UID_ROOT, ++ GID_WHEEL, ++ 0664, ++ "vboxguest"); ++ if (g_pDev) + { + printf(DEVICE_NAME ": loaded successfully\n"); + return 0; + } + +- printf(DEVICE_NAME ": EVENTHANDLER_REGISTER(dev_clone,,,) failed\n"); +- clone_cleanup(&g_pvgdrvFreeBSDClones); ++ printf(DEVICE_NAME ": make_dev failed\n"); + vgdrvFreeBSDRemoveIRQ(pDevice, pState); + } + else --- emulators/virtualbox-ose/files/patch-src_VBox_Additions_common_VBoxGuest_freebsd_Makefile (nonexistent) +++ emulators/virtualbox-ose/files/patch-src_VBox_Additions_common_VBoxGuest_freebsd_Makefile (working copy) @@ -0,0 +1,27 @@ +--- src/VBox/Additions/common/VBoxGuest/freebsd/Makefile.orig 2019-11-21 16:54:06 UTC ++++ src/VBox/Additions/common/VBoxGuest/freebsd/Makefile +@@ -25,7 +25,7 @@ + # + KMOD = vboxguest + +-CFLAGS += -DRT_OS_FREEBSD -DIN_RING0 -DIN_RT_R0 -DIN_SUP_R0 -DVBOX -DRT_WITH_VBOX -Iinclude -I. -Ir0drv -w -DVBGL_VBOXGUEST -DVBOX_WITH_HGCM -DVBOX_WITH_64_BITS_GUESTS ++CFLAGS += -DRT_OS_FREEBSD -DIN_RING0 -DIN_RT_R0 -DIN_GUEST -DIN_GUEST_R0 -DIN_SUP_R0 -DVBOX -DRT_WITH_VBOX -Iinclude -I. -Ir0drv -w -DVBGL_VBOXGUEST -DVBOX_WITH_HGCM -DVBOX_WITH_64_BITS_GUESTS + + .if (${MACHINE_ARCH} == "i386") + CFLAGS += -DRT_ARCH_X86 +@@ -80,6 +80,7 @@ SRCS += \ + handletable.c \ + handletablectx.c \ + once.c \ ++ term.c \ + thread.c + + .PATH: ${.CURDIR}/common/string +@@ -147,6 +148,7 @@ SRCS += \ + + .PATH: ${.CURDIR}/r0drv + SRCS += \ ++ alloc-ef-r0drv.c \ + alloc-r0drv.c \ + initterm-r0drv.c \ + memobj-r0drv.c \ --- emulators/virtualbox-ose/files/patch-src_VBox_Additions_common_VBoxGuest_freebsd_files__vboxguest (nonexistent) +++ emulators/virtualbox-ose/files/patch-src_VBox_Additions_common_VBoxGuest_freebsd_files__vboxguest (working copy) @@ -0,0 +1,34 @@ +--- src/VBox/Additions/common/VBoxGuest/freebsd/files_vboxguest.orig 2019-11-21 16:54:06 UTC ++++ src/VBox/Additions/common/VBoxGuest/freebsd/files_vboxguest +@@ -63,6 +63,7 @@ FILES_VBOXGUEST_NOBIN=" \ + ${PATH_ROOT}/include/iprt/time.h=>include/iprt/time.h \ + ${PATH_ROOT}/include/iprt/timer.h=>include/iprt/timer.h \ + ${PATH_ROOT}/include/iprt/types.h=>include/iprt/types.h \ ++ ${PATH_ROOT}/include/iprt/uni.h=>include/iprt/uni.h \ + ${PATH_ROOT}/include/iprt/utf16.h=>include/iprt/utf16.h \ + ${PATH_ROOT}/include/iprt/uuid.h=>include/iprt/uuid.h \ + ${PATH_ROOT}/include/iprt/crc.h=>include/iprt/crc.h \ +@@ -111,6 +112,7 @@ FILES_VBOXGUEST_NOBIN=" \ + ${PATH_ROOT}/src/VBox/Runtime/common/misc/handletable.h=>common/misc/handletable.h \ + ${PATH_ROOT}/src/VBox/Runtime/common/misc/handletablectx.cpp=>common/misc/handletablectx.c \ + ${PATH_ROOT}/src/VBox/Runtime/common/misc/once.cpp=>common/misc/once.c \ ++ ${PATH_ROOT}/src/VBox/Runtime/common/misc/term.cpp=>common/misc/term.c \ + ${PATH_ROOT}/src/VBox/Runtime/common/misc/thread.cpp=>common/misc/thread.c \ + ${PATH_ROOT}/src/VBox/Runtime/common/misc/RTAssertMsg1Weak.cpp=>common/misc/RTAssertMsg1Weak.c \ + ${PATH_ROOT}/src/VBox/Runtime/common/misc/RTAssertMsg2.cpp=>common/misc/RTAssertMsg2.c \ +@@ -181,6 +183,7 @@ FILES_VBOXGUEST_NOBIN=" \ + ${PATH_ROOT}/src/VBox/Runtime/generic/errvars-generic.cpp=>generic/errvars-generic.c \ + ${PATH_ROOT}/src/VBox/Runtime/generic/timer-generic.cpp=>generic/timer-generic.c \ + ${PATH_ROOT}/src/VBox/Runtime/generic/mppresent-generic.cpp=>generic/mppresent-generic.c \ ++ ${PATH_ROOT}/src/VBox/Runtime/r0drv/alloc-ef-r0drv.cpp=>r0drv/alloc-ef-r0drv.c \ + ${PATH_ROOT}/src/VBox/Runtime/r0drv/alloc-r0drv.cpp=>r0drv/alloc-r0drv.c \ + ${PATH_ROOT}/src/VBox/Runtime/r0drv/alloc-r0drv.h=>r0drv/alloc-r0drv.h \ + ${PATH_ROOT}/src/VBox/Runtime/r0drv/initterm-r0drv.cpp=>r0drv/initterm-r0drv.c \ +@@ -207,6 +210,7 @@ FILES_VBOXGUEST_NOBIN=" \ + ${PATH_ROOT}/src/VBox/Runtime/r0drv/freebsd/sleepqueue-r0drv-freebsd.h=>r0drv/freebsd/sleepqueue-r0drv-freebsd.h \ + ${PATH_ROOT}/src/VBox/Runtime/r0drv/generic/semspinmutex-r0drv-generic.c=>r0drv/generic/semspinmutex-r0drv-generic.c \ + ${PATH_ROOT}/src/VBox/Runtime/r0drv/generic/mpnotification-r0drv-generic.cpp=>r0drv/generic/mpnotification-r0drv-generic.c \ ++ ${PATH_ROOT}/src/VBox/Runtime/r0drv/generic/threadctxhooks-r0drv-generic.cpp=>r0drv/generic/threadctxhooks-r0drv-generic.c \ + ${PATH_ROOT}/src/VBox/Runtime/r0drv/generic/RTMpIsCpuWorkPending-r0drv-generic.cpp=>r0drv/generic/RTMpIsCpuWorkPending-r0drv-generic.c \ + ${PATH_ROOT}/src/VBox/Runtime/r0drv/memobj-r0drv.cpp=>r0drv/memobj-r0drv.c \ + ${PATH_ROOT}/src/VBox/Runtime/VBox/log-vbox.cpp=>VBox/log-vbox.c \ --- emulators/virtualbox-ose/files/patch-src_VBox_Additions_common_VBoxService_Makefile.kmk (nonexistent) +++ emulators/virtualbox-ose/files/patch-src_VBox_Additions_common_VBoxService_Makefile.kmk (working copy) @@ -0,0 +1,13 @@ +--- src/VBox/Additions/common/VBoxService/Makefile.kmk.orig 2019-11-21 16:54:08 UTC ++++ src/VBox/Additions/common/VBoxService/Makefile.kmk +@@ -172,6 +172,10 @@ VBoxService_LIBS += \ + $(VBOX_LIB_IPRT_GUEST_R3) \ + $(VBOX_LIB_VBGL_R3) \ + $(VBOX_LIB_IPRT_GUEST_R3) # (The joy of unix linkers.) ++if1of ($(KBUILD_TARGET), freebsd) ++ VBoxService_LIBS += \ ++ crypt ++endif + ifdef VBOX_WITH_DBUS + if1of ($(KBUILD_TARGET), linux solaris) # FreeBSD? + VBoxService_LIBS += \ --- emulators/virtualbox-ose/files/patch-src_VBox_Additions_common_VBoxService_VBoxServiceVMInfo.cpp (revision 520061) +++ emulators/virtualbox-ose/files/patch-src_VBox_Additions_common_VBoxService_VBoxServiceVMInfo.cpp (working copy) @@ -1,6 +1,6 @@ ---- src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo.cpp.orig 2017-03-08 17:15:20 UTC +--- src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo.cpp.orig 2019-11-21 16:54:09 UTC +++ src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo.cpp -@@ -71,8 +71,8 @@ +@@ -67,8 +67,8 @@ # include # include /* getpwuid */ # include @@ -11,7 +11,7 @@ # endif # ifdef RT_OS_OS2 # include -@@ -531,7 +531,7 @@ static void vgsvcVMInfoWriteFixedPropert +@@ -528,7 +528,7 @@ static void vgsvcVMInfoWriteFixedProperties(void) } @@ -20,9 +20,9 @@ /* * Simple wrapper to work around compiler-specific va_list madness. */ -@@ -562,12 +562,6 @@ static int vgsvcVMInfoWriteUsers(void) - rc = VERR_NOT_IMPLEMENTED; - # endif +@@ -555,12 +555,6 @@ static int vgsvcVMInfoWriteUsers(void) + #ifdef RT_OS_WINDOWS + rc = VGSvcVMInfoWinWriteUsers(&g_VMInfoPropCache, &pszUserList, &cUsersInList); -#elif defined(RT_OS_FREEBSD) - /** @todo FreeBSD: Port logged on user info retrieval. @@ -33,7 +33,7 @@ #elif defined(RT_OS_HAIKU) /** @todo Haiku: Port logged on user info retrieval. */ rc = VERR_NOT_IMPLEMENTED; -@@ -593,7 +587,7 @@ static int vgsvcVMInfoWriteUsers(void) +@@ -586,7 +580,7 @@ static int vgsvcVMInfoWriteUsers(void) while ( (ut_user = getutxent()) && RT_SUCCESS(rc)) { @@ -42,7 +42,7 @@ VGSvcVerbose(4, "Found entry '%s' (type: %d, PID: %RU32)\n", ut_user->ut_user, ut_user->ut_type, ut_user->ut_pid); # else VGSvcVerbose(4, "Found entry '%s' (type: %d, PID: %RU32, session: %RU32)\n", -@@ -628,7 +622,7 @@ static int vgsvcVMInfoWriteUsers(void) +@@ -621,7 +615,7 @@ static int vgsvcVMInfoWriteUsers(void) } # ifdef VBOX_WITH_DBUS @@ -51,7 +51,7 @@ DBusError dbErr; DBusConnection *pConnection = NULL; int rc2 = RTDBusLoadLib(); -@@ -837,7 +831,7 @@ static int vgsvcVMInfoWriteUsers(void) +@@ -830,7 +824,7 @@ static int vgsvcVMInfoWriteUsers(void) if ( fHaveLibDbus && dbus_error_is_set(&dbErr)) dbus_error_free(&dbErr); @@ -60,7 +60,7 @@ # endif /* VBOX_WITH_DBUS */ /** @todo Fedora/others: Handle systemd-loginctl. */ -@@ -874,7 +868,7 @@ static int vgsvcVMInfoWriteUsers(void) +@@ -867,7 +861,7 @@ static int vgsvcVMInfoWriteUsers(void) RTMemFree(papszUsers); endutxent(); /* Close utmpx file. */ --- emulators/virtualbox-ose/files/patch-src_VBox_Additions_common_crOpenGL_stub.h (revision 520061) +++ emulators/virtualbox-ose/files/patch-src_VBox_Additions_common_crOpenGL_stub.h (nonexistent) @@ -1,11 +0,0 @@ ---- src/VBox/Additions/common/crOpenGL/stub.h.orig 2016-07-18 11:50:44 UTC -+++ src/VBox/Additions/common/crOpenGL/stub.h -@@ -47,7 +47,7 @@ - #include - #endif - --#if defined(WINDOWS) || defined(Linux) || defined(SunOS) -+#if defined(WINDOWS) || defined(Linux) || defined(FreeBSD) || defined(SunOS) - # define CR_NEWWINTRACK - #endif - --- emulators/virtualbox-ose/files/patch-src_VBox_Additions_common_pam_pam__vbox.cpp (revision 520061) +++ emulators/virtualbox-ose/files/patch-src_VBox_Additions_common_pam_pam__vbox.cpp (working copy) @@ -1,6 +1,6 @@ ---- src/VBox/Additions/common/pam/pam_vbox.cpp.orig 2016-07-18 11:50:44 UTC +--- src/VBox/Additions/common/pam/pam_vbox.cpp.orig 2019-11-21 16:54:09 UTC +++ src/VBox/Additions/common/pam/pam_vbox.cpp -@@ -105,7 +105,7 @@ static void pam_vbox_writesyslog(char *p +@@ -104,7 +104,7 @@ static void pam_vbox_writesyslog(char *pszBuf) openlog("pam_vbox", LOG_PID, LOG_AUTHPRIV); syslog(LOG_ERR, "%s", pszBuf); closelog(); @@ -9,7 +9,7 @@ syslog(LOG_ERR, "pam_vbox: %s\n", pszBuf); #endif } -@@ -180,7 +180,7 @@ static int vbox_set_msg(pam_handle_t *hP +@@ -183,7 +183,7 @@ static int vbox_set_msg(pam_handle_t *hPAM, int iStyle pam_message msg; msg.msg_style = iStyle; --- emulators/virtualbox-ose/files/patch-src_VBox_Additions_freebsd_Makefile (revision 520061) +++ emulators/virtualbox-ose/files/patch-src_VBox_Additions_freebsd_Makefile (working copy) @@ -1,6 +1,6 @@ ---- src/VBox/Additions/freebsd/Makefile.orig 2017-04-28 16:59:22.000000000 +0200 -+++ src/VBox/Additions/freebsd/Makefile 2017-07-13 00:04:11.766870597 +0200 -@@ -31,6 +31,14 @@ +--- src/VBox/Additions/freebsd/Makefile.orig 2019-11-21 16:54:10 UTC ++++ src/VBox/Additions/freebsd/Makefile +@@ -30,6 +30,14 @@ all: cp vboxvfs/vboxvfs.ko .; \ fi; \ fi @@ -15,7 +15,7 @@ install: -@@ -38,13 +46,19 @@ +@@ -37,13 +45,19 @@ install: @if [ -d vboxvfs ]; then \ $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxvfs install; \ fi --- emulators/virtualbox-ose/files/patch-src_VBox_Additions_freebsd_Makefile.kmk (revision 520061) +++ emulators/virtualbox-ose/files/patch-src_VBox_Additions_freebsd_Makefile.kmk (working copy) @@ -1,4 +1,4 @@ ---- src/VBox/Additions/freebsd/Makefile.kmk.orig 2019-07-12 08:42:35 UTC +--- src/VBox/Additions/freebsd/Makefile.kmk.orig 2019-11-21 16:54:10 UTC +++ src/VBox/Additions/freebsd/Makefile.kmk @@ -23,8 +23,9 @@ $(error "The FreeBSD guest additions installer can onl endif @@ -12,13 +12,13 @@ # # Globals -@@ -67,11 +68,13 @@ VBOX_FBSD_ADD_STRIP_BIN = \ +@@ -66,11 +67,13 @@ VBOX_FBSD_ADD_STRIP_BIN = \ + vboxvideo_drv_14.so \ vboxvideo_drv_15.so \ vboxvideo_drv_16.so \ - vboxvideo_drv_17.so \ -- VBoxOGL.so +- vboxvideo_drv_17.so ++ vboxvideo_drv_17.so \ + $(if $(VBOX_WITH_PAM),pam_vbox.so,) \ -+ VBoxOGL.so \ + mount_vboxvfs VBOX_FBSD_ADD_MODULES = \ --- emulators/virtualbox-ose/files/patch-src_VBox_Additions_freebsd_mount__vboxvfs_Makefile.kmk (revision 520061) +++ emulators/virtualbox-ose/files/patch-src_VBox_Additions_freebsd_mount__vboxvfs_Makefile.kmk (working copy) @@ -1,4 +1,4 @@ ---- src/VBox/Additions/freebsd/mount_vboxvfs/Makefile.kmk.orig 2018-11-29 19:03:21 UTC +--- src/VBox/Additions/freebsd/mount_vboxvfs/Makefile.kmk.orig 2019-12-04 01:14:22 UTC +++ src/VBox/Additions/freebsd/mount_vboxvfs/Makefile.kmk @@ -0,0 +1,23 @@ +# $Id: Makefile.kmk $ --- emulators/virtualbox-ose/files/patch-src_VBox_Additions_freebsd_mount__vboxvfs_mount__vboxvfs.8 (revision 520061) +++ emulators/virtualbox-ose/files/patch-src_VBox_Additions_freebsd_mount__vboxvfs_mount__vboxvfs.8 (working copy) @@ -1,5 +1,5 @@ ---- src/VBox/Additions/freebsd/mount_vboxvfs/mount_vboxvfs.8.orig 1970-01-01 01:00:00.000000000 +0100 -+++ src/VBox/Additions/freebsd/mount_vboxvfs/mount_vboxvfs.8 2017-07-12 19:24:26.106029000 +0200 +--- src/VBox/Additions/freebsd/mount_vboxvfs/mount_vboxvfs.8.orig 2019-12-03 22:06:34 UTC ++++ src/VBox/Additions/freebsd/mount_vboxvfs/mount_vboxvfs.8 @@ -0,0 +1,53 @@ +.\" +.\" Copyright (c) 1992, 1993, 1994 --- emulators/virtualbox-ose/files/patch-src_VBox_Additions_freebsd_mount__vboxvfs_mount__vboxvfs.c (revision 520061) +++ emulators/virtualbox-ose/files/patch-src_VBox_Additions_freebsd_mount__vboxvfs_mount__vboxvfs.c (working copy) @@ -1,5 +1,5 @@ ---- src/VBox/Additions/freebsd/mount_vboxvfs/mount_vboxvfs.c.orig 1970-01-01 01:00:00.000000000 +0100 -+++ src/VBox/Additions/freebsd/mount_vboxvfs/mount_vboxvfs.c 2017-07-12 19:24:26.106029000 +0200 +--- src/VBox/Additions/freebsd/mount_vboxvfs/mount_vboxvfs.c.orig 2019-12-03 22:06:50 UTC ++++ src/VBox/Additions/freebsd/mount_vboxvfs/mount_vboxvfs.c @@ -0,0 +1,168 @@ +/* +* Copyright (c) 1992, 1993, 1994 --- emulators/virtualbox-ose/files/patch-src_VBox_Additions_freebsd_vboxvfs_Makefile.kmk (revision 520061) +++ emulators/virtualbox-ose/files/patch-src_VBox_Additions_freebsd_vboxvfs_Makefile.kmk (working copy) @@ -1,6 +1,6 @@ ---- src/VBox/Additions/freebsd/vboxvfs/Makefile.kmk.orig 2017-04-28 16:59:22.000000000 +0200 -+++ src/VBox/Additions/freebsd/vboxvfs/Makefile.kmk 2017-07-13 00:52:49.020669620 +0200 -@@ -33,32 +33,36 @@ +--- src/VBox/Additions/freebsd/vboxvfs/Makefile.kmk.orig 2019-11-21 16:54:10 UTC ++++ src/VBox/Additions/freebsd/vboxvfs/Makefile.kmk +@@ -33,32 +33,36 @@ vboxvfs_INCS = \ $(vboxvfs_0_OUTDIR) vboxvfs_SOURCES = \ vboxvfs_vfsops.c \ --- emulators/virtualbox-ose/files/patch-src_VBox_Additions_freebsd_vboxvfs_vboxvfs.h (revision 520061) +++ emulators/virtualbox-ose/files/patch-src_VBox_Additions_freebsd_vboxvfs_vboxvfs.h (working copy) @@ -1,4 +1,4 @@ ---- src/VBox/Additions/freebsd/vboxvfs/vboxvfs.h.orig 2018-06-29 13:08:17 UTC +--- src/VBox/Additions/freebsd/vboxvfs/vboxvfs.h.orig 2019-11-21 16:54:10 UTC +++ src/VBox/Additions/freebsd/vboxvfs/vboxvfs.h @@ -1,8 +1,3 @@ -/* $Id: vboxvfs.h $ */ @@ -7,9 +7,9 @@ - */ - /* - * Copyright (C) 2010-2017 Oracle Corporation + * Copyright (C) 2010-2019 Oracle Corporation * -@@ -21,72 +16,413 @@ +@@ -24,72 +19,371 @@ #define VBOXVFS_VFSNAME "vboxvfs" #define VBOXVFS_VERSION 1 @@ -78,7 +78,6 @@ +#include "../../../../../include/iprt/err.h" +#include "../../../../../include/iprt/fs.h" +#include "../../../../../include/iprt/log.h" -+#include "../../../../../include/iprt/mangling.h" +#include "../../../../../include/iprt/mem.h" +#include "../../../../../include/iprt/param.h" +#include "../../../../../include/iprt/path.h" @@ -89,27 +88,6 @@ +#include "../../../../../include/iprt/time.h" +#include "../../../../../include/iprt/types.h" +#include "../../../../../include/iprt/uni.h" -+#include "../../../../../include/iprt/nocrt/limits.h" -+#include "../../../../../include/iprt/alloc.h" -+#include "../../../../../include/iprt/asm.h" -+#include "../../../../../include/iprt/asm-amd64-x86.h" -+#include "../../../../../include/iprt/asm-math.h" -+#include "../../../../../include/iprt/assert.h" -+#include "../../../../../include/iprt/cdefs.h" -+#include "../../../../../include/iprt/err.h" -+#include "../../../../../include/iprt/fs.h" -+#include "../../../../../include/iprt/log.h" -+#include "../../../../../include/iprt/mangling.h" -+#include "../../../../../include/iprt/mem.h" -+#include "../../../../../include/iprt/param.h" -+#include "../../../../../include/iprt/path.h" -+#include "../../../../../include/iprt/semaphore.h" -+#include "../../../../../include/iprt/stdarg.h" -+#include "../../../../../include/iprt/stdint.h" -+#include "../../../../../include/iprt/string.h" -+#include "../../../../../include/iprt/time.h" -+#include "../../../../../include/iprt/types.h" -+#include "../../../../../include/iprt/uni.h" -#include +#else @@ -134,26 +112,6 @@ +#include "iprt/time.h" +#include "iprt/types.h" +#include "iprt/uni.h" -+#include "iprt/nocrt/limits.h" -+#include "iprt/alloc.h" -+#include "iprt/asm.h" -+#include "iprt/asm-amd64-x86.h" -+#include "iprt/asm-math.h" -+#include "iprt/assert.h" -+#include "iprt/cdefs.h" -+#include "iprt/err.h" -+#include "iprt/fs.h" -+#include "iprt/log.h" -+#include "iprt/mem.h" -+#include "iprt/param.h" -+#include "iprt/path.h" -+#include "iprt/semaphore.h" -+#include "iprt/stdarg.h" -+#include "iprt/stdint.h" -+#include "iprt/string.h" -+#include "iprt/time.h" -+#include "iprt/types.h" -+#include "iprt/uni.h" + +#include "common/VBoxGuestLib/SysHlp.h" + @@ -459,5 +417,5 @@ + #endif /* KERNEL */ - #endif /* !___VBOXVFS_H___ */ + #endif /* !GA_INCLUDED_SRC_freebsd_vboxvfs_vboxvfs_h */ - --- emulators/virtualbox-ose/files/patch-src_VBox_Additions_freebsd_vboxvfs_vboxvfs__prov.c (revision 520061) +++ emulators/virtualbox-ose/files/patch-src_VBox_Additions_freebsd_vboxvfs_vboxvfs__prov.c (working copy) @@ -1,5 +1,5 @@ ---- src/VBox/Additions/freebsd/vboxvfs/vboxvfs_prov.c.orig 1970-01-01 01:00:00.000000000 +0100 -+++ src/VBox/Additions/freebsd/vboxvfs/vboxvfs_prov.c 2017-07-12 19:24:26.109029000 +0200 +--- src/VBox/Additions/freebsd/vboxvfs/vboxvfs_prov.c.orig 2019-12-03 22:07:39 UTC ++++ src/VBox/Additions/freebsd/vboxvfs/vboxvfs_prov.c @@ -0,0 +1,1020 @@ +/* + * Copyright (C) 2008-2016 Oracle Corporation --- emulators/virtualbox-ose/files/patch-src_VBox_Additions_freebsd_vboxvfs_vboxvfs__vfsops.c (revision 520061) +++ emulators/virtualbox-ose/files/patch-src_VBox_Additions_freebsd_vboxvfs_vboxvfs__vfsops.c (working copy) @@ -1,6 +1,6 @@ ---- src/VBox/Additions/freebsd/vboxvfs/vboxvfs_vfsops.c.orig 2017-04-28 16:59:22.000000000 +0200 -+++ src/VBox/Additions/freebsd/vboxvfs/vboxvfs_vfsops.c 2017-07-12 19:24:26.109029000 +0200 -@@ -1,10 +1,5 @@ +--- src/VBox/Additions/freebsd/vboxvfs/vboxvfs_vfsops.c.orig 2019-11-21 16:54:10 UTC ++++ src/VBox/Additions/freebsd/vboxvfs/vboxvfs_vfsops.c +@@ -1,8 +1,3 @@ -/* $Id: vboxvfs_vfsops.c $ */ -/** @file - * Description. @@ -7,11 +7,9 @@ - */ - /* - * Copyright (C) 2008-2017 Oracle Corporation + * Copyright (C) 2008-2019 Oracle Corporation * - * This file is part of VirtualBox Open Source Edition (OSE), as - * available from http://www.virtualbox.org. This file is free software; -@@ -14,245 +9,479 @@ +@@ -14,245 +9,478 @@ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. */ @@ -38,20 +36,26 @@ +#include -#include -- --#define VFSMP2SFGLOBINFO(mp) ((struct sf_glob_info *)mp->mnt_data) -- --static int vboxvfs_version = VBOXVFS_VERSION; +#include +#include ++#include "vboxvfs.h" ++ + #define VFSMP2SFGLOBINFO(mp) ((struct sf_glob_info *)mp->mnt_data) + +-static int vboxvfs_version = VBOXVFS_VERSION; ++#ifdef MALLOC_DECLARE ++MALLOC_DEFINE(M_VBOXVFS, "vboxvfs", "VBOX VFS"); ++#endif + -SYSCTL_NODE(_vfs, OID_AUTO, vboxvfs, CTLFLAG_RW, 0, "VirtualBox shared filesystem"); -SYSCTL_INT(_vfs_vboxvfs, OID_AUTO, version, CTLFLAG_RD, &vboxvfs_version, 0, ""); -+#include "vboxvfs.h" ++static sfp_connection_t *sfprov = NULL; -/* global connection to the host service. */ -static VBGLSFCLIENT g_vboxSFClient; -+#define VFSMP2SFGLOBINFO(mp) ((struct sf_glob_info *)mp->mnt_data) ++static int vboxfs_version = VBOXVFS_VERSION; ++u_int vboxvfs_debug = 1; -static vfs_init_t vboxvfs_init; -static vfs_uninit_t vboxvfs_uninit; @@ -61,7 +65,10 @@ -static vfs_quotactl_t vboxvfs_quotactl; -static vfs_statfs_t vboxvfs_statfs; -static vfs_unmount_t vboxvfs_unmount; -- ++SYSCTL_NODE(_vfs, OID_AUTO, vboxfs, CTLFLAG_RW, 0, "VirtualBox shared filesystem"); ++SYSCTL_INT(_vfs_vboxfs, OID_AUTO, version, CTLFLAG_RD, &vboxfs_version, 0, ""); ++SYSCTL_UINT(_vfs_vboxfs, OID_AUTO, debug, CTLFLAG_RW, &vboxvfs_debug, 0, "Debug level"); + -static struct vfsops vboxvfs_vfsops = { - .vfs_init = vboxvfs_init, - .vfs_cmount = vboxvfs_cmount, @@ -72,19 +79,6 @@ - .vfs_sync = vfs_stdsync, - .vfs_uninit = vboxvfs_uninit, - .vfs_unmount = vboxvfs_unmount, -+#ifdef MALLOC_DECLARE -+MALLOC_DEFINE(M_VBOXVFS, "vboxvfs", "VBOX VFS"); -+#endif -+ -+static sfp_connection_t *sfprov = NULL; -+ -+static int vboxfs_version = VBOXVFS_VERSION; -+u_int vboxvfs_debug = 1; -+ -+SYSCTL_NODE(_vfs, OID_AUTO, vboxfs, CTLFLAG_RW, 0, "VirtualBox shared filesystem"); -+SYSCTL_INT(_vfs_vboxfs, OID_AUTO, version, CTLFLAG_RD, &vboxfs_version, 0, ""); -+SYSCTL_UINT(_vfs_vboxfs, OID_AUTO, debug, CTLFLAG_RW, &vboxvfs_debug, 0, "Debug level"); -+ +static vfs_init_t vboxfs_init; +static vfs_uninit_t vboxfs_uninit; +static vfs_cmount_t vboxfs_cmount; @@ -141,17 +135,9 @@ { - struct vboxvfs_mount_info args; - int rc = 0; -- -- printf("%s: Enter\n", __FUNCTION__); -- -- rc = copyin(data, &args, sizeof(struct vboxvfs_mount_info)); -- if (rc) -- return rc; + struct vboxfs_node *nnode; -- ma = mount_argf(ma, "uid", "%d", args.uid); -- ma = mount_argf(ma, "gid", "%d", args.gid); -- ma = mount_arg(ma, "from", args.name, -1); +- printf("%s: Enter\n", __FUNCTION__); + if ((mp->mnt_kern_flag & MNTK_UNMOUNT) != 0) { + /* + * When a new tmpfs node is created for fully @@ -169,10 +155,16 @@ + */ + return (EBUSY); + } -+ + +- rc = copyin(data, &args, sizeof(struct vboxvfs_mount_info)); +- if (rc) +- return rc; + nnode = (struct vboxfs_node *)uma_zalloc_arg( + vsfmp->sf_node_pool, vsfmp, M_WAITOK); -+ + +- ma = mount_argf(ma, "uid", "%d", args.uid); +- ma = mount_argf(ma, "gid", "%d", args.gid); +- ma = mount_arg(ma, "from", args.name, -1); + /* Generic initialization. */ + nnode->sf_type = type; + nnode->sf_ino = vsfmp->sf_ino++; @@ -179,7 +171,8 @@ + nnode->sf_path = strdup(fullpath, M_VBOXVFS); + nnode->sf_parent = parent; + nnode->vboxfsmp = vsfmp; -+ + +- rc = kernel_mount(ma, flags); + /* Type-specific initialization. */ + switch (nnode->sf_type) { + case VBLK: @@ -190,15 +183,12 @@ + case VLNK: + case VREG: + break; -+ + +- printf("%s: Leave rc=%d\n", __FUNCTION__, rc); + default: + panic("vboxfs_alloc_node: type %p %d", nnode, (int)nnode->sf_type); + } -- rc = kernel_mount(ma, flags); -- -- printf("%s: Leave rc=%d\n", __FUNCTION__, rc); -- - return rc; + *node = nnode; + return 0; @@ -219,33 +209,8 @@ - struct sf_glob_info *pShFlGlobalInfo; - SHFLSTRING *pShFlShareName = NULL; - int cbShFlShareName; -- + - printf("%s: Enter\n", __FUNCTION__); -- -- if (mp->mnt_flag & (MNT_UPDATE | MNT_ROOTFS)) -- return EOPNOTSUPP; -- -- if (vfs_filteropt(mp->mnt_optnew, vboxvfs_opts)) -- { -- vfs_mount_error(mp, "%s", "Invalid option"); -- return EINVAL; -- } -- -- rc = vfs_getopt(mp->mnt_optnew, "from", (void **)&pszShare, &cbShare); -- if (rc || pszShare[cbShare-1] != '\0' || cbShare > 0xfffe) -- return EINVAL; -- -- rc = vfs_getopt(mp->mnt_optnew, "gid", (void **)&gid, &cbOption); -- if ((rc != ENOENT) && (rc || cbOption != sizeof(gid))) -- return EINVAL; -- -- rc = vfs_getopt(mp->mnt_optnew, "uid", (void **)&uid, &cbOption); -- if ((rc != ENOENT) && (rc || cbOption != sizeof(uid))) -- return EINVAL; - -- pShFlGlobalInfo = RTMemAllocZ(sizeof(struct sf_glob_info)); -- if (!pShFlGlobalInfo) -- return ENOMEM; +#ifdef INVARIANTS + TMPFS_NODE_LOCK(node); + MPASS(node->sf_vnode == NULL); @@ -255,16 +220,16 @@ + if (node->sf_path) + free(node->sf_path, M_VBOXVFS); -- cbShFlShareName = offsetof (SHFLSTRING, String.utf8) + cbShare + 1; -- pShFlShareName = RTMemAllocZ(cbShFlShareName); -- if (!pShFlShareName) -- return VERR_NO_MEMORY; +- if (mp->mnt_flag & (MNT_UPDATE | MNT_ROOTFS)) +- return EOPNOTSUPP; + uma_zfree(vboxfs->sf_node_pool, node); +} -- pShFlShareName->u16Length = cbShare; -- pShFlShareName->u16Size = cbShare + 1; -- memcpy (pShFlShareName->String.utf8, pszShare, cbShare + 1); +- if (vfs_filteropt(mp->mnt_optnew, vboxvfs_opts)) +- { +- vfs_mount_error(mp, "%s", "Invalid option"); +- return EINVAL; +- } +static int +vboxfs_cmount(struct mntarg *ma, void *data, uint64_t flags) +{ @@ -271,14 +236,18 @@ + struct vboxfs_mount_info args; + int error = 0; -- rc = VbglR0SfMapFolder (&g_vboxSFClient, pShFlShareName, &pShFlGlobalInfo->map); -- RTMemFree(pShFlShareName); +- rc = vfs_getopt(mp->mnt_optnew, "from", (void **)&pszShare, &cbShare); +- if (rc || pszShare[cbShare-1] != '\0' || cbShare > 0xfffe) +- return EINVAL; + if (data == NULL) + return (EINVAL); + error = copyin(data, &args, sizeof(struct vboxfs_mount_info)); + if (error) + return (error); -+ + +- rc = vfs_getopt(mp->mnt_optnew, "gid", (void **)&gid, &cbOption); +- if ((rc != ENOENT) && (rc || cbOption != sizeof(gid))) +- return EINVAL; + ma = mount_argf(ma, "uid", "%d", args.uid); + ma = mount_argf(ma, "gid", "%d", args.gid); + ma = mount_argf(ma, "file_mode", "%d", args.fmode); @@ -285,17 +254,15 @@ + ma = mount_argf(ma, "dir_mode", "%d", args.dmode); + ma = mount_arg(ma, "from", args.name, -1); -- if (RT_FAILURE (rc)) -- { -- RTMemFree(pShFlGlobalInfo); -- printf("VbglR0SfMapFolder failed rc=%d\n", rc); -- return EPROTO; -- } +- rc = vfs_getopt(mp->mnt_optnew, "uid", (void **)&uid, &cbOption); +- if ((rc != ENOENT) && (rc || cbOption != sizeof(uid))) +- return EINVAL; + return (kernel_mount(ma, flags)); +} -- pShFlGlobalInfo->uid = uid; -- pShFlGlobalInfo->gid = gid; +- pShFlGlobalInfo = RTMemAllocZ(sizeof(struct sf_glob_info)); +- if (!pShFlGlobalInfo) +- return ENOMEM; +static const char *vboxfs_opts[] = { + "fstype", + "fspath", @@ -308,7 +275,10 @@ + NULL +}; -- mp->mnt_data = pShFlGlobalInfo; +- cbShFlShareName = offsetof (SHFLSTRING, String.utf8) + cbShare + 1; +- pShFlShareName = RTMemAllocZ(cbShFlShareName); +- if (!pShFlShareName) +- return VERR_NO_MEMORY; +#define VBOX_INTOPT(optname, val, base) do { \ + char *ep, *optarg = NULL; \ + if (vfs_getopt(opts, optname, (void **)&optarg, NULL) == 0) { \ @@ -328,66 +298,69 @@ + } \ +} while (0) -- /** @todo root vnode. */ +- pShFlShareName->u16Length = cbShare; +- pShFlShareName->u16Size = cbShare + 1; +- memcpy (pShFlShareName->String.utf8, pszShare, cbShare + 1); +static int +vboxfs_node_ctor(void *mem, int size, void *arg, int flags) +{ + struct vboxfs_node *node = (struct vboxfs_node *)mem; -- vfs_getnewfsid(mp); -- vfs_mountedfrom(mp, pszShare); +- rc = VbglR0SfMapFolder (&g_vboxSFClient, pShFlShareName, &pShFlGlobalInfo->map); +- RTMemFree(pShFlShareName); + node->sf_vnode = NULL; + node->sf_vpstate = 0; -- printf("%s: Leave rc=0\n", __FUNCTION__); +- if (RT_FAILURE (rc)) +- { +- RTMemFree(pShFlGlobalInfo); +- printf("VbglR0SfMapFolder failed rc=%d\n", rc); +- return EPROTO; +- } + return (0); +} -- return 0; +- pShFlGlobalInfo->uid = uid; +- pShFlGlobalInfo->gid = gid; +static void +vboxfs_node_dtor(void *mem, int size, void *arg) +{ + struct vboxfs_node *node = (struct vboxfs_node *)mem; + node->sf_type = VNON; - } ++} --static int vboxvfs_unmount(struct mount *mp, int mntflags, struct thread *td) +- mp->mnt_data = pShFlGlobalInfo; +static int +vboxfs_node_init(void *mem, int size, int flags) - { -- struct sf_glob_info *pShFlGlobalInfo = VFSMP2SFGLOBINFO(mp); -- int rc; -- int flags = 0; ++{ + struct vboxfs_node *node = (struct vboxfs_node *)mem; + node->sf_ino = 0; -- rc = VbglR0SfUnmapFolder(&g_vboxSFClient, &pShFlGlobalInfo->map); -- if (RT_FAILURE(rc)) -- printf("Failed to unmap shared folder\n"); +- /** @todo root vnode. */ + mtx_init(&node->sf_interlock, "tmpfs node interlock", NULL, MTX_DEF); -- if (mntflags & MNT_FORCE) -- flags |= FORCECLOSE; +- vfs_getnewfsid(mp); +- vfs_mountedfrom(mp, pszShare); + return (0); +} -- /* There is 1 extra root vnode reference (vnode_root). */ -- rc = vflush(mp, 1, flags, td); -- if (rc) -- return rc; +- printf("%s: Leave rc=0\n", __FUNCTION__); +static void +vboxfs_node_fini(void *mem, int size) +{ + struct vboxfs_node *node = (struct vboxfs_node *)mem; +- return 0; + mtx_destroy(&node->sf_interlock); -+} + } -- RTMemFree(pShFlGlobalInfo); -- mp->mnt_data = NULL; +-static int vboxvfs_unmount(struct mount *mp, int mntflags, struct thread *td) +static int +vboxfs_mount(struct mount *mp) -+{ + { +- struct sf_glob_info *pShFlGlobalInfo = VFSMP2SFGLOBINFO(mp); +- int rc; +- int flags = 0; + struct vboxfs_mnt *vboxfsmp = NULL; + struct vfsoptlist *opts = mp->mnt_optnew; + sfp_mount_t *handle = NULL; @@ -399,27 +372,38 @@ + uid_t uid = 0; + gid_t gid = 0; + struct vboxfs_node *root; -+ + +- rc = VbglR0SfUnmapFolder(&g_vboxSFClient, &pShFlGlobalInfo->map); +- if (RT_FAILURE(rc)) +- printf("Failed to unmap shared folder\n"); + if (mp->mnt_flag & (MNT_UPDATE | MNT_ROOTFS)) + return (EOPNOTSUPP); -+ + +- if (mntflags & MNT_FORCE) +- flags |= FORCECLOSE; + if (vfs_filteropt(opts, vboxfs_opts)) { + vfs_mount_error(mp, "%s", "Invalid option"); + return (EINVAL); + } -+ + +- /* There is 1 extra root vnode reference (vnode_root). */ +- rc = vflush(mp, 1, flags, td); +- if (rc) +- return rc; + VBOX_INTOPT("uid", uid, 10); + VBOX_INTOPT("gid", gid, 10); + VBOX_INTOPT("file_mode", file_mode, 8); + VBOX_INTOPT("dir_mode", dir_mode, 8); + VBOX_INTOPT("ro", readonly, 10); -+ + + error = vfs_getopt(opts, "from", (void **)&share_name, &share_len); + if (error != 0 || share_len == 0) { + vfs_mount_error(mp, "Invalid from"); + return (EINVAL); + } -+ + +- RTMemFree(pShFlGlobalInfo); +- mp->mnt_data = NULL; + vboxfsmp = malloc(sizeof(struct vboxfs_mnt), M_VBOXVFS, M_WAITOK | M_ZERO); + vboxfsmp->sf_uid = uid; + vboxfsmp->sf_gid = gid; @@ -427,7 +411,8 @@ + vboxfsmp->sf_dmode = dir_mode & (S_IRWXU | S_IRWXG | S_IRWXO); + vboxfsmp->sf_ino = 3; + vboxfsmp->sf_stat_ttl = 200; -+ + +- return 0; + /* Invoke Hypervisor mount interface before proceeding */ + error = sfprov_mount(share_name, &handle); + if (error) @@ -466,7 +451,6 @@ + + MNT_ILOCK(mp); + mp->mnt_data = vboxfsmp; -+ bzero(&mp->mnt_stat.f_fsid, sizeof(&mp->mnt_stat.f_fsid)); + /* f_fsid is int32_t but serial is uint32_t, convert */ + memcpy(&mp->mnt_stat.f_fsid, &fsinfo.serial, sizeof(mp->mnt_stat.f_fsid)); + mp->mnt_flag |= MNT_LOCAL; @@ -480,8 +464,7 @@ +#endif + MNT_IUNLOCK(mp); + vfs_mountedfrom(mp, share_name); - -- return 0; ++ + return (0); } @@ -502,55 +485,56 @@ + struct thread *td; + int error; + int flags; -+ + +- printf("%s: Enter\n", __FUNCTION__); + vboxfsmp = VFSTOVBOXFS(mp); + td = curthread; + flags = 0; + if (mntflags & MNT_FORCE) + flags |= FORCECLOSE; -+ + +- vp = pShFlGlobalInfo->vnode_root; +- VREF(vp); + error = vflush(mp, 0, flags, td); + if (error) + return (error); -+ + +- vn_lock(vp, flags | LK_RETRY, td); +- *vpp = vp; + /* Invoke Hypervisor unmount interface before proceeding */ + error = sfprov_unmount(vboxfsmp->sf_handle); + if (error != 0) { + /* TBD anything here? */ + } -+ + +- printf("%s: Leave\n", __FUNCTION__); + uma_zdestroy(vboxfsmp->sf_node_pool); -+ + +- return rc; + free(vboxfsmp, M_VBOXVFS); + MNT_ILOCK(mp); + mp->mnt_data = NULL; + mp->mnt_flag &= ~MNT_LOCAL; + MNT_IUNLOCK(mp); - -- printf("%s: Enter\n", __FUNCTION__); -- -- vp = pShFlGlobalInfo->vnode_root; -- VREF(vp); ++ + return (0); -+} + } -- vn_lock(vp, flags | LK_RETRY, td); -- *vpp = vp; +-static int vboxvfs_quotactl(struct mount *mp, int cmd, uid_t uid, void *arg, struct thread *td) +static int +vboxfs_root(struct mount *mp, int flags, struct vnode **vpp) -+{ + { +- return EOPNOTSUPP; + int error; + error = vboxfs_alloc_vp(mp, VFSTOVBOXFS(mp)->sf_root, flags, vpp); - -- printf("%s: Leave\n", __FUNCTION__); ++ + if (!error) + (*vpp)->v_vflag |= VV_ROOT; - -- return rc; ++ + return error; } --static int vboxvfs_quotactl(struct mount *mp, int cmd, uid_t uid, void *arg, struct thread *td) +-int vboxvfs_init(struct vfsconf *vfsp) +/* + * Do operation associated with quotas, not supported + */ @@ -557,26 +541,22 @@ +static int +vboxfs_quotactl(struct mount *mp, int cmd, uid_t uid, void *arg) { -- return EOPNOTSUPP; +- int rc; + return (EOPNOTSUPP); - } ++} --int vboxvfs_init(struct vfsconf *vfsp) +- /* Initialize the R0 guest library. */ +- rc = VbglR0SfInit(); +- if (RT_FAILURE(rc)) +- return ENXIO; +/* + * Initialize the filesystem globals. + */ +static int +vboxfs_init(struct vfsconf *vfsp) - { -- int rc; ++{ + int error; -- /* Initialize the R0 guest library. */ -- rc = VbglR0SfInit(); -- if (RT_FAILURE(rc)) -- return ENXIO; -+ DROP_GIANT(); - - /* Connect to the host service. */ - rc = VbglR0SfConnect(&g_vboxSFClient); - if (RT_FAILURE(rc)) @@ -585,28 +565,28 @@ - VbglR0SfTerm(); - return ENXIO; - } ++ DROP_GIANT(); + +- rc = VbglR0SfSetUtf8(&g_vboxSFClient); +- if (RT_FAILURE (rc)) +- { +- printf("VbglR0SfSetUtf8 failed, rc=%d\n", rc); +- VbglR0SfDisconnect(&g_vboxSFClient); +- VbglR0SfTerm(); +- return EPROTO; +- } + sfprov = sfprov_connect(SFPROV_VERSION); + if (sfprov == NULL) { + printf("%s: couldn't connect to sf provider", __func__); + return (ENODEV); + } -+ + +- printf("Successfully loaded shared folder module\n"); + error = sfprov_set_show_symlinks(); + if (error != 0) + printf("%s: host unable to show symlinks, error=%d\n", + __func__, error); -- rc = VbglR0SfSetUtf8(&g_vboxSFClient); -- if (RT_FAILURE (rc)) -- { -- printf("VbglR0SfSetUtf8 failed, rc=%d\n", rc); -- VbglR0SfDisconnect(&g_vboxSFClient); -- VbglR0SfTerm(); -- return EPROTO; -- } -- -- printf("Successfully loaded shared folder module\n"); -- - return 0; + PICKUP_GIANT(); + return (0); --- emulators/virtualbox-ose/files/patch-src_VBox_Additions_freebsd_vboxvfs_vboxvfs__vnops.c (revision 520061) +++ emulators/virtualbox-ose/files/patch-src_VBox_Additions_freebsd_vboxvfs_vboxvfs__vnops.c (working copy) @@ -1,4 +1,4 @@ ---- src/VBox/Additions/freebsd/vboxvfs/vboxvfs_vnops.c.orig 2019-10-10 18:06:51 UTC +--- src/VBox/Additions/freebsd/vboxvfs/vboxvfs_vnops.c.orig 2019-12-10 17:45:29 UTC +++ src/VBox/Additions/freebsd/vboxvfs/vboxvfs_vnops.c @@ -1,10 +1,6 @@ -/* $Id: vboxvfs_vnops.c $ */ @@ -7,7 +7,7 @@ - */ - /* - * Copyright (C) 2008-2017 Oracle Corporation + * Copyright (C) 2008-2019 Oracle Corporation + * Copyright (C) 2017 Mahdi Mokhtari * * This file is part of VirtualBox Open Source Edition (OSE), as --- emulators/virtualbox-ose/files/patch-src_VBox_Additions_x11_Installer_98vboxadd-xclient (nonexistent) +++ emulators/virtualbox-ose/files/patch-src_VBox_Additions_x11_Installer_98vboxadd-xclient (working copy) @@ -0,0 +1,19 @@ +--- src/VBox/Additions/x11/Installer/98vboxadd-xclient.orig 2019-11-21 16:54:14 UTC ++++ src/VBox/Additions/x11/Installer/98vboxadd-xclient +@@ -30,10 +30,10 @@ elif test -z "${SSH_CONNECTION}"; then + # This script can also be triggered by a connection over SSH, which is not + # what we had in mind, so we do not start VBoxClient in that case. We do + # not use "exit" here as this script is "source"d, not executed. +- /usr/bin/VBoxClient --clipboard +- /usr/bin/VBoxClient --checkhostversion +- /usr/bin/VBoxClient --display +- /usr/bin/VBoxClient --seamless +- /usr/bin/VBoxClient --draganddrop +- /usr/bin/VBoxClient --vmsvga-x11 # In case VMSVGA emulation is enabled ++ /usr/local/bin/VBoxClient --clipboard ++ /usr/local/bin/VBoxClient --checkhostversion ++ /usr/local/bin/VBoxClient --display ++ /usr/local/bin/VBoxClient --seamless ++ /usr/local/bin/VBoxClient --draganddrop ++ /usr/local/bin/VBoxClient --vmsvga-x11 # In case VMSVGA emulation is enabled + fi --- emulators/virtualbox-ose/files/patch-src_VBox_Additions_x11_Installer_vboxclient.desktop (nonexistent) +++ emulators/virtualbox-ose/files/patch-src_VBox_Additions_x11_Installer_vboxclient.desktop (working copy) @@ -0,0 +1,10 @@ +--- src/VBox/Additions/x11/Installer/vboxclient.desktop.orig 2019-11-21 16:54:14 UTC ++++ src/VBox/Additions/x11/Installer/vboxclient.desktop +@@ -8,6 +8,6 @@ Comment[C]=VirtualBox User Session Services + Comment=VirtualBox User Session Services + Comment[it]=Servizi di sessione utente di VirtualBox + Comment[pl]=Usługi sesji użytkownika VirtualBox +-Exec=/usr/bin/VBoxClient-all ++Exec=/usr/local/bin/VBoxClient-all + X-GNOME-Autostart-enabled=true + X-KDE-autostart-after=panel --- emulators/virtualbox-ose/files/patch-src_VBox_Additions_x11_vboxmouse_Makefile.kmk (revision 520061) +++ emulators/virtualbox-ose/files/patch-src_VBox_Additions_x11_vboxmouse_Makefile.kmk (working copy) @@ -1,4 +1,4 @@ ---- src/VBox/Additions/x11/vboxmouse/Makefile.kmk.orig 2019-01-25 18:24:30 UTC +--- src/VBox/Additions/x11/vboxmouse/Makefile.kmk.orig 2019-11-21 16:54:15 UTC +++ src/VBox/Additions/x11/vboxmouse/Makefile.kmk @@ -227,10 +227,22 @@ endif # neq ($(KBUILD_TARGET),linux) --- emulators/virtualbox-ose/files/patch-src_VBox_Additions_x11_vboxvideo_Makefile.kmk (revision 520061) +++ emulators/virtualbox-ose/files/patch-src_VBox_Additions_x11_vboxvideo_Makefile.kmk (working copy) @@ -1,4 +1,4 @@ ---- src/VBox/Additions/x11/vboxvideo/Makefile.kmk.orig 2019-01-25 18:24:30 UTC +--- src/VBox/Additions/x11/vboxvideo/Makefile.kmk.orig 2019-11-21 16:54:15 UTC +++ src/VBox/Additions/x11/vboxvideo/Makefile.kmk @@ -406,9 +406,10 @@ ifdef VBOX_USE_SYSTEM_XORG_HEADERS vboxvideo_drv_system_INCS += \ --- emulators/virtualbox-ose/files/patch-src_VBox_Debugger_Makefile.kmk (revision 520061) +++ emulators/virtualbox-ose/files/patch-src_VBox_Debugger_Makefile.kmk (working copy) @@ -1,6 +1,6 @@ ---- src/VBox/Debugger/Makefile.kmk.orig 2017-10-18 07:09:03 UTC +--- src/VBox/Debugger/Makefile.kmk.orig 2019-11-21 16:57:02 UTC +++ src/VBox/Debugger/Makefile.kmk -@@ -109,6 +109,7 @@ VBoxDbg_SOURCES = \ +@@ -110,6 +110,7 @@ VBoxDbg_SOURCES = \ VBoxDbgBase.cpp \ VBoxDbgConsole.cpp \ VBoxDbgStatsQt.cpp --- emulators/virtualbox-ose/files/patch-src_VBox_Devices_Audio_DrvHostALSAAudio.cpp (revision 520061) +++ emulators/virtualbox-ose/files/patch-src_VBox_Devices_Audio_DrvHostALSAAudio.cpp (working copy) @@ -1,6 +1,6 @@ ---- src/VBox/Devices/Audio/DrvHostALSAAudio.cpp.orig 2017-10-18 07:09:04 UTC +--- src/VBox/Devices/Audio/DrvHostALSAAudio.cpp.orig 2019-11-21 16:57:02 UTC +++ src/VBox/Devices/Audio/DrvHostALSAAudio.cpp -@@ -1231,6 +1231,7 @@ static DECLCALLBACK(int) drvHostALSAAudioStreamPlay(PP +@@ -819,6 +819,7 @@ static DECLCALLBACK(int) drvHostALSAAudioStreamPlay(PP continue; } @@ -8,7 +8,7 @@ case -ESTRPIPE: { /* Stream was suspended and waiting for a recovery. */ -@@ -1244,6 +1245,7 @@ static DECLCALLBACK(int) drvHostALSAAudioStreamPlay(PP +@@ -832,6 +833,7 @@ static DECLCALLBACK(int) drvHostALSAAudioStreamPlay(PP LogFlowFunc(("Resumed suspended output stream\n")); continue; } --- emulators/virtualbox-ose/files/patch-src_VBox_Devices_Graphics_DevVGA-SVGA3d-glLdr.cpp (nonexistent) +++ emulators/virtualbox-ose/files/patch-src_VBox_Devices_Graphics_DevVGA-SVGA3d-glLdr.cpp (working copy) @@ -0,0 +1,29 @@ +--- src/VBox/Devices/Graphics/DevVGA-SVGA3d-glLdr.cpp.orig 2019-11-21 16:59:41 UTC ++++ src/VBox/Devices/Graphics/DevVGA-SVGA3d-glLdr.cpp +@@ -186,7 +186,7 @@ int glLdrInit(PPDMDEVINS pDevIns) + pfn_wglDeleteContext = 0; + pfn_wglMakeCurrent = 0; + pfn_wglShareLists = 0; +-#elif defined(RT_OS_LINUX) ++#elif defined(RT_OS_FREEBSD) || defined(RT_OS_LINUX) + pfn_XConfigureWindow = 0; + pfn_XCloseDisplay = 0; + pfn_XCreateColormap = 0; +@@ -276,7 +276,7 @@ int glLdrInit(PPDMDEVINS pDevIns) + GLGETPROC_(wglDeleteContext, ""); + GLGETPROC_(wglMakeCurrent, ""); + GLGETPROC_(wglShareLists, ""); +-#elif defined(RT_OS_LINUX) ++#elif defined(RT_OS_FREEBSD) || defined(RT_OS_LINUX) + X11GETPROC_(XConfigureWindow); + X11GETPROC_(XCloseDisplay); + X11GETPROC_(XCreateColormap); +@@ -357,7 +357,7 @@ int glLdrInit(PPDMDEVINS pDevIns) + GLGETPROC_(glVertexPointer, ""); + GLGETPROC_(glViewport, ""); + +-#ifdef RT_OS_LINUX ++#if defined(RT_OS_FREEBSD) || defined(RT_OS_LINUX) + XInitThreads(); + #endif + return VINF_SUCCESS; --- emulators/virtualbox-ose/files/patch-src_VBox_Devices_Graphics_DevVGA-SVGA3d-glLdr.h (nonexistent) +++ emulators/virtualbox-ose/files/patch-src_VBox_Devices_Graphics_DevVGA-SVGA3d-glLdr.h (working copy) @@ -0,0 +1,11 @@ +--- src/VBox/Devices/Graphics/DevVGA-SVGA3d-glLdr.h.orig 2019-11-21 16:59:41 UTC ++++ src/VBox/Devices/Graphics/DevVGA-SVGA3d-glLdr.h +@@ -317,7 +317,7 @@ GLPFN BOOL (WINAPI *pfn_wglMakeCurrent)(HDC, HGLRC); + GLPFN BOOL (WINAPI *pfn_wglShareLists)(HGLRC, HGLRC); + #define wglShareLists pfn_wglShareLists + +-#elif defined(RT_OS_LINUX) ++#elif defined(RT_OS_FREEBSD) || defined(RT_OS_LINUX) + /* + * GLX + */ --- emulators/virtualbox-ose/files/patch-src_VBox_Devices_Graphics_DevVGA-SVGA3d-ogl.cpp (nonexistent) +++ emulators/virtualbox-ose/files/patch-src_VBox_Devices_Graphics_DevVGA-SVGA3d-ogl.cpp (working copy) @@ -0,0 +1,38 @@ +--- src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp.orig 2019-11-21 16:59:41 UTC ++++ src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp +@@ -1175,7 +1175,7 @@ int vmsvga3dTerminate(PVGASTATE pThis) + RTSemEventDestroy(pState->WndRequestSem); + #elif defined(RT_OS_DARWIN) + +-#elif defined(RT_OS_LINUX) ++#elif defined(RT_OS_FREEBSD) || defined(RT_OS_LINUX) + /* signal to the thread that it is supposed to exit */ + pState->bTerminate = true; + /* wait for it to terminate */ +@@ -3004,7 +3004,7 @@ int vmsvga3dGenerateMipmaps(PVGASTATE pThis, uint32_t + } + + +-#ifdef RT_OS_LINUX ++#if defined(RT_OS_FREEBSD) || defined(RT_OS_LINUX) + /** + * X11 event handling thread. + * +@@ -3034,7 +3034,7 @@ DECLCALLBACK(int) vmsvga3dXEventThread(RTTHREAD hThrea + } + return VINF_SUCCESS; + } +-#endif // RT_OS_LINUX ++#endif // RT_OS_FREEBSD || RT_OS_LINUX + + + /** +@@ -3369,7 +3369,7 @@ static int vmsvga3dContextDestroyOgl(PVGASTATE pThis, + AssertRC(rc); + #elif defined(RT_OS_DARWIN) + vmsvga3dCocoaDestroyViewAndContext(pContext->cocoaView, pContext->cocoaContext); +-#elif defined(RT_OS_LINUX) ++#elif defined(RT_OS_FREEBSD) || defined(RT_OS_LINUX) + glXMakeCurrent(pState->display, None, NULL); + glXDestroyContext(pState->display, pContext->glxContext); + XDestroyWindow(pState->display, pContext->window); --- emulators/virtualbox-ose/files/patch-src_VBox_Devices_Makefile.kmk (nonexistent) +++ emulators/virtualbox-ose/files/patch-src_VBox_Devices_Makefile.kmk (working copy) @@ -0,0 +1,44 @@ +--- src/VBox/Devices/Makefile.kmk.orig 2019-11-21 17:00:01 UTC ++++ src/VBox/Devices/Makefile.kmk +@@ -112,6 +112,7 @@ if !defined(VBOX_ONLY_EXTPACKS) + VBoxDDU_LDFLAGS.darwin += -framework IOKit + endif + ++ VBoxDDU_LDFLAGS.freebsd = $(VBOX_GCC_NO_UNDEFINED) + VBoxDDU_LDFLAGS.linux = $(VBOX_GCC_NO_UNDEFINED) + $(call VBOX_SET_VER_INFO_DLL,VBoxDDU,VirtualBox VMM Devices and Drivers Utilities) + +@@ -241,6 +242,7 @@ if !defined(VBOX_ONLY_EXTPACKS) && "$(intersects $(KBU + -framework Carbon \ + -framework DiskArbitration \ + -framework SystemConfiguration ++ VBoxDD_LDFLAGS.freebsd = $(VBOX_GCC_NO_UNDEFINED) + VBoxDD_LDFLAGS.linux = $(VBOX_GCC_NO_UNDEFINED) + + # --- Tracing bits. --- +@@ -283,7 +285,7 @@ if !defined(VBOX_ONLY_EXTPACKS) && "$(intersects $(KBU + VBoxDD_SOURCES += Graphics/DevVGA-SVGA.cpp + endif + ifdef VBOX_WITH_VMSVGA3D +- if1of ($(KBUILD_TARGET), linux win) ++ if1of ($(KBUILD_TARGET), freebsd linux win) + # Dynamically load 3D library (opengl32, libGL). + # This is a temporary solution. In future the 3D backend will be in a separate library. + VBOX_WITH_VMSVGA3D_DYNAMIC_LOAD = 1 +@@ -324,6 +326,7 @@ VBOX_WITH_VMSVGA3D_DYNAMIC_LOAD = 1 + VBoxDD_SOURCES += \ + Graphics/DevVGA-SVGA3d-glLdr.cpp + else ++ VBoxDD_LIBS.freebsd += X11 GL + VBoxDD_LIBS.linux += X11 GL + VBoxDD_LIBS.win += $(PATH_SDK_$(VBOX_WINPSDK)_LIB)/Opengl32.lib + endif +@@ -1516,6 +1519,8 @@ if defined(VBOX_WITH_VMSVGA3D) && !defined(VBOX_ONLY_E + VBoxSVGA3D_INCS = $(VBOX_GRAPHICS_INCS) + VBoxSVGA3D_INCS.win := \ + Graphics/shaderlib/libWineStub/include ++ VBoxSVGA3D_INCS.freebsd := \ ++ Graphics/shaderlib/wine/include + VBoxSVGA3D_INCS.linux := \ + Graphics/shaderlib/wine/include + VBoxSVGA3D_INCS.darwin := \ --- emulators/virtualbox-ose/files/patch-src_VBox_Devices_Network_slirp_bsd_sys_mbuf.h (nonexistent) +++ emulators/virtualbox-ose/files/patch-src_VBox_Devices_Network_slirp_bsd_sys_mbuf.h (working copy) @@ -0,0 +1,12 @@ +--- src/VBox/Devices/Network/slirp/bsd/sys/mbuf.h.orig 2019-11-21 17:00:06 UTC ++++ src/VBox/Devices/Network/slirp/bsd/sys/mbuf.h +@@ -245,6 +245,9 @@ struct mbuf { + #define M_FRAG 0x00000800 /* packet is a fragment of a larger packet */ + #define M_FIRSTFRAG 0x00001000 /* packet is first fragment */ + #define M_LASTFRAG 0x00002000 /* packet is last fragment */ ++#ifdef M_SKIP_FIREWALL ++#undef M_SKIP_FIREWALL ++#endif + #define M_SKIP_FIREWALL 0x00004000 /* skip firewall processing */ + #define M_FREELIST 0x00008000 /* mbuf is on the free list */ + #define M_VLANTAG 0x00010000 /* ether_vtag is valid */ --- emulators/virtualbox-ose/files/patch-src_VBox_Devices_PC_vbox-cpuhotplug.dsl (revision 520061) +++ emulators/virtualbox-ose/files/patch-src_VBox_Devices_PC_vbox-cpuhotplug.dsl (nonexistent) @@ -1,96 +0,0 @@ ---- src/VBox/Devices/PC/vbox-cpuhotplug.dsl.orig 2019-10-10 18:34:15 UTC -+++ src/VBox/Devices/PC/vbox-cpuhotplug.dsl -@@ -44,11 +44,11 @@ DefinitionBlock ("SSDT-cpuhotplug.aml", "SSDT", 1, "VB - Scope (\_SB) - { - --#define GENERATE_CPU_OBJECT(id, sck, sckuid, cpu, cpuuid) \ -+#define GENERATE_CPU_OBJECT(id, sck, cpu) \ - Device (sck) \ - { \ - Name (_HID, "ACPI0004") \ -- Name (_UID, sckuid) \ -+ Name (_UID, id) \ - \ - \ - Processor (cpu, /* Name */ \ -@@ -58,7 +58,7 @@ DefinitionBlock ("SSDT-cpuhotplug.aml", "SSDT", 1, "VB - ) \ - { \ - Name (_HID, "ACPI0007") \ -- Name (_UID, cpuuid) \ -+ Name (_UID, id) \ - Name (_PXM, 0x00) \ - \ - Method(_MAT, 0, Serialized) \ -@@ -95,38 +95,38 @@ DefinitionBlock ("SSDT-cpuhotplug.aml", "SSDT", 1, "VB - } \ - } \ - -- GENERATE_CPU_OBJECT(0x00, SCK0, "SCKCPU0", CPU0, "SCK0-CPU0") -- GENERATE_CPU_OBJECT(0x01, SCK1, "SCKCPU1", CPU1, "SCK1-CPU0") -- GENERATE_CPU_OBJECT(0x02, SCK2, "SCKCPU2", CPU2, "SCK2-CPU0") -- GENERATE_CPU_OBJECT(0x03, SCK3, "SCKCPU3", CPU3, "SCK3-CPU0") -- GENERATE_CPU_OBJECT(0x04, SCK4, "SCKCPU4", CPU4, "SCK4-CPU0") -- GENERATE_CPU_OBJECT(0x05, SCK5, "SCKCPU5", CPU5, "SCK5-CPU0") -- GENERATE_CPU_OBJECT(0x06, SCK6, "SCKCPU6", CPU6, "SCK6-CPU0") -- GENERATE_CPU_OBJECT(0x07, SCK7, "SCKCPU7", CPU7, "SCK7-CPU0") -- GENERATE_CPU_OBJECT(0x08, SCK8, "SCKCPU8", CPU8, "SCK8-CPU0") -- GENERATE_CPU_OBJECT(0x09, SCK9, "SCKCPU9", CPU9, "SCK9-CPU0") -- GENERATE_CPU_OBJECT(0x0a, SCKA, "SCKCPUA", CPUA, "SCKA-CPU0") -- GENERATE_CPU_OBJECT(0x0b, SCKB, "SCKCPUB", CPUB, "SCKB-CPU0") -- GENERATE_CPU_OBJECT(0x0c, SCKC, "SCKCPUC", CPUC, "SCKC-CPU0") -- GENERATE_CPU_OBJECT(0x0d, SCKD, "SCKCPUD", CPUD, "SCKD-CPU0") -- GENERATE_CPU_OBJECT(0x0e, SCKE, "SCKCPUE", CPUE, "SCKE-CPU0") -- GENERATE_CPU_OBJECT(0x0f, SCKF, "SCKCPUF", CPUF, "SCKF-CPU0") -- GENERATE_CPU_OBJECT(0x10, SCKG, "SCKCPUG", CPUG, "SCKG-CPU0") -- GENERATE_CPU_OBJECT(0x11, SCKH, "SCKCPUH", CPUH, "SCKH-CPU0") -- GENERATE_CPU_OBJECT(0x12, SCKI, "SCKCPUI", CPUI, "SCKI-CPU0") -- GENERATE_CPU_OBJECT(0x13, SCKJ, "SCKCPUJ", CPUJ, "SCKJ-CPU0") -- GENERATE_CPU_OBJECT(0x14, SCKK, "SCKCPUK", CPUK, "SCKK-CPU0") -- GENERATE_CPU_OBJECT(0x15, SCKL, "SCKCPUL", CPUL, "SCKL-CPU0") -- GENERATE_CPU_OBJECT(0x16, SCKM, "SCKCPUM", CPUM, "SCKM-CPU0") -- GENERATE_CPU_OBJECT(0x17, SCKN, "SCKCPUN", CPUN, "SCKN-CPU0") -- GENERATE_CPU_OBJECT(0x18, SCKO, "SCKCPUO", CPUO, "SCKO-CPU0") -- GENERATE_CPU_OBJECT(0x19, SCKP, "SCKCPUP", CPUP, "SCKP-CPU0") -- GENERATE_CPU_OBJECT(0x1a, SCKQ, "SCKCPUQ", CPUQ, "SCKQ-CPU0") -- GENERATE_CPU_OBJECT(0x1b, SCKR, "SCKCPUR", CPUR, "SCKR-CPU0") -- GENERATE_CPU_OBJECT(0x1c, SCKS, "SCKCPUS", CPUS, "SCKS-CPU0") -- GENERATE_CPU_OBJECT(0x1d, SCKT, "SCKCPUT", CPUT, "SCKT-CPU0") -- GENERATE_CPU_OBJECT(0x1e, SCKU, "SCKCPUU", CPUU, "SCKU-CPU0") -- GENERATE_CPU_OBJECT(0x1f, SCKV, "SCKCPUV", CPUV, "SCKV-CPU0") -+ GENERATE_CPU_OBJECT(0x00, SCK0, CPU0) -+ GENERATE_CPU_OBJECT(0x01, SCK1, CPU1) -+ GENERATE_CPU_OBJECT(0x02, SCK2, CPU2) -+ GENERATE_CPU_OBJECT(0x03, SCK3, CPU3) -+ GENERATE_CPU_OBJECT(0x04, SCK4, CPU4) -+ GENERATE_CPU_OBJECT(0x05, SCK5, CPU5) -+ GENERATE_CPU_OBJECT(0x06, SCK6, CPU6) -+ GENERATE_CPU_OBJECT(0x07, SCK7, CPU7) -+ GENERATE_CPU_OBJECT(0x08, SCK8, CPU8) -+ GENERATE_CPU_OBJECT(0x09, SCK9, CPU9) -+ GENERATE_CPU_OBJECT(0x0a, SCKA, CPUA) -+ GENERATE_CPU_OBJECT(0x0b, SCKB, CPUB) -+ GENERATE_CPU_OBJECT(0x0c, SCKC, CPUC) -+ GENERATE_CPU_OBJECT(0x0d, SCKD, CPUD) -+ GENERATE_CPU_OBJECT(0x0e, SCKE, CPUE) -+ GENERATE_CPU_OBJECT(0x0f, SCKF, CPUF) -+ GENERATE_CPU_OBJECT(0x10, SCKG, CPUG) -+ GENERATE_CPU_OBJECT(0x11, SCKH, CPUH) -+ GENERATE_CPU_OBJECT(0x12, SCKI, CPUI) -+ GENERATE_CPU_OBJECT(0x13, SCKJ, CPUJ) -+ GENERATE_CPU_OBJECT(0x14, SCKK, CPUK) -+ GENERATE_CPU_OBJECT(0x15, SCKL, CPUL) -+ GENERATE_CPU_OBJECT(0x16, SCKM, CPUM) -+ GENERATE_CPU_OBJECT(0x17, SCKN, CPUN) -+ GENERATE_CPU_OBJECT(0x18, SCKO, CPUO) -+ GENERATE_CPU_OBJECT(0x19, SCKP, CPUP) -+ GENERATE_CPU_OBJECT(0x1a, SCKQ, CPUQ) -+ GENERATE_CPU_OBJECT(0x1b, SCKR, CPUR) -+ GENERATE_CPU_OBJECT(0x1c, SCKS, CPUS) -+ GENERATE_CPU_OBJECT(0x1d, SCKT, CPUT) -+ GENERATE_CPU_OBJECT(0x1e, SCKU, CPUU) -+ GENERATE_CPU_OBJECT(0x1f, SCKV, CPUV) - - #undef GENERATE_CPU_OBJECT - } --- emulators/virtualbox-ose/files/patch-src_VBox_Devices_Storage_DrvHostBase-freebsd.cpp (revision 520061) +++ emulators/virtualbox-ose/files/patch-src_VBox_Devices_Storage_DrvHostBase-freebsd.cpp (nonexistent) @@ -1,10 +0,0 @@ ---- src/VBox/Devices/Storage/DrvHostBase-freebsd.cpp.orig 2017-10-18 07:11:48 UTC -+++ src/VBox/Devices/Storage/DrvHostBase-freebsd.cpp -@@ -24,6 +24,7 @@ - #include - #include - #include -+#include - #include - - /** Maximum buffer size supported by the CAM subsystem. */ --- emulators/virtualbox-ose/files/patch-src_VBox_Frontends_VBoxManage_VBoxManageHelp.cpp (revision 520061) +++ emulators/virtualbox-ose/files/patch-src_VBox_Frontends_VBoxManage_VBoxManageHelp.cpp (working copy) @@ -1,6 +1,15 @@ ---- src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp.orig 2016-08-16 19:59:52 UTC +--- src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp.orig 2019-11-21 17:01:16 UTC +++ src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp -@@ -797,7 +797,7 @@ void printUsage(USAGECATEGORY fCategory, +@@ -641,7 +641,7 @@ void printUsage(USAGECATEGORY enmCommand, uint64_t fSu + " file |\n" + " ]\n" + " [--uarttype<1-N> 16450|16550A|16750]\n" +-#if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS) ++#if defined(RT_OS_FREEBSD) || defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS) + " [--lpt<1-N> off| ]\n" + " [--lptmode<1-N> ]\n" + #endif +@@ -656,7 +656,7 @@ void printUsage(USAGECATEGORY enmCommand, uint64_t fSu RTStrmPrintf(pStrm, "|dsound"); #endif } @@ -9,10 +18,11 @@ { RTStrmPrintf(pStrm, "" #ifdef VBOX_WITH_AUDIO_OSS -@@ -811,22 +811,6 @@ void printUsage(USAGECATEGORY fCategory, +@@ -669,22 +669,6 @@ void printUsage(USAGECATEGORY enmCommand, uint64_t fSu + "|pulse" #endif ); - } +- } - if (fFreeBSD) - { -#ifdef VBOX_WITH_AUDIO_OSS @@ -28,7 +38,6 @@ -#ifdef VBOX_WITH_AUDIO_PULSE - RTStrmPrintf(pStrm, "|pulse"); -#endif -- } + } if (fDarwin) { - RTStrmPrintf(pStrm, "|coreaudio"); --- emulators/virtualbox-ose/files/patch-src_VBox_Frontends_VBoxManage_VBoxManageModifyVM.cpp (nonexistent) +++ emulators/virtualbox-ose/files/patch-src_VBox_Frontends_VBoxManage_VBoxManageModifyVM.cpp (working copy) @@ -0,0 +1,29 @@ +--- src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp.orig 2019-11-21 17:01:17 UTC ++++ src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp +@@ -153,7 +153,7 @@ enum + MODIFYVM_UARTMODE, + MODIFYVM_UARTTYPE, + MODIFYVM_UART, +-#if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS) ++#if defined(RT_OS_FREEBSD) || defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS) + MODIFYVM_LPTMODE, + MODIFYVM_LPT, + #endif +@@ -348,7 +348,7 @@ static const RTGETOPTDEF g_aModifyVMOptions[] = + { "--uartmode", MODIFYVM_UARTMODE, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX }, + { "--uarttype", MODIFYVM_UARTTYPE, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX }, + { "--uart", MODIFYVM_UART, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX }, +-#if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS) ++#if defined(RT_OS_FREEBSD) || defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS) + { "--lptmode", MODIFYVM_LPTMODE, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX }, + { "--lpt", MODIFYVM_LPT, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX }, + #endif +@@ -2269,7 +2269,7 @@ RTEXITCODE handleModifyVM(HandlerArg *a) + break; + } + +-#if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS) ++#if defined(RT_OS_FREEBSD) || defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS) + case MODIFYVM_LPTMODE: + { + ComPtr lpt; --- emulators/virtualbox-ose/files/patch-src_VBox_Frontends_VirtualBox_Makefile.kmk (revision 520061) +++ emulators/virtualbox-ose/files/patch-src_VBox_Frontends_VirtualBox_Makefile.kmk (working copy) @@ -1,14 +1,14 @@ ---- src/VBox/Frontends/VirtualBox/Makefile.kmk.orig 2017-10-18 07:12:20 UTC +--- src/VBox/Frontends/VirtualBox/Makefile.kmk.orig 2019-11-21 17:01:17 UTC +++ src/VBox/Frontends/VirtualBox/Makefile.kmk -@@ -895,6 +895,7 @@ if defined(VBOX_WITH_VIDEOHWACCEL) || defined(VBOX_GUI - VirtualBox_SOURCES += \ +@@ -1154,6 +1154,7 @@ if defined(VBOX_WITH_VIDEOHWACCEL) || defined(VBOX_GUI + src/VBox2DHelpers.cpp \ src/VBoxFBOverlay.cpp \ src/VBoxGLSupportInfo.cpp + VirtualBox_CXXFLAGS.freebsd += -std=c++11 endif - # -@@ -1217,6 +1218,7 @@ if defined(VBOX_WITH_VIDEOHWACCEL) + +@@ -1824,6 +1825,7 @@ if defined(VBOX_WITH_VIDEOHWACCEL) VBoxOGL2D_SOURCES = \ src/VBoxGLSupportInfo.cpp VBoxOGL2D_INCS = include --- emulators/virtualbox-ose/files/patch-src_VBox_GuestHost_OpenGL_include_chromium.h (revision 520061) +++ emulators/virtualbox-ose/files/patch-src_VBox_GuestHost_OpenGL_include_chromium.h (nonexistent) @@ -1,11 +0,0 @@ ---- src/VBox/GuestHost/OpenGL/include/chromium.h.orig 2018-05-09 16:38:12 UTC -+++ src/VBox/GuestHost/OpenGL/include/chromium.h -@@ -63,7 +63,7 @@ - #include - /* Quick fix so as not to update the version of glext.h we provide. */ - #ifdef GL_GLEXT_PROTOTYPES --# if defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) -+# if defined(RT_OS_FREEBSD) || defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) - GLAPI void APIENTRY glBindFramebuffer (GLenum, GLuint); - GLAPI void APIENTRY glBlitFramebuffer (GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum); - GLAPI GLenum APIENTRY glCheckFramebufferStatus (GLenum); --- emulators/virtualbox-ose/files/patch-src_VBox_HostDrivers_Support_SUPDrv.cpp (revision 520061) +++ emulators/virtualbox-ose/files/patch-src_VBox_HostDrivers_Support_SUPDrv.cpp (working copy) @@ -1,4 +1,4 @@ ---- src/VBox/HostDrivers/Support/SUPDrv.cpp.orig 2018-10-15 14:30:56 UTC +--- src/VBox/HostDrivers/Support/SUPDrv.cpp.orig 2019-11-21 17:01:59 UTC +++ src/VBox/HostDrivers/Support/SUPDrv.cpp @@ -104,7 +104,7 @@ /** @def SUPDRV_CHECK_SMAP_CHECK --- emulators/virtualbox-ose/files/patch-src_VBox_HostDrivers_Support_SUPDrvInternal.h (revision 520061) +++ emulators/virtualbox-ose/files/patch-src_VBox_HostDrivers_Support_SUPDrvInternal.h (working copy) @@ -1,6 +1,6 @@ ---- src/VBox/HostDrivers/Support/SUPDrvInternal.h.orig 2016-07-18 11:56:19 UTC +--- src/VBox/HostDrivers/Support/SUPDrvInternal.h.orig 2019-11-21 17:01:59 UTC +++ src/VBox/HostDrivers/Support/SUPDrvInternal.h -@@ -235,7 +235,7 @@ +@@ -211,7 +211,7 @@ # define SUPDRV_WITHOUT_MSR_PROBER #endif --- emulators/virtualbox-ose/files/patch-src_VBox_HostDrivers_Support_freebsd_Makefile (nonexistent) +++ emulators/virtualbox-ose/files/patch-src_VBox_HostDrivers_Support_freebsd_Makefile (working copy) @@ -0,0 +1,28 @@ +--- src/VBox/HostDrivers/Support/freebsd/Makefile.orig 2019-11-21 17:02:00 UTC ++++ src/VBox/HostDrivers/Support/freebsd/Makefile +@@ -82,6 +82,7 @@ SRCS += \ + assert.c \ + handletable.c \ + handletablectx.c \ ++ handletablesimple.c \ + once.c \ + term.c \ + thread.c +@@ -94,14 +95,15 @@ SRCS += \ + RTStrCopy.c \ + RTStrCopyEx.c \ + RTStrCopyP.c \ ++ memchr.c \ + strformat.c \ + strformatnum.c \ + strformatrt.c \ + strformattype.c \ ++ stringalloc.c \ + strprintf.c \ + strtonum.c \ +- memchr.c \ +- stringalloc.c ++ utf-8.c + + .PATH: ${.CURDIR}/common/rand + SRCS += \ --- emulators/virtualbox-ose/files/patch-src_VBox_HostDrivers_Support_freebsd_SUPDrv-freebsd.c (revision 520061) +++ emulators/virtualbox-ose/files/patch-src_VBox_HostDrivers_Support_freebsd_SUPDrv-freebsd.c (working copy) @@ -1,4 +1,4 @@ ---- src/VBox/HostDrivers/Support/freebsd/SUPDrv-freebsd.c.orig 2018-10-15 14:30:57 UTC +--- src/VBox/HostDrivers/Support/freebsd/SUPDrv-freebsd.c.orig 2019-11-21 17:02:00 UTC +++ src/VBox/HostDrivers/Support/freebsd/SUPDrv-freebsd.c @@ -46,6 +46,7 @@ #include @@ -47,31 +47,9 @@ /* * Configure character devices. Add symbolic links for compatibility. */ -@@ -311,7 +328,21 @@ static int VBoxDrvFreeBSDIOCtl(struct cdev *pDev, u_lo - PSUPDRVSESSION pSession; - devfs_get_cdevpriv((void **)&pSession); +@@ -324,6 +341,45 @@ static int VBoxDrvFreeBSDIOCtl(struct cdev *pDev, u_lo -+#ifdef VBOX_WITH_EFLAGS_AC_SET_IN_VBOXDRV - /* -+ * Refuse all I/O control calls if we've ever detected EFLAGS.AC being cleared. -+ * -+ * This isn't a problem, as there is absolutely nothing in the kernel context that -+ * depend on user context triggering cleanups. That would be pretty wild, right? -+ */ -+ if (RT_UNLIKELY(g_VBoxDrvFreeBSDDevExt.cBadContextCalls > 0)) -+ { -+ SUPR0Printf("VBoxDrvFreBSDIOCtl: EFLAGS.AC=0 detected %u times, refusing all I/O controls!\n", g_VBoxDrvFreeBSDDevExt.cBadContextCalls); -+ return ESPIPE; -+ } -+#endif -+ -+ /* - * Deal with the fast ioctl path first. - */ - if ( ( ulCmd == SUP_IOCTL_FAST_DO_RAW_RUN -@@ -325,6 +356,45 @@ static int VBoxDrvFreeBSDIOCtl(struct cdev *pDev, u_lo - /** + * Alternative Device I/O Control entry point on hosts with SMAP support. + * @@ -115,7 +93,7 @@ * Deal with the 'slow' I/O control requests. * * @returns 0 on success, appropriate errno on failure. -@@ -373,11 +443,10 @@ static int VBoxDrvFreeBSDIOCtlSlow(PSUPDRVSESSION pSes +@@ -372,11 +428,10 @@ static int VBoxDrvFreeBSDIOCtlSlow(PSUPDRVSESSION pSes */ SUPREQHDR Hdr; pvUser = *(void **)pvData; @@ -130,7 +108,7 @@ } if (RT_UNLIKELY((Hdr.fFlags & SUPREQHDR_FLAGS_MAGIC_MASK) != SUPREQHDR_FLAGS_MAGIC)) { -@@ -402,13 +471,12 @@ static int VBoxDrvFreeBSDIOCtlSlow(PSUPDRVSESSION pSes +@@ -401,13 +456,12 @@ static int VBoxDrvFreeBSDIOCtlSlow(PSUPDRVSESSION pSes OSDBGPRINT(("VBoxDrvFreeBSDIOCtlSlow: failed to allocate buffer of %d bytes; ulCmd=%#lx\n", cbReq, ulCmd)); return ENOMEM; } @@ -148,7 +126,7 @@ } if (Hdr.cbIn < cbReq) RT_BZERO((uint8_t *)pHdr + Hdr.cbIn, cbReq - Hdr.cbIn); -@@ -436,9 +504,8 @@ static int VBoxDrvFreeBSDIOCtlSlow(PSUPDRVSESSION pSes +@@ -435,9 +489,8 @@ static int VBoxDrvFreeBSDIOCtlSlow(PSUPDRVSESSION pSes OSDBGPRINT(("VBoxDrvFreeBSDIOCtlSlow: too much output! %#x > %#x; uCmd=%#lx!\n", cbOut, cbReq, ulCmd)); cbOut = cbReq; } @@ -160,7 +138,7 @@ Log(("VBoxDrvFreeBSDIOCtlSlow: returns %d / %d ulCmd=%lx\n", 0, pHdr->rc, ulCmd)); -@@ -541,8 +608,7 @@ bool VBOXCALL supdrvOSGetForcedAsyncTscMode(PSUPDRVDE +@@ -540,8 +593,7 @@ bool VBOXCALL supdrvOSGetForcedAsyncTscMode(PSUPDRVDE bool VBOXCALL supdrvOSAreCpusOfflinedOnSuspend(void) { @@ -170,7 +148,7 @@ } -@@ -616,11 +682,25 @@ int VBOXCALL supdrvOSMsrProberModify(RTCPUID idCpu, +@@ -624,11 +676,25 @@ int VBOXCALL supdrvOSMsrProberModify(RTCPUID idCpu, #endif /* SUPDRV_WITH_MSR_PROBER */ @@ -196,7 +174,7 @@ va_start(va, pszFormat); cch = RTStrPrintfV(szMsg, sizeof(szMsg), pszFormat, va); -@@ -628,12 +708,19 @@ SUPR0DECL(int) SUPR0Printf(const char *pszFormat, ...) +@@ -636,12 +702,19 @@ SUPR0DECL(int) SUPR0Printf(const char *pszFormat, ...) printf("%s", szMsg); --- emulators/virtualbox-ose/files/patch-src_VBox_HostDrivers_Support_freebsd_files__vboxdrv (nonexistent) +++ emulators/virtualbox-ose/files/patch-src_VBox_HostDrivers_Support_freebsd_files__vboxdrv (working copy) @@ -0,0 +1,28 @@ +--- src/VBox/HostDrivers/Support/freebsd/files_vboxdrv.orig 2019-11-21 17:02:00 UTC ++++ src/VBox/HostDrivers/Support/freebsd/files_vboxdrv +@@ -119,6 +119,7 @@ FILES_VBOXDRV_NOBIN=" \ + ${PATH_ROOT}/src/VBox/Runtime/common/misc/handletable.cpp=>common/misc/handletable.c \ + ${PATH_ROOT}/src/VBox/Runtime/common/misc/handletable.h=>common/misc/handletable.h \ + ${PATH_ROOT}/src/VBox/Runtime/common/misc/handletablectx.cpp=>common/misc/handletablectx.c \ ++ ${PATH_ROOT}/src/VBox/Runtime/common/misc/handletablesimple.cpp=>common/misc/handletablesimple.c \ + ${PATH_ROOT}/src/VBox/Runtime/common/misc/once.cpp=>common/misc/once.c \ + ${PATH_ROOT}/src/VBox/Runtime/common/misc/term.cpp=>common/misc/term.c \ + ${PATH_ROOT}/src/VBox/Runtime/common/misc/thread.cpp=>common/misc/thread.c \ +@@ -128,14 +129,15 @@ FILES_VBOXDRV_NOBIN=" \ + ${PATH_ROOT}/src/VBox/Runtime/common/string/RTStrCopyEx.cpp=>common/string/RTStrCopyEx.c \ + ${PATH_ROOT}/src/VBox/Runtime/common/string/RTStrNCmp.cpp=>common/string/RTStrNCmp.c \ + ${PATH_ROOT}/src/VBox/Runtime/common/string/RTStrNLen.cpp=>common/string/RTStrNLen.c \ ++ ${PATH_ROOT}/src/VBox/Runtime/common/string/memchr.cpp=>common/string/memchr.c \ + ${PATH_ROOT}/src/VBox/Runtime/common/string/strformat.cpp=>common/string/strformat.c \ + ${PATH_ROOT}/src/VBox/Runtime/common/string/strformatnum.cpp=>common/string/strformatnum.c \ + ${PATH_ROOT}/src/VBox/Runtime/common/string/strformatrt.cpp=>common/string/strformatrt.c \ + ${PATH_ROOT}/src/VBox/Runtime/common/string/strformattype.cpp=>common/string/strformattype.c \ ++ ${PATH_ROOT}/src/VBox/Runtime/common/string/stringalloc.cpp=>common/string/stringalloc.c \ + ${PATH_ROOT}/src/VBox/Runtime/common/string/strprintf.cpp=>common/string/strprintf.c \ + ${PATH_ROOT}/src/VBox/Runtime/common/string/strtonum.cpp=>common/string/strtonum.c \ +- ${PATH_ROOT}/src/VBox/Runtime/common/string/memchr.cpp=>common/string/memchr.c \ +- ${PATH_ROOT}/src/VBox/Runtime/common/string/stringalloc.cpp=>common/string/stringalloc.c \ ++ ${PATH_ROOT}/src/VBox/Runtime/common/string/utf-8.cpp=>common/string/utf-8.c \ + ${PATH_ROOT}/src/VBox/Runtime/common/rand/rand.cpp=>common/rand/rand.c \ + ${PATH_ROOT}/src/VBox/Runtime/common/rand/randadv.cpp=>common/rand/randadv.c \ + ${PATH_ROOT}/src/VBox/Runtime/common/rand/randparkmiller.cpp=>common/rand/randparkmiller.c \ --- emulators/virtualbox-ose/files/patch-src_VBox_HostDrivers_VBoxNetAdp_Makefile.kmk (nonexistent) +++ emulators/virtualbox-ose/files/patch-src_VBox_HostDrivers_VBoxNetAdp_Makefile.kmk (working copy) @@ -0,0 +1,20 @@ +--- src/VBox/HostDrivers/VBoxNetAdp/Makefile.kmk.orig 2019-11-21 17:02:02 UTC ++++ src/VBox/HostDrivers/VBoxNetAdp/Makefile.kmk +@@ -206,10 +206,14 @@ $$(VBoxNetAdp-src_0_OUTDIR)/Makefile: \ + $$(if $$(eq $$(VBoxNetAdp/freebsd/Makefile_VBOX_HARDENED),$$(VBOX_WITH_HARDENING)),,FORCE) \ + | $$(dir $$@) + $(QUIET)$(RM) -f -- $@ +- ifndef VBOX_WITH_HARDENING +- $(QUIET)$(SED) -e "s;VBOX_WITH_HARDENING;;g" --output $@ $< +- else + $(QUIET)$(CP) -f $< $@ ++ ifndef VBOX_WITH_HARDENING ++ $(QUIET)$(SED) -e "s;-DVBOX_WITH_HARDENING;;g" --output $@.tmp $@ ++ $(QUIET)$(MV) -f $@.tmp $@ ++ endif ++ ifndef VBOX_WITH_NETFLT_VIMAGE ++ $(QUIET)$(SED) -e "s;-DVIMAGE;;g" --output $@.tmp $@ ++ $(QUIET)$(MV) -f $@.tmp $@ + endif + + endif # freebsd --- emulators/virtualbox-ose/files/patch-src_VBox_HostDrivers_VBoxNetAdp_freebsd_Makefile (nonexistent) +++ emulators/virtualbox-ose/files/patch-src_VBox_HostDrivers_VBoxNetAdp_freebsd_Makefile (working copy) @@ -0,0 +1,11 @@ +--- src/VBox/HostDrivers/VBoxNetAdp/freebsd/Makefile.orig 2019-11-21 17:02:02 UTC ++++ src/VBox/HostDrivers/VBoxNetAdp/freebsd/Makefile +@@ -26,7 +26,7 @@ + + KMOD = vboxnetadp + +-CFLAGS += -DRT_OS_FREEBSD -DIN_RING0 -DIN_RT_R0 -DIN_SUP_R0 -DVBOX -DRT_WITH_VBOX -Iinclude -I. -Ir0drv -w -DVBOX_WITH_HARDENING -DVIMAGE ++CFLAGS += -DRT_OS_FREEBSD -DIN_RING0 -DIN_RT_R0 -DIN_SUP_R0 -DVBOX -DRT_WITH_VBOX -DVBOX_WITH_HARDENING -DVBOX_WITH_64_BITS_GUESTS -DVIMAGE -Iinclude -I. -Ir0drv -w + + .if (${MACHINE_ARCH} == "i386") + CFLAGS += -DRT_ARCH_X86 --- emulators/virtualbox-ose/files/patch-src_VBox_HostDrivers_VBoxNetFlt_Makefile.kmk (nonexistent) +++ emulators/virtualbox-ose/files/patch-src_VBox_HostDrivers_VBoxNetFlt_Makefile.kmk (working copy) @@ -0,0 +1,11 @@ +--- src/VBox/HostDrivers/VBoxNetFlt/Makefile.kmk.orig 2019-11-21 17:02:02 UTC ++++ src/VBox/HostDrivers/VBoxNetFlt/Makefile.kmk +@@ -565,7 +565,7 @@ $(PATH_OUT)/opt_netgraph.h: + $(QUIET)$(RM) -f -- $@ + $(QUIET)$(CP) -f $< $@ + ifndef VBOX_WITH_HARDENING +- $(QUIET)$(SED) -e "s;VBOX_WITH_HARDENING;;g" --output $@.tmp $@ ++ $(QUIET)$(SED) -e "s;-DVBOX_WITH_HARDENING;;g" --output $@.tmp $@ + ${QUIET}$(MV) -f $@.tmp $@ + endif + ifndef VBOX_WITH_NETFLT_VIMAGE --- emulators/virtualbox-ose/files/patch-src_VBox_HostDrivers_VBoxNetFlt_freebsd_Makefile (nonexistent) +++ emulators/virtualbox-ose/files/patch-src_VBox_HostDrivers_VBoxNetFlt_freebsd_Makefile (working copy) @@ -0,0 +1,11 @@ +--- src/VBox/HostDrivers/VBoxNetFlt/freebsd/Makefile.orig 2019-11-21 17:02:02 UTC ++++ src/VBox/HostDrivers/VBoxNetFlt/freebsd/Makefile +@@ -26,7 +26,7 @@ + + KMOD = vboxnetflt + +-CFLAGS += -DRT_OS_FREEBSD -DIN_RING0 -DIN_RT_R0 -DIN_SUP_R0 -DVBOX -DRT_WITH_VBOX -Iinclude -I. -Ir0drv -w -DVBOX_WITH_HARDENING -DVIMAGE ++CFLAGS += -DRT_OS_FREEBSD -DIN_RING0 -DIN_RT_R0 -DIN_SUP_R0 -DVBOX -DRT_WITH_VBOX -DVBOX_WITH_HARDENING -DVBOX_WITH_64_BITS_GUESTS -DVIMAGE -Iinclude -I. -Ir0drv -w + + .if (${MACHINE_ARCH} == "i386") + CFLAGS += -DRT_ARCH_X86 --- emulators/virtualbox-ose/files/patch-src_VBox_HostDrivers_VBoxNetFlt_freebsd_VBoxNetFlt-freebsd.c (nonexistent) +++ emulators/virtualbox-ose/files/patch-src_VBox_HostDrivers_VBoxNetFlt_freebsd_VBoxNetFlt-freebsd.c (working copy) @@ -0,0 +1,249 @@ +--- src/VBox/HostDrivers/VBoxNetFlt/freebsd/VBoxNetFlt-freebsd.c.orig 2019-11-21 17:02:02 UTC ++++ src/VBox/HostDrivers/VBoxNetFlt/freebsd/VBoxNetFlt-freebsd.c +@@ -52,6 +52,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -73,6 +74,7 @@ + + #define VBOXNETFLT_OS_SPECFIC 1 + #include "../VBoxNetFltInternal.h" ++#include "freebsd/the-freebsd-kernel.h" + + static int vboxnetflt_modevent(struct module *, int, void *); + static ng_constructor_t ng_vboxnetflt_constructor; +@@ -436,6 +438,8 @@ static void vboxNetFltFreeBSDinput(void *arg, int pend + struct ifnet *ifp = pThis->u.s.ifp; + unsigned int cSegs = 0; + bool fDropIt = false, fActive; ++ bool is_vl_tagged = false; ++ uint16_t vl_tag; + PINTNETSG pSG; + + VBOXCURVNET_SET(ifp->if_vnet); +@@ -448,6 +452,19 @@ static void vboxNetFltFreeBSDinput(void *arg, int pend + if (m == NULL) + break; + ++ /* Prepend a VLAN header for consumption by the virtual switch */ ++ if (m->m_flags & M_VLANTAG) { ++ vl_tag = m->m_pkthdr.ether_vtag; ++ is_vl_tagged = true; ++ ++ m = ether_vlanencap(m, m->m_pkthdr.ether_vtag); ++ if (m == NULL) { ++ printf("vboxflt: unable to prepend VLAN header\n"); ++ break; ++ } ++ m->m_flags &= ~M_VLANTAG; ++ } ++ + for (m0 = m; m0 != NULL; m0 = m0->m_next) + if (m0->m_len > 0) + cSegs++; +@@ -462,6 +479,27 @@ static void vboxNetFltFreeBSDinput(void *arg, int pend + vboxNetFltFreeBSDMBufToSG(pThis, m, pSG, cSegs, 0); + fDropIt = pThis->pSwitchPort->pfnRecv(pThis->pSwitchPort, NULL /* pvIf */, pSG, INTNETTRUNKDIR_WIRE); + RTMemTmpFree(pSG); ++ ++ /* Restore the VLAN flags before re-injecting the packet */ ++ if (is_vl_tagged && !fDropIt) { ++ struct ether_vlan_header *vl_hdr; ++ ++ /* This shouldn't fail, as the header was just prepended */ ++ if (m->m_len < sizeof(*vl_hdr) && (m = m_pullup(m, sizeof(*vl_hdr))) == NULL) { ++ printf("vboxflt: unable to pullup VLAN header\n"); ++ m_freem(m); ++ break; ++ } ++ ++ /* Copy the MAC dhost/shost over the 802.1q field */ ++ vl_hdr = mtod(m, struct ether_vlan_header *); ++ bcopy((char *)vl_hdr, (char *)vl_hdr + ETHER_VLAN_ENCAP_LEN, ETHER_HDR_LEN - ETHER_TYPE_LEN); ++ m_adj(m, ETHER_VLAN_ENCAP_LEN); ++ ++ m->m_pkthdr.ether_vtag = vl_tag; ++ m->m_flags |= M_VLANTAG; ++ } ++ + if (fDropIt) + m_freem(m); + else +@@ -521,6 +559,7 @@ static void vboxNetFltFreeBSDoutput(void *arg, int pen + */ + int vboxNetFltPortOsXmit(PVBOXNETFLTINS pThis, void *pvIfData, PINTNETSG pSG, uint32_t fDst) + { ++ IPRT_FREEBSD_SAVE_EFL_AC(); + NOREF(pvIfData); + + void (*input_f)(struct ifnet *, struct mbuf *); +@@ -537,10 +576,16 @@ int vboxNetFltPortOsXmit(PVBOXNETFLTINS pThis, void *p + { + m = vboxNetFltFreeBSDSGMBufFromSG(pThis, pSG); + if (m == NULL) ++ { ++ IPRT_FREEBSD_RESTORE_EFL_AC(); + return VERR_NO_MEMORY; ++ } + m = m_pullup(m, ETHER_HDR_LEN); + if (m == NULL) ++ { ++ IPRT_FREEBSD_RESTORE_EFL_AC(); + return VERR_NO_MEMORY; ++ } + + m->m_flags |= M_PKTHDR; + ether_output_frame(ifp, m); +@@ -550,10 +595,16 @@ int vboxNetFltPortOsXmit(PVBOXNETFLTINS pThis, void *p + { + m = vboxNetFltFreeBSDSGMBufFromSG(pThis, pSG); + if (m == NULL) ++ { ++ IPRT_FREEBSD_RESTORE_EFL_AC(); + return VERR_NO_MEMORY; ++ } + m = m_pullup(m, ETHER_HDR_LEN); + if (m == NULL) ++ { ++ IPRT_FREEBSD_RESTORE_EFL_AC(); + return VERR_NO_MEMORY; ++ } + /* + * Delivering packets to the host will be captured by the + * input hook. Tag the packet with a mbuf tag so that we +@@ -564,6 +615,7 @@ int vboxNetFltPortOsXmit(PVBOXNETFLTINS pThis, void *p + if (mtag == NULL) + { + m_freem(m); ++ IPRT_FREEBSD_RESTORE_EFL_AC(); + return VERR_NO_MEMORY; + } + +@@ -574,6 +626,7 @@ int vboxNetFltPortOsXmit(PVBOXNETFLTINS pThis, void *p + ifp->if_input(ifp, m); + } + VBOXCURVNET_RESTORE(); ++ IPRT_FREEBSD_RESTORE_EFL_AC(); + return VINF_SUCCESS; + } + +@@ -586,6 +639,7 @@ static bool vboxNetFltFreeBsdIsPromiscuous(PVBOXNETFLT + + int vboxNetFltOsInitInstance(PVBOXNETFLTINS pThis, void *pvContext) + { ++ IPRT_FREEBSD_SAVE_EFL_AC(); + char nam[NG_NODESIZ]; + struct ifnet *ifp; + node_p node; +@@ -594,7 +648,10 @@ int vboxNetFltOsInitInstance(PVBOXNETFLTINS pThis, voi + NOREF(pvContext); + ifp = ifunit(pThis->szName); + if (ifp == NULL) ++ { ++ IPRT_FREEBSD_RESTORE_EFL_AC(); + return VERR_INTNET_FLT_IF_NOT_FOUND; ++ } + + /* Create a new netgraph node for this instance */ + if (ng_make_node_common(&ng_vboxnetflt_typestruct, &node) != 0) +@@ -638,12 +695,14 @@ int vboxNetFltOsInitInstance(PVBOXNETFLTINS pThis, voi + vboxNetFltRelease(pThis, true /*fBusy*/); + } + VBOXCURVNET_RESTORE(); ++ IPRT_FREEBSD_RESTORE_EFL_AC(); + + return VINF_SUCCESS; + } + + bool vboxNetFltOsMaybeRediscovered(PVBOXNETFLTINS pThis) + { ++ IPRT_FREEBSD_SAVE_EFL_AC(); + struct ifnet *ifp, *ifp0; + + ifp = ASMAtomicUoReadPtrT(&pThis->u.s.ifp, struct ifnet *); +@@ -660,6 +719,7 @@ bool vboxNetFltOsMaybeRediscovered(PVBOXNETFLTINS pThi + pThis->u.s.node = NULL; + } + VBOXCURVNET_RESTORE(); ++ IPRT_FREEBSD_RESTORE_EFL_AC(); + + if (ifp0 != NULL) + { +@@ -672,6 +732,7 @@ bool vboxNetFltOsMaybeRediscovered(PVBOXNETFLTINS pThi + + void vboxNetFltOsDeleteInstance(PVBOXNETFLTINS pThis) + { ++ IPRT_FREEBSD_SAVE_EFL_AC(); + + taskqueue_drain(taskqueue_fast, &pThis->u.s.tskin); + taskqueue_drain(taskqueue_fast, &pThis->u.s.tskout); +@@ -684,6 +745,7 @@ void vboxNetFltOsDeleteInstance(PVBOXNETFLTINS pThis) + ng_rmnode_self(pThis->u.s.node); + VBOXCURVNET_RESTORE(); + pThis->u.s.node = NULL; ++ IPRT_FREEBSD_RESTORE_EFL_AC(); + } + + int vboxNetFltOsPreInitInstance(PVBOXNETFLTINS pThis) +@@ -697,6 +759,7 @@ int vboxNetFltOsPreInitInstance(PVBOXNETFLTINS pThis) + + void vboxNetFltPortOsSetActive(PVBOXNETFLTINS pThis, bool fActive) + { ++ IPRT_FREEBSD_SAVE_EFL_AC(); + struct ifnet *ifp; + struct ifreq ifreq; + int error; +@@ -730,7 +793,10 @@ void vboxNetFltPortOsSetActive(PVBOXNETFLTINS pThis, b + NG_MKMESSAGE(msg, NGM_GENERIC_COOKIE, NGM_CONNECT, + sizeof(struct ngm_connect), M_NOWAIT); + if (msg == NULL) ++ { ++ IPRT_FREEBSD_RESTORE_EFL_AC(); + return; ++ } + con = (struct ngm_connect *)msg->data; + snprintf(con->path, NG_PATHSIZ, "vboxnetflt_%s:", ifp->if_xname); + strlcpy(con->ourhook, "lower", NG_HOOKSIZ); +@@ -744,7 +810,10 @@ void vboxNetFltPortOsSetActive(PVBOXNETFLTINS pThis, b + NG_MKMESSAGE(msg, NGM_GENERIC_COOKIE, NGM_CONNECT, + sizeof(struct ngm_connect), M_NOWAIT); + if (msg == NULL) ++ { ++ IPRT_FREEBSD_RESTORE_EFL_AC(); + return; ++ } + con = (struct ngm_connect *)msg->data; + snprintf(con->path, NG_PATHSIZ, "vboxnetflt_%s:", + ifp->if_xname); +@@ -767,7 +836,10 @@ void vboxNetFltPortOsSetActive(PVBOXNETFLTINS pThis, b + NG_MKMESSAGE(msg, NGM_GENERIC_COOKIE, NGM_RMHOOK, + sizeof(struct ngm_rmhook), M_NOWAIT); + if (msg == NULL) ++ { ++ IPRT_FREEBSD_RESTORE_EFL_AC(); + return; ++ } + rm = (struct ngm_rmhook *)msg->data; + strlcpy(rm->ourhook, "input", NG_HOOKSIZ); + NG_SEND_MSG_PATH(error, node, msg, path, 0); +@@ -778,12 +850,16 @@ void vboxNetFltPortOsSetActive(PVBOXNETFLTINS pThis, b + NG_MKMESSAGE(msg, NGM_GENERIC_COOKIE, NGM_RMHOOK, + sizeof(struct ngm_rmhook), M_NOWAIT); + if (msg == NULL) ++ { ++ IPRT_FREEBSD_RESTORE_EFL_AC(); + return; ++ } + rm = (struct ngm_rmhook *)msg->data; + strlcpy(rm->ourhook, "output", NG_HOOKSIZ); + NG_SEND_MSG_PATH(error, node, msg, path, 0); + } + VBOXCURVNET_RESTORE(); ++ IPRT_FREEBSD_RESTORE_EFL_AC(); + } + + int vboxNetFltOsDisconnectIt(PVBOXNETFLTINS pThis) --- emulators/virtualbox-ose/files/patch-src_VBox_HostDrivers_VBoxNetFlt_freebsd_files__vboxnetflt (nonexistent) +++ emulators/virtualbox-ose/files/patch-src_VBox_HostDrivers_VBoxNetFlt_freebsd_files__vboxnetflt (working copy) @@ -0,0 +1,10 @@ +--- src/VBox/HostDrivers/VBoxNetFlt/freebsd/files_vboxnetflt.orig 2019-11-21 17:02:02 UTC ++++ src/VBox/HostDrivers/VBoxNetFlt/freebsd/files_vboxnetflt +@@ -62,6 +62,7 @@ VBOX_VBOXNETFLT_SOURCES=" \ + ${PATH_ROOT}/include/iprt/uni.h=>include/iprt/uni.h \ + ${PATH_ROOT}/include/iprt/utf16.h=>include/iprt/utf16.h \ + ${PATH_ROOT}/include/iprt/uuid.h=>include/iprt/uuid.h \ ++ ${PATH_ROOT}/include/iprt/x86.h=>include/iprt/x86.h \ + ${PATH_ROOT}/include/iprt/nocrt/limits.h=>include/iprt/nocrt/limits.h \ + ${PATH_ROOT}/include/VBox/cdefs.h=>include/VBox/cdefs.h \ + ${PATH_ROOT}/include/VBox/err.h=>include/VBox/err.h \ --- emulators/virtualbox-ose/files/patch-src_VBox_HostServices_SharedOpenGL_Makefile.kmk (revision 520061) +++ emulators/virtualbox-ose/files/patch-src_VBox_HostServices_SharedOpenGL_Makefile.kmk (nonexistent) @@ -1,10 +0,0 @@ ---- src/VBox/HostServices/SharedOpenGL/Makefile.kmk.orig 2017-10-18 07:12:48 UTC -+++ src/VBox/HostServices/SharedOpenGL/Makefile.kmk -@@ -436,6 +436,7 @@ if ( defined(VBOX_WITH_QTGUI) \ - $(if $(VBOX_WITH_CROGL), VBOX_WITH_CROGL,) \ - $(if $(VBOX_WITH_VIDEOHWACCEL), VBOX_WITH_VIDEOHWACCEL,) - ifdef VBOX_WITH_VIDEOHWACCEL -+ VBoxTestOGL_CXXFLAGS.freebsd += -std=c++11 - VBoxTestOGL_QT_MODULES += Core Gui OpenGL Widgets - VBoxTestOGL_LIBS.linux += xcb - VBoxTestOGL_LIBS.solaris += xcb --- emulators/virtualbox-ose/files/patch-src_VBox_Installer_Makefile.kmk (nonexistent) +++ emulators/virtualbox-ose/files/patch-src_VBox_Installer_Makefile.kmk (working copy) @@ -0,0 +1,14 @@ +--- src/VBox/Installer/Makefile.kmk.orig 2019-11-21 17:02:08 UTC ++++ src/VBox/Installer/Makefile.kmk +@@ -41,9 +41,11 @@ ifndef VBOX_ONLY_SDK + if "$(KBUILD_TARGET)" == "win" && "$(KBUILD_HOST)" == "win" + include $(PATH_SUB_CURRENT)/win/Makefile.kmk + endif ++if 0 + if "$(KBUILD_TARGET)" == "freebsd" && "$(KBUILD_HOST)" == "freebsd" + include $(PATH_SUB_CURRENT)/freebsd/Makefile.kmk + endif ++endif + endif + + include $(PATH_SUB_CURRENT)/common/Makefile.kmk --- emulators/virtualbox-ose/files/patch-src_VBox_Installer_freebsd_VBox.sh (nonexistent) +++ emulators/virtualbox-ose/files/patch-src_VBox_Installer_freebsd_VBox.sh (working copy) @@ -0,0 +1,73 @@ +--- src/VBox/Installer/freebsd/VBox.sh.orig 2019-12-03 22:23:10 UTC ++++ src/VBox/Installer/freebsd/VBox.sh +@@ -0,0 +1,70 @@ ++#!/bin/sh ++# ++# Oracle VM VirtualBox startup script, FreeBSD hosts. ++# ++# Copyright (C) 2006-2012 Oracle Corporation ++# ++# This file is part of VirtualBox Open Source Edition (OSE), as ++# available from http://www.virtualbox.org. This file is free software; ++# you can redistribute it and/or modify it under the terms of the GNU ++# General Public License (GPL) as published by the Free Software ++# Foundation, in version 2 as it comes in the "COPYING" file of the ++# VirtualBox OSE distribution. VirtualBox OSE is distributed in the ++# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. ++# ++ ++PATH="/usr/bin:/bin:/usr/sbin:/sbin" ++CONFIG="/usr/local/etc/vbox/vbox.cfg" ++ ++test -r "${CONFIG}" && ++ . "${CONFIG}" ++test -z "${INSTALL_DIR}" && ++ if test -d /usr/local/lib/virtualbox && ++ test -f /usr/local/lib/virtualbox/VBoxRT.so; then ++ INSTALL_DIR=/usr/local/lib/virtualbox ++ else ++ echo "Could not find VirtualBox installation. Please reinstall." ++ exit 1 ++ fi ++ ++# workaround for the KDE dialog problem ++KDE_FORK_SLAVES=1; export KDE_FORK_SLAVES ++ ++APP=`basename $0` ++case "$APP" in ++ VirtualBox|virtualbox) ++ exec "$INSTALL_DIR/VirtualBox" "$@" ++ ;; ++ VirtualBoxVM|virtualboxvm) ++ exec "$INSTALL_DIR/VirtualBoxVM" "$@" ++ ;; ++ VBoxManage|vboxmanage) ++ exec "$INSTALL_DIR/VBoxManage" "$@" ++ ;; ++ VBoxSDL|vboxsdl) ++ exec "$INSTALL_DIR/VBoxSDL" "$@" ++ ;; ++ VBoxVRDP|VBoxHeadless|vboxheadless) ++ exec "$INSTALL_DIR/VBoxHeadless" "$@" ++ ;; ++ VBoxAutostart|vboxautostart) ++ exec "$INSTALL_DIR/VBoxAutostart" "$@" ++ ;; ++ VBoxBalloonCtrl|vboxballoonctrl) ++ exec "$INSTALL_DIR/VBoxBalloonCtrl" "$@" ++ ;; ++ VBoxBugReport|vboxbugreport) ++ exec "$INSTALL_DIR/VBoxBugReport" "$@" ++ ;; ++ vbox-img) ++ exec "$INSTALL_DIR/vbox-img" "$@" ++ ;; ++ vboxwebsrv) ++ exec "$INSTALL_DIR/vboxwebsrv" "$@" ++ ;; ++ *) ++ echo "Unknown application - $APP" ++ exit 1 ++ ;; ++esac ++exit 0 --- emulators/virtualbox-ose/files/patch-src_VBox_Installer_freebsd_virtualbox.desktop (nonexistent) +++ emulators/virtualbox-ose/files/patch-src_VBox_Installer_freebsd_virtualbox.desktop (working copy) @@ -0,0 +1,10 @@ +--- src/VBox/Installer/freebsd/virtualbox.desktop.orig 2019-11-21 17:02:08 UTC ++++ src/VBox/Installer/freebsd/virtualbox.desktop +@@ -7,7 +7,6 @@ GenericName=Virtual Machine + Type=Application + Exec=VirtualBox + TryExec=VirtualBox +-DocPath=file://$VBOX_DOC_PATH/UserManual.pdf + Icon=VBox + Categories=Emulator;System; + Comment=Run several virtual systems on a single host computer --- emulators/virtualbox-ose/files/patch-src_VBox_Main_Makefile.kmk (revision 520061) +++ emulators/virtualbox-ose/files/patch-src_VBox_Main_Makefile.kmk (working copy) @@ -1,6 +1,6 @@ ---- src/VBox/Main/Makefile.kmk.orig 2017-03-08 17:20:11 UTC +--- src/VBox/Main/Makefile.kmk.orig 2019-11-21 17:02:12 UTC +++ src/VBox/Main/Makefile.kmk -@@ -445,6 +445,7 @@ VBoxSVC_SOURCES.os2 = \ +@@ -640,6 +640,7 @@ VBoxSVC_SOURCES.os2 = \ VBoxSVC_SOURCES.freebsd = \ src-server/freebsd/HostHardwareFreeBSD.cpp \ --- emulators/virtualbox-ose/files/patch-src_VBox_Main_include_HostPower.h (revision 520061) +++ emulators/virtualbox-ose/files/patch-src_VBox_Main_include_HostPower.h (working copy) @@ -1,6 +1,6 @@ ---- src/VBox/Main/include/HostPower.h.orig 2017-10-18 07:12:54 UTC +--- src/VBox/Main/include/HostPower.h.orig 2019-11-21 17:02:14 UTC +++ src/VBox/Main/include/HostPower.h -@@ -28,7 +28,7 @@ +@@ -31,7 +31,7 @@ #include @@ -9,7 +9,7 @@ # include #endif -@@ -64,7 +64,7 @@ class HostPowerServiceWin : public HostPowerService (p +@@ -67,7 +67,7 @@ class HostPowerServiceWin : public HostPowerService (p RTTHREAD mThread; }; # endif --- emulators/virtualbox-ose/files/patch-src_VBox_Main_include_USBProxyBackend.h (revision 520061) +++ emulators/virtualbox-ose/files/patch-src_VBox_Main_include_USBProxyBackend.h (nonexistent) @@ -1,17 +0,0 @@ ---- src/VBox/Main/include/USBProxyBackend.h.orig 2017-01-17 07:27:19 UTC -+++ src/VBox/Main/include/USBProxyBackend.h -@@ -359,13 +359,10 @@ public: - virtual int releaseDevice(HostUSBDevice *aDevice); - - protected: -- int initUsbfs(void); -- int initSysfs(void); - virtual int wait(RTMSINTERVAL aMillies); - virtual int interruptWait(void); - virtual PUSBDEVICE getDevices(void); -- int addDeviceToChain(PUSBDEVICE pDev, PUSBDEVICE *ppFirst, PUSBDEVICE **pppNext, int rc); -- virtual void deviceAdded(ComObjPtr &aDevice, SessionMachinesList &llOpenedMachines, PUSBDEVICE aUSBDevice); -+ virtual bool isFakeUpdateRequired(); - - private: - RTSEMEVENT mNotifyEventSem; --- emulators/virtualbox-ose/files/patch-src_VBox_Main_src-all_Global.cpp (nonexistent) +++ emulators/virtualbox-ose/files/patch-src_VBox_Main_src-all_Global.cpp (working copy) @@ -0,0 +1,24 @@ +--- src/VBox/Main/src-all/Global.cpp.orig 2019-11-21 17:02:16 UTC ++++ src/VBox/Main/src-all/Global.cpp +@@ -364,14 +364,15 @@ const Global::OSType Global::sOSTypes[] = + StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97, AudioCodecType_STAC9700 }, + + { "BSD", "BSD", "FreeBSD", "FreeBSD (32-bit)", +- VBOXOSTYPE_FreeBSD, VBOXOSHINT_NONE, +- 1024, 16, 2 * _1G64, GraphicsControllerType_VBoxVGA, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, +- StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_AC97, AudioCodecType_STAC9700 }, ++ VBOXOSTYPE_FreeBSD, VBOXOSHINT_RTCUTC | VBOXOSHINT_PAE | VBOXOSHINT_X2APIC, ++ 1024, 16, 10 * _1G64, GraphicsControllerType_VMSVGA, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, ++ StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97, AudioCodecType_STAC9700 }, + + { "BSD", "BSD", "FreeBSD_64", "FreeBSD (64-bit)", +- VBOXOSTYPE_FreeBSD_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC, +- 1024, 16, 16 * _1G64, GraphicsControllerType_VBoxVGA, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, +- StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_AC97, AudioCodecType_STAC9700 }, ++ VBOXOSTYPE_FreeBSD_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC ++ | VBOXOSHINT_X2APIC, ++ 1024, 16, 10 * _1G64, GraphicsControllerType_VMSVGA, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, ++ StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97, AudioCodecType_STAC9700 }, + + { "BSD", "BSD", "OpenBSD", "OpenBSD (32-bit)", + VBOXOSTYPE_OpenBSD, VBOXOSHINT_HWVIRTEX, --- emulators/virtualbox-ose/files/patch-src_VBox_Main_src-client_ConsoleImpl2.cpp (revision 520061) +++ emulators/virtualbox-ose/files/patch-src_VBox_Main_src-client_ConsoleImpl2.cpp (nonexistent) @@ -1,20 +0,0 @@ ---- src/VBox/Main/src-client/ConsoleImpl2.cpp.orig 2017-10-18 07:12:56 UTC -+++ src/VBox/Main/src-client/ConsoleImpl2.cpp -@@ -5206,7 +5206,7 @@ int Console::i_configNetwork(const char *pszDevice, - { - switch (hrc) - { -- case VERR_ACCESS_DENIED: -+ case (HRESULT)VERR_ACCESS_DENIED: - return VMSetError(VMR3GetVM(mpUVM), VERR_HOSTIF_INIT_FAILED, RT_SRC_POS, N_( - "Failed to open '/dev/net/tun' for read/write access. Please check the " - "permissions of that node. Either run 'chmod 0666 /dev/net/tun' or " -@@ -5408,7 +5408,7 @@ int Console::i_configNetwork(const char *pszDevice, - { - switch (hrc) - { -- case VERR_ACCESS_DENIED: -+ case (HRESULT)VERR_ACCESS_DENIED: - return VMSetError(VMR3GetVM(mpUVM), VERR_HOSTIF_INIT_FAILED, RT_SRC_POS, N_( - "Failed to open '/dev/%s' for read/write access. Please check the " - "permissions of that node, and that the net.link.tap.user_open " --- emulators/virtualbox-ose/files/patch-src_VBox_Main_src-server_HostImpl.cpp (revision 520061) +++ emulators/virtualbox-ose/files/patch-src_VBox_Main_src-server_HostImpl.cpp (working copy) @@ -1,6 +1,6 @@ ---- src/VBox/Main/src-server/HostImpl.cpp.orig 2017-03-08 17:20:14 UTC +--- src/VBox/Main/src-server/HostImpl.cpp.orig 2019-11-21 17:02:19 UTC +++ src/VBox/Main/src-server/HostImpl.cpp -@@ -293,7 +293,7 @@ HRESULT Host::init(VirtualBox *aParent) +@@ -286,7 +286,7 @@ HRESULT Host::init(VirtualBox *aParent) #if defined(RT_OS_WINDOWS) m->pHostPowerService = new HostPowerServiceWin(m->pParent); --- emulators/virtualbox-ose/files/patch-src_VBox_Main_src-server_VirtualBoxImpl.cpp (nonexistent) +++ emulators/virtualbox-ose/files/patch-src_VBox_Main_src-server_VirtualBoxImpl.cpp (working copy) @@ -0,0 +1,11 @@ +--- src/VBox/Main/src-server/VirtualBoxImpl.cpp.orig 2019-11-21 17:02:20 UTC ++++ src/VBox/Main/src-server/VirtualBoxImpl.cpp +@@ -2655,7 +2655,7 @@ int VirtualBox::i_encryptSettingBytes(const uint8_t *a + if (aCiphertextSize < 32) + return VERR_INVALID_PARAMETER; + +- AssertCompile(sizeof(m->SettingsCipherKey) >= 32); ++ // AssertCompile(sizeof(m->SettingsCipherKey) >= 32); + + /* store the first 8 bytes of the cipherkey for verification */ + for (i = 0, j = 0; i < 8; i++, j++) --- emulators/virtualbox-ose/files/patch-src_VBox_Main_src-server_freebsd_NetIf-freebsd.cpp (revision 520061) +++ emulators/virtualbox-ose/files/patch-src_VBox_Main_src-server_freebsd_NetIf-freebsd.cpp (nonexistent) @@ -1,19 +0,0 @@ ---- src/VBox/Main/src-server/freebsd/NetIf-freebsd.cpp.orig 2017-10-18 07:12:58 UTC -+++ src/VBox/Main/src-server/freebsd/NetIf-freebsd.cpp -@@ -43,6 +43,7 @@ - - #include - #include -+#include - - #include - #include -@@ -311,7 +312,7 @@ int NetIfList(std::list wireless = isWireless(pNew->szName); -+ pNew->fWireless = isWireless(pNew->szName); - - ComObjPtr IfObj; - IfObj.createObject(); --- emulators/virtualbox-ose/files/patch-src_VBox_Main_src-server_freebsd_PerformanceFreeBSD.cpp (revision 520061) +++ emulators/virtualbox-ose/files/patch-src_VBox_Main_src-server_freebsd_PerformanceFreeBSD.cpp (working copy) @@ -1,4 +1,4 @@ ---- src/VBox/Main/src-server/freebsd/PerformanceFreeBSD.cpp.orig 2017-07-27 13:18:27 UTC +--- src/VBox/Main/src-server/freebsd/PerformanceFreeBSD.cpp.orig 2019-11-21 17:02:20 UTC +++ src/VBox/Main/src-server/freebsd/PerformanceFreeBSD.cpp @@ -80,8 +80,10 @@ int CollectorFreeBSD::getHostMemoryUsage(ULONG *total, cbParameter = sizeof(cPagesMemInactive); --- emulators/virtualbox-ose/files/patch-src_VBox_Main_webservice_Makefile.kmk (nonexistent) +++ emulators/virtualbox-ose/files/patch-src_VBox_Main_webservice_Makefile.kmk (working copy) @@ -0,0 +1,39 @@ +--- src/VBox/Main/webservice/Makefile.kmk.orig 2019-11-21 17:02:22 UTC ++++ src/VBox/Main/webservice/Makefile.kmk +@@ -158,7 +158,6 @@ VBOX_PATH_IDL := $(abspath $(PATH_SUB_ + RECOMPILE_ON_MAKEFILE_CURRENT := $(MAKEFILE_CURRENT) + + PATH_TARGET_SOAPDEMOXML := $(VBOXWEB_OUT_DIR)/demo_soapxml +-PATH_TARGET_SOAPDEMOHEADERS := $(VBOXWEB_OUT_DIR)/demo_headers + PATH_TARGET_SOAPDEMONSMAPS := $(VBOXWEB_OUT_DIR)/demo_namespacemaps + PATH_TARGET_WEBTEST := $(VBOXWEB_OUT_DIR)/webtest + +@@ -565,8 +564,6 @@ $$(VBOX_JWSSRC_JAR): $$(VBOX_JWS_JAR) | $$(dir $$@) + $(VBOXWEB_OUT_DIR)/gsoap_copy_all_ts \ + $(wildcard $(PATH_TARGET_SOAPDEMOXML)/*) \ + $(PATH_TARGET_SOAPDEMOXML)/dummy_file \ +- $(wildcard $(PATH_TARGET_SOAPDEMOHEADERS)/*) \ +- $(PATH_TARGET_SOAPDEMOHEADERS)/dummy_file \ + $(wildcard $(PATH_TARGET_SOAPDEMONSMAPS)/*) \ + $(PATH_TARGET_SOAPDEMONSMAPS)/dummy_file + +@@ -786,17 +783,14 @@ endif + # any more. Ignoring the exit code is the simple solution, accepting the error. + $(VBOXWEB_OUT_DIR)/gsoap_copy_all_ts: $(VBOXWEB_OUT_DIR)/gsoap_generate_all_ts | $$(dir $$@) + $(RM) -f $@ +- $(MKDIR) -p $(PATH_TARGET_SOAPDEMOXML) $(PATH_TARGET_SOAPDEMOHEADERS) $(PATH_TARGET_SOAPDEMONSMAPS) ++ $(MKDIR) -p $(PATH_TARGET_SOAPDEMOXML) $(PATH_TARGET_SOAPDEMONSMAPS) + ifdef VBOX_GSOAP_VERBOSE + $(MV_EXT) -f -- $(VBOXWEB_OUT_DIR)/*.req.xml $(VBOXWEB_OUT_DIR)/*.res.xml $(PATH_TARGET_SOAPDEMOXML)/ + endif +- -$(MV_EXT) -f -- $(VBOXWEB_OUT_DIR)/soapvbox*.h $(PATH_TARGET_SOAPDEMOHEADERS)/ + $(MV_EXT) -f -- $(VBOXWEB_OUT_DIR)/vboxBinding.nsmap $(PATH_TARGET_SOAPDEMONSMAPS)/ + $(APPEND) $@ done + +-$(PATH_TARGET_SOAPDEMONSMAPS) \ +-$(PATH_TARGET_SOAPDEMOHEADERS)/soapvboxBindingProxy.h \ +-$(PATH_TARGET_SOAPDEMOHEADERS)/soapvboxBindingObject.h: $(VBOXWEB_OUT_DIR)/gsoap_copy_all_ts ++$(PATH_TARGET_SOAPDEMONSMAPS): $(VBOXWEB_OUT_DIR)/gsoap_copy_all_ts + + # soapcpp2 -2: generate SOAP 1.2 calls + # soapcpp2 -S: server-side code only --- emulators/virtualbox-ose/files/patch-src_VBox_Runtime_Makefile.kmk (nonexistent) +++ emulators/virtualbox-ose/files/patch-src_VBox_Runtime_Makefile.kmk (working copy) @@ -0,0 +1,30 @@ +--- src/VBox/Runtime/Makefile.kmk.orig 2019-11-21 17:02:28 UTC ++++ src/VBox/Runtime/Makefile.kmk +@@ -175,6 +175,11 @@ $(IPRT_OUT_DIR)/oiddb.h.ts +| $(IPRT_OUT_DIR)/oiddb.h: + + + # ++# Set the defines that utf8-posix.cpp needs. It's used by several targets. ++# ++r3/posix/utf8-posix.cpp_DEFS.freebsd = $(VBOX_ICONV_DEFS) ++ ++# + # Unicode Specification reader used to regenerate unidata-*.cpp. + # + uniread_TEMPLATE = VBoxBldProg +@@ -2226,6 +2231,7 @@ endif + VBoxRT_LIBS.darwin = \ + iconv + VBoxRT_LIBS.freebsd = \ ++ crypt \ + iconv \ + rt + VBoxRT_LIBS.haiku = \ +@@ -2369,6 +2375,7 @@ endif + VBoxRT-x86_LIBS.darwin = \ + iconv + VBoxRT-x86_LIBS.freebsd = \ ++ crypt \ + iconv \ + rt + VBoxRT-x86_LIBS.haiku = \ --- emulators/virtualbox-ose/files/patch-src_VBox_Runtime_common_err_RTErrConvertFromErrno.cpp (revision 520061) +++ emulators/virtualbox-ose/files/patch-src_VBox_Runtime_common_err_RTErrConvertFromErrno.cpp (nonexistent) @@ -1,11 +0,0 @@ ---- src/VBox/Runtime/common/err/RTErrConvertFromErrno.cpp.orig 2018-01-15 14:56:07 UTC -+++ src/VBox/Runtime/common/err/RTErrConvertFromErrno.cpp -@@ -302,7 +302,7 @@ RTDECL(int) RTErrConvertFromErrno(unsigned uNativeCod - case EILSEQ: return VERR_NO_TRANSLATION; - #endif - #ifdef ERESTART -- case ERESTART: return VERR_INTERRUPTED;/** @todo fix duplicate error?*/ -+ case (unsigned)ERESTART: return VERR_INTERRUPTED;/** @todo fix duplicate error?*/ - #endif - #ifdef ESTRPIPE - //case ESTRPIPE 86 /* Streams pipe error */ --- emulators/virtualbox-ose/files/patch-src_VBox_Runtime_r0drv_freebsd_alloc-r0drv-freebsd.c (revision 520061) +++ emulators/virtualbox-ose/files/patch-src_VBox_Runtime_r0drv_freebsd_alloc-r0drv-freebsd.c (working copy) @@ -1,6 +1,6 @@ ---- src/VBox/Runtime/r0drv/freebsd/alloc-r0drv-freebsd.c.orig 2018-10-15 14:31:31 UTC +--- src/VBox/Runtime/r0drv/freebsd/alloc-r0drv-freebsd.c.orig 2019-11-21 17:02:50 UTC +++ src/VBox/Runtime/r0drv/freebsd/alloc-r0drv-freebsd.c -@@ -54,6 +54,7 @@ MALLOC_DEFINE(M_IPRTCONT, "iprtcont", "IPRT - contiguo +@@ -79,6 +79,7 @@ MALLOC_DEFINE(M_IPRTCONT, "iprtcont", "IPRT - contiguo DECLHIDDEN(int) rtR0MemAllocEx(size_t cb, uint32_t fFlags, PRTMEMHDR *ppHdr) { @@ -8,7 +8,7 @@ size_t cbAllocated = cb; PRTMEMHDR pHdr = NULL; -@@ -76,8 +77,10 @@ DECLHIDDEN(int) rtR0MemAllocEx(size_t cb, uint32_t fFl +@@ -101,8 +102,10 @@ DECLHIDDEN(int) rtR0MemAllocEx(size_t cb, uint32_t fFl cbAllocated = RT_ALIGN_Z(cb + sizeof(*pHdr), PAGE_SIZE); pVmObject = vm_object_allocate(OBJT_DEFAULT, cbAllocated >> PAGE_SHIFT); @@ -20,7 +20,7 @@ /* Addr contains a start address vm_map_find will start searching for suitable space at. */ #if __FreeBSD_version >= 1000055 -@@ -114,6 +117,8 @@ DECLHIDDEN(int) rtR0MemAllocEx(size_t cb, uint32_t fFl +@@ -139,6 +142,8 @@ DECLHIDDEN(int) rtR0MemAllocEx(size_t cb, uint32_t fFl fFlags & RTMEMHDR_FLAG_ZEROED ? M_NOWAIT | M_ZERO : M_NOWAIT); } @@ -29,7 +29,7 @@ if (RT_UNLIKELY(!pHdr)) return VERR_NO_MEMORY; -@@ -129,6 +134,8 @@ DECLHIDDEN(int) rtR0MemAllocEx(size_t cb, uint32_t fFl +@@ -154,6 +159,8 @@ DECLHIDDEN(int) rtR0MemAllocEx(size_t cb, uint32_t fFl DECLHIDDEN(void) rtR0MemFree(PRTMEMHDR pHdr) { @@ -38,7 +38,7 @@ pHdr->u32Magic += 1; #ifdef RT_ARCH_AMD64 -@@ -141,11 +148,14 @@ DECLHIDDEN(void) rtR0MemFree(PRTMEMHDR pHdr) +@@ -166,11 +173,14 @@ DECLHIDDEN(void) rtR0MemFree(PRTMEMHDR pHdr) else #endif free(pHdr, M_IPRTHEAP); @@ -53,7 +53,7 @@ void *pv; /* -@@ -170,6 +180,7 @@ RTR0DECL(void *) RTMemContAlloc(PRTCCPHYS pPhys, size_ +@@ -195,6 +205,7 @@ RTR0DECL(void *) RTMemContAlloc(PRTCCPHYS pPhys, size_ *pPhys = vtophys(pv); Assert(!(*pPhys & PAGE_OFFSET_MASK)); } @@ -61,7 +61,7 @@ return pv; } -@@ -179,7 +190,9 @@ RTR0DECL(void) RTMemContFree(void *pv, size_t cb) +@@ -204,7 +215,9 @@ RTR0DECL(void) RTMemContFree(void *pv, size_t cb) if (pv) { AssertMsg(!((uintptr_t)pv & PAGE_OFFSET_MASK), ("pv=%p\n", pv)); --- emulators/virtualbox-ose/files/patch-src_VBox_Runtime_r0drv_freebsd_assert-r0drv-freebsd.c (revision 520061) +++ emulators/virtualbox-ose/files/patch-src_VBox_Runtime_r0drv_freebsd_assert-r0drv-freebsd.c (working copy) @@ -1,6 +1,6 @@ ---- src/VBox/Runtime/r0drv/freebsd/assert-r0drv-freebsd.c.orig 2018-10-15 14:31:31 UTC +--- src/VBox/Runtime/r0drv/freebsd/assert-r0drv-freebsd.c.orig 2019-11-21 17:02:50 UTC +++ src/VBox/Runtime/r0drv/freebsd/assert-r0drv-freebsd.c -@@ -44,15 +44,18 @@ +@@ -69,15 +69,18 @@ DECLHIDDEN(void) rtR0AssertNativeMsg1(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction) { @@ -19,7 +19,7 @@ char szMsg[256]; RTStrPrintfV(szMsg, sizeof(szMsg) - 1, pszFormat, va); -@@ -60,6 +63,7 @@ DECLHIDDEN(void) rtR0AssertNativeMsg2V(bool fInitial, +@@ -85,6 +88,7 @@ DECLHIDDEN(void) rtR0AssertNativeMsg2V(bool fInitial, printf("%s", szMsg); NOREF(fInitial); --- emulators/virtualbox-ose/files/patch-src_VBox_Runtime_r0drv_freebsd_memobj-r0drv-freebsd.c (revision 520061) +++ emulators/virtualbox-ose/files/patch-src_VBox_Runtime_r0drv_freebsd_memobj-r0drv-freebsd.c (working copy) @@ -1,6 +1,6 @@ ---- src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c.orig 2018-10-15 14:31:31 UTC +--- src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c.orig 2019-11-21 17:02:50 UTC +++ src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c -@@ -105,6 +105,7 @@ static vm_map_t rtR0MemObjFreeBSDGetMap(PRTR0MEMOBJINT +@@ -130,6 +130,7 @@ static vm_map_t rtR0MemObjFreeBSDGetMap(PRTR0MEMOBJINT DECLHIDDEN(int) rtR0MemObjNativeFree(RTR0MEMOBJ pMem) { @@ -8,7 +8,7 @@ PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)pMem; int rc; -@@ -121,16 +122,15 @@ DECLHIDDEN(int) rtR0MemObjNativeFree(RTR0MEMOBJ pMem) +@@ -146,16 +147,15 @@ DECLHIDDEN(int) rtR0MemObjNativeFree(RTR0MEMOBJ pMem) case RTR0MEMOBJTYPE_LOCK: { @@ -30,7 +30,7 @@ break; } -@@ -194,6 +194,7 @@ DECLHIDDEN(int) rtR0MemObjNativeFree(RTR0MEMOBJ pMem) +@@ -211,6 +211,7 @@ DECLHIDDEN(int) rtR0MemObjNativeFree(RTR0MEMOBJ pMem) return VERR_INTERNAL_ERROR; } @@ -38,84 +38,8 @@ return VINF_SUCCESS; } -@@ -224,18 +225,23 @@ static vm_page_t rtR0MemObjFreeBSDContigPhysAllocHelpe - #else - VM_OBJECT_UNLOCK(pObject); - #endif -- if (pPages) -+ if (pPages || cTries >= 1) - break; -+#if __FreeBSD_version >= 1100092 -+ if (!vm_page_reclaim_contig(fFlags, cPages, 0, VmPhysAddrHigh, uAlignment, 0)) -+ break; -+#elif __FreeBSD_version >= 1000015 - vm_pageout_grow_cache(cTries, 0, VmPhysAddrHigh); -+#else -+ vm_contig_grow_cache(cTries, 0, VmPhysAddrHigh); -+#endif - cTries++; - } -- -- return pPages; - #else -- while (cTries <= 1) -+ while (1) - { - pPages = vm_phys_alloc_contig(cPages, 0, VmPhysAddrHigh, uAlignment, 0); -- if (pPages) -+ if (pPages || cTries >= 1) - break; - vm_contig_grow_cache(cTries, 0, VmPhysAddrHigh); - cTries++; -@@ -243,11 +249,8 @@ static vm_page_t rtR0MemObjFreeBSDContigPhysAllocHelpe - - if (!pPages) - return pPages; --#if __FreeBSD_version >= 1000030 -- VM_OBJECT_WLOCK(pObject); --#else -+ - VM_OBJECT_LOCK(pObject); --#endif - for (vm_pindex_t iPage = 0; iPage < cPages; iPage++) - { - vm_page_t pPage = pPages + iPage; -@@ -259,13 +262,9 @@ static vm_page_t rtR0MemObjFreeBSDContigPhysAllocHelpe - atomic_add_int(&cnt.v_wire_count, 1); - } - } --#if __FreeBSD_version >= 1000030 -- VM_OBJECT_WUNLOCK(pObject); --#else - VM_OBJECT_UNLOCK(pObject); - #endif - return pPages; --#endif +@@ -362,58 +363,77 @@ static int rtR0MemObjFreeBSDAllocHelper(PRTR0MEMOBJFRE } - - static int rtR0MemObjFreeBSDPhysAllocHelper(vm_object_t pObject, u_long cPages, -@@ -292,16 +291,17 @@ static int rtR0MemObjFreeBSDPhysAllocHelper(vm_object_ - #else - VM_OBJECT_LOCK(pObject); - #endif -+ - while (iPage-- > 0) - { - pPage = vm_page_lookup(pObject, iPage); --#if __FreeBSD_version < 1000000 -+#if __FreeBSD_version < 900000 - vm_page_lock_queues(); - #endif - if (fWire) - vm_page_unwire(pPage, 0); - vm_page_free(pPage); --#if __FreeBSD_version < 1000000 -+#if __FreeBSD_version < 900000 - vm_page_unlock_queues(); - #endif - } -@@ -364,58 +364,77 @@ static int rtR0MemObjFreeBSDAllocHelper(PRTR0MEMOBJFRE - } DECLHIDDEN(int) rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) { + IPRT_FREEBSD_SAVE_EFL_AC(); @@ -192,7 +116,7 @@ return rc; } -@@ -425,6 +444,7 @@ static int rtR0MemObjFreeBSDAllocPhysPages(PPRTR0MEMOB +@@ -423,6 +443,7 @@ static int rtR0MemObjFreeBSDAllocPhysPages(PPRTR0MEMOB RTHCPHYS PhysHighest, size_t uAlignment, bool fContiguous, int rcNoMem) { @@ -200,7 +124,7 @@ uint32_t cPages = atop(cb); vm_paddr_t VmPhysAddrHigh; -@@ -432,7 +452,10 @@ static int rtR0MemObjFreeBSDAllocPhysPages(PPRTR0MEMOB +@@ -430,7 +451,10 @@ static int rtR0MemObjFreeBSDAllocPhysPages(PPRTR0MEMOB PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD), enmType, NULL, cb); if (!pMemFreeBSD) @@ -211,7 +135,7 @@ pMemFreeBSD->pObject = vm_object_allocate(OBJT_PHYS, atop(cb)); -@@ -470,6 +493,7 @@ static int rtR0MemObjFreeBSDAllocPhysPages(PPRTR0MEMOB +@@ -460,6 +484,7 @@ static int rtR0MemObjFreeBSDAllocPhysPages(PPRTR0MEMOB rtR0MemObjDelete(&pMemFreeBSD->Core); } @@ -219,7 +143,7 @@ return rc; } -@@ -489,17 +513,22 @@ DECLHIDDEN(int) rtR0MemObjNativeAllocPhysNC(PPRTR0MEMO +@@ -479,17 +504,22 @@ DECLHIDDEN(int) rtR0MemObjNativeAllocPhysNC(PPRTR0MEMO DECLHIDDEN(int) rtR0MemObjNativeEnterPhys(PPRTR0MEMOBJINTERNAL ppMem, RTHCPHYS Phys, size_t cb, uint32_t uCachePolicy) { AssertReturn(uCachePolicy == RTMEM_CACHE_POLICY_DONT_CARE, VERR_NOT_SUPPORTED); @@ -242,7 +166,7 @@ return VINF_SUCCESS; } -@@ -511,6 +540,7 @@ static int rtR0MemObjNativeLockInMap(PPRTR0MEMOBJINTER +@@ -501,6 +531,7 @@ static int rtR0MemObjNativeLockInMap(PPRTR0MEMOBJINTER vm_offset_t AddrStart, size_t cb, uint32_t fAccess, RTR0PROCESS R0Process, int fFlags) { @@ -250,7 +174,7 @@ int rc; NOREF(fAccess); -@@ -519,21 +549,28 @@ static int rtR0MemObjNativeLockInMap(PPRTR0MEMOBJINTER +@@ -509,21 +540,28 @@ static int rtR0MemObjNativeLockInMap(PPRTR0MEMOBJINTER if (!pMemFreeBSD) return VERR_NO_MEMORY; @@ -287,7 +211,7 @@ return VERR_NO_MEMORY;/** @todo fix mach -> vbox error conversion for freebsd. */ } -@@ -569,6 +606,7 @@ DECLHIDDEN(int) rtR0MemObjNativeLockKernel(PPRTR0MEMOB +@@ -559,6 +597,7 @@ DECLHIDDEN(int) rtR0MemObjNativeLockKernel(PPRTR0MEMOB */ static int rtR0MemObjNativeReserveInMap(PPRTR0MEMOBJINTERNAL ppMem, void *pvFixed, size_t cb, size_t uAlignment, RTR0PROCESS R0Process, vm_map_t pMap) { @@ -295,7 +219,7 @@ int rc; /* -@@ -626,11 +664,13 @@ static int rtR0MemObjNativeReserveInMap(PPRTR0MEMOBJIN +@@ -616,11 +655,13 @@ static int rtR0MemObjNativeReserveInMap(PPRTR0MEMOBJIN pMemFreeBSD->Core.pv = (void *)MapAddress; pMemFreeBSD->Core.u.ResVirt.R0Process = R0Process; *ppMem = &pMemFreeBSD->Core; @@ -309,7 +233,7 @@ return rc; } -@@ -652,6 +692,8 @@ DECLHIDDEN(int) rtR0MemObjNativeReserveUser(PPRTR0MEMO +@@ -642,6 +683,8 @@ DECLHIDDEN(int) rtR0MemObjNativeReserveUser(PPRTR0MEMO DECLHIDDEN(int) rtR0MemObjNativeMapKernel(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, void *pvFixed, size_t uAlignment, unsigned fProt, size_t offSub, size_t cbSub) { @@ -318,7 +242,7 @@ // AssertMsgReturn(!offSub && !cbSub, ("%#x %#x\n", offSub, cbSub), VERR_NOT_SUPPORTED); AssertMsgReturn(pvFixed == (void *)-1, ("%p\n", pvFixed), VERR_NOT_SUPPORTED); -@@ -707,6 +749,7 @@ DECLHIDDEN(int) rtR0MemObjNativeMapKernel(PPRTR0MEMOBJ +@@ -698,6 +741,7 @@ DECLHIDDEN(int) rtR0MemObjNativeMapKernel(PPRTR0MEMOBJ Assert((vm_offset_t)pMemFreeBSD->Core.pv == Addr); pMemFreeBSD->Core.u.Mapping.R0Process = NIL_RTR0PROCESS; *ppMem = &pMemFreeBSD->Core; @@ -326,7 +250,7 @@ return VINF_SUCCESS; } rc = vm_map_remove(kernel_map, Addr, Addr + cbSub); -@@ -715,6 +758,7 @@ DECLHIDDEN(int) rtR0MemObjNativeMapKernel(PPRTR0MEMOBJ +@@ -706,6 +750,7 @@ DECLHIDDEN(int) rtR0MemObjNativeMapKernel(PPRTR0MEMOBJ else vm_object_deallocate(pMemToMapFreeBSD->pObject); @@ -334,9 +258,9 @@ return VERR_NO_MEMORY; } -@@ -722,6 +766,8 @@ DECLHIDDEN(int) rtR0MemObjNativeMapKernel(PPRTR0MEMOBJ +@@ -713,6 +758,8 @@ DECLHIDDEN(int) rtR0MemObjNativeMapKernel(PPRTR0MEMOBJ DECLHIDDEN(int) rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, RTR3PTR R3PtrFixed, size_t uAlignment, - unsigned fProt, RTR0PROCESS R0Process) + unsigned fProt, RTR0PROCESS R0Process, size_t offSub, size_t cbSub) { + IPRT_FREEBSD_SAVE_EFL_AC(); + @@ -343,21 +267,7 @@ /* * Check for unsupported stuff. */ -@@ -751,7 +797,12 @@ DECLHIDDEN(int) rtR0MemObjNativeMapUser(PPRTR0MEMOBJIN - { - /** @todo is this needed?. */ - PROC_LOCK(pProc); -- AddrR3 = round_page((vm_offset_t)pProc->p_vmspace->vm_daddr + lim_max(pProc, RLIMIT_DATA)); -+ AddrR3 = round_page((vm_offset_t)pProc->p_vmspace->vm_daddr + -+#if __FreeBSD_version >= 1100077 -+ lim_max_proc(pProc, RLIMIT_DATA)); -+#else -+ lim_max(pProc, RLIMIT_DATA)); -+#endif - PROC_UNLOCK(pProc); - } - else -@@ -793,6 +844,7 @@ DECLHIDDEN(int) rtR0MemObjNativeMapUser(PPRTR0MEMOBJIN +@@ -788,6 +835,7 @@ DECLHIDDEN(int) rtR0MemObjNativeMapUser(PPRTR0MEMOBJIN Assert((vm_offset_t)pMemFreeBSD->Core.pv == AddrR3); pMemFreeBSD->Core.u.Mapping.R0Process = R0Process; *ppMem = &pMemFreeBSD->Core; @@ -365,7 +275,7 @@ return VINF_SUCCESS; } -@@ -802,19 +854,25 @@ DECLHIDDEN(int) rtR0MemObjNativeMapUser(PPRTR0MEMOBJIN +@@ -797,19 +845,25 @@ DECLHIDDEN(int) rtR0MemObjNativeMapUser(PPRTR0MEMOBJIN else vm_object_deallocate(pMemToMapFreeBSD->pObject); @@ -391,7 +301,7 @@ if ((fProt & RTMEM_PROT_NONE) == RTMEM_PROT_NONE) ProtectionFlags = VM_PROT_NONE; -@@ -826,6 +884,7 @@ DECLHIDDEN(int) rtR0MemObjNativeProtect(PRTR0MEMOBJINT +@@ -821,6 +875,7 @@ DECLHIDDEN(int) rtR0MemObjNativeProtect(PRTR0MEMOBJINT ProtectionFlags |= VM_PROT_EXECUTE; int krc = vm_map_protect(pVmMap, AddrStart, AddrEnd, ProtectionFlags, FALSE); @@ -399,7 +309,7 @@ if (krc == KERN_SUCCESS) return VINF_SUCCESS; -@@ -850,11 +909,19 @@ DECLHIDDEN(RTHCPHYS) rtR0MemObjNativeGetPagePhysAddr(P +@@ -845,11 +900,19 @@ DECLHIDDEN(RTHCPHYS) rtR0MemObjNativeGetPagePhysAddr(P vm_offset_t pb = (vm_offset_t)pMemFreeBSD->Core.pv + ptoa(iPage); @@ -423,7 +333,7 @@ } case RTR0MEMOBJTYPE_MAPPING: -@@ -863,11 +930,15 @@ DECLHIDDEN(RTHCPHYS) rtR0MemObjNativeGetPagePhysAddr(P +@@ -858,11 +921,15 @@ DECLHIDDEN(RTHCPHYS) rtR0MemObjNativeGetPagePhysAddr(P if (pMemFreeBSD->Core.u.Mapping.R0Process != NIL_RTR0PROCESS) { @@ -440,18 +350,14 @@ } return vtophys(pb); } -@@ -877,6 +948,7 @@ DECLHIDDEN(RTHCPHYS) rtR0MemObjNativeGetPagePhysAddr(P - case RTR0MEMOBJTYPE_PHYS_NC: +@@ -873,9 +940,11 @@ DECLHIDDEN(RTHCPHYS) rtR0MemObjNativeGetPagePhysAddr(P { RTHCPHYS addr; + + IPRT_FREEBSD_SAVE_EFL_AC(); - #if __FreeBSD_version >= 1000030 VM_OBJECT_WLOCK(pMemFreeBSD->pObject); - #else -@@ -888,6 +960,7 @@ DECLHIDDEN(RTHCPHYS) rtR0MemObjNativeGetPagePhysAddr(P - #else - VM_OBJECT_UNLOCK(pMemFreeBSD->pObject); - #endif + addr = VM_PAGE_TO_PHYS(vm_page_lookup(pMemFreeBSD->pObject, iPage)); + VM_OBJECT_WUNLOCK(pMemFreeBSD->pObject); + IPRT_FREEBSD_RESTORE_EFL_AC(); return addr; } --- emulators/virtualbox-ose/files/patch-src_VBox_Runtime_r0drv_freebsd_memuserkernel-r0drv-freebsd.c (revision 520061) +++ emulators/virtualbox-ose/files/patch-src_VBox_Runtime_r0drv_freebsd_memuserkernel-r0drv-freebsd.c (working copy) @@ -1,4 +1,4 @@ ---- src/VBox/Runtime/r0drv/freebsd/memuserkernel-r0drv-freebsd.c.orig 2018-10-15 14:31:31 UTC +--- src/VBox/Runtime/r0drv/freebsd/memuserkernel-r0drv-freebsd.c.orig 2019-11-21 17:02:50 UTC +++ src/VBox/Runtime/r0drv/freebsd/memuserkernel-r0drv-freebsd.c @@ -36,7 +36,9 @@ --- emulators/virtualbox-ose/files/patch-src_VBox_Runtime_r0drv_freebsd_mp-r0drv-freebsd.c (revision 520061) +++ emulators/virtualbox-ose/files/patch-src_VBox_Runtime_r0drv_freebsd_mp-r0drv-freebsd.c (working copy) @@ -1,22 +1,6 @@ ---- src/VBox/Runtime/r0drv/freebsd/mp-r0drv-freebsd.c.orig 2018-10-15 14:31:31 UTC +--- src/VBox/Runtime/r0drv/freebsd/mp-r0drv-freebsd.c.orig 2019-11-21 17:02:50 UTC +++ src/VBox/Runtime/r0drv/freebsd/mp-r0drv-freebsd.c -@@ -36,6 +36,15 @@ - #include - #include "r0drv/mp-r0drv.h" - -+#if __FreeBSD_version >= 700000 && __FreeBSD_version < 900000 -+#define cpuset_t cpumask_t -+#define all_cpus (~(cpumask_t)0) -+#define CPU_CLR(n, p) do { *(p) &= ~((cpumask_t)1 << (n)); } while (0) -+#define CPU_SETOF(n, p) do { *(p) = (cpumask_t)1 << (n); } while (0) -+#endif -+#if __FreeBSD_version < 1200028 -+#define smp_no_rendezvous_barrier smp_no_rendevous_barrier -+#endif - - RTDECL(RTCPUID) RTMpCpuId(void) - { -@@ -143,7 +152,9 @@ RTDECL(RTCPUID) RTMpGetOnlineCount(void) +@@ -147,7 +147,9 @@ RTDECL(RTCPUID) RTMpGetOnlineCount(void) static void rtmpOnAllFreeBSDWrapper(void *pvArg) { PRTMPARGS pArgs = (PRTMPARGS)pvArg; @@ -26,18 +10,17 @@ } -@@ -155,7 +166,9 @@ RTDECL(int) RTMpOnAll(PFNRTMPWORKER pfnWorker, void *p +@@ -159,7 +161,9 @@ RTDECL(int) RTMpOnAll(PFNRTMPWORKER pfnWorker, void *p Args.pvUser2 = pvUser2; Args.idCpu = NIL_RTCPUID; Args.cHits = 0; -- smp_rendezvous(NULL, rtmpOnAllFreeBSDWrapper, smp_no_rendevous_barrier, &Args); + IPRT_FREEBSD_SAVE_EFL_AC(); -+ smp_rendezvous(NULL, rtmpOnAllFreeBSDWrapper, smp_no_rendezvous_barrier, &Args); + smp_rendezvous(NULL, rtmpOnAllFreeBSDWrapper, smp_no_rendezvous_barrier, &Args); + IPRT_FREEBSD_RESTORE_EFL_AC(); return VINF_SUCCESS; } -@@ -171,7 +184,11 @@ static void rtmpOnOthersFreeBSDWrapper(void *pvArg) +@@ -175,7 +179,11 @@ static void rtmpOnOthersFreeBSDWrapper(void *pvArg) PRTMPARGS pArgs = (PRTMPARGS)pvArg; RTCPUID idCpu = curcpu; if (pArgs->idCpu != idCpu) @@ -49,35 +32,15 @@ } -@@ -180,10 +197,8 @@ RTDECL(int) RTMpOnOthers(PFNRTMPWORKER pfnWorker, void - /* Will panic if no rendezvousing cpus, so check up front. */ - if (RTMpGetOnlineCount() > 1) - { --#if __FreeBSD_version >= 900000 -- cpuset_t Mask; --#elif __FreeBSD_version >= 700000 -- cpumask_t Mask; -+#if __FreeBSD_version >= 700000 -+ cpuset_t Cpus; - #endif - RTMPARGS Args; - -@@ -192,17 +207,15 @@ RTDECL(int) RTMpOnOthers(PFNRTMPWORKER pfnWorker, void +@@ -196,6 +204,7 @@ RTDECL(int) RTMpOnOthers(PFNRTMPWORKER pfnWorker, void Args.pvUser2 = pvUser2; Args.idCpu = RTMpCpuId(); Args.cHits = 0; + IPRT_FREEBSD_SAVE_EFL_AC(); #if __FreeBSD_version >= 700000 --# if __FreeBSD_version >= 900000 -- Mask = all_cpus; -- CPU_CLR(curcpu, &Mask); --# else -- Mask = ~(cpumask_t)curcpu; --# endif -- smp_rendezvous_cpus(Mask, NULL, rtmpOnOthersFreeBSDWrapper, smp_no_rendevous_barrier, &Args); -+ Cpus = all_cpus; -+ CPU_CLR(curcpu, &Cpus); -+ smp_rendezvous_cpus(Cpus, NULL, rtmpOnOthersFreeBSDWrapper, smp_no_rendezvous_barrier, &Args); + # if __FreeBSD_version >= 900000 + Mask = all_cpus; +@@ -207,6 +216,7 @@ RTDECL(int) RTMpOnOthers(PFNRTMPWORKER pfnWorker, void #else smp_rendezvous(NULL, rtmpOnOthersFreeBSDWrapper, NULL, &Args); #endif @@ -85,7 +48,7 @@ } return VINF_SUCCESS; } -@@ -220,18 +233,18 @@ static void rtmpOnSpecificFreeBSDWrapper(void *pvArg) +@@ -224,8 +234,10 @@ static void rtmpOnSpecificFreeBSDWrapper(void *pvArg) RTCPUID idCpu = curcpu; if (pArgs->idCpu == idCpu) { @@ -96,32 +59,15 @@ } } - - RTDECL(int) RTMpOnSpecific(RTCPUID idCpu, PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2) - { --#if __FreeBSD_version >= 900000 -- cpuset_t Mask; --#elif __FreeBSD_version >= 700000 -- cpumask_t Mask; -+#if __FreeBSD_version >= 700000 -+ cpuset_t Cpus; - #endif - RTMPARGS Args; - -@@ -244,16 +257,14 @@ RTDECL(int) RTMpOnSpecific(RTCPUID idCpu, PFNRTMPWORKE +@@ -248,6 +260,7 @@ RTDECL(int) RTMpOnSpecific(RTCPUID idCpu, PFNRTMPWORKE Args.pvUser2 = pvUser2; Args.idCpu = idCpu; Args.cHits = 0; + IPRT_FREEBSD_SAVE_EFL_AC(); #if __FreeBSD_version >= 700000 --# if __FreeBSD_version >= 900000 -- CPU_SETOF(idCpu, &Mask); --# else -- Mask = (cpumask_t)1 << idCpu; --# endif -- smp_rendezvous_cpus(Mask, NULL, rtmpOnSpecificFreeBSDWrapper, smp_no_rendevous_barrier, &Args); -+ CPU_SETOF(idCpu, &Cpus); -+ smp_rendezvous_cpus(Cpus, NULL, rtmpOnSpecificFreeBSDWrapper, smp_no_rendezvous_barrier, &Args); + # if __FreeBSD_version >= 900000 + CPU_SETOF(idCpu, &Mask); +@@ -258,6 +271,7 @@ RTDECL(int) RTMpOnSpecific(RTCPUID idCpu, PFNRTMPWORKE #else smp_rendezvous(NULL, rtmpOnSpecificFreeBSDWrapper, NULL, &Args); #endif @@ -129,30 +75,17 @@ return Args.cHits == 1 ? VINF_SUCCESS : VERR_CPU_NOT_FOUND; -@@ -273,22 +284,16 @@ static void rtmpFreeBSDPokeCallback(void *pvArg) - - RTDECL(int) RTMpPokeCpu(RTCPUID idCpu) - { --#if __FreeBSD_version >= 900000 -- cpuset_t Mask; --#elif __FreeBSD_version >= 700000 -- cpumask_t Mask; --#endif -+ cpuset_t Cpus; - - /* Will panic if no rendezvousing cpus, so make sure the cpu is online. */ +@@ -287,12 +301,14 @@ RTDECL(int) RTMpPokeCpu(RTCPUID idCpu) if (!RTMpIsCpuOnline(idCpu)) return VERR_CPU_NOT_FOUND; --# if __FreeBSD_version >= 900000 -- CPU_SETOF(idCpu, &Mask); --# else -- Mask = (cpumask_t)1 << idCpu; --# endif -- smp_rendezvous_cpus(Mask, NULL, rtmpFreeBSDPokeCallback, smp_no_rendevous_barrier, NULL); + IPRT_FREEBSD_SAVE_EFL_AC(); -+ CPU_SETOF(idCpu, &Cpus); -+ smp_rendezvous_cpus(Cpus, NULL, rtmpFreeBSDPokeCallback, smp_no_rendezvous_barrier, NULL); + # if __FreeBSD_version >= 900000 + CPU_SETOF(idCpu, &Mask); + # else + Mask = (cpumask_t)1 << idCpu; + # endif + smp_rendezvous_cpus(Mask, NULL, rtmpFreeBSDPokeCallback, smp_no_rendezvous_barrier, NULL); + IPRT_FREEBSD_RESTORE_EFL_AC(); return VINF_SUCCESS; --- emulators/virtualbox-ose/files/patch-src_VBox_Runtime_r0drv_freebsd_semevent-r0drv-freebsd.c (revision 520061) +++ emulators/virtualbox-ose/files/patch-src_VBox_Runtime_r0drv_freebsd_semevent-r0drv-freebsd.c (working copy) @@ -1,6 +1,6 @@ ---- src/VBox/Runtime/r0drv/freebsd/semevent-r0drv-freebsd.c.orig 2018-10-15 14:31:31 UTC +--- src/VBox/Runtime/r0drv/freebsd/semevent-r0drv-freebsd.c.orig 2019-11-21 17:02:50 UTC +++ src/VBox/Runtime/r0drv/freebsd/semevent-r0drv-freebsd.c -@@ -77,7 +77,9 @@ RTDECL(int) RTSemEventCreateEx(PRTSEMEVENT phEventSem +@@ -102,7 +102,9 @@ RTDECL(int) RTSemEventCreateEx(PRTSEMEVENT phEventSem Assert(!(fFlags & RTSEMEVENT_FLAGS_BOOTSTRAP_HACK) || (fFlags & RTSEMEVENT_FLAGS_NO_LOCK_VAL)); AssertPtrReturn(phEventSem, VERR_INVALID_POINTER); @@ -10,7 +10,7 @@ if (!pThis) return VERR_NO_MEMORY; -@@ -128,10 +130,12 @@ RTDECL(int) RTSemEventDestroy(RTSEMEVENT hEventSem) +@@ -153,10 +155,12 @@ RTDECL(int) RTSemEventDestroy(RTSEMEVENT hEventSem) /* * Invalidate it and signal the object just in case. */ @@ -23,7 +23,7 @@ return VINF_SUCCESS; } -@@ -149,9 +153,11 @@ RTDECL(int) RTSemEventSignal(RTSEMEVENT hEventSem) +@@ -174,9 +178,11 @@ RTDECL(int) RTSemEventSignal(RTSEMEVENT hEventSem) /* * Signal the event object. */ @@ -35,7 +35,7 @@ return VINF_SUCCESS; } -@@ -175,6 +181,7 @@ static int rtR0SemEventWait(PRTSEMEVENTINTERNAL pThis, +@@ -200,6 +206,7 @@ static int rtR0SemEventWait(PRTSEMEVENTINTERNAL pThis, AssertPtrReturn(pThis, VERR_INVALID_PARAMETER); AssertMsgReturn(pThis->u32Magic == RTSEMEVENT_MAGIC, ("%p u32Magic=%RX32\n", pThis, pThis->u32Magic), VERR_INVALID_PARAMETER); AssertReturn(RTSEMWAIT_FLAGS_ARE_VALID(fFlags), VERR_INVALID_PARAMETER); @@ -43,7 +43,7 @@ rtR0SemEventBsdRetain(pThis); /* -@@ -224,6 +231,7 @@ static int rtR0SemEventWait(PRTSEMEVENTINTERNAL pThis, +@@ -249,6 +256,7 @@ static int rtR0SemEventWait(PRTSEMEVENTINTERNAL pThis, } rtR0SemEventBsdRelease(pThis); --- emulators/virtualbox-ose/files/patch-src_VBox_Runtime_r0drv_freebsd_semeventmulti-r0drv-freebsd.c (revision 520061) +++ emulators/virtualbox-ose/files/patch-src_VBox_Runtime_r0drv_freebsd_semeventmulti-r0drv-freebsd.c (working copy) @@ -1,6 +1,6 @@ ---- src/VBox/Runtime/r0drv/freebsd/semeventmulti-r0drv-freebsd.c.orig 2018-10-15 14:31:31 UTC +--- src/VBox/Runtime/r0drv/freebsd/semeventmulti-r0drv-freebsd.c.orig 2019-11-21 17:02:50 UTC +++ src/VBox/Runtime/r0drv/freebsd/semeventmulti-r0drv-freebsd.c -@@ -96,7 +96,9 @@ RTDECL(int) RTSemEventMultiCreateEx(PRTSEMEVENTMULTI +@@ -121,7 +121,9 @@ RTDECL(int) RTSemEventMultiCreateEx(PRTSEMEVENTMULTI PRTSEMEVENTMULTIINTERNAL pThis; AssertReturn(!(fFlags & ~RTSEMEVENTMULTI_FLAGS_NO_LOCK_VAL), VERR_INVALID_PARAMETER); @@ -10,7 +10,7 @@ if (pThis) { pThis->u32Magic = RTSEMEVENTMULTI_MAGIC; -@@ -152,10 +154,12 @@ RTDECL(int) RTSemEventMultiDestroy(RTSEMEVENTMULTI hE +@@ -177,10 +179,12 @@ RTDECL(int) RTSemEventMultiDestroy(RTSEMEVENTMULTI hE /* * Invalidate it and signal the object just in case. */ @@ -23,7 +23,7 @@ return VINF_SUCCESS; } -@@ -164,6 +168,7 @@ RTDECL(int) RTSemEventMultiSignal(RTSEMEVENTMULTI hEv +@@ -189,6 +193,7 @@ RTDECL(int) RTSemEventMultiSignal(RTSEMEVENTMULTI hEv { uint32_t fNew; uint32_t fOld; @@ -31,7 +31,7 @@ /* * Validate input. -@@ -190,12 +195,15 @@ RTDECL(int) RTSemEventMultiSignal(RTSEMEVENTMULTI hEv +@@ -215,12 +220,15 @@ RTDECL(int) RTSemEventMultiSignal(RTSEMEVENTMULTI hEv rtR0SemBsdBroadcast(pThis); rtR0SemEventMultiBsdRelease(pThis); @@ -47,7 +47,7 @@ /* * Validate input. */ -@@ -212,6 +220,7 @@ RTDECL(int) RTSemEventMultiReset(RTSEMEVENTMULTI hEve +@@ -237,6 +245,7 @@ RTDECL(int) RTSemEventMultiReset(RTSEMEVENTMULTI hEve ASMAtomicAndU32(&pThis->fStateAndGen, ~RTSEMEVENTMULTIBSD_STATE_MASK); rtR0SemEventMultiBsdRelease(pThis); @@ -55,7 +55,7 @@ return VINF_SUCCESS; } -@@ -228,6 +237,7 @@ RTDECL(int) RTSemEventMultiReset(RTSEMEVENTMULTI hEve +@@ -253,6 +262,7 @@ RTDECL(int) RTSemEventMultiReset(RTSEMEVENTMULTI hEve static int rtR0SemEventMultiBsdWait(PRTSEMEVENTMULTIINTERNAL pThis, uint32_t fFlags, uint64_t uTimeout, PCRTLOCKVALSRCPOS pSrcPos) { @@ -63,7 +63,7 @@ uint32_t fOrgStateAndGen; int rc; -@@ -287,6 +297,7 @@ static int rtR0SemEventMultiBsdWait(PRTSEMEVENTMULTIIN +@@ -312,6 +322,7 @@ static int rtR0SemEventMultiBsdWait(PRTSEMEVENTMULTIIN } rtR0SemEventMultiBsdRelease(pThis); --- emulators/virtualbox-ose/files/patch-src_VBox_Runtime_r0drv_freebsd_semfastmutex-r0drv-freebsd.c (revision 520061) +++ emulators/virtualbox-ose/files/patch-src_VBox_Runtime_r0drv_freebsd_semfastmutex-r0drv-freebsd.c (working copy) @@ -1,6 +1,6 @@ ---- src/VBox/Runtime/r0drv/freebsd/semfastmutex-r0drv-freebsd.c.orig 2018-10-15 14:31:31 UTC +--- src/VBox/Runtime/r0drv/freebsd/semfastmutex-r0drv-freebsd.c.orig 2019-11-21 17:02:50 UTC +++ src/VBox/Runtime/r0drv/freebsd/semfastmutex-r0drv-freebsd.c -@@ -62,6 +62,7 @@ RTDECL(int) RTSemFastMutexCreate(PRTSEMFASTMUTEX phFa +@@ -87,6 +87,7 @@ RTDECL(int) RTSemFastMutexCreate(PRTSEMFASTMUTEX phFa { AssertCompile(sizeof(RTSEMFASTMUTEXINTERNAL) > sizeof(void *)); AssertPtrReturn(phFastMtx, VERR_INVALID_POINTER); @@ -8,7 +8,7 @@ PRTSEMFASTMUTEXINTERNAL pThis = (PRTSEMFASTMUTEXINTERNAL)RTMemAllocZ(sizeof(*pThis)); if (pThis) -@@ -70,8 +71,10 @@ RTDECL(int) RTSemFastMutexCreate(PRTSEMFASTMUTEX phFa +@@ -95,8 +96,10 @@ RTDECL(int) RTSemFastMutexCreate(PRTSEMFASTMUTEX phFa sx_init_flags(&pThis->SxLock, "IPRT Fast Mutex Semaphore", SX_DUPOK); *phFastMtx = pThis; @@ -19,7 +19,7 @@ return VERR_NO_MEMORY; } -@@ -83,11 +86,13 @@ RTDECL(int) RTSemFastMutexDestroy(RTSEMFASTMUTEX hFas +@@ -108,11 +111,13 @@ RTDECL(int) RTSemFastMutexDestroy(RTSEMFASTMUTEX hFas return VINF_SUCCESS; AssertPtrReturn(pThis, VERR_INVALID_HANDLE); AssertMsgReturn(pThis->u32Magic == RTSEMFASTMUTEX_MAGIC, ("%p: u32Magic=%RX32\n", pThis, pThis->u32Magic), VERR_INVALID_HANDLE); @@ -33,7 +33,7 @@ return VINF_SUCCESS; } -@@ -97,8 +102,11 @@ RTDECL(int) RTSemFastMutexRequest(RTSEMFASTMUTEX hFas +@@ -122,8 +127,11 @@ RTDECL(int) RTSemFastMutexRequest(RTSEMFASTMUTEX hFas PRTSEMFASTMUTEXINTERNAL pThis = hFastMtx; AssertPtrReturn(pThis, VERR_INVALID_HANDLE); AssertMsgReturn(pThis->u32Magic == RTSEMFASTMUTEX_MAGIC, ("%p: u32Magic=%RX32\n", pThis, pThis->u32Magic), VERR_INVALID_HANDLE); @@ -45,7 +45,7 @@ return VINF_SUCCESS; } -@@ -108,8 +116,11 @@ RTDECL(int) RTSemFastMutexRelease(RTSEMFASTMUTEX hFas +@@ -133,8 +141,11 @@ RTDECL(int) RTSemFastMutexRelease(RTSEMFASTMUTEX hFas PRTSEMFASTMUTEXINTERNAL pThis = hFastMtx; AssertPtrReturn(pThis, VERR_INVALID_HANDLE); AssertMsgReturn(pThis->u32Magic == RTSEMFASTMUTEX_MAGIC, ("%p: u32Magic=%RX32\n", pThis, pThis->u32Magic), VERR_INVALID_HANDLE); --- emulators/virtualbox-ose/files/patch-src_VBox_Runtime_r0drv_freebsd_semmutex-r0drv-freebsd.c (revision 520061) +++ emulators/virtualbox-ose/files/patch-src_VBox_Runtime_r0drv_freebsd_semmutex-r0drv-freebsd.c (working copy) @@ -1,4 +1,4 @@ ---- src/VBox/Runtime/r0drv/freebsd/semmutex-r0drv-freebsd.c.orig 2018-10-15 14:31:31 UTC +--- src/VBox/Runtime/r0drv/freebsd/semmutex-r0drv-freebsd.c.orig 2019-11-21 17:02:50 UTC +++ src/VBox/Runtime/r0drv/freebsd/semmutex-r0drv-freebsd.c @@ -62,6 +62,7 @@ RTDECL(int) RTSemMutexCreate(PRTSEMMUTEX phMutexSem) { --- emulators/virtualbox-ose/files/patch-src_VBox_Runtime_r0drv_freebsd_sleepqueue-r0drv-freebsd.h (nonexistent) +++ emulators/virtualbox-ose/files/patch-src_VBox_Runtime_r0drv_freebsd_sleepqueue-r0drv-freebsd.h (working copy) @@ -0,0 +1,11 @@ +--- src/VBox/Runtime/r0drv/freebsd/sleepqueue-r0drv-freebsd.h.orig 2019-11-21 17:02:50 UTC ++++ src/VBox/Runtime/r0drv/freebsd/sleepqueue-r0drv-freebsd.h +@@ -84,6 +84,8 @@ DECLINLINE(uint32_t) rtR0SemBsdWaitUpdateTimeout(PRTR0 + uint64_t cTicks = ASMMultU64ByU32DivByU32(uTimeout, hz, UINT32_C(1000000000)); + if (cTicks >= INT_MAX) + return RTSEMWAIT_FLAGS_INDEFINITE; ++ else if (cTicks == 0 && uTimeout > 0) ++ pWait->iTimeout = 1; + else + pWait->iTimeout = (int)cTicks; + #endif --- emulators/virtualbox-ose/files/patch-src_VBox_Runtime_r0drv_freebsd_spinlock-r0drv-freebsd.c (revision 520061) +++ emulators/virtualbox-ose/files/patch-src_VBox_Runtime_r0drv_freebsd_spinlock-r0drv-freebsd.c (working copy) @@ -1,6 +1,6 @@ ---- src/VBox/Runtime/r0drv/freebsd/spinlock-r0drv-freebsd.c.orig 2018-10-15 14:31:31 UTC +--- src/VBox/Runtime/r0drv/freebsd/spinlock-r0drv-freebsd.c.orig 2019-11-21 17:02:50 UTC +++ src/VBox/Runtime/r0drv/freebsd/spinlock-r0drv-freebsd.c -@@ -82,7 +82,9 @@ RTDECL(int) RTSpinlockCreate(PRTSPINLOCK pSpinlock, u +@@ -107,7 +107,9 @@ RTDECL(int) RTSpinlockCreate(PRTSPINLOCK pSpinlock, u * Allocate. */ AssertCompile(sizeof(RTSPINLOCKINTERNAL) > sizeof(void *)); @@ -10,7 +10,7 @@ if (!pThis) return VERR_NO_MEMORY; -@@ -116,7 +118,9 @@ RTDECL(int) RTSpinlockDestroy(RTSPINLOCK Spinlock) +@@ -141,7 +143,9 @@ RTDECL(int) RTSpinlockDestroy(RTSPINLOCK Spinlock) * Make the lock invalid and release the memory. */ ASMAtomicIncU32(&pThis->u32Magic); @@ -20,7 +20,7 @@ return VINF_SUCCESS; } -@@ -142,6 +146,7 @@ RTDECL(void) RTSpinlockAcquire(RTSPINLOCK Spinlock) +@@ -167,6 +171,7 @@ RTDECL(void) RTSpinlockAcquire(RTSPINLOCK Spinlock) { RT_ASSERT_PREEMPT_CPUID_SPIN_ACQUIRED(pThis); pThis->fIntSaved = fIntSaved; --- emulators/virtualbox-ose/files/patch-src_VBox_Runtime_r0drv_freebsd_the-freebsd-kernel.h (revision 520061) +++ emulators/virtualbox-ose/files/patch-src_VBox_Runtime_r0drv_freebsd_the-freebsd-kernel.h (working copy) @@ -1,6 +1,6 @@ ---- src/VBox/Runtime/r0drv/freebsd/the-freebsd-kernel.h.orig 2018-10-15 14:31:31 UTC +--- src/VBox/Runtime/r0drv/freebsd/the-freebsd-kernel.h.orig 2019-11-21 17:02:50 UTC +++ src/VBox/Runtime/r0drv/freebsd/the-freebsd-kernel.h -@@ -60,6 +60,7 @@ +@@ -88,6 +88,7 @@ #include #include #include @@ -8,7 +8,7 @@ #include #include /* for vtophys */ #include -@@ -70,7 +71,6 @@ +@@ -98,7 +99,6 @@ #include /* vm_phys_alloc_* */ #include /* kmem_alloc_attr */ #include /* vm_contig_grow_cache */ @@ -16,7 +16,7 @@ #include #include -@@ -114,6 +114,24 @@ +@@ -156,6 +156,24 @@ */ #if 0 /** @todo Not available yet. */ # define USE_KMEM_ALLOC_PROT @@ -40,4 +40,4 @@ +# define IPRT_FREEBSD_RESTORE_EFL_ONLY_AC_EX(f) do { } while (0) #endif - #endif + #endif /* !IPRT_INCLUDED_SRC_r0drv_freebsd_the_freebsd_kernel_h */ --- emulators/virtualbox-ose/files/patch-src_VBox_Runtime_r0drv_freebsd_thread-r0drv-freebsd.c (revision 520061) +++ emulators/virtualbox-ose/files/patch-src_VBox_Runtime_r0drv_freebsd_thread-r0drv-freebsd.c (working copy) @@ -1,4 +1,4 @@ ---- src/VBox/Runtime/r0drv/freebsd/thread-r0drv-freebsd.c.orig 2018-10-15 14:31:31 UTC +--- src/VBox/Runtime/r0drv/freebsd/thread-r0drv-freebsd.c.orig 2019-11-21 17:02:50 UTC +++ src/VBox/Runtime/r0drv/freebsd/thread-r0drv-freebsd.c @@ -49,7 +49,6 @@ RTDECL(RTNATIVETHREAD) RTThreadNativeSelf(void) static int rtR0ThreadFbsdSleepCommon(RTMSINTERVAL cMillies) --- emulators/virtualbox-ose/files/patch-src_VBox_Runtime_r0drv_freebsd_thread2-r0drv-freebsd.c (revision 520061) +++ emulators/virtualbox-ose/files/patch-src_VBox_Runtime_r0drv_freebsd_thread2-r0drv-freebsd.c (working copy) @@ -1,6 +1,6 @@ ---- src/VBox/Runtime/r0drv/freebsd/thread2-r0drv-freebsd.c.orig 2018-10-15 14:31:31 UTC +--- src/VBox/Runtime/r0drv/freebsd/thread2-r0drv-freebsd.c.orig 2019-11-21 17:02:50 UTC +++ src/VBox/Runtime/r0drv/freebsd/thread2-r0drv-freebsd.c -@@ -70,6 +70,8 @@ DECLHIDDEN(int) rtThreadNativeSetPriority(PRTTHREADINT +@@ -95,6 +95,8 @@ DECLHIDDEN(int) rtThreadNativeSetPriority(PRTTHREADINT return VERR_INVALID_PARAMETER; } @@ -9,7 +9,7 @@ #if __FreeBSD_version < 700000 /* Do like they're doing in subr_ntoskrnl.c... */ mtx_lock_spin(&sched_lock); -@@ -86,6 +88,7 @@ DECLHIDDEN(int) rtThreadNativeSetPriority(PRTTHREADINT +@@ -111,6 +113,7 @@ DECLHIDDEN(int) rtThreadNativeSetPriority(PRTTHREADINT thread_unlock(curthread); #endif @@ -17,7 +17,7 @@ return VINF_SUCCESS; } -@@ -135,6 +138,7 @@ static void rtThreadNativeMain(void *pvThreadInt) +@@ -160,6 +163,7 @@ static void rtThreadNativeMain(void *pvThreadInt) DECLHIDDEN(int) rtThreadNativeCreate(PRTTHREADINT pThreadInt, PRTNATIVETHREAD pNativeThread) { @@ -25,7 +25,7 @@ int rc; struct proc *pProc; -@@ -150,6 +154,7 @@ DECLHIDDEN(int) rtThreadNativeCreate(PRTTHREADINT pThr +@@ -175,6 +179,7 @@ DECLHIDDEN(int) rtThreadNativeCreate(PRTTHREADINT pThr } else rc = RTErrConvertFromErrno(rc); --- emulators/virtualbox-ose/files/patch-src_VBox_Runtime_r0drv_freebsd_time-r0drv-freebsd.c (revision 520061) +++ emulators/virtualbox-ose/files/patch-src_VBox_Runtime_r0drv_freebsd_time-r0drv-freebsd.c (working copy) @@ -1,6 +1,6 @@ ---- src/VBox/Runtime/r0drv/freebsd/time-r0drv-freebsd.c.orig 2016-07-18 11:56:55 UTC +--- src/VBox/Runtime/r0drv/freebsd/time-r0drv-freebsd.c.orig 2019-11-21 17:02:50 UTC +++ src/VBox/Runtime/r0drv/freebsd/time-r0drv-freebsd.c -@@ -40,16 +40,23 @@ +@@ -65,16 +65,23 @@ RTDECL(uint64_t) RTTimeNanoTS(void) { @@ -29,7 +29,7 @@ } -@@ -67,8 +74,7 @@ RTDECL(uint64_t) RTTimeSystemMilliTS(voi +@@ -92,8 +99,7 @@ RTDECL(uint64_t) RTTimeSystemMilliTS(void) RTDECL(PRTTIMESPEC) RTTimeNow(PRTTIMESPEC pTime) { --- emulators/virtualbox-ose/files/patch-src_VBox_Runtime_r0drv_freebsd_timer-r0drv-freebsd.c (revision 520061) +++ emulators/virtualbox-ose/files/patch-src_VBox_Runtime_r0drv_freebsd_timer-r0drv-freebsd.c (working copy) @@ -1,6 +1,6 @@ ---- src/VBox/Runtime/r0drv/freebsd/timer-r0drv-freebsd.c.orig 2018-10-15 14:31:31 UTC +--- src/VBox/Runtime/r0drv/freebsd/timer-r0drv-freebsd.c.orig 2019-11-21 17:02:50 UTC +++ src/VBox/Runtime/r0drv/freebsd/timer-r0drv-freebsd.c -@@ -92,6 +92,7 @@ static void rtTimerFreeBSDCallback(void *pvTimer); +@@ -117,6 +117,7 @@ static void rtTimerFreeBSDCallback(void *pvTimer); RTDECL(int) RTTimerCreateEx(PRTTIMER *ppTimer, uint64_t u64NanoInterval, uint32_t fFlags, PFNRTTIMER pfnTimer, void *pvUser) { *ppTimer = NULL; @@ -8,7 +8,7 @@ /* * Validate flags. -@@ -121,6 +122,7 @@ RTDECL(int) RTTimerCreateEx(PRTTIMER *ppTimer, uint64_ +@@ -146,6 +147,7 @@ RTDECL(int) RTTimerCreateEx(PRTTIMER *ppTimer, uint64_ callout_init(&pTimer->Callout, CALLOUT_MPSAFE); *ppTimer = pTimer; @@ -16,7 +16,7 @@ return VINF_SUCCESS; } -@@ -141,6 +143,8 @@ DECLINLINE(bool) rtTimerIsValid(PRTTIMER pTimer) +@@ -166,6 +168,8 @@ DECLINLINE(bool) rtTimerIsValid(PRTTIMER pTimer) RTDECL(int) RTTimerDestroy(PRTTIMER pTimer) { @@ -25,7 +25,7 @@ /* It's ok to pass NULL pointer. */ if (pTimer == /*NIL_RTTIMER*/ NULL) return VINF_SUCCESS; -@@ -153,6 +157,8 @@ RTDECL(int) RTTimerDestroy(PRTTIMER pTimer) +@@ -178,6 +182,8 @@ RTDECL(int) RTTimerDestroy(PRTTIMER pTimer) pTimer->u32Magic++; callout_stop(&pTimer->Callout); RTMemFree(pTimer); @@ -34,7 +34,7 @@ return VINF_SUCCESS; } -@@ -160,6 +166,7 @@ RTDECL(int) RTTimerDestroy(PRTTIMER pTimer) +@@ -185,6 +191,7 @@ RTDECL(int) RTTimerDestroy(PRTTIMER pTimer) RTDECL(int) RTTimerStart(PRTTIMER pTimer, uint64_t u64First) { struct timeval tv; @@ -42,7 +42,7 @@ if (!rtTimerIsValid(pTimer)) return VERR_INVALID_HANDLE; -@@ -183,12 +190,15 @@ RTDECL(int) RTTimerStart(PRTTIMER pTimer, uint64_t u64 +@@ -208,12 +215,15 @@ RTDECL(int) RTTimerStart(PRTTIMER pTimer, uint64_t u64 tv.tv_usec = (u64First % 1000000000) / 1000; callout_reset(&pTimer->Callout, tvtohz(&tv), rtTimerFreeBSDCallback, pTimer); @@ -58,7 +58,7 @@ if (!rtTimerIsValid(pTimer)) return VERR_INVALID_HANDLE; if (pTimer->fSuspended) -@@ -200,6 +210,7 @@ RTDECL(int) RTTimerStop(PRTTIMER pTimer) +@@ -225,6 +235,7 @@ RTDECL(int) RTTimerStop(PRTTIMER pTimer) pTimer->fSuspended = true; callout_stop(&pTimer->Callout); --- emulators/virtualbox-ose/files/patch-src_VBox_Runtime_r3_freebsd_systemmem-freebsd.cpp (revision 520061) +++ emulators/virtualbox-ose/files/patch-src_VBox_Runtime_r3_freebsd_systemmem-freebsd.cpp (working copy) @@ -1,4 +1,4 @@ ---- src/VBox/Runtime/r3/freebsd/systemmem-freebsd.cpp.orig 2017-07-27 13:18:46 UTC +--- src/VBox/Runtime/r3/freebsd/systemmem-freebsd.cpp.orig 2019-11-21 17:02:54 UTC +++ src/VBox/Runtime/r3/freebsd/systemmem-freebsd.cpp @@ -65,7 +65,6 @@ RTDECL(int) RTSystemQueryAvailableRam(uint64_t *pcb) u_int cPagesMemFree = 0; --- emulators/virtualbox-ose/files/patch-src_VBox_Runtime_r3_posix_ldrNative-posix.cpp (nonexistent) +++ emulators/virtualbox-ose/files/patch-src_VBox_Runtime_r3_posix_ldrNative-posix.cpp (working copy) @@ -0,0 +1,20 @@ +--- src/VBox/Runtime/r3/posix/ldrNative-posix.cpp.orig 2019-11-21 17:02:57 UTC ++++ src/VBox/Runtime/r3/posix/ldrNative-posix.cpp +@@ -148,7 +148,7 @@ DECLHIDDEN(int) rtldrNativeLoadSystem(const char *pszF + */ + if (!pszExt) + { +-#if !defined(RT_OS_DARWIN) && !defined(RT_OS_OS2) && !defined(RT_OS_WINDOWS) ++#if !defined(RT_OS_DARWIN) && !defined(RT_OS_FREEBSD) && !defined(RT_OS_OS2) && !defined(RT_OS_WINDOWS) + if ( (fFlags & RTLDRLOAD_FLAGS_SO_VER_BEGIN_MASK) >> RTLDRLOAD_FLAGS_SO_VER_BEGIN_SHIFT + == (fFlags & RTLDRLOAD_FLAGS_SO_VER_END_MASK) >> RTLDRLOAD_FLAGS_SO_VER_END_SHIFT) + #endif +@@ -168,7 +168,7 @@ DECLHIDDEN(int) rtldrNativeLoadSystem(const char *pszF + + int rc = RTLdrLoadEx(pszTmp, phLdrMod, fFlags2, NULL); + +-#if !defined(RT_OS_DARWIN) && !defined(RT_OS_OS2) && !defined(RT_OS_WINDOWS) ++#if !defined(RT_OS_DARWIN) && !defined(RT_OS_FREEBSD) && !defined(RT_OS_OS2) && !defined(RT_OS_WINDOWS) + /* + * If no version was given after the .so and do .so.MAJOR search according + * to the range in the fFlags. --- emulators/virtualbox-ose/files/patch-src_VBox_Runtime_r3_posix_process-creation-posix.cpp (nonexistent) +++ emulators/virtualbox-ose/files/patch-src_VBox_Runtime_r3_posix_process-creation-posix.cpp (working copy) @@ -0,0 +1,40 @@ +--- src/VBox/Runtime/r3/posix/process-creation-posix.cpp.orig 2019-11-21 17:02:57 UTC ++++ src/VBox/Runtime/r3/posix/process-creation-posix.cpp +@@ -33,7 +33,7 @@ + #ifdef RT_OS_LINUX + # define IPRT_WITH_DYNAMIC_CRYPT_R + #endif +-#if (defined(RT_OS_LINUX) || defined(RT_OS_OS2)) && !defined(_GNU_SOURCE) ++#if (defined(RT_OS_FREEBSD) || defined(RT_OS_LINUX) || defined(RT_OS_OS2)) && !defined(_GNU_SOURCE) + # define _GNU_SOURCE + #endif + +@@ -64,7 +64,7 @@ + # include + #endif + +-#if defined(RT_OS_LINUX) || defined(RT_OS_OS2) ++#if defined(RT_OS_FREEBSD) || defined(RT_OS_LINUX) || defined(RT_OS_OS2) + /* While Solaris has posix_spawn() of course we don't want to use it as + * we need to have the child in a different process contract, no matter + * whether it is started detached or not. */ +@@ -97,6 +97,10 @@ + # include + #endif + ++#ifdef RT_OS_FREEBSD ++# include ++#endif ++ + #ifdef RT_OS_SOLARIS + # include + # include +@@ -372,7 +376,7 @@ static int rtCheckCredentials(const char *pszUser, con + if (pPwd->pw_passwd && *pPwd->pw_passwd) + # endif + { +-# if defined(RT_OS_LINUX) || defined(RT_OS_OS2) ++# if (defined(RT_OS_FREEBSD) && __FreeBSD_version >= 1200000) || defined(RT_OS_LINUX) || defined(RT_OS_OS2) + # ifdef IPRT_WITH_DYNAMIC_CRYPT_R + size_t const cbCryptData = RT_MAX(sizeof(struct crypt_data) * 2, _256K); + # else --- emulators/virtualbox-ose/files/patch-src_VBox_Storage_testcase_Makefile.kmk (nonexistent) +++ emulators/virtualbox-ose/files/patch-src_VBox_Storage_testcase_Makefile.kmk (working copy) @@ -0,0 +1,23 @@ +--- src/VBox/Storage/testcase/Makefile.kmk.orig 2019-11-21 17:03:07 UTC ++++ src/VBox/Storage/testcase/Makefile.kmk +@@ -146,7 +146,7 @@ if defined(VBOX_WITH_TESTCASES) || defined(VBOX_WITH_V + vbox-img_LIBS += xml2 + endif + else ifeq ($(KBUILD_TARGET),freebsd) +- vbox-img_LIBS += iconv ++ vbox-img_LIBS += crypt iconv + ifdef SDK_VBOX_LIBXML2_LIBS + vbox-img_LIBS += xml2 lzma + endif +@@ -191,8 +191,10 @@ if defined(VBOX_WITH_TESTCASES) && defined(VBOX_WIT + ifdef SDK_VBOX_LIBXML2_LIBS + vdkeystoremgr_LIBS += xml2 + endif +- else if1of ($(KBUILD_TARGET),darwin freebsd) ++ else ifeq ($(KBUILD_TARGET),darwin) + vdkeystoremgr_LIBS += iconv ++ else ifeq ($(KBUILD_TARGET),freebsd) ++ vdkeystoremgr_LIBS += crypt iconv + else ifeq ($(KBUILD_TARGET),win) + vdkeystoremgr_SDKS.win = VBOX_NTDLL + else ifeq ($(KBUILD_TARGET),solaris) --- emulators/virtualbox-ose/files/patch-src_VBox_VMM_VMMR0_GVMMR0.cpp (revision 520061) +++ emulators/virtualbox-ose/files/patch-src_VBox_VMM_VMMR0_GVMMR0.cpp (nonexistent) @@ -1,11 +0,0 @@ ---- src/VBox/VMM/VMMR0/GVMMR0.cpp.orig 2018-01-15 14:56:33.000000000 +0000 -+++ src/VBox/VMM/VMMR0/GVMMR0.cpp 2018-01-17 01:13:24.832105000 +0000 -@@ -1243,7 +1243,7 @@ static void gvmmR0CleanupVM(PGVM pGVM) - - GMMR0CleanupVM(pGVM); - -- AssertCompile((uintptr_t)NIL_RTTHREADCTXHOOK == 0); /* Depends on zero initialized memory working for NIL at the moment. */ -+ AssertCompile(NIL_RTTHREADCTXHOOK == (RTTHREADCTXHOOK)0); /* Depends on zero initialized memory working for NIL at the moment. */ - for (VMCPUID idCpu = 0; idCpu < pGVM->cCpus; idCpu++) - { - /** @todo Can we busy wait here for all thread-context hooks to be --- emulators/virtualbox-ose/files/patch-src_VBox_VMM_VMMR3_VMReq.cpp (revision 520061) +++ emulators/virtualbox-ose/files/patch-src_VBox_VMM_VMMR3_VMReq.cpp (nonexistent) @@ -1,11 +0,0 @@ ---- src/VBox/VMM/VMMR3/VMReq.cpp.orig 2018-01-15 14:56:37 UTC -+++ src/VBox/VMM/VMMR3/VMReq.cpp -@@ -669,7 +669,7 @@ VMMR3DECL(int) VMR3ReqAlloc(PUVM pUVM, PVMREQ *ppReq, - Assert(pReq->enmType == VMREQTYPE_INVALID); - Assert(pReq->enmState == VMREQSTATE_FREE); - Assert(pReq->pUVM == pUVM); -- ASMAtomicXchgSize(&pReq->pNext, NULL); -+ ASMAtomicXchgSize(&pReq->pNext, (uintptr_t)NULL); - pReq->enmState = VMREQSTATE_ALLOCATED; - pReq->iStatus = VERR_VM_REQUEST_STATUS_STILL_PENDING; - pReq->fFlags = VMREQFLAGS_VBOX_STATUS; --- emulators/virtualbox-ose/files/patch-src_VBox_ValidationKit_Config.kmk (nonexistent) +++ emulators/virtualbox-ose/files/patch-src_VBox_ValidationKit_Config.kmk (working copy) @@ -0,0 +1,12 @@ +--- src/VBox/ValidationKit/Config.kmk.orig 2019-11-21 17:03:18 UTC ++++ src/VBox/ValidationKit/Config.kmk +@@ -50,6 +50,9 @@ ifn1of ($(KBUILD_TARGET), darwin solaris win) + TEMPLATE_VBoxValidationKitR3Base_LDFLAGS = $(filter-out -static, $(TEMPLATE_VBoxR3Static_LDFLAGS)) + endif + TEMPLATE_VBoxValidationKitR3Base_LIBS = $(TEMPLATE_VBoxR3Static_LIBS) ++if1of ($(KBUILD_TARGET), freebsd) ++ TEMPLATE_VBoxValidationKitR3Base_LIBS += crypt ++endif + if1of ($(KBUILD_TARGET), linux) + TEMPLATE_VBoxValidationKitR3Base_LIBS += supc++ + TEMPLATE_VBoxValidationKitR3Base_LDTOOL = $(subst GXX,GCC,$(TEMPLATE_VBoxR3Static_TOOL)) --- emulators/virtualbox-ose/files/patch-src_libs_xpcom18a4_Makefile.kmk (revision 520061) +++ emulators/virtualbox-ose/files/patch-src_libs_xpcom18a4_Makefile.kmk (working copy) @@ -1,6 +1,6 @@ ---- src/libs/xpcom18a4/Makefile.kmk.orig 2019-01-25 18:32:58 UTC +--- src/libs/xpcom18a4/Makefile.kmk.orig 2019-11-21 17:03:58 UTC +++ src/libs/xpcom18a4/Makefile.kmk -@@ -980,6 +980,8 @@ VBoxXPCOM_LIBS = \ +@@ -985,6 +985,8 @@ VBoxXPCOM_LIBS = \ $(VBox-xpcom-proxy_1_TARGET) \ $(VBox-xpcom-nspr_1_TARGET) \ $(VBoxXPCOMGlue_s_1_TARGET) --- emulators/virtualbox-ose/files/patch-src_libs_xpcom18a4_nsprpub_pr_src_pthreads_ptsynch.c (revision 520061) +++ emulators/virtualbox-ose/files/patch-src_libs_xpcom18a4_nsprpub_pr_src_pthreads_ptsynch.c (working copy) @@ -1,4 +1,4 @@ ---- src/libs/xpcom18a4/nsprpub/pr/src/pthreads/ptsynch.c.orig +--- src/libs/xpcom18a4/nsprpub/pr/src/pthreads/ptsynch.c.orig 2019-11-21 17:04:13 UTC +++ src/libs/xpcom18a4/nsprpub/pr/src/pthreads/ptsynch.c @@ -49,6 +49,9 @@ #include @@ -10,13 +10,11 @@ static pthread_mutexattr_t _pt_mattr; static pthread_condattr_t _pt_cvar_attr; -@@ -798,7 +801,8 @@ +@@ -798,6 +801,7 @@ PR_IMPLEMENT(PRStatus) PR_DeleteSemaphore(const char * * From the semctl(2) man page in glibc 2.0 */ #if (defined(__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED)) \ -- || defined(FREEBSD) || defined(OPENBSD) || defined(BSDI) + || (defined(FREEBSD) && __FreeBSD_version < 1200059) \ -+ || defined(OPENBSD) || defined(BSDI) + || defined(OPENBSD) || defined(BSDI) /* union semun is defined by including */ #else - /* according to X/OPEN we have to define it ourselves */ --- emulators/virtualbox-ose/files/patch-src_libs_xpcom18a4_xpcom_io_nsLocalFileUnix.h (revision 520061) +++ emulators/virtualbox-ose/files/patch-src_libs_xpcom18a4_xpcom_io_nsLocalFileUnix.h (working copy) @@ -1,5 +1,5 @@ ---- src/libs/xpcom18a4/xpcom/io/nsLocalFileUnix.h.orig 2017-03-08 17:21:24.000000000 +0000 -+++ src/libs/xpcom18a4/xpcom/io/nsLocalFileUnix.h 2017-03-08 22:53:39.572250000 +0000 +--- src/libs/xpcom18a4/xpcom/io/nsLocalFileUnix.h.orig 2019-11-21 17:04:26 UTC ++++ src/libs/xpcom18a4/xpcom/io/nsLocalFileUnix.h @@ -72,14 +72,6 @@ #define STATFS statfs #endif --- emulators/virtualbox-ose/files/patch-src_recompiler_Makefile.kmk (revision 520061) +++ emulators/virtualbox-ose/files/patch-src_recompiler_Makefile.kmk (nonexistent) @@ -1,12 +0,0 @@ ---- src/recompiler/Makefile.kmk.orig 2019-01-25 18:33:40 UTC -+++ src/recompiler/Makefile.kmk -@@ -63,6 +63,9 @@ else - # Missing fpclassify. Is there a better define or flag for this? - VBoxRemPrimary_DEFS.solaris += __C99FEATURES__ - endif # win -+# XXX Work around a linker issue with GCC 8.x & LLD: -+# ld: error: translate.c:(.debug_loc+0xA40FD): has non-ABS relocation R_386_GOTOFF against symbol 'cpu_regs' -+VBoxRemPrimary_CFLAGS.freebsd.x86 += -g0 - VBoxRemPrimary_DEFS += IN_REM_R3 REM_INCLUDE_CPU_H NEED_CPU_H - #VBoxRemPrimary_DEFS += REM_PHYS_ADDR_IN_TLB - #VBoxRemPrimary_DEFS += DEBUG_ALL_LOGGING DEBUG_DISAS DEBUG_PCALL CONFIG_DEBUG_EXEC DEBUG_FLUSH DEBUG_IOPORT DEBUG_SIGNAL DEBUG_TLB_CHECK DEBUG_TB_INVALIDATE DEBUG_TLB # Enables huge amounts of debug logging. --- emulators/virtualbox-ose/pkg-plist (revision 520061) +++ emulators/virtualbox-ose/pkg-plist (working copy) @@ -6,6 +6,8 @@ bin/VBoxManage %%X11%%bin/VBoxSDL bin/VBoxVRDP %%QT%%bin/VirtualBox +%%QT%%bin/VirtualBoxVM +bin/vbox-img bin/vboxautostart bin/vboxballoonctrl bin/vboxbugreport @@ -14,6 +16,7 @@ bin/vboxmanage %%X11%%bin/vboxsdl %%WEBSERVICE%%bin/vboxwebsrv %%QT%%bin/virtualbox +%%QT%%bin/virtualboxvm include/virtualbox/VirtualBox_XPCOM.h include/virtualbox/ipcIClientObserver.h include/virtualbox/ipcIDConnectService.h @@ -369,6 +372,7 @@ include/virtualbox/xpcom/xptinfo.h %%PYTHON%%%%PYTHON_SITELIBDIR%%/xpcom/server/policy.py %%PYTHON%%%%PYTHON_SITELIBDIR%%/xpcom/server%%PYTHON_PYCDIR%%policy%%PYTHON_PYCEXT%% %%QT%%lib/virtualbox/DbgPlugInDiggers.so +%%QT%%lib/virtualbox/UICommon.so lib/virtualbox/VBox.sh lib/virtualbox/VBoxAuth.so lib/virtualbox/VBoxAuthSimple.so @@ -378,12 +382,9 @@ lib/virtualbox/VBoxBugReport lib/virtualbox/VBoxDD.so lib/virtualbox/VBoxDD2.so lib/virtualbox/VBoxDDR0.r0 -lib/virtualbox/VBoxDDRC.rc lib/virtualbox/VBoxDDU.so %%QT%%lib/virtualbox/VBoxDbg.so %%QT%%lib/virtualbox/VBoxDragAndDropSvc.so -lib/virtualbox/VBoxEFI32.fd -lib/virtualbox/VBoxEFI64.fd lib/virtualbox/VBoxExtPackHelperApp lib/virtualbox/VBoxGuestControlSvc.so lib/virtualbox/VBoxGuestPropSvc.so @@ -399,15 +400,12 @@ lib/virtualbox/VBoxNetDHCP.so lib/virtualbox/VBoxNetNAT.so %%PYTHON%%lib/virtualbox/VBoxPython.so %%PYTHON%%lib/virtualbox/VBoxPython%%PYTHON_VERU%%.so -lib/virtualbox/VBoxREM.so -%%I386%%lib/virtualbox/VBoxREM32.so -%%I386%%lib/virtualbox/VBoxREM64.so lib/virtualbox/VBoxRT.so %%X11%%@(root,%%VBOXGROUP%%,4510) lib/virtualbox/VBoxSDL %%X11%%lib/virtualbox/VBoxSDL.so lib/virtualbox/VBoxSVC +%%X11%%lib/virtualbox/VBoxSVGA3D.so %%X11%%lib/virtualbox/VBoxSharedClipboard.so -%%X11%%lib/virtualbox/VBoxSharedCrOpenGL.so lib/virtualbox/VBoxSharedFolders.so %%QT%%lib/virtualbox/VBoxTestOGL lib/virtualbox/VBoxVMM.so @@ -416,10 +414,11 @@ lib/virtualbox/VBoxXPCOM.so lib/virtualbox/VBoxXPCOMC.so lib/virtualbox/VBoxXPCOMIPCD lib/virtualbox/VMMR0.r0 -lib/virtualbox/VMMRC.rc -%%QT%%@(root,%%VBOXGROUP%%,4510) lib/virtualbox/VirtualBox -%%QT%%lib/virtualbox/VirtualBox.so +%%QT%%lib/virtualbox/VirtualBox +%%QT%%@(root,%%VBOXGROUP%%,4510) lib/virtualbox/VirtualBoxVM +%%QT%%lib/virtualbox/VirtualBoxVM.so %%SDK%%lib/virtualbox/sdk +lib/virtualbox/vbox-img %%WEBSERVICE%%lib/virtualbox/vboxwebsrv %%WEBSERVICE%%lib/virtualbox/webtest %%VNC%%lib/virtualbox/ExtensionPacks/VNC/ExtPack-license.html --- emulators/virtualbox-ose-additions/Makefile (revision 520061) +++ emulators/virtualbox-ose-additions/Makefile (working copy) @@ -2,10 +2,9 @@ # $FreeBSD$ PORTNAME= virtualbox-ose -PORTVERSION= 5.2.34 -PORTREVISION= 1 +PORTVERSION= 6.1.0 CATEGORIES= emulators -MASTER_SITES= https://download.oracle.com/virtualbox/${PORTVERSION}/ +MASTER_SITES= https://download.virtualbox.org/virtualbox/${PORTVERSION}/ PKGNAMESUFFIX?= -additions DISTNAME= VirtualBox-${PORTVERSION} @@ -47,21 +46,15 @@ CONFLICTS_INSTALL= virtualbox-ose-[0-9]* \ virtualbox-ose-lite-[0-9]* \ virtualbox-ose-nox11-[0-9]* -OPTIONS_DEFINE= DBUS DEBUG OPENGL X11 +OPTIONS_DEFINE= DBUS DEBUG X11 OPTIONS_DEFAULT= DBUS X11 OPTIONS_SUB= yes -OPENGL_DESC= 3D pass-through support (requires X11) - DBUS_CONFIGURE_OFF= --disable-dbus DBUS_LIB_DEPENDS= libdbus-1.so:devel/dbus DEBUG_CONFIGURE_ON= --build-debug DEBUG_VARS= KMK_BUILDTYPE=debug DEBUG_VARS_OFF= KMK_BUILDTYPE=release -OPENGL_CONFIGURE_OFF= --disable-opengl -OPENGL_IMPLIES= X11 -OPENGL_USE= GL=gl,glu XORG=xcomposite,xdamage,xfixes -OPENGL_USES= gl python:2.7,build xorg X11_BUILD_DEPENDS= ${LOCALBASE}/include/xorg/compiler.h:x11-servers/xorg-server X11_RUN_DEPENDS= xrandr:x11/xrandr X11_USE= XORG=x11,xcursor,xext,xorgproto,xmu,xrandr,xt @@ -89,11 +82,6 @@ BUILD_WRKSRC= ${VBOX_BIN}/src KMK_ARCH= freebsd.${ARCH:S/i386/x86/} KMK_CONFIG+= VBOX_LIBPATH_X11=${LOCALBASE} VBOX_FREEBSD_SRC=${SRC_BASE}/sys -.if ${PORT_OPTIONS:MOPENGL} -VBOX_LIBS= VBoxEGL.so \ - VBoxOGL.so -.endif - .if ${PORT_OPTIONS:MX11} .else VBOX_WITH_X11= @@ -103,10 +91,7 @@ VBOX_WITH_X11= .if ${COMPILER_TYPE} == clang EXTRA_PATCHES+= ${PATCHDIR}/extrapatch-Config.kmk -.if ${COMPILER_FEATURES:Mlibc++} -EXTRA_PATCHES+= ${PATCHDIR}/extrapatch-src-VBox-Additions-x11-VBoxClient-Makefile.kmk .endif -.endif post-patch: @${ECHO_CMD} 'VBOX_ONLY_ADDITIONS = 1' > ${WRKSRC}/LocalConfig.kmk @@ -118,9 +103,8 @@ post-patch: ${WRKSRC}/LocalConfig.kmk @${ECHO_CMD} 'VBOX_GCC_std = -std=c++11' >> ${WRKSRC}/LocalConfig.kmk .if ${COMPILER_TYPE} == clang - @${REINPLACE_CMD} -e 's| -finline-limit=8000||' \ - -e 's| -fno-merge-constants||' \ - -e 's| -mpreferred-stack-boundary=2||' ${WRKSRC}/Config.kmk + @${REINPLACE_CMD} -e 's| -mno-align-long-strings||' \ + ${WRKSRC}/Config.kmk .endif @${REINPLACE_CMD} -e 's|/usr/X11|${LOCALBASE}|g' \ ${WRKSRC}/src/VBox/Additions/x11/VBoxClient/display.cpp @@ -128,7 +112,6 @@ post-patch: ${WRKSRC}/Config.kmk ${WRKSRC}/configure \ ${WRKSRC}/kBuild/header.kmk ${WRKSRC}/kBuild/units/qt4.kmk \ ${WRKSRC}/kBuild/units/qt5.kmk ${WRKSRC}/kBuild/sdks/LIBSDL.kmk \ - ${WRKSRC}/src/VBox/Additions/common/crOpenGL/load.c \ ${WRKSRC}/src/VBox/Additions/x11/Installer/98vboxadd-xclient \ ${WRKSRC}/src/VBox/Additions/x11/Installer/vboxclient.desktop \ ${WRKSRC}/src/VBox/Additions/x11/vboxmouse/Makefile.kmk \ @@ -143,9 +126,6 @@ post-patch: @${ECHO_CMD} 'VBOX_ICONV_DEFS = LIBICONV_PLUG' >> ${WRKSRC}/LocalConfig.kmk .endif -post-patch-OPENGL-on: - @${ECHO_CMD} 'VBOX_USE_SYSTEM_GL_HEADERS = 1' >> ${WRKSRC}/LocalConfig.kmk - post-patch-X11-on: @${ECHO_CMD} 'VBOX_USE_SYSTEM_XORG_HEADERS = 1' >> \ ${WRKSRC}/LocalConfig.kmk @@ -185,10 +165,4 @@ do-install-X11-on: ${INSTALL_DATA} ${VBOX_BIN}/vboxmouse_drv_system.so \ ${STAGEDIR}${INPUTDIR}/vboxmouse_drv.so -do-install-OPENGL-on: - ${INSTALL_DATA} ${FILESDIR}/vboxvideo.conf \ - ${STAGEDIR}${PREFIX}/etc/libmap.d/ - ${INSTALL_DATA} ${VBOX_LIBS:S|^|${VBOX_BIN}/|} \ - ${STAGEDIR}${PREFIX}/lib/ - .include --- emulators/virtualbox-ose-additions/distinfo (revision 520061) +++ emulators/virtualbox-ose-additions/distinfo (working copy) @@ -1,3 +1,3 @@ -TIMESTAMP = 1571257463 -SHA256 (VirtualBox-5.2.34.tar.bz2) = 9abff37330bba46b97aa836bc886397ba9cfb06cb75be5d60ac31f5ae9c2f2e1 -SIZE (VirtualBox-5.2.34.tar.bz2) = 118268064 +TIMESTAMP = 1576163196 +SHA256 (VirtualBox-6.1.0.tar.bz2) = 49005ed94454f893fc3955e1e2b9607e85c300235cb983b39d1df2cfcf29f039 +SIZE (VirtualBox-6.1.0.tar.bz2) = 165322453 --- emulators/virtualbox-ose-additions/pkg-plist (revision 520061) +++ emulators/virtualbox-ose-additions/pkg-plist (working copy) @@ -1,9 +1,6 @@ %%X11%%bin/VBoxClient %%X11%%bin/VBoxClient-all -%%OPENGL%%etc/libmap.d/vboxvideo.conf %%X11%%etc/xdg/autostart/vboxclient.desktop -%%OPENGL%%lib/VBoxEGL.so -%%OPENGL%%lib/VBoxOGL.so lib/pam_vbox.so %%X11%%lib/xorg/modules/drivers/vboxvideo_drv.so %%X11%%lib/xorg/modules/input/vboxmouse_drv.so --- emulators/virtualbox-ose-kmod/Makefile (revision 520061) +++ emulators/virtualbox-ose-kmod/Makefile (working copy) @@ -2,9 +2,9 @@ # $FreeBSD$ PORTNAME= virtualbox-ose -PORTVERSION= 5.2.34 +PORTVERSION= 6.1.0 CATEGORIES= emulators -MASTER_SITES= https://download.oracle.com/virtualbox/${PORTVERSION}/ +MASTER_SITES= https://download.virtualbox.org/virtualbox/${PORTVERSION}/ PKGNAMESUFFIX= -kmod DISTNAME= VirtualBox-${PORTVERSION} --- emulators/virtualbox-ose-kmod/distinfo (revision 520061) +++ emulators/virtualbox-ose-kmod/distinfo (working copy) @@ -1,3 +1,3 @@ -TIMESTAMP = 1571257293 -SHA256 (VirtualBox-5.2.34.tar.bz2) = 9abff37330bba46b97aa836bc886397ba9cfb06cb75be5d60ac31f5ae9c2f2e1 -SIZE (VirtualBox-5.2.34.tar.bz2) = 118268064 +TIMESTAMP = 1576163196 +SHA256 (VirtualBox-6.1.0.tar.bz2) = 49005ed94454f893fc3955e1e2b9607e85c300235cb983b39d1df2cfcf29f039 +SIZE (VirtualBox-6.1.0.tar.bz2) = 165322453 --- emulators/virtualbox-ose-nox11/Makefile (revision 520061) +++ emulators/virtualbox-ose-nox11/Makefile (working copy) @@ -2,8 +2,8 @@ PKGNAMESUFFIX= -nox11 -OPTIONS_EXCLUDE= ALSA DBUS DEBUG GUESTADDITIONS MANUAL NLS PULSEAUDIO -OPTIONS_EXCLUDE+= QT5 VPX X11 +OPTIONS_EXCLUDE= ALSA DBUS DEBUG GUESTADDITIONS MANUAL NLS OPUS +OPTIONS_EXCLUDE+= PULSEAUDIO QT5 VPX X11 MASTERDIR= ${.CURDIR}/../virtualbox-ose --- www/phpvirtualbox/Makefile (revision 520061) +++ www/phpvirtualbox/Makefile (working copy) @@ -10,6 +10,8 @@ COMMENT= AJAX Web Interface for VirtualBox LICENSE= GPLv3 +IGNORE= does not work with VirtualBox 6.0 or later + USES= dos2unix php USE_PHP= json session simplexml soap xml