summaryrefslogtreecommitdiff
path: root/emulators/virtualbox-ose-70
diff options
context:
space:
mode:
Diffstat (limited to 'emulators/virtualbox-ose-70')
-rw-r--r--emulators/virtualbox-ose-70/Makefile20
-rw-r--r--emulators/virtualbox-ose-70/files/patch-configure43
-rw-r--r--emulators/virtualbox-ose-70/files/patch-src_VBox_Additions_freebsd_mount__vboxvfs_Makefile.kmk13
-rw-r--r--emulators/virtualbox-ose-70/files/patch-src_VBox_Devices_Graphics_DevVGA-SVGA.cpp20
-rw-r--r--emulators/virtualbox-ose-70/files/patch-src_VBox_Devices_Graphics_DevVGA-SVGA3d-dx-dx11.cpp11
-rw-r--r--emulators/virtualbox-ose-70/files/patch-src_VBox_Devices_Graphics_DevVGA-SVGA3d-glLdr.cpp8
-rw-r--r--emulators/virtualbox-ose-70/files/patch-src_VBox_Devices_Graphics_DevVGA-SVGA3d-glLdr.h4
-rw-r--r--emulators/virtualbox-ose-70/files/patch-src_VBox_Devices_Graphics_DevVGA-SVGA3d-ogl.cpp28
-rw-r--r--emulators/virtualbox-ose-70/files/patch-src_VBox_Runtime_r0drv_freebsd_memobj-r0drv-freebsd.c81
-rw-r--r--emulators/virtualbox-ose-70/files/patch-src_VBox_Runtime_r3_freebsd_systemmem-freebsd.cpp39
10 files changed, 194 insertions, 73 deletions
diff --git a/emulators/virtualbox-ose-70/Makefile b/emulators/virtualbox-ose-70/Makefile
index c1823c5bd1a5..482fc5725a82 100644
--- a/emulators/virtualbox-ose-70/Makefile
+++ b/emulators/virtualbox-ose-70/Makefile
@@ -1,6 +1,6 @@
PORTNAME= virtualbox-ose
DISTVERSION= 7.0.26
-PORTREVISION?= 0
+PORTREVISION?= 2
CATEGORIES= emulators
MASTER_SITES= https://download.virtualbox.org/virtualbox/${DISTVERSION}/:src \
LOCAL/vvd:docs
@@ -28,7 +28,7 @@ LIB_DEPENDS= libpng.so:graphics/png \
libcurl.so:ftp/curl
RUN_DEPENDS= ${LOCALBASE}/etc/rc.d/vboxnet:emulators/virtualbox-ose-kmod-70
-USES= compiler:c++14-lang cpe gnome iconv qt:5 pkgconfig ssl tar:bzip2
+USES= compiler:c++14-lang cpe gnome iconv pkgconfig qt:5 ssl tar:bzip2
CPE_VENDOR= oracle
CPE_PRODUCT= vm_virtualbox
USE_BINUTILS= yes
@@ -43,7 +43,9 @@ CONFIGURE_ARGS+= --with-gcc="${CC}" --with-g++="${CXX}"
CONFLICTS_INSTALL= virtualbox-ose-legacy \
virtualbox-ose-nox11-legacy \
virtualbox-ose \
- virtualbox-ose-nox11
+ virtualbox-ose-nox11 \
+ virtualbox-ose-71 \
+ virtualbox-ose-nox11-71
PORTSCOUT= limit:^7\.0\.
SUB_FILES= pkg-message
@@ -75,8 +77,9 @@ PLIST_SUB= GUEST_VER=${DISTVERSION} \
SLAVE_PORT?= no
-OPTIONS_DEFINE= AIO ALSA DBUS DEBUG DOCS GUESTADDITIONS NLS PULSEAUDIO \
- PYTHON QT5 R0LOGGING UDPTUNNEL VBOXIMG VDE VNC WEBSERVICE VPX X11
+OPTIONS_DEFINE= AIO ALSA DBUS DEBUG DOCS GUESTADDITIONS NLS OGG PULSEAUDIO \
+ PYTHON QT5 R0LOGGING UDPTUNNEL VBOXIMG VDE VNC VORBIS VPX \
+ WEBSERVICE X11
OPTIONS_DEFAULT= AIO DBUS QT5 UDPTUNNEL VNC WEBSERVICE X11
.if ${SLAVE_PORT} == no
OPTIONS_DEFAULT+= PYTHON
@@ -90,12 +93,14 @@ AIO_DESC= Enable Asyncronous IO support (check pkg-message)
DEBUG_DESC= Debug symbols, additional logs and assertions
GUESTADDITIONS_DESC= Build with Guest Additions
NLS_DESC= Native language support (requires QT5)
+OGG_DESC= Use libogg from audio/libogg instead of bundled one
QT5_DESC= Build with QT5 frontend (requires X11)
R0LOGGING_DESC= Enable R0 logging (requires DEBUG)
UDPTUNNEL_DESC= Build with UDP tunnel support
VBOXIMG_DESC= Build vboximg-mount (requires fuse-libs)
VDE_DESC= Build with VDE support
VNC_DESC= Build with VNC support
+VORBIS_DESC= Use libvorbis from audio/libvorbis instead of bundled one
VPX_DESC= Use libvpx for video recording
WEBSERVICE_DESC= Build Webservice
@@ -105,6 +110,8 @@ DBUS_LIB_DEPENDS= libdbus-1.so:devel/dbus
DBUS_CONFIGURE_OFF= --disable-dbus
DEBUG_CONFIGURE_ON= --build-debug
NLS_IMPLIES= QT5
+OGG_LIB_DEPENDS= libogg.so:audio/libogg
+OGG_CONFIGURE_ON= --enable-libogg
PULSEAUDIO_LIB_DEPENDS= libpulse.so:audio/pulseaudio
PULSEAUDIO_CONFIGURE_OFF= --disable-pulse
PYTHON_USES= python
@@ -125,6 +132,9 @@ VDE_RUN_DEPENDS= vde_switch:net/vde2
VDE_CONFIGURE_ON= --enable-vde
VNC_LIB_DEPENDS= libvncserver.so:net/libvncserver
VNC_CONFIGURE_ON= --enable-vnc
+VORBIS_LIB_DEPENDS= libvorbis.so:audio/libvorbis \
+ libvorbisenc.so:audio/libvorbis
+VORBIS_CONFIGURE_ON= --enable-libvorbis
VPX_LIB_DEPENDS= libvpx.so:multimedia/libvpx
VPX_CONFIGURE_OFF= --disable-libvpx
WEBSERVICE_BUILD_DEPENDS= soapcpp2:devel/gsoap
diff --git a/emulators/virtualbox-ose-70/files/patch-configure b/emulators/virtualbox-ose-70/files/patch-configure
index fe0f4247089b..992770166b0f 100644
--- a/emulators/virtualbox-ose-70/files/patch-configure
+++ b/emulators/virtualbox-ose-70/files/patch-configure
@@ -1,6 +1,6 @@
---- configure.orig 2024-10-10 20:19:24.000000000 +0200
-+++ configure 2024-12-27 13:12:46.010746000 +0100
-@@ -154,10 +154,14 @@
+--- configure.orig 2025-04-11 11:59:42 UTC
++++ configure
+@@ -154,10 +154,14 @@ if [ "$OS" = "freebsd" ]; then
if [ "$OS" = "freebsd" ]; then
INCCURL="-I/usr/local/include"
LIBCURL="-L/usr/local/lib -lcurl"
@@ -15,7 +15,7 @@
else
INCCURL=""
LIBCURL="-lcurl"
-@@ -1207,6 +1211,9 @@
+@@ -1207,6 +1211,9 @@ extern "C" int main(int argc, char** argv)
printf("found version %d.%d.%d",
SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL);
#if SDL_VERSION_ATLEAST(1,2,7)
@@ -25,7 +25,7 @@
printf(", OK.\n");
return 0;
#else
-@@ -1291,7 +1298,7 @@
+@@ -1291,7 +1298,7 @@ EOF
#endif
}
EOF
@@ -34,7 +34,7 @@
test_execute
fi
}
-@@ -1605,6 +1612,7 @@
+@@ -1605,6 +1612,7 @@ EOF
FLGQT5=`pkg-config Qt5Core --cflags`
# gcc 4.8 is able to compile with C++11 (see also VBOX_GCC_std in Config.kmk)
[ $(($cc_maj * 100 + $cc_min)) -ge 408 ] && FLGQT5="$FLGQT5 -std=c++11"
@@ -42,7 +42,28 @@
INCQT5=`strip_I "$FLGQT5"`
LIBDIR5=`pkg-config Qt5Core --variable=libdir`
LIBQT5=`pkg-config Qt5Core Qt5Gui --libs`
-@@ -2180,8 +2188,8 @@
+@@ -1861,9 +1869,9 @@ check_libvorbis()
+ if which_wrapper pkg-config > /dev/null; then
+ libvorbis_ver=`pkg-config vorbis --modversion 2>> $LOG`
+ if [ $? -eq 0 ]; then
+- FLGVRB=`pkg-config vorbis --cflags`
++ FLGVRB=`pkg-config vorbis vorbisenc --cflags`
+ INCVRB=`strip_I "$FLGVRB"`
+- LIBVRB=`pkg-config vorbis --libs`
++ LIBVRB=`pkg-config vorbis vorbisenc --libs`
+ fi
+ cat > $ODIR.tmp_src.cc << EOF
+ #include <cstdio>
+@@ -1913,7 +1921,7 @@ EOF
+ return 0;
+ }
+ EOF
+- [ -n "$INCOGG" ] && I_INCVRB=`prefix_I "$INCOGG"`
++ [ -n "$INCOGG" ] && I_INCOGG=`prefix_I "$INCOGG"`
+ if test_compile "$LIBOGG $I_INCOGG" ogg ogg nofatal; then
+ if test_execute; then
+ cnf_append "SDK_VBoxLibOgg_INCS" "$INCOGG"
+@@ -2180,8 +2188,8 @@ EOF
echo "compiling the following source file:" >> $LOG
cat $ODIR.tmp_src.cc >> $LOG
echo "using the following command line:" >> $LOG
@@ -53,7 +74,7 @@
if [ $? -eq 0 ]; then
found=1
break
-@@ -2297,7 +2305,7 @@
+@@ -2297,7 +2305,7 @@ check_gsoap()
else
cnf_append "VBOX_GSOAP_CXX_SOURCES" ""
fi
@@ -62,7 +83,7 @@
gsoap_version=`pkg-config gsoapssl++ --modversion`
log_success "found version $gsoap_version"
return
-@@ -2661,7 +2669,7 @@
+@@ -2661,7 +2669,7 @@ for option in "$@"; do
--with-openssl-dir=*)
OPENSSLDIR=`echo $option | cut -d'=' -f2`
INCCRYPTO="-I${OPENSSLDIR}/include"
@@ -71,7 +92,7 @@
# On Darwin (at least for macports) static OpenSSL also needs zlib.
[ "$OS" = "darwin" ] && LIBCRYPTO="$LIBCRYPTO ${OPENSSLDIR}/lib/libz.a"
# On Linux static OpenSSL typically needs a few additional libraries.
-@@ -3028,12 +3036,22 @@
+@@ -3028,12 +3036,22 @@ if [ $ONLY_ADDITIONS -eq 0 ]; then
[ $WITH_JAVA -eq 1 ] && check_java
# PulseAudio
@@ -100,7 +121,7 @@
fi
fi
-@@ -3049,14 +3067,6 @@
+@@ -3049,14 +3067,6 @@ if [ "$OS" = "linux" ]; then
cnf_append "VBOX_WITHOUT_LINUX_TEST_BUILDS" "1"
fi
if [ $ONLY_ADDITIONS -eq 0 ]; then
diff --git a/emulators/virtualbox-ose-70/files/patch-src_VBox_Additions_freebsd_mount__vboxvfs_Makefile.kmk b/emulators/virtualbox-ose-70/files/patch-src_VBox_Additions_freebsd_mount__vboxvfs_Makefile.kmk
index 4d327e1089b1..270472c045e3 100644
--- a/emulators/virtualbox-ose-70/files/patch-src_VBox_Additions_freebsd_mount__vboxvfs_Makefile.kmk
+++ b/emulators/virtualbox-ose-70/files/patch-src_VBox_Additions_freebsd_mount__vboxvfs_Makefile.kmk
@@ -1,6 +1,6 @@
---- 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 2025-05-11 03:54:13 UTC
+++ src/VBox/Additions/freebsd/mount_vboxvfs/Makefile.kmk
-@@ -0,0 +1,23 @@
+@@ -0,0 +1,28 @@
+# $Id: Makefile.kmk $
+## @file
+# Sub-Makefile for the FreeBSD Shared folder mount utility.
@@ -19,8 +19,13 @@
+
+PROGRAMS += mount_vboxvfs
+mount_vboxvfs_TEMPLATE = NewVBoxGuestR3Exe
-+mount_vboxvfs_SOURCES = $(MOUNT)/getmntopts.c \
-+ mount_vboxvfs.c
++mount_vboxvfs_SOURCES = mount_vboxvfs.c
++
++ifdef HAVE_MNTOPTS_IN_LIBUTIL
++mount_vboxvfs_LIBS = util
++else
++mount_vboxvfs_SOURCES += $(MOUNT)/getmntopts.c
++endif
+
+include $(FILE_KBUILD_SUB_FOOTER)
+
diff --git a/emulators/virtualbox-ose-70/files/patch-src_VBox_Devices_Graphics_DevVGA-SVGA.cpp b/emulators/virtualbox-ose-70/files/patch-src_VBox_Devices_Graphics_DevVGA-SVGA.cpp
new file mode 100644
index 000000000000..aa74b95e2303
--- /dev/null
+++ b/emulators/virtualbox-ose-70/files/patch-src_VBox_Devices_Graphics_DevVGA-SVGA.cpp
@@ -0,0 +1,20 @@
+--- src/VBox/Devices/Graphics/DevVGA-SVGA.cpp.orig 2025-04-11 12:09:20 UTC
++++ src/VBox/Devices/Graphics/DevVGA-SVGA.cpp
+@@ -178,7 +178,7 @@
+ # ifdef RT_OS_DARWIN
+ # include "DevVGA-SVGA3d-cocoa.h"
+ # endif
+-# ifdef RT_OS_LINUX
++# if defined(RT_OS_FREEBSD) || defined(RT_OS_LINUX)
+ # ifdef IN_RING3
+ # include "DevVGA-SVGA3d-glLdr.h"
+ # endif
+@@ -7153,7 +7153,7 @@ static void vmsvgaR3PowerOnDevice(PPDMDEVINS pDevIns,
+ }
+ # endif
+
+-# if defined(VBOX_WITH_VMSVGA3D) && defined(RT_OS_LINUX)
++# if defined(VBOX_WITH_VMSVGA3D) && (defined(RT_OS_FREEBSD) || defined(RT_OS_LINUX))
+ if (pThis->svga.f3DEnabled)
+ {
+ /* The FIFO thread may use X API for accelerated screen output. */
diff --git a/emulators/virtualbox-ose-70/files/patch-src_VBox_Devices_Graphics_DevVGA-SVGA3d-dx-dx11.cpp b/emulators/virtualbox-ose-70/files/patch-src_VBox_Devices_Graphics_DevVGA-SVGA3d-dx-dx11.cpp
new file mode 100644
index 000000000000..8592bccdc8fc
--- /dev/null
+++ b/emulators/virtualbox-ose-70/files/patch-src_VBox_Devices_Graphics_DevVGA-SVGA3d-dx-dx11.cpp
@@ -0,0 +1,11 @@
+--- src/VBox/Devices/Graphics/DevVGA-SVGA3d-dx-dx11.cpp.orig 2025-04-11 12:09:20 UTC
++++ src/VBox/Devices/Graphics/DevVGA-SVGA3d-dx-dx11.cpp
+@@ -3111,7 +3111,7 @@ static DECLCALLBACK(int) vmsvga3dBackInit(PPDMDEVINS p
+ RT_NOREF(pDevIns, pThis);
+
+ int rc;
+-#ifdef RT_OS_LINUX /** @todo Remove, this is currently needed for loading the X11 library in order to call XInitThreads(). */
++#if defined(RT_OS_FREEBSD) || defined(RT_OS_LINUX) /** @todo Remove, this is currently needed for loading the X11 library in order to call XInitThreads(). */
+ rc = glLdrInit(pDevIns);
+ if (RT_FAILURE(rc))
+ {
diff --git a/emulators/virtualbox-ose-70/files/patch-src_VBox_Devices_Graphics_DevVGA-SVGA3d-glLdr.cpp b/emulators/virtualbox-ose-70/files/patch-src_VBox_Devices_Graphics_DevVGA-SVGA3d-glLdr.cpp
index c9574654562d..caa97030f41c 100644
--- a/emulators/virtualbox-ose-70/files/patch-src_VBox_Devices_Graphics_DevVGA-SVGA3d-glLdr.cpp
+++ b/emulators/virtualbox-ose-70/files/patch-src_VBox_Devices_Graphics_DevVGA-SVGA3d-glLdr.cpp
@@ -1,6 +1,6 @@
---- src/VBox/Devices/Graphics/DevVGA-SVGA3d-glLdr.cpp.orig 2021-01-07 15:39:16 UTC
+--- src/VBox/Devices/Graphics/DevVGA-SVGA3d-glLdr.cpp.orig 2025-04-11 12:09:20 UTC
+++ src/VBox/Devices/Graphics/DevVGA-SVGA3d-glLdr.cpp
-@@ -186,7 +186,7 @@ int glLdrInit(PPDMDEVINS pDevIns)
+@@ -196,7 +196,7 @@ int glLdrInit(PPDMDEVINS pDevIns)
pfn_wglDeleteContext = 0;
pfn_wglMakeCurrent = 0;
pfn_wglShareLists = 0;
@@ -9,7 +9,7 @@
pfn_XConfigureWindow = 0;
pfn_XCloseDisplay = 0;
pfn_XCreateColormap = 0;
-@@ -296,7 +296,7 @@ int glLdrInit(PPDMDEVINS pDevIns)
+@@ -306,7 +306,7 @@ int glLdrInit(PPDMDEVINS pDevIns)
GLGETPROC_(wglDeleteContext, "");
GLGETPROC_(wglMakeCurrent, "");
GLGETPROC_(wglShareLists, "");
@@ -18,7 +18,7 @@
X11GETPROC_(XConfigureWindow);
X11GETPROC_(XCloseDisplay);
X11GETPROC_(XCreateColormap);
-@@ -397,7 +397,7 @@ int glLdrInit(PPDMDEVINS pDevIns)
+@@ -407,7 +407,7 @@ int glLdrInit(PPDMDEVINS pDevIns)
GLGETPROC_(glVertexPointer, "");
GLGETPROC_(glViewport, "");
diff --git a/emulators/virtualbox-ose-70/files/patch-src_VBox_Devices_Graphics_DevVGA-SVGA3d-glLdr.h b/emulators/virtualbox-ose-70/files/patch-src_VBox_Devices_Graphics_DevVGA-SVGA3d-glLdr.h
index 3069950947cd..ea1c170e8f17 100644
--- a/emulators/virtualbox-ose-70/files/patch-src_VBox_Devices_Graphics_DevVGA-SVGA3d-glLdr.h
+++ b/emulators/virtualbox-ose-70/files/patch-src_VBox_Devices_Graphics_DevVGA-SVGA3d-glLdr.h
@@ -1,6 +1,6 @@
---- src/VBox/Devices/Graphics/DevVGA-SVGA3d-glLdr.h.orig 2021-01-07 15:39:17 UTC
+--- src/VBox/Devices/Graphics/DevVGA-SVGA3d-glLdr.h.orig 2025-04-11 12:09:20 UTC
+++ src/VBox/Devices/Graphics/DevVGA-SVGA3d-glLdr.h
-@@ -338,7 +338,7 @@ GLPFN BOOL (WINAPI *pfn_wglMakeCurrent)(HDC, HGLRC);
+@@ -346,7 +346,7 @@ GLPFN BOOL (WINAPI *pfn_wglShareLists)(HGLRC, HGLRC);
GLPFN BOOL (WINAPI *pfn_wglShareLists)(HGLRC, HGLRC);
#define wglShareLists pfn_wglShareLists
diff --git a/emulators/virtualbox-ose-70/files/patch-src_VBox_Devices_Graphics_DevVGA-SVGA3d-ogl.cpp b/emulators/virtualbox-ose-70/files/patch-src_VBox_Devices_Graphics_DevVGA-SVGA3d-ogl.cpp
index 96058e78ff1f..caf9d72e8e19 100644
--- a/emulators/virtualbox-ose-70/files/patch-src_VBox_Devices_Graphics_DevVGA-SVGA3d-ogl.cpp
+++ b/emulators/virtualbox-ose-70/files/patch-src_VBox_Devices_Graphics_DevVGA-SVGA3d-ogl.cpp
@@ -1,6 +1,6 @@
---- src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp.orig 2021-01-07 15:39:17 UTC
+--- src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp.orig 2025-04-11 12:09:20 UTC
+++ src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp
-@@ -1189,7 +1189,7 @@ int vmsvga3dTerminate(PVGASTATECC pThisCC)
+@@ -1198,7 +1198,7 @@ static DECLCALLBACK(int) vmsvga3dBackTerminate(PVGASTA
RTSemEventDestroy(pState->WndRequestSem);
#elif defined(RT_OS_DARWIN)
@@ -9,7 +9,7 @@
/* signal to the thread that it is supposed to exit */
pState->bTerminate = true;
/* wait for it to terminate */
-@@ -3194,7 +3194,7 @@ int vmsvga3dGenerateMipmaps(PVGASTATECC pThisCC, uint3
+@@ -3216,7 +3216,7 @@ static DECLCALLBACK(int) vmsvga3dBackGenerateMipmaps(P
}
@@ -18,7 +18,7 @@
/**
* X11 event handling thread.
*
-@@ -3224,7 +3224,7 @@ DECLCALLBACK(int) vmsvga3dXEventThread(RTTHREAD hThrea
+@@ -3246,7 +3246,7 @@ DECLCALLBACK(int) vmsvga3dXEventThread(RTTHREAD hThrea
}
return VINF_SUCCESS;
}
@@ -27,7 +27,25 @@
/**
-@@ -4052,7 +4052,7 @@ static int vmsvga3dContextDestroyOgl(PVGASTATECC pThis
+@@ -3484,7 +3484,7 @@ int vmsvga3dContextDefineOgl(PVGASTATECC pThisCC, uint
+ return VINF_SUCCESS;
+ }
+
+-#if defined(RT_OS_LINUX)
++#if defined(RT_OS_FREEBSD) || defined(RT_OS_LINUX)
+ /*
+ * HW accelerated graphics output.
+ */
+@@ -3976,7 +3976,7 @@ static DECLCALLBACK(int) vmsvga3dBackSurfaceBlitToScre
+ return VINF_SUCCESS;
+ }
+
+-#else /* !RT_OS_LINUX */
++#else /* !RT_OS_FREEBSD && !RT_OS_LINUX */
+
+ static DECLCALLBACK(int) vmsvga3dBackDefineScreen(PVGASTATE pThis, PVGASTATECC pThisCC, VMSVGASCREENOBJECT *pScreen)
+ {
+@@ -4096,7 +4096,7 @@ static int vmsvga3dContextDestroyOgl(PVGASTATECC pThis
AssertRC(rc);
#elif defined(RT_OS_DARWIN)
vmsvga3dCocoaDestroyViewAndContext(pContext->cocoaView, pContext->cocoaContext);
diff --git a/emulators/virtualbox-ose-70/files/patch-src_VBox_Runtime_r0drv_freebsd_memobj-r0drv-freebsd.c b/emulators/virtualbox-ose-70/files/patch-src_VBox_Runtime_r0drv_freebsd_memobj-r0drv-freebsd.c
index 205c897c818d..cbdcb490764f 100644
--- a/emulators/virtualbox-ose-70/files/patch-src_VBox_Runtime_r0drv_freebsd_memobj-r0drv-freebsd.c
+++ b/emulators/virtualbox-ose-70/files/patch-src_VBox_Runtime_r0drv_freebsd_memobj-r0drv-freebsd.c
@@ -1,6 +1,6 @@
---- src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c.orig 2025-04-11 05:12:39.000000000 -0700
-+++ src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c 2025-04-28 10:14:45.981609000 -0700
-@@ -139,8 +139,10 @@
+--- src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c.orig 2025-04-11 12:12:39 UTC
++++ src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c
+@@ -139,8 +139,10 @@ DECLHIDDEN(int) rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
DECLHIDDEN(int) rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
{
@@ -11,7 +11,7 @@
switch (pMemFreeBSD->Core.enmType)
{
-@@ -155,8 +157,6 @@
+@@ -155,8 +157,6 @@ DECLHIDDEN(int) rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
case RTR0MEMOBJTYPE_LOCK:
{
@@ -20,7 +20,7 @@
if (pMemFreeBSD->Core.u.Lock.R0Process != NIL_RTR0PROCESS)
pMap = &((struct proc *)pMemFreeBSD->Core.u.Lock.R0Process)->p_vmspace->vm_map;
-@@ -197,6 +197,7 @@
+@@ -197,6 +197,7 @@ DECLHIDDEN(int) rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
case RTR0MEMOBJTYPE_PHYS_NC:
{
VM_OBJECT_WLOCK(pMemFreeBSD->pObject);
@@ -28,22 +28,22 @@
vm_page_t pPage = vm_page_find_least(pMemFreeBSD->pObject, 0);
#if __FreeBSD_version < 1000000
vm_page_lock_queues();
-@@ -209,6 +210,14 @@
- }
+@@ -210,6 +211,14 @@ DECLHIDDEN(int) rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
#if __FreeBSD_version < 1000000
vm_page_unlock_queues();
-+#endif
+ #endif
+#else /* __FreeBSD_version >= 1500038 */
+ struct pctrie_iter pages;
+ vm_page_t page;
+
-+ pctrie_iter_init(&pages, pMemFreeBSD->pObject);
++ vm_page_iter_init(&pages, pMemFreeBSD->pObject);
+ VM_RADIX_FORALL(page, &pages)
-+ vm_page_unwire(page, PQ_INACTIVE);
- #endif
++ (void)vm_page_unwire_noq(page);
++#endif
VM_OBJECT_WUNLOCK(pMemFreeBSD->pObject);
vm_object_deallocate(pMemFreeBSD->pObject);
-@@ -220,6 +229,7 @@
+ break;
+@@ -220,6 +229,7 @@ DECLHIDDEN(int) rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
return VERR_INTERNAL_ERROR;
}
@@ -51,7 +51,7 @@
return VINF_SUCCESS;
}
-@@ -329,7 +339,8 @@
+@@ -329,7 +339,8 @@ static int rtR0MemObjFreeBSDAllocHelper(PRTR0MEMOBJFRE
size_t cPages = atop(pMemFreeBSD->Core.cb);
int rc;
@@ -61,7 +61,7 @@
/* No additional object reference for auto-deallocation upon unmapping. */
#if __FreeBSD_version >= 1000055
-@@ -371,6 +382,7 @@
+@@ -371,6 +382,7 @@ DECLHIDDEN(int) rtR0MemObjNativeAllocPage(PPRTR0MEMOBJ
DECLHIDDEN(int) rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable, const char *pszTag)
{
@@ -69,7 +69,7 @@
PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD), RTR0MEMOBJTYPE_PAGE,
NULL, cb, pszTag);
if (pMemFreeBSD)
-@@ -380,8 +392,10 @@
+@@ -380,8 +392,10 @@ DECLHIDDEN(int) rtR0MemObjNativeAllocPage(PPRTR0MEMOBJ
*ppMem = &pMemFreeBSD->Core;
else
rtR0MemObjDelete(&pMemFreeBSD->Core);
@@ -80,7 +80,7 @@
return VERR_NO_MEMORY;
}
-@@ -395,6 +409,7 @@
+@@ -395,6 +409,7 @@ DECLHIDDEN(int) rtR0MemObjNativeAllocLow(PPRTR0MEMOBJI
DECLHIDDEN(int) rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable, const char *pszTag)
{
@@ -88,7 +88,7 @@
PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD), RTR0MEMOBJTYPE_LOW, NULL, cb, pszTag);
if (pMemFreeBSD)
{
-@@ -403,14 +418,17 @@
+@@ -403,14 +418,17 @@ DECLHIDDEN(int) rtR0MemObjNativeAllocLow(PPRTR0MEMOBJI
*ppMem = &pMemFreeBSD->Core;
else
rtR0MemObjDelete(&pMemFreeBSD->Core);
@@ -106,7 +106,7 @@
PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD), RTR0MEMOBJTYPE_CONT,
NULL, cb, pszTag);
if (pMemFreeBSD)
-@@ -423,8 +441,10 @@
+@@ -423,8 +441,10 @@ DECLHIDDEN(int) rtR0MemObjNativeAllocCont(PPRTR0MEMOBJ
}
else
rtR0MemObjDelete(&pMemFreeBSD->Core);
@@ -117,7 +117,7 @@
return VERR_NO_MEMORY;
}
-@@ -432,6 +452,7 @@
+@@ -432,6 +452,7 @@ static int rtR0MemObjFreeBSDAllocPhysPages(PPRTR0MEMOB
static int rtR0MemObjFreeBSDAllocPhysPages(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJTYPE enmType, size_t cb, RTHCPHYS PhysHighest,
size_t uAlignment, bool fContiguous, int rcNoMem, const char *pszTag)
{
@@ -125,7 +125,7 @@
/* create the object. */
PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD), enmType, NULL, cb, pszTag);
if (pMemFreeBSD)
-@@ -439,7 +460,8 @@
+@@ -439,7 +460,8 @@ static int rtR0MemObjFreeBSDAllocPhysPages(PPRTR0MEMOB
vm_paddr_t const VmPhysAddrHigh = PhysHighest != NIL_RTHCPHYS ? PhysHighest : ~(vm_paddr_t)0;
u_long const cPages = atop(cb);
@@ -135,19 +135,16 @@
int rc = rtR0MemObjFreeBSDPhysAllocHelper(pMemFreeBSD->pObject, cPages, VmPhysAddrHigh,
uAlignment, fContiguous, true, rcNoMem);
-@@ -449,7 +471,11 @@
+@@ -449,7 +471,7 @@ static int rtR0MemObjFreeBSDAllocPhysPages(PPRTR0MEMOB
{
Assert(enmType == RTR0MEMOBJTYPE_PHYS);
VM_OBJECT_WLOCK(pMemFreeBSD->pObject);
-+#if __FreeBSD_version < 1500038
- pMemFreeBSD->Core.u.Phys.PhysBase = VM_PAGE_TO_PHYS(vm_page_find_least(pMemFreeBSD->pObject, 0));
-+#else
-+ pMemFreeBSD->Core.u.Phys.PhysBase = VM_PAGE_TO_PHYS(vm_radix_lookup_ge(&(pMemFreeBSD->pObject->rtree), 0));
-+#endif
+- pMemFreeBSD->Core.u.Phys.PhysBase = VM_PAGE_TO_PHYS(vm_page_find_least(pMemFreeBSD->pObject, 0));
++ pMemFreeBSD->Core.u.Phys.PhysBase = VM_PAGE_TO_PHYS(vm_radix_lookup_ge(&pMemFreeBSD->pObject->rtree, 0));
VM_OBJECT_WUNLOCK(pMemFreeBSD->pObject);
pMemFreeBSD->Core.u.Phys.fAllocated = true;
}
-@@ -462,8 +488,10 @@
+@@ -462,8 +484,10 @@ static int rtR0MemObjFreeBSDAllocPhysPages(PPRTR0MEMOB
vm_object_deallocate(pMemFreeBSD->pObject);
rtR0MemObjDelete(&pMemFreeBSD->Core);
}
@@ -158,7 +155,7 @@
return VERR_NO_MEMORY;
}
-@@ -486,6 +514,7 @@
+@@ -486,6 +510,7 @@ DECLHIDDEN(int) rtR0MemObjNativeEnterPhys(PPRTR0MEMOBJ
const char *pszTag)
{
AssertReturn(uCachePolicy == RTMEM_CACHE_POLICY_DONT_CARE, VERR_NOT_SUPPORTED);
@@ -166,7 +163,7 @@
/* create the object. */
PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD), RTR0MEMOBJTYPE_PHYS,
-@@ -497,8 +526,10 @@
+@@ -497,8 +522,10 @@ DECLHIDDEN(int) rtR0MemObjNativeEnterPhys(PPRTR0MEMOBJ
pMemFreeBSD->Core.u.Phys.PhysBase = Phys;
pMemFreeBSD->Core.u.Phys.uCachePolicy = uCachePolicy;
*ppMem = &pMemFreeBSD->Core;
@@ -177,7 +174,7 @@
return VERR_NO_MEMORY;
}
-@@ -510,6 +541,7 @@
+@@ -510,6 +537,7 @@ static int rtR0MemObjNativeLockInMap(PPRTR0MEMOBJINTER
vm_offset_t AddrStart, size_t cb, uint32_t fAccess,
RTR0PROCESS R0Process, int fFlags, const char *pszTag)
{
@@ -185,7 +182,7 @@
int rc;
NOREF(fAccess);
-@@ -519,21 +551,28 @@
+@@ -519,21 +547,28 @@ static int rtR0MemObjNativeLockInMap(PPRTR0MEMOBJINTER
if (!pMemFreeBSD)
return VERR_NO_MEMORY;
@@ -222,7 +219,7 @@
return VERR_NO_MEMORY;/** @todo fix mach -> vbox error conversion for freebsd. */
}
-@@ -573,6 +612,7 @@
+@@ -573,6 +608,7 @@ static int rtR0MemObjNativeReserveInMap(PPRTR0MEMOBJIN
static int rtR0MemObjNativeReserveInMap(PPRTR0MEMOBJINTERNAL ppMem, void *pvFixed, size_t cb, size_t uAlignment,
RTR0PROCESS R0Process, vm_map_t pMap, const char *pszTag)
{
@@ -230,7 +227,7 @@
int rc;
/*
-@@ -631,11 +671,13 @@
+@@ -631,11 +667,13 @@ static int rtR0MemObjNativeReserveInMap(PPRTR0MEMOBJIN
pMemFreeBSD->Core.pv = (void *)MapAddress;
pMemFreeBSD->Core.u.ResVirt.R0Process = R0Process;
*ppMem = &pMemFreeBSD->Core;
@@ -244,7 +241,7 @@
return rc;
}
-@@ -659,6 +701,8 @@
+@@ -659,6 +697,8 @@ DECLHIDDEN(int) rtR0MemObjNativeMapKernel(PPRTR0MEMOBJ
DECLHIDDEN(int) rtR0MemObjNativeMapKernel(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, void *pvFixed, size_t uAlignment,
unsigned fProt, size_t offSub, size_t cbSub, const char *pszTag)
{
@@ -253,7 +250,7 @@
// AssertMsgReturn(!offSub && !cbSub, ("%#x %#x\n", offSub, cbSub), VERR_NOT_SUPPORTED);
AssertMsgReturn(pvFixed == (void *)-1, ("%p\n", pvFixed), VERR_NOT_SUPPORTED);
-@@ -713,6 +757,7 @@
+@@ -713,6 +753,7 @@ DECLHIDDEN(int) rtR0MemObjNativeMapKernel(PPRTR0MEMOBJ
Assert((vm_offset_t)pMemFreeBSD->Core.pv == Addr);
pMemFreeBSD->Core.u.Mapping.R0Process = NIL_RTR0PROCESS;
*ppMem = &pMemFreeBSD->Core;
@@ -261,7 +258,7 @@
return VINF_SUCCESS;
}
rc = vm_map_remove(kernel_map, Addr, Addr + cbSub);
-@@ -721,6 +766,7 @@
+@@ -721,6 +762,7 @@ DECLHIDDEN(int) rtR0MemObjNativeMapKernel(PPRTR0MEMOBJ
else
vm_object_deallocate(pMemToMapFreeBSD->pObject);
@@ -269,7 +266,7 @@
return VERR_NO_MEMORY;
}
-@@ -728,6 +774,8 @@
+@@ -728,6 +770,8 @@ DECLHIDDEN(int) rtR0MemObjNativeMapUser(PPRTR0MEMOBJIN
DECLHIDDEN(int) rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, RTR3PTR R3PtrFixed, size_t uAlignment,
unsigned fProt, RTR0PROCESS R0Process, size_t offSub, size_t cbSub, const char *pszTag)
{
@@ -278,7 +275,7 @@
/*
* Check for unsupported stuff.
*/
-@@ -785,44 +833,50 @@
+@@ -785,44 +829,50 @@ DECLHIDDEN(int) rtR0MemObjNativeMapUser(PPRTR0MEMOBJIN
if (rc == KERN_SUCCESS)
{
@@ -333,7 +330,7 @@
if ((fProt & RTMEM_PROT_NONE) == RTMEM_PROT_NONE)
ProtectionFlags = VM_PROT_NONE;
-@@ -833,7 +887,12 @@
+@@ -833,7 +883,12 @@ DECLHIDDEN(int) rtR0MemObjNativeProtect(PRTR0MEMOBJINT
if ((fProt & RTMEM_PROT_EXEC) == RTMEM_PROT_EXEC)
ProtectionFlags |= VM_PROT_EXECUTE;
@@ -346,7 +343,7 @@
if (krc == KERN_SUCCESS)
return VINF_SUCCESS;
-@@ -858,11 +917,19 @@
+@@ -858,11 +913,19 @@ DECLHIDDEN(RTHCPHYS) rtR0MemObjNativeGetPagePhysAddr(P
vm_offset_t pb = (vm_offset_t)pMemFreeBSD->Core.pv + ptoa(iPage);
@@ -370,7 +367,7 @@
}
case RTR0MEMOBJTYPE_MAPPING:
-@@ -871,11 +938,15 @@
+@@ -871,11 +934,15 @@ DECLHIDDEN(RTHCPHYS) rtR0MemObjNativeGetPagePhysAddr(P
if (pMemFreeBSD->Core.u.Mapping.R0Process != NIL_RTR0PROCESS)
{
@@ -387,7 +384,7 @@
}
return vtophys(pb);
}
-@@ -886,9 +957,11 @@
+@@ -886,9 +953,11 @@ DECLHIDDEN(RTHCPHYS) rtR0MemObjNativeGetPagePhysAddr(P
{
RTHCPHYS addr;
diff --git a/emulators/virtualbox-ose-70/files/patch-src_VBox_Runtime_r3_freebsd_systemmem-freebsd.cpp b/emulators/virtualbox-ose-70/files/patch-src_VBox_Runtime_r3_freebsd_systemmem-freebsd.cpp
new file mode 100644
index 000000000000..87ae993446a3
--- /dev/null
+++ b/emulators/virtualbox-ose-70/files/patch-src_VBox_Runtime_r3_freebsd_systemmem-freebsd.cpp
@@ -0,0 +1,39 @@
+--- src/VBox/Runtime/r3/freebsd/systemmem-freebsd.cpp.orig 2025-04-14 17:59:18 UTC
++++ src/VBox/Runtime/r3/freebsd/systemmem-freebsd.cpp
+@@ -75,7 +75,6 @@ RTDECL(int) RTSystemQueryAvailableRam(uint64_t *pcb)
+ u_int cPagesMemFree = 0;
+ u_int cPagesMemInactive = 0;
+ u_int cPagesMemCached = 0;
+- u_int cPagesMemUsed = 0;
+ int cbPage = 0;
+ size_t cbParameter;
+ int cProcessed = 0;
+@@ -83,25 +82,23 @@ RTDECL(int) RTSystemQueryAvailableRam(uint64_t *pcb)
+ cbParameter = sizeof(cPagesMemFree);
+ if (sysctlbyname("vm.stats.vm.v_free_count", &cPagesMemFree, &cbParameter, NULL, 0))
+ rc = RTErrConvertFromErrno(errno);
+- cbParameter = sizeof(cPagesMemUsed);
+- if ( RT_SUCCESS(rc)
+- && sysctlbyname("vm.stats.vm.v_active_count", &cPagesMemUsed, &cbParameter, NULL, 0))
+- rc = RTErrConvertFromErrno(errno);
+ cbParameter = sizeof(cPagesMemInactive);
+ if ( RT_SUCCESS(rc)
+ && sysctlbyname("vm.stats.vm.v_inactive_count", &cPagesMemInactive, &cbParameter, NULL, 0))
+ rc = RTErrConvertFromErrno(errno);
++#if __FreeBSD_version < 1200016
+ cbParameter = sizeof(cPagesMemCached);
+ if ( RT_SUCCESS(rc)
+ && sysctlbyname("vm.stats.vm.v_cache_count", &cPagesMemCached, &cbParameter, NULL, 0))
+ rc = RTErrConvertFromErrno(errno);
++#endif
+ cbParameter = sizeof(cbPage);
+ if ( RT_SUCCESS(rc)
+ && sysctlbyname("hw.pagesize", &cbPage, &cbParameter, NULL, 0))
+ rc = RTErrConvertFromErrno(errno);
+
+ if (RT_SUCCESS(rc))
+- *pcb = (cPagesMemFree + cPagesMemInactive + cPagesMemCached ) * cbPage;
++ *pcb = ((uint64_t)cPagesMemFree + cPagesMemInactive + cPagesMemCached) * cbPage;
+
+ return rc;
+ }