mirror of
https://git.freebsd.org/ports.git
synced 2025-05-06 19:06:44 -04:00
emulators/virtualbox-ose{,-kmod,-nox11}-70: Repocopy from emulators/virtualbox-ose{,-kmod,-nox11}
PR: 271146
This commit is contained in:
parent
92fcc3e57e
commit
9ef87f0830
108 changed files with 10000 additions and 0 deletions
|
@ -156,14 +156,17 @@
|
|||
SUBDIR += vgba-bin
|
||||
SUBDIR += vice
|
||||
SUBDIR += virtualbox-ose
|
||||
SUBDIR += virtualbox-ose-70
|
||||
SUBDIR += virtualbox-ose-additions
|
||||
SUBDIR += virtualbox-ose-additions-legacy
|
||||
SUBDIR += virtualbox-ose-additions-nox11
|
||||
SUBDIR += virtualbox-ose-additions-nox11-legacy
|
||||
SUBDIR += virtualbox-ose-kmod
|
||||
SUBDIR += virtualbox-ose-kmod-70
|
||||
SUBDIR += virtualbox-ose-kmod-legacy
|
||||
SUBDIR += virtualbox-ose-legacy
|
||||
SUBDIR += virtualbox-ose-nox11
|
||||
SUBDIR += virtualbox-ose-nox11-70
|
||||
SUBDIR += virtualbox-ose-nox11-legacy
|
||||
SUBDIR += visualboyadvance-m
|
||||
SUBDIR += vmips
|
||||
|
|
431
emulators/virtualbox-ose-70/Makefile
Normal file
431
emulators/virtualbox-ose-70/Makefile
Normal file
|
@ -0,0 +1,431 @@
|
|||
PORTNAME= virtualbox-ose
|
||||
DISTVERSION= 6.1.50
|
||||
PORTREVISION?= 8
|
||||
CATEGORIES= emulators
|
||||
MASTER_SITES= https://download.virtualbox.org/virtualbox/${DISTVERSION}/:src \
|
||||
LOCAL/bofh/emulators/virtualbox-ose:docs
|
||||
DISTFILES= VirtualBox-${DISTVERSION}${EXTRACT_SUFX}:src \
|
||||
VirtualBox-docs-${DISTVERSION}${EXTRACT_SUFX}:docs
|
||||
EXTRACT_ONLY= VirtualBox-${DISTVERSION}${EXTRACT_SUFX} \
|
||||
VirtualBox-docs-${DISTVERSION}${EXTRACT_SUFX}
|
||||
|
||||
MAINTAINER= vbox@FreeBSD.org
|
||||
COMMENT= General-purpose full virtualizer for x86 hardware
|
||||
WWW= https://www.virtualbox.org/
|
||||
|
||||
LICENSE= GPLv2
|
||||
LICENSE_FILE= ${WRKSRC}/COPYING
|
||||
|
||||
ONLY_FOR_ARCHS= amd64
|
||||
|
||||
BUILD_DEPENDS= gtar:archivers/gtar \
|
||||
kmk:devel/kBuild \
|
||||
libIDL-config-2:devel/libIDL \
|
||||
yasm:devel/yasm \
|
||||
xsltproc:textproc/libxslt
|
||||
LIB_DEPENDS= libpng.so:graphics/png \
|
||||
libcurl.so:ftp/curl
|
||||
RUN_DEPENDS= ${LOCALBASE}/etc/rc.d/vboxnet:emulators/virtualbox-ose-kmod
|
||||
|
||||
USES= compiler:c++14-lang cpe gnome iconv pkgconfig ssl tar:bzip2
|
||||
CPE_VENDOR= oracle
|
||||
CPE_PRODUCT= vm_virtualbox
|
||||
USE_GNOME= libxml2
|
||||
USE_RC_SUBR= vboxheadless vboxwatchdog
|
||||
|
||||
HAS_CONFIGURE= yes
|
||||
CONFIGURE_ARGS= --disable-java --passive-mesa --disable-docs
|
||||
CONFIGURE_ARGS+= --with-gcc="${CC}" --with-g++="${CXX}"
|
||||
|
||||
CONFLICTS_INSTALL= virtualbox-ose-legacy \
|
||||
virtualbox-ose-nox11-legacy \
|
||||
virtualbox-ose-70 \
|
||||
virtualbox-ose-nox11-70
|
||||
|
||||
PORTSCOUT= limit:^6\.
|
||||
SUB_FILES= pkg-message
|
||||
SUB_LIST= VBOXDIR=${VBOX_DIR} \
|
||||
VBOX_ETC=${VBOX_ETC} \
|
||||
VBOXGROUP=${VBOXGROUP} \
|
||||
VBOXUSER=${VBOXUSER} \
|
||||
VBOXWSUSER=${VBOXWSUSER}
|
||||
|
||||
WRKSRC= ${WRKDIR}/VirtualBox-${DISTVERSION}
|
||||
|
||||
VBOXUSER?= vboxusers
|
||||
VBOXWSUSER?= vboxusers
|
||||
VBOXGROUP?= vboxusers
|
||||
USERS= ${VBOXUSER}
|
||||
GROUPS= ${VBOXGROUP}
|
||||
VBOX_DIR= ${PREFIX}/${VBOX_DIR_REL}
|
||||
VBOX_DIR_REL= lib/virtualbox
|
||||
VBOX_ETC= ${PREFIX}/etc/vbox
|
||||
VBOX_LINKS= VBoxVRDP
|
||||
VBOX_PROGS= VBoxAutostart VBoxBalloonCtrl VBoxBugReport VBoxHeadless \
|
||||
VBoxManage
|
||||
VBOX_UTILS= VBoxExtPackHelperApp VBoxNetAdpCtl VBoxNetDHCP VBoxNetNAT \
|
||||
VBoxSVC VBoxXPCOMIPCD
|
||||
|
||||
PLIST_SUB= GUEST_VER=${DISTVERSION} \
|
||||
PYTHON_VERU=${PYTHON_VER:S/./_/}${PYTHON_ABIVER} \
|
||||
VBOXGROUP=${VBOXGROUP}
|
||||
|
||||
SLAVE_PORT?= no
|
||||
|
||||
OPTIONS_DEFINE= AIO ALSA DBUS DEBUG DOCS GUESTADDITIONS NLS OPUS PULSEAUDIO \
|
||||
PYTHON QT5 R0LOGGING UDPTUNNEL VBOXIMG VDE VNC WEBSERVICE VPX X11
|
||||
OPTIONS_DEFAULT= AIO DBUS QT5 UDPTUNNEL VNC WEBSERVICE X11
|
||||
.if ${SLAVE_PORT} == no
|
||||
OPTIONS_DEFAULT+= PYTHON
|
||||
.endif
|
||||
# Since version 6.1.24 pulseaudio is broken at runtime, preventing
|
||||
# virtual machines from starting if configured to use it.
|
||||
OPTIONS_EXCLUDE+= PULSEAUDIO
|
||||
OPTIONS_SUB= yes
|
||||
|
||||
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)
|
||||
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
|
||||
VBOXIMG_DESC= Build vboximg-mount (requires fuse-libs)
|
||||
VDE_DESC= Build with VDE support
|
||||
VNC_DESC= Build with VNC support
|
||||
VPX_DESC= Use libvpx for video recording
|
||||
WEBSERVICE_DESC= Build Webservice
|
||||
|
||||
ALSA_LIB_DEPENDS= libasound.so:audio/alsa-lib
|
||||
ALSA_CONFIGURE_OFF= --disable-alsa
|
||||
DBUS_LIB_DEPENDS= libdbus-1.so:devel/dbus
|
||||
DBUS_CONFIGURE_OFF= --disable-dbus
|
||||
DEBUG_CONFIGURE_ON= --build-debug
|
||||
NLS_IMPLIES= QT5
|
||||
OPUS_IMPLIES= VPX
|
||||
OPUS_LIB_DEPENDS= libopus.so:audio/opus
|
||||
OPUS_CONFIGURE_OFF= --disable-libopus
|
||||
PULSEAUDIO_LIB_DEPENDS= libpulse.so:audio/pulseaudio
|
||||
PULSEAUDIO_CONFIGURE_OFF= --disable-pulse
|
||||
PYTHON_USES= python
|
||||
PYTHON_USES_OFF= python:build
|
||||
PYTHON_USE= PYTHON=distutils,noegginfo,noflavors
|
||||
PYTHON_CONFIGURE_OFF= --disable-python
|
||||
PYTHON_VARS= pydistutils_pkgname=vboxapi pydistutils_pkgversion=1.0
|
||||
QT5_IMPLIES= X11
|
||||
QT5_USES= gl qmake:no_env qt:5 xorg
|
||||
QT5_USE= QT=buildtools:build,core,dbus,gui,linguisttools:build,opengl \
|
||||
QT=printsupport,widgets,x11extras XORG=xcb GL=gl
|
||||
QT5_CONFIGURE_ON= --enable-qt5
|
||||
QT5_CONFIGURE_OFF= --disable-qt
|
||||
R0LOGGING_IMPLIES= DEBUG
|
||||
UDPTUNNEL_CONFIGURE_OFF= --disable-udptunnel
|
||||
VBOXIMG_LIB_DEPENDS= libfuse.so.2:filesystems/fusefs-libs
|
||||
VDE_RUN_DEPENDS= vde_switch:net/vde2
|
||||
VDE_CONFIGURE_ON= --enable-vde
|
||||
VNC_LIB_DEPENDS= libvncserver.so:net/libvncserver
|
||||
VNC_CONFIGURE_ON= --enable-vnc
|
||||
VPX_LIB_DEPENDS= libvpx.so:multimedia/libvpx
|
||||
VPX_CONFIGURE_OFF= --disable-libvpx
|
||||
WEBSERVICE_BUILD_DEPENDS= soapcpp2:devel/gsoap
|
||||
X11_USES= sdl xorg
|
||||
X11_USE= SDL=sdl XORG=x11,xcursor,xext,xinerama,xmu,xorgproto,xt
|
||||
X11_CONFIGURE_OFF= --build-headless
|
||||
|
||||
ENV=
|
||||
.export ENV
|
||||
|
||||
.include <bsd.port.options.mk>
|
||||
|
||||
.if ${SLAVE_PORT} == no
|
||||
CONFLICTS_INSTALL+= virtualbox-ose-nox11
|
||||
.else
|
||||
CONFLICTS_INSTALL+= virtualbox-ose
|
||||
.endif
|
||||
|
||||
.if ${PORT_OPTIONS:MDEBUG}
|
||||
KMK_BUILDTYPE= debug
|
||||
KMK_FLAGS+= BUILD_TYPE=debug
|
||||
.else
|
||||
KMK_BUILDTYPE= release
|
||||
.endif
|
||||
|
||||
.if ${PORT_OPTIONS:MGUESTADDITIONS}
|
||||
GUESTADDITIONS= VBoxGuestAdditions_${DISTVERSION}.iso
|
||||
DISTFILES+= ${GUESTADDITIONS}:src
|
||||
LICENSE+= Additions
|
||||
LICENSE_COMB= multi
|
||||
LICENSE_NAME_Additions= Guest Additions
|
||||
LICENSE_PERMS_Additions= auto-accept
|
||||
LICENSE_DISTFILES_Additions= ${GUESTADDITIONS}
|
||||
.endif
|
||||
|
||||
.if ${PORT_OPTIONS:MQT5}
|
||||
PLIST_SUB+= QT=""
|
||||
VBOX_PROGS+= VirtualBox VirtualBoxVM
|
||||
VBOX_UTILS+= VBoxTestOGL
|
||||
VBOX_WITH_QT= 1
|
||||
.else
|
||||
PLIST_SUB+= QT="@comment "
|
||||
.endif
|
||||
|
||||
.if ${PORT_OPTIONS:MWEBSERVICE}
|
||||
USE_RC_SUBR+= vboxinit vboxwebsrv
|
||||
VBOX_LINKS+= vboxwebsrv
|
||||
VBOX_UTILS+= vboxwebsrv webtest
|
||||
.endif
|
||||
|
||||
.if ${PORT_OPTIONS:MX11}
|
||||
VBOX_PROGS+= VBoxSDL
|
||||
.endif
|
||||
|
||||
.if ${PORT_OPTIONS:MPYTHON} || ${PORT_OPTIONS:MWEBSERVICE}
|
||||
PLIST_SUB+= SDK=""
|
||||
.else
|
||||
PLIST_SUB+= SDK="@comment "
|
||||
.endif
|
||||
|
||||
.if ${PORT_OPTIONS:MVBOXIMG}
|
||||
EXTRA_PATCHES+= ${PATCHDIR}/extrapatch-vboximg-Config.kmk
|
||||
VBOX_UTILS+= vboximg-mount
|
||||
PLIST_SUB+= VBOXIMG=""
|
||||
.else
|
||||
PLIST_SUB+= VBOXIMG="@comment "
|
||||
.endif
|
||||
|
||||
KMK_ARCH= freebsd.${ARCH}
|
||||
PLIST_SUB+= ARCH="${KMK_ARCH}"
|
||||
|
||||
KMK_BUILDDIR= ${WRKSRC}/out/${KMK_ARCH}/${KMK_BUILDTYPE}
|
||||
KMK_CONFIG= VBOX_LIBPATH_X11=${LOCALBASE} VBOX_FREEBSD_SRC=${SRC_BASE}/sys
|
||||
KMK_FLAGS+= -j${MAKE_JOBS_NUMBER}
|
||||
|
||||
.include <bsd.port.pre.mk>
|
||||
|
||||
.if ${CHOSEN_COMPILER_TYPE} == clang
|
||||
# 1) llvm10 in FreeBSD before r364284 miscompiles virtualbox 6.1 causing errors.
|
||||
# 2) llvm15 in FreeBSD miscompiles virtualbox 6.1 causing errors: PR#270189.
|
||||
# Force llvm from ports.
|
||||
.if ${OPSYS} == FreeBSD
|
||||
# USES must be before .include <bsd.port.pre.mk>, but CHOSEN_COMPILER_TYPE must be after.
|
||||
# This is a workaround with possibility to define different llvm via VBOX_LLVM_VER in make.conf.
|
||||
#USES+= llvm:min=11,max=14
|
||||
#CC= clang${LLVM_VERSION}
|
||||
#CXX= clang++${LLVM_VERSION}
|
||||
BUILD_DEPENDS+= clang${VBOX_LLVM_VER}:devel/llvm${VBOX_LLVM_VER}
|
||||
CC= clang${VBOX_LLVM_VER}
|
||||
CXX= clang++${VBOX_LLVM_VER}
|
||||
.if ${LLVM_DEFAULT} < 11 || ${LLVM_DEFAULT} > 14
|
||||
VBOX_LLVM_VER?= 14
|
||||
.else
|
||||
VBOX_LLVM_VER?= ${LLVM_DEFAULT}
|
||||
.endif
|
||||
.endif
|
||||
PATCH_DEPENDS+= ${LOCALBASE}/share/kBuild/tools/GXX3.kmk:devel/kBuild
|
||||
.endif
|
||||
|
||||
.if ${PYTHON_MAJOR_VER} >= 3
|
||||
PLIST_SUB+= PYTHON_PYCDIR=/__pycache__/ \
|
||||
PYTHON_PYCEXT=.cpython-${PYTHON_SUFFIX}.pyc
|
||||
.else
|
||||
PLIST_SUB+= PYTHON_PYCDIR=/ \
|
||||
PYTHON_PYCEXT=.pyc
|
||||
.endif
|
||||
|
||||
.if ${SSL_DEFAULT} != base
|
||||
CONFIGURE_ARGS+= --with-openssl-dir="${OPENSSLBASE}"
|
||||
.endif
|
||||
|
||||
post-patch:
|
||||
@${ECHO_CMD} 'VBOX_PATH_APP_PRIVATE_ARCH = ${VBOX_DIR}' > \
|
||||
${WRKSRC}/LocalConfig.kmk
|
||||
@${ECHO_CMD} 'VBOX_PATH_DOCBOOK = ${DBKXSLDIR}' >> \
|
||||
${WRKSRC}/LocalConfig.kmk
|
||||
@${ECHO_CMD} 'VBOX_PATH_DOCBOOK_DTD = ${DBKXMLDIR}' >> \
|
||||
${WRKSRC}/LocalConfig.kmk
|
||||
@${ECHO_CMD} 'VBOX_PATH_SHARED_LIBS = ${VBOX_DIR}' >> \
|
||||
${WRKSRC}/LocalConfig.kmk
|
||||
# Please keep this even if using Clang to avoid repeated regressions.
|
||||
# PR 245048
|
||||
@${ECHO_CMD} "VBOX_WITH_RUNPATH = ${_GCC_RUNTIME:D${_GCC_RUNTIME}\:}${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
|
||||
.if ${SSL_DEFAULT} != base
|
||||
@${ECHO_CMD} 'VBOX_WITH_ALT_HASH_CODE = 1' >> ${WRKSRC}/LocalConfig.kmk
|
||||
.endif
|
||||
@${ECHO_CMD} 'VBOX_WITH_EXTPACK_VBOXDTRACE =' >> ${WRKSRC}/LocalConfig.kmk
|
||||
@${ECHO_CMD} 'VBOX_WITH_INSTALLER = 1' >> ${WRKSRC}/LocalConfig.kmk
|
||||
@${ECHO_CMD} 'VBOX_WITH_VBOXDRV =' >> ${WRKSRC}/LocalConfig.kmk
|
||||
@${ECHO_CMD} 'VBOX_WITH_TESTCASES =' >> ${WRKSRC}/LocalConfig.kmk
|
||||
@${ECHO_CMD} 'SDK_VBOX_LIBPNG_INCS = ${PREFIX}/include/libpng' >> \
|
||||
${WRKSRC}/LocalConfig.kmk
|
||||
@${ECHO_CMD} 'SDK_VBOX_LIBPNG_LIBS = png' >> ${WRKSRC}/LocalConfig.kmk
|
||||
@${ECHO_CMD} 'VBOX_WITH_ADDITIONS =' >> ${WRKSRC}/LocalConfig.kmk
|
||||
@${ECHO_CMD} 'VBOX_WITH_DRAG_AND_DROP = ${VBOX_WITH_QT}' >> \
|
||||
${WRKSRC}/LocalConfig.kmk
|
||||
@${ECHO_CMD} 'VBOX_WITH_DRAG_AND_DROP_GH = ${VBOX_WITH_QT}' >> \
|
||||
${WRKSRC}/LocalConfig.kmk
|
||||
@${ECHO_CMD} 'VBOX_WITH_VALIDATIONKIT =' >> ${WRKSRC}/LocalConfig.kmk
|
||||
@${ECHO_CMD} 'VBOX_WITH_X11_ADDITIONS =' >> ${WRKSRC}/LocalConfig.kmk
|
||||
.if ${PORT_OPTIONS:MR0LOGGING}
|
||||
@${ECHO_CMD} 'VBOX_WITH_R0_LOGGING = 1' >> ${WRKSRC}/LocalConfig.kmk
|
||||
.endif
|
||||
.if ${PORT_OPTIONS:MWEBSERVICE}
|
||||
@${ECHO_CMD} 'VBOX_WITH_WEBSERVICES = 1' >> ${WRKSRC}/LocalConfig.kmk
|
||||
@${ECHO_CMD} 'VBOX_GSOAP_INSTALLED = 1' >> ${WRKSRC}/LocalConfig.kmk
|
||||
@${ECHO_CMD} 'VBOX_PATH_GSOAP = ${PREFIX}/lib/gsoap' >> \
|
||||
${WRKSRC}/LocalConfig.kmk
|
||||
@${ECHO_CMD} 'VBOX_PATH_GSOAP_BIN = ${PREFIX}/bin' >> \
|
||||
${WRKSRC}/LocalConfig.kmk
|
||||
@${ECHO_CMD} 'VBOX_PATH_GSOAP_IMPORT = ${PREFIX}/share/gsoap/import' >> \
|
||||
${WRKSRC}/LocalConfig.kmk
|
||||
@${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 ${CHOSEN_COMPILER_TYPE} == clang
|
||||
@${REINPLACE_CMD} -e 's| -finline-limit=8000||' \
|
||||
-e 's| -mpreferred-stack-boundary=2||' ${WRKSRC}/Config.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
|
||||
# Causes a "reinplace" QA warning with default LOCALBASE
|
||||
@${REINPLACE_CMD} -e 's|/usr/local|${LOCALBASE}|g' \
|
||||
${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/libs/xpcom18a4/python/gen_python_deps.py
|
||||
@${REINPLACE_CMD} \
|
||||
-e 's|\$$KBUILDDIR_BIN/kmk_sed|${LOCALBASE}/bin/kmk_sed|g' \
|
||||
-e 's|SUPPYTHONLIBS=.*|SUPPYTHONLIBS="${PYTHON_VERSION}${PYTHON_ABIVER}"|' \
|
||||
${WRKSRC}/configure
|
||||
.if empty(ICONV_LIB)
|
||||
@${REINPLACE_CMD} -e 's|iconv||' ${WRKSRC}/Config.kmk \
|
||||
${WRKSRC}/src/VBox/Runtime/Makefile.kmk
|
||||
@${ECHO_CMD} 'VBOX_ICONV_DEFS = LIBICONV_PLUG' >> ${WRKSRC}/LocalConfig.kmk
|
||||
.endif
|
||||
@${REINPLACE_CMD} -e 's|%%VBOX_DIR%%|${VBOX_DIR}|g' \
|
||||
-e 's|%%VBOX_ETC%%|${VBOX_ETC}|g' \
|
||||
-e 's|%%LOCALBASE%%|${LOCALBASE}|g' \
|
||||
${WRKSRC}/src/VBox/Installer/freebsd/VBox.sh
|
||||
@${REINPLACE_CMD} -e 's|%%VBOX_ETC%%|${VBOX_ETC}|g' \
|
||||
${WRKSRC}/src/VBox/HostDrivers/adpctl/VBoxNetAdpCtl.cpp
|
||||
@${REINPLACE_CMD} \
|
||||
-e 's|^versions =.*|versions = ["${PYTHON_VER}${PYTHON_ABIVER}"]|' \
|
||||
${WRKSRC}/src/libs/xpcom18a4/python/gen_python_deps.py
|
||||
|
||||
post-patch-AIO-off:
|
||||
@${REINPLACE_CMD} 's|r3/freebsd/fileaio-freebsd.cpp|r3/posix/fileaio-posix.cpp|' \
|
||||
${WRKSRC}/src/VBox/Runtime/Makefile.kmk
|
||||
|
||||
do-build:
|
||||
cd ${WRKSRC} && ${SH} -c '. ${WRKSRC}/env.sh && \
|
||||
${SETENV} ${MAKE_ENV} ${KMK_CONFIG} ${LOCALBASE}/bin/kmk ${KMK_FLAGS}'
|
||||
.if ${PORT_OPTIONS:MPYTHON}
|
||||
${PYTHON_CMD} -mcompileall \
|
||||
${KMK_BUILDDIR}/bin/sdk/bindings/xpcom/python/xpcom
|
||||
.endif
|
||||
|
||||
do-install:
|
||||
.if ${PORT_OPTIONS:MPYTHON} || ${PORT_OPTIONS:MWEBSERVICE}
|
||||
${MKDIR} ${STAGEDIR}${DATADIR}/sdk
|
||||
.endif
|
||||
cd ${KMK_BUILDDIR}/bin/sdk/bindings/xpcom && \
|
||||
${COPYTREE_SHARE} "idl samples" ${STAGEDIR}${DATADIR}
|
||||
|
||||
${MKDIR} ${STAGEDIR}${PREFIX}/include/virtualbox
|
||||
cd ${KMK_BUILDDIR}/bin/sdk/bindings/xpcom/include && \
|
||||
${COPYTREE_SHARE} "*" ${STAGEDIR}${PREFIX}/include/virtualbox
|
||||
|
||||
${MKDIR} ${STAGEDIR}${VBOX_DIR}
|
||||
cd ${KMK_BUILDDIR}/bin && ${COPYTREE_SHARE} \
|
||||
"*.fd *.r0 *.so components" ${STAGEDIR}${VBOX_DIR}
|
||||
.if ${PORT_OPTIONS:MPYTHON} || ${PORT_OPTIONS:MWEBSERVICE}
|
||||
${RLN} ${STAGEDIR}${DATADIR}/sdk ${STAGEDIR}${VBOX_DIR}
|
||||
.endif
|
||||
|
||||
${INSTALL_SCRIPT} ${WRKSRC}/src/VBox/Installer/freebsd/VBox.sh \
|
||||
${STAGEDIR}${VBOX_DIR}
|
||||
.for f in ${VBOX_PROGS} ${VBOX_UTILS}
|
||||
${INSTALL_PROGRAM} ${KMK_BUILDDIR}/bin/${f} ${STAGEDIR}${VBOX_DIR}
|
||||
.endfor
|
||||
.for f in ${VBOX_PROGS} ${VBOX_LINKS}
|
||||
${LN} -fs ../${VBOX_DIR_REL}/VBox.sh ${STAGEDIR}${PREFIX}/bin/${f}
|
||||
.endfor
|
||||
.for f in ${VBOX_PROGS}
|
||||
${LN} -fs ../${VBOX_DIR_REL}/VBox.sh ${STAGEDIR}${PREFIX}/bin/${f:tl}
|
||||
.endfor
|
||||
|
||||
.if ${PORT_OPTIONS:MGUESTADDITIONS}
|
||||
${MKDIR} ${STAGEDIR}${VBOX_DIR}/additions
|
||||
${INSTALL_DATA} ${DISTDIR}/${GUESTADDITIONS} \
|
||||
${STAGEDIR}${VBOX_DIR}/additions/
|
||||
${RLN} ${STAGEDIR}${VBOX_DIR}/additions/${GUESTADDITIONS} \
|
||||
${STAGEDIR}${VBOX_DIR}/additions/VBoxGuestAdditions.iso
|
||||
.endif
|
||||
|
||||
.if ${PORT_OPTIONS:MDOCS}
|
||||
${MKDIR} ${STAGEDIR}${DOCSDIR}
|
||||
${INSTALL_DATA} ${WRKDIR}/VirtualBox-docs-${DISTVERSION}/UserManual.pdf \
|
||||
${STAGEDIR}${DOCSDIR}
|
||||
.endif
|
||||
|
||||
.if ${PORT_OPTIONS:MNLS}
|
||||
cd ${KMK_BUILDDIR}/obj/VirtualBox/qtnls && \
|
||||
${COPYTREE_SHARE} "*.qm" ${STAGEDIR}${DATADIR}/nls
|
||||
.endif
|
||||
|
||||
.if ${PORT_OPTIONS:MPYTHON}
|
||||
cd ${KMK_BUILDDIR}/bin/sdk/installer && \
|
||||
${SETENV} VBOX_INSTALL_PATH="${VBOX_DIR}" \
|
||||
${PYTHON_CMD} vboxapisetup.py install --root=${STAGEDIR}
|
||||
|
||||
@${MKDIR} ${STAGEDIR}${PYTHON_SITELIBDIR}/xpcom
|
||||
cd ${KMK_BUILDDIR}/bin/sdk/bindings/xpcom/python/xpcom && \
|
||||
${COPYTREE_SHARE} "*" ${STAGEDIR}${PYTHON_SITELIBDIR}/xpcom
|
||||
@${MKDIR} ${STAGEDIR}${DATADIR}/sdk/bindings/xpcom/python
|
||||
${RLN} ${STAGEDIR}${PYTHON_SITELIBDIR}/xpcom \
|
||||
${STAGEDIR}${DATADIR}/sdk/bindings/xpcom/python
|
||||
.endif
|
||||
|
||||
.if ${PORT_OPTIONS:MQT5}
|
||||
${INSTALL_DATA} \
|
||||
${WRKSRC}/src/VBox/Frontends/VirtualBox/images/OSE/VirtualBox_48px.png \
|
||||
${STAGEDIR}${PREFIX}/share/pixmaps/VBox.png
|
||||
${INSTALL_DATA} \
|
||||
${WRKSRC}/src/VBox/Installer/freebsd/virtualbox.desktop \
|
||||
${STAGEDIR}${PREFIX}/share/applications/virtualbox.desktop
|
||||
.endif
|
||||
|
||||
.if ${PORT_OPTIONS:MVNC}
|
||||
${MKDIR} ${STAGEDIR}${VBOX_DIR}/ExtensionPacks/VNC/${KMK_ARCH}
|
||||
${INSTALL_DATA} ${KMK_BUILDDIR}/bin/ExtensionPacks/VNC/ExtPack* \
|
||||
${STAGEDIR}${VBOX_DIR}/ExtensionPacks/VNC/
|
||||
${INSTALL_LIB} ${KMK_BUILDDIR}/bin/ExtensionPacks/VNC/${KMK_ARCH}/* \
|
||||
${STAGEDIR}${VBOX_DIR}/ExtensionPacks/VNC/${KMK_ARCH}/
|
||||
.endif
|
||||
|
||||
.if ${PORT_OPTIONS:MVBOXIMG}
|
||||
${LN} -fs ../${VBOX_DIR_REL}/vboximg-mount ${STAGEDIR}${PREFIX}/bin/
|
||||
.endif
|
||||
|
||||
.if ${PORT_OPTIONS:MWEBSERVICE}
|
||||
${MKDIR} ${STAGEDIR}${DATADIR}/sdk/bindings/webservice
|
||||
${INSTALL_DATA} ${KMK_BUILDDIR}/obj/webservice/vboxweb.wsdl \
|
||||
${STAGEDIR}${DATADIR}/sdk/bindings/webservice/
|
||||
.endif
|
||||
|
||||
post-install:
|
||||
${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/virtualbox/*.so \
|
||||
${STAGEDIR}${PREFIX}/lib/virtualbox/components/*.so
|
||||
|
||||
.include <bsd.port.post.mk>
|
7
emulators/virtualbox-ose-70/distinfo
Normal file
7
emulators/virtualbox-ose-70/distinfo
Normal file
|
@ -0,0 +1,7 @@
|
|||
TIMESTAMP = 1716920210
|
||||
SHA256 (VirtualBox-6.1.50.tar.bz2) = 73ff603842896cb8d86ac5a817eb5037d7d225d3c46ea238e39d7ba5aaf61a57
|
||||
SIZE (VirtualBox-6.1.50.tar.bz2) = 165959648
|
||||
SHA256 (VBoxGuestAdditions_6.1.50.iso) = af53e34c5a5ec143f3418ac01d00ed5f33f6b31bfdc92eb4714c99d9bccb6602
|
||||
SIZE (VBoxGuestAdditions_6.1.50.iso) = 64051200
|
||||
SHA256 (VirtualBox-docs-6.1.50.tar.bz2) = e5dc118e8bb8352c06d5359e4f75ceb339a3917f0727fd74ad02ff07251e67db
|
||||
SIZE (VirtualBox-docs-6.1.50.tar.bz2) = 4063302
|
11
emulators/virtualbox-ose-70/files/extrapatch-Config.kmk
Normal file
11
emulators/virtualbox-ose-70/files/extrapatch-Config.kmk
Normal file
|
@ -0,0 +1,11 @@
|
|||
--- Config.kmk.orig 2021-04-28 16:21:25 UTC
|
||||
+++ Config.kmk
|
||||
@@ -4931,7 +4931,7 @@ define TOOL_FREEBSDKMODLD_LINK_SYSMOD_CMDS
|
||||
| xargs -J% objcopy % $(out)
|
||||
|
||||
## Strip debug info (comment out if debugging or something).
|
||||
- objcopy --strip-debug $(out)
|
||||
+# objcopy --strip-debug $(out)
|
||||
endef
|
||||
else # x86
|
||||
TOOL_FREEBSDKMODLD_LINK_SYSMOD_OUTPUT = $(outbase).kld
|
|
@ -0,0 +1,11 @@
|
|||
--- 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
|
|
@ -0,0 +1,11 @@
|
|||
--- Config.kmk.orig 2023-10-12 15:43:35.000000000 +0700
|
||||
+++ Config.kmk 2023-10-30 22:11:09.119922000 +0700
|
||||
@@ -869,7 +869,7 @@
|
||||
# windows versions (only define when buildling win.x86).
|
||||
#VBOX_WITH_MORE_NT4_COMPAT_BINARIES = 1
|
||||
# Set this to enable building of the vboximg-mount FUSE mounting utility.
|
||||
-if1of ($(KBUILD_TARGET), darwin linux)
|
||||
+if1of ($(KBUILD_TARGET), darwin freebsd linux)
|
||||
VBOX_WITH_VBOXIMGMOUNT = 1
|
||||
endif
|
||||
# Set this to enable packaging the fuse related bits into our installer.
|
234
emulators/virtualbox-ose-70/files/patch-Config.kmk
Normal file
234
emulators/virtualbox-ose-70/files/patch-Config.kmk
Normal file
|
@ -0,0 +1,234 @@
|
|||
--- Config.kmk.orig 2021-01-07 15:31:21 UTC
|
||||
+++ Config.kmk
|
||||
@@ -469,11 +469,11 @@ ifn1of ($(KBUILD_TARGET), win darwin)
|
||||
# Enable OSS audio support.
|
||||
VBOX_WITH_AUDIO_OSS = 1
|
||||
endif
|
||||
-if1of ($(KBUILD_TARGET), linux)
|
||||
+if1of ($(KBUILD_TARGET), freebsd linux)
|
||||
# Enable ALSA audio support.
|
||||
VBOX_WITH_AUDIO_ALSA = 1
|
||||
endif
|
||||
-if1of ($(KBUILD_TARGET), linux)
|
||||
+if1of ($(KBUILD_TARGET), freebsd linux)
|
||||
# Enable PulseAudio audio support.
|
||||
VBOX_WITH_AUDIO_PULSE = 1
|
||||
endif
|
||||
@@ -489,11 +489,11 @@ VBOX_WITH_AUDIO_MMNOTIFICATION_CLIENT = 1
|
||||
# (disabled with 6.1, since it's not complete/useful enough)
|
||||
VBOX_WITH_PCI_PASSTHROUGH =
|
||||
# Enable statically linked dbus support.
|
||||
-if1of ($(KBUILD_TARGET), linux solaris)
|
||||
+if1of ($(KBUILD_TARGET), freebsd linux solaris)
|
||||
VBOX_WITH_DBUS = 1
|
||||
endif
|
||||
# Enable building PAM modules.
|
||||
-if1of ($(KBUILD_TARGET), linux solaris)
|
||||
+if1of ($(KBUILD_TARGET), freebsd linux solaris)
|
||||
VBOX_WITH_PAM = 1
|
||||
endif
|
||||
# Enable internal networking.
|
||||
@@ -501,7 +501,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
|
||||
@@ -647,7 +647,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.
|
||||
@@ -1064,10 +1064,6 @@ ifeq ($(KBUILD_TARGET),darwin)
|
||||
VBOX_WITH_VBOXSDL=
|
||||
endif
|
||||
|
||||
-ifeq ($(KBUILD_TARGET),freebsd)
|
||||
- VBOX_WITH_DOCS=
|
||||
-endif
|
||||
-
|
||||
ifeq ($(KBUILD_TARGET),haiku)
|
||||
# Don't bother with SDL ttf for now.
|
||||
VBOX_WITH_SECURELABEL=
|
||||
@@ -1228,7 +1224,7 @@ ifdef VBOX_OSE
|
||||
VBOX_WITH_KCHMVIEWER=
|
||||
VBOX_WITH_PLUGIN_CRYPT=
|
||||
VBOX_WITH_DRAG_AND_DROP_PROMISES=
|
||||
- ifn1of ($(KBUILD_TARGET), linux)
|
||||
+ ifn1of ($(KBUILD_TARGET), freebsd linux)
|
||||
VBOX_WITH_DOCS=
|
||||
VBOX_WITH_DOCS_PACKING=
|
||||
endif
|
||||
@@ -4928,7 +4924,7 @@ define TOOL_FREEBSDKMODLD_LINK_SYSMOD_CMDS
|
||||
| xargs -J% objcopy % $(outbase).kld
|
||||
|
||||
# Link the final .ko (a shared object).
|
||||
- ld $(flags) -Bshareable -o $(out) $(outbase).kld
|
||||
+ ld $(flags) -Bshareable -znotext -o $(out) $(outbase).kld
|
||||
endef
|
||||
endif # x86
|
||||
|
||||
@@ -5205,6 +5201,7 @@ TEMPLATE_VBOXR3EXE_LDFLAGS.x86 = -m32
|
||||
TEMPLATE_VBOXR3EXE_LDFLAGS.amd64 = -m64
|
||||
TEMPLATE_VBOXR3EXE_LDFLAGS.sparc32 = -m32
|
||||
TEMPLATE_VBOXR3EXE_LDFLAGS.sparc64 = -m64
|
||||
+TEMPLATE_VBOXR3EXE_LDFLAGS.freebsd = -Wl,-z,noexecstack,-z,relro $(VBOX_LD_as_needed)
|
||||
TEMPLATE_VBOXR3EXE_LDFLAGS.linux = -Wl,-z,noexecstack,-z,relro $(VBOX_LD_as_needed)
|
||||
TEMPLATE_VBOXR3EXE_LDFLAGS.solaris = -Wl,-z,ignore # same as VBOX_LD_as_needed
|
||||
TEMPLATE_VBOXR3EXE_LDFLAGS.debug = $(VBOX_GCC_SANITIZER_FLAGS) $(VBOX_GCC_SANITIZER_LDFLAGS)
|
||||
@@ -5238,10 +5235,18 @@ TEMPLATE_VBOXR3EXE_LIBPATH += \
|
||||
TEMPLATE_VBOXR3EXE_CFLAGS += -fno-pic
|
||||
TEMPLATE_VBOXR3EXE_CXXFLAGS += -fno-pic
|
||||
TEMPLATE_VBOXR3EXE_LDFLAGS += -fno-pic
|
||||
- else if1of ($(KBUILD_TARGET), freebsd openbsd)
|
||||
+ else ifeq ($(KBUILD_TARGET),freebsd)
|
||||
TEMPLATE_VBOXR3EXE_TOOL = GXX3
|
||||
TEMPLATE_VBOXR3EXE_LIBS = pthread
|
||||
+TEMPLATE_VBOXR3EXE_LDFLAGS.freebsd.x86 = -Wl,-z,notext
|
||||
TEMPLATE_VBOXR3EXE_INCS += \
|
||||
+ /usr/local/include
|
||||
+TEMPLATE_VBOXR3EXE_LIBPATH += \
|
||||
+ /usr/local/lib
|
||||
+ else ifeq ($(KBUILD_TARGET),openbsd)
|
||||
+TEMPLATE_VBOXR3EXE_TOOL = GXX3
|
||||
+TEMPLATE_VBOXR3EXE_LIBS = pthread
|
||||
+TEMPLATE_VBOXR3EXE_INCS += \
|
||||
/usr/include \
|
||||
/usr/X11R6/include \
|
||||
/usr/local/include
|
||||
@@ -5273,6 +5278,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
|
||||
@@ -5412,7 +5418,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
|
||||
@@ -5557,6 +5563,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_VBoxR3HardenedTstDll_LDFLAGS.freebsd = $(filter-out $(VBOX_GCC_ORIGIN_OPT),$(TEMPLATE_VBoxR3TstDll_LDFLAGS.freebsd))
|
||||
TEMPLATE_VBOXR3HARDENEDEXE_LDFLAGS.linux = $(filter-out $(VBOX_GCC_ORIGIN_OPT),$(TEMPLATE_VBOXR3EXE_LDFLAGS.linux))
|
||||
endif
|
||||
|
||||
@@ -5584,6 +5591,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
|
||||
|
||||
@@ -5606,6 +5614,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
|
||||
@@ -6132,10 +6141,19 @@ TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTI
|
||||
else ifeq ($(KBUILD_TARGET),haiku)
|
||||
TEMPLATE_VBOXMAINEXE_TOOL = GXX3
|
||||
TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME) network stdc++ supc++
|
||||
- else if1of ($(KBUILD_TARGET), freebsd openbsd)
|
||||
+ else ifeq ($(KBUILD_TARGET),freebsd)
|
||||
TEMPLATE_VBOXMAINEXE_TOOL = GXX3
|
||||
TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
|
||||
+TEMPLATE_VBOXMAINEXE_LDFLAGS.freebsd = -Wl,-z,noexecstack,-z,relro $(VBOX_LD_as_needed)
|
||||
+TEMPLATE_VBOXMAINEXE_LDFLAGS.freebsd.x86 = -Wl,-z,notext
|
||||
TEMPLATE_VBOXMAINEXE_INCS += \
|
||||
+ /usr/local/include
|
||||
+TEMPLATE_VBOXMAINEXE_LIBPATH += \
|
||||
+ /usr/local/lib
|
||||
+ else ifeq ($(KBUILD_TARGET),openbsd)
|
||||
+TEMPLATE_VBOXMAINEXE_TOOL = GXX3
|
||||
+TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
|
||||
+TEMPLATE_VBOXMAINEXE_INCS += \
|
||||
/usr/include \
|
||||
/usr/X11R6/include \
|
||||
/usr/local/include
|
||||
@@ -6167,6 +6185,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
|
||||
|
||||
@@ -6735,13 +6754,11 @@ ifdef VBOX_WITH_QTGUI
|
||||
TEMPLATE_VBOXQTGUIEXE_LIBPATH += \
|
||||
$(VBOX_LIBPATH_X11)
|
||||
ifeq ($(KBUILD_TARGET),freebsd)
|
||||
+ TEMPLATE_VBOXQTGUIEXE_LDFLAGS += -Wl,-z,noexecstack,-z,relro $(VBOX_LD_as_needed)
|
||||
+ TEMPLATE_VBOXQTGUIEXE_LDFLAGS.freebsd.x86 = -Wl,-z,notext
|
||||
TEMPLATE_VBOXQTGUIEXE_INCS += \
|
||||
- /usr/include \
|
||||
- /usr/X11R6/include \
|
||||
/usr/local/include
|
||||
TEMPLATE_VBOXQTGUIEXE_LIBPATH += \
|
||||
- /usr/lib \
|
||||
- /usr/X11R6/lib \
|
||||
/usr/local/lib
|
||||
endif
|
||||
ifeq ($(KBUILD_TARGET),solaris)
|
||||
@@ -6988,10 +7005,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/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
|
||||
@@ -7115,6 +7139,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))
|
||||
@@ -7138,6 +7163,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)
|
||||
|
||||
#
|
||||
@@ -7345,6 +7371,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
|
126
emulators/virtualbox-ose-70/files/patch-configure
Normal file
126
emulators/virtualbox-ose-70/files/patch-configure
Normal file
|
@ -0,0 +1,126 @@
|
|||
--- configure.orig 2021-10-18 17:47:25 UTC
|
||||
+++ configure
|
||||
@@ -139,10 +139,14 @@ CXX_FLAGS=""
|
||||
if [ "$OS" = "freebsd" ]; then
|
||||
INCCURL="-I/usr/local/include"
|
||||
LIBCURL="-L/usr/local/lib -lcurl"
|
||||
+ INCALSA="-I/usr/local/include"
|
||||
+ LIBALSA="-L/usr/local/lib"
|
||||
INCPULSE="-I/usr/local/include"
|
||||
LIBPULSE="-L/usr/local/lib"
|
||||
INCPNG="-I/usr/local/include"
|
||||
LIBPNG="-L/usr/local/lib -lpng"
|
||||
+ INCVNCSERVER="-I/usr/local/include"
|
||||
+ LIBVNCSERVER="-L/usr/local/lib"
|
||||
else
|
||||
INCCURL=""
|
||||
LIBCURL="-lcurl"
|
||||
@@ -1173,6 +1177,9 @@ extern "C" int main(int argc, char** arg
|
||||
printf("found version %d.%d.%d",
|
||||
SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL);
|
||||
#if SDL_VERSION_ATLEAST(1,2,7)
|
||||
+#if !defined(SDL_VIDEO_DRIVER_X11)
|
||||
+#error SDL must be compiled with X11 support
|
||||
+#endif
|
||||
printf(", OK.\n");
|
||||
return 0;
|
||||
#else
|
||||
@@ -1257,7 +1264,7 @@ extern "C" int main(void)
|
||||
#endif
|
||||
}
|
||||
EOF
|
||||
- if test_compile "-lasound" asound asound; then
|
||||
+ if test_compile "$INCALSA $LIBALSA -lasound" asound asound; then
|
||||
test_execute
|
||||
fi
|
||||
}
|
||||
@@ -1564,6 +1571,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"
|
||||
+ FLGQT5="$FLGQT5 -std=c++11"
|
||||
INCQT5=`strip_I "$FLGQT5"`
|
||||
LIBDIR5=`pkg-config Qt5Core --variable=libdir`
|
||||
LIBQT5=`pkg-config Qt5Core Qt5Gui --libs`
|
||||
@@ -1702,7 +1710,7 @@ check_libopus()
|
||||
fi
|
||||
cat > $ODIR.tmp_src.cc << EOF
|
||||
#include <cstdio>
|
||||
-#include <opus/opus.h>
|
||||
+#include <opus.h>
|
||||
extern "C" int main(void)
|
||||
{
|
||||
OpusEncoder *test;
|
||||
@@ -2034,8 +2042,8 @@ EOF
|
||||
echo "compiling the following source file:" >> $LOG
|
||||
cat $ODIR.tmp_src.cc >> $LOG
|
||||
echo "using the following command line:" >> $LOG
|
||||
- echo "$CXX -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.cc -I$p/include/$d $p/$b/lib$d.so" >> $LOG
|
||||
- $CXX -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.cc -I$p/include/$d $p/$b/lib$d.so >> $LOG 2>&1
|
||||
+ echo "$CXX -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.cc -I$p/include/$d $p/$b/lib$d.so -pthread" >> $LOG
|
||||
+ $CXX -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.cc -I$p/include/$d $p/$b/lib$d.so -pthread >> $LOG 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
found=1
|
||||
break
|
||||
@@ -2151,7 +2159,7 @@ check_gsoap()
|
||||
else
|
||||
cnf_append "VBOX_GSOAP_CXX_SOURCES" ""
|
||||
fi
|
||||
- cnf_append "VBOX_GSOAP_CXX_LIBS" "`strip_l "$GSOAP_CXX_LIBS"`"
|
||||
+ cnf_append "VBOX_GSOAP_CXX_LIBS" "`strip_l "$GSOAP_CXX_LIBS"` z"
|
||||
gsoap_version=`pkg-config gsoapssl++ --modversion`
|
||||
log_success "found version $gsoap_version"
|
||||
return
|
||||
@@ -2519,7 +2527,7 @@ for option in "$@"; do
|
||||
--with-openssl-dir=*)
|
||||
OPENSSLDIR=`echo $option | cut -d'=' -f2`
|
||||
INCCRYPTO="-I${OPENSSLDIR}/include"
|
||||
- LIBCRYPTO="${OPENSSLDIR}/lib/libssl.a ${OPENSSLDIR}/lib/libcrypto.a"
|
||||
+ LIBCRYPTO="-L${OPENSSLDIR}/lib -lssl -lcrypto"
|
||||
# On Linux static OpenSSL typically needs a few additional libraries.
|
||||
[ "$OS" = "linux" ] && LIBCRYPTO="-ldl $LIBPTHREAD -lm"
|
||||
;;
|
||||
@@ -2865,12 +2873,22 @@ if [ $ONLY_ADDITIONS -eq 0 ]; then
|
||||
[ $WITH_JAVA -eq 1 ] && check_java
|
||||
|
||||
# PulseAudio
|
||||
- if [ $WITH_PULSE -eq 1 ]; then
|
||||
- check_pulse
|
||||
- elif [ $WITH_PULSE -eq 0 ]; then # Force disabling PulseAudio.
|
||||
- cnf_append "VBOX_WITH_AUDIO_PULSE" ""
|
||||
- elif [ $WITH_PULSE -eq 2 ]; then # --enable-pulse was passed, force PulseAudio.
|
||||
- cnf_append "VBOX_WITH_AUDIO_PULSE" "1"
|
||||
+ 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 # Force disabling PulseAudio.
|
||||
+ cnf_append "VBOX_WITH_AUDIO_PULSE" ""
|
||||
+ elif [ $WITH_PULSE -eq 2 ]; then # --enable-pulse was passed, force PulseAudio.
|
||||
+ cnf_append "VBOX_WITH_AUDIO_PULSE" "1"
|
||||
+ fi
|
||||
+ if [ $WITH_DBUS -eq 0 ]; then
|
||||
+ cnf_append "VBOX_WITH_DBUS" ""
|
||||
+ fi
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -2886,14 +2904,6 @@ if [ "$OS" = "linux" ]; then
|
||||
cnf_append "VBOX_WITHOUT_LINUX_TEST_BUILDS" "1"
|
||||
fi
|
||||
if [ $ONLY_ADDITIONS -eq 0 ]; then
|
||||
- if [ $WITH_ALSA -eq 1 ]; then
|
||||
- check_alsa
|
||||
- else
|
||||
- cnf_append "VBOX_WITH_AUDIO_ALSA" ""
|
||||
- fi
|
||||
- if [ $WITH_DBUS -eq 0 ]; then
|
||||
- cnf_append "VBOX_WITH_DBUS" ""
|
||||
- fi
|
||||
if [ $WITH_DEVMAPPER -eq 1 ]; then
|
||||
check_libdevmapper
|
||||
else
|
19
emulators/virtualbox-ose-70/files/patch-include-iprt-x86.h
Normal file
19
emulators/virtualbox-ose-70/files/patch-include-iprt-x86.h
Normal file
|
@ -0,0 +1,19 @@
|
|||
--- include/iprt/x86.h.orig 2021-04-20 04:22:23 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 and sys/controlregs.h
|
||||
* defining MSR_IA32_FLUSH_CMD */
|
||||
#ifdef RT_OS_SOLARIS
|
|
@ -0,0 +1,36 @@
|
|||
--- include/VBox/com/array.h.orig 2021-01-07 15:31:25 UTC
|
||||
+++ include/VBox/com/array.h
|
||||
@@ -171,7 +171,7 @@
|
||||
|
||||
#include "VBox/com/defs.h"
|
||||
|
||||
-#if RT_GNUC_PREREQ(4, 6) || (defined(_MSC_VER) && (_MSC_VER >= 1600))
|
||||
+#if RT_GNUC_PREREQ(4, 6) || (defined(_MSC_VER) && (_MSC_VER >= 1600)) || defined(_LIBCPP_VERSION)
|
||||
/** @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.
|
||||
@@ -960,12 +960,12 @@ class SafeArray : public Traits (public)
|
||||
{
|
||||
/** @todo r=klaus should do this as a AssertCompile, but cannot find a way which works. */
|
||||
Assert(sizeof(T) <= sizeof(Zeroes));
|
||||
- AssertReturn(m.arr != NULL, *(T *)&Zeroes[0]);
|
||||
- AssertReturn(aIdx < size(), *(T *)&Zeroes[0]);
|
||||
+ 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 *)&Zeroes[0]);
|
||||
+ AssertReturn(m.raw != NULL, *((T *)1));
|
||||
return m.raw[aIdx];
|
||||
#endif
|
||||
}
|
||||
@@ -980,7 +980,7 @@ class SafeArray : public Traits (public)
|
||||
#ifdef VBOX_WITH_XPCOM
|
||||
return m.arr[aIdx];
|
||||
#else
|
||||
- AssertReturn(m.raw != NULL, *(const T *)&Zeroes[0]);
|
||||
+ AssertReturn(m.raw != NULL, *((T *)1));
|
||||
return m.raw[aIdx];
|
||||
#endif
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
--- include/iprt/string.h.orig 2021-01-07 15:31:33 UTC
|
||||
+++ include/iprt/string.h
|
||||
@@ -46,6 +46,11 @@
|
||||
#elif defined(RT_OS_FREEBSD) && defined(_KERNEL)
|
||||
RT_C_DECLS_BEGIN
|
||||
# include <sys/libkern.h>
|
||||
+ /*
|
||||
+ * Kludge for the FreeBSD kernel:
|
||||
+ * sys/libkern.h includes sys/param.h via sys/systm.h since r335879.
|
||||
+ */
|
||||
+# undef PVM
|
||||
RT_C_DECLS_END
|
||||
|
||||
#elif defined(RT_OS_NETBSD) && defined(_KERNEL)
|
|
@ -0,0 +1,290 @@
|
|||
--- src/VBox/Additions/common/VBoxGuest/VBoxGuest-freebsd.c.orig 2022-03-22 23:37:46 UTC
|
||||
+++ src/VBox/Additions/common/VBoxGuest/VBoxGuest-freebsd.c
|
||||
@@ -45,6 +45,7 @@
|
||||
#include <sys/uio.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/poll.h>
|
||||
+#include <sys/proc.h>
|
||||
#include <sys/selinfo.h>
|
||||
#include <sys/queue.h>
|
||||
#include <sys/lock.h>
|
||||
@@ -61,6 +62,7 @@
|
||||
#include <VBox/version.h>
|
||||
#include <VBox/log.h>
|
||||
#include <iprt/assert.h>
|
||||
+#include <iprt/err.h>
|
||||
#include <iprt/initterm.h>
|
||||
#include <iprt/process.h>
|
||||
#include <iprt/string.h>
|
||||
@@ -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<N> 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 vgdrvFreeBSDIOCtl(struct cdev *pDev, u_long
|
||||
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 @@ static int vgdrvFreeBSDPoll(struct cdev *pDev, int fEv
|
||||
|
||||
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
|
||||
@@ -782,8 +699,12 @@ static driver_t vgdrvFreeBSDDriver =
|
||||
sizeof(struct VBoxGuestDeviceState),
|
||||
};
|
||||
|
||||
+#if __FreeBSD_version >= 1400058
|
||||
+DRIVER_MODULE(vboxguest, pci, vgdrvFreeBSDDriver, 0, 0);
|
||||
+#else
|
||||
static devclass_t vgdrvFreeBSDClass;
|
||||
|
||||
DRIVER_MODULE(vboxguest, pci, vgdrvFreeBSDDriver, vgdrvFreeBSDClass, 0, 0);
|
||||
+#endif
|
||||
MODULE_VERSION(vboxguest, 1);
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
--- src/VBox/Additions/common/VBoxGuest/freebsd/Makefile.orig 2019-04-16 10:09:09 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 \
|
|
@ -0,0 +1,34 @@
|
|||
--- src/VBox/Additions/common/VBoxGuest/freebsd/files_vboxguest.orig 2019-01-25 18:12:28 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 \
|
|
@ -0,0 +1,17 @@
|
|||
--- src/VBox/Additions/x11/Installer/98vboxadd-xclient.orig 2021-01-07 15:34:29 UTC
|
||||
+++ src/VBox/Additions/x11/Installer/98vboxadd-xclient
|
||||
@@ -30,9 +30,9 @@ 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 --seamless
|
||||
- /usr/bin/VBoxClient --draganddrop
|
||||
- /usr/bin/VBoxClient --vmsvga # In case VMSVGA emulation is enabled
|
||||
+ /usr/local/bin/VBoxClient --clipboard
|
||||
+ /usr/local/bin/VBoxClient --checkhostversion
|
||||
+ /usr/local/bin/VBoxClient --seamless
|
||||
+ /usr/local/bin/VBoxClient --draganddrop
|
||||
+ /usr/local/bin/VBoxClient --vmsvga # In case VMSVGA emulation is enabled
|
||||
fi
|
|
@ -0,0 +1,10 @@
|
|||
--- src/VBox/Additions/x11/Installer/vboxclient.desktop.orig 2020-05-13 19:37:09 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
|
|
@ -0,0 +1,12 @@
|
|||
--- src/VBox/Devices/Network/slirp/bsd/sys/mbuf.h.orig 2020-05-13 19:42:23 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 */
|
|
@ -0,0 +1,20 @@
|
|||
--- src/VBox/HostDrivers/VBoxNetAdp/Makefile.kmk.orig 2019-05-13 13:33:07 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
|
|
@ -0,0 +1,10 @@
|
|||
--- src/VBox/HostDrivers/VBoxNetFlt/freebsd/files_vboxnetflt.orig 2021-01-07 15:41:28 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 \
|
|
@ -0,0 +1,14 @@
|
|||
--- src/VBox/Installer/Makefile.kmk.orig 2020-05-13 19:44:01 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
|
|
@ -0,0 +1,77 @@
|
|||
--- src/VBox/Installer/freebsd/VBox.sh.orig 2016-08-27 05:10:34 UTC
|
||||
+++ src/VBox/Installer/freebsd/VBox.sh
|
||||
@@ -0,0 +1,74 @@
|
||||
+#!/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="/sbin:/bin:/usr/sbin:/usr/bin:%%LOCALBASE%%/sbin:%%LOCALBASE%%/bin"
|
||||
+CONFIG="%%VBOX_ETC%%/vbox.cfg"
|
||||
+
|
||||
+test -r "${CONFIG}" &&
|
||||
+ . "${CONFIG}"
|
||||
+test -z "${INSTALL_DIR}" &&
|
||||
+ if test -d %%VBOX_DIR%% &&
|
||||
+ test -f %%VBOX_DIR%%/VBoxRT.so; then
|
||||
+ INSTALL_DIR=%%VBOX_DIR%%
|
||||
+ else
|
||||
+ >&2 echo "Could not find VirtualBox installation. Please reinstall."
|
||||
+ exit 1
|
||||
+ fi
|
||||
+
|
||||
+if [ -d /etc/vbox ]; then
|
||||
+ >&2 cat <<-EOH
|
||||
+ WARNING: Directory /etc/vbox found, but ignored. VirtualBox
|
||||
+ configuration files are stored in %%VBOX_ETC%%/.
|
||||
+ EOH
|
||||
+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" "$@"
|
||||
+ ;;
|
||||
+ vboxwebsrv)
|
||||
+ exec "$INSTALL_DIR/vboxwebsrv" "$@"
|
||||
+ ;;
|
||||
+ *)
|
||||
+ >&2 echo "Unknown application - $APP"
|
||||
+ exit 1
|
||||
+ ;;
|
||||
+esac
|
||||
+exit 0
|
|
@ -0,0 +1,10 @@
|
|||
--- src/VBox/Installer/freebsd/virtualbox.desktop.orig 2020-05-13 19:44:01 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
|
|
@ -0,0 +1,11 @@
|
|||
--- src/VBox/Main/src-server/VirtualBoxImpl.cpp.orig 2021-01-07 15:41:43 UTC
|
||||
+++ src/VBox/Main/src-server/VirtualBoxImpl.cpp
|
||||
@@ -2663,7 +2663,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++)
|
|
@ -0,0 +1,39 @@
|
|||
--- src/VBox/Main/webservice/Makefile.kmk.orig 2021-01-07 15:41:45 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
|
|
@ -0,0 +1,14 @@
|
|||
--- src/VBox/Runtime/Makefile.kmk.orig 2021-01-07 15:41:50 UTC
|
||||
+++ src/VBox/Runtime/Makefile.kmk
|
||||
@@ -177,6 +177,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
|
|
@ -0,0 +1,39 @@
|
|||
Without the first part of 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 clamping improves the situation significantly. Also, it (approximately)
|
||||
follows what tvtohz does. The rest of the patch just chases an upstream
|
||||
KPI change.
|
||||
|
||||
Submitted by: Andriy Gapon <avg@FreeBSD.org>
|
||||
--- src/VBox/Runtime/r0drv/freebsd/sleepqueue-r0drv-freebsd.h.orig 2024-07-29 13:10:32 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
|
||||
@@ -300,10 +302,16 @@ DECLINLINE(void) rtR0SemBsdSignal(void *pvWaitChan)
|
||||
DECLINLINE(void) rtR0SemBsdSignal(void *pvWaitChan)
|
||||
{
|
||||
sleepq_lock(pvWaitChan);
|
||||
+#if __FreeBSD_version < 1500022
|
||||
int fWakeupSwapProc = sleepq_signal(pvWaitChan, SLEEPQ_CONDVAR, 0, 0);
|
||||
+#else
|
||||
+ sleepq_signal(pvWaitChan, SLEEPQ_CONDVAR, 0, 0);
|
||||
+#endif
|
||||
sleepq_release(pvWaitChan);
|
||||
+#if __FreeBSD_version < 1500022
|
||||
if (fWakeupSwapProc)
|
||||
kick_proc0();
|
||||
+#endif
|
||||
}
|
||||
|
||||
/**
|
|
@ -0,0 +1,71 @@
|
|||
--- src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo.cpp.orig 2021-01-07 15:34:20 UTC
|
||||
+++ src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo.cpp
|
||||
@@ -67,8 +67,8 @@
|
||||
# include <net/if.h>
|
||||
# include <pwd.h> /* getpwuid */
|
||||
# include <unistd.h>
|
||||
-# if !defined(RT_OS_OS2) && !defined(RT_OS_FREEBSD) && !defined(RT_OS_HAIKU)
|
||||
-# include <utmpx.h> /** @todo FreeBSD 9 should have this. */
|
||||
+# if !defined(RT_OS_OS2) && !defined(RT_OS_HAIKU)
|
||||
+# include <utmpx.h>
|
||||
# endif
|
||||
# ifdef RT_OS_OS2
|
||||
# include <net/if_dl.h>
|
||||
@@ -528,7 +528,7 @@ static void vgsvcVMInfoWriteFixedProperties(void)
|
||||
}
|
||||
|
||||
|
||||
-#if defined(VBOX_WITH_DBUS) && defined(RT_OS_LINUX) /* Not yet for Solaris/FreeBSB. */
|
||||
+#if defined(VBOX_WITH_DBUS) && (defined(RT_OS_LINUX) || defined(RT_OS_FREEBSD)) /* Not yet for Solaris. */
|
||||
/*
|
||||
* Simple wrapper to work around compiler-specific va_list madness.
|
||||
*/
|
||||
@@ -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.
|
||||
- * However, FreeBSD 9 supports utmpx, so we could use the code
|
||||
- * block below (?). */
|
||||
- rc = VERR_NOT_IMPLEMENTED;
|
||||
-
|
||||
#elif defined(RT_OS_HAIKU)
|
||||
/** @todo Haiku: Port logged on user info retrieval. */
|
||||
rc = VERR_NOT_IMPLEMENTED;
|
||||
@@ -586,7 +580,7 @@ static int vgsvcVMInfoWriteUsers(void)
|
||||
while ( (ut_user = getutxent())
|
||||
&& RT_SUCCESS(rc))
|
||||
{
|
||||
-# ifdef RT_OS_DARWIN /* No ut_user->ut_session on Darwin */
|
||||
+# if defined(RT_OS_DARWIN) || defined(RT_OS_FREEBSD) /* No ut_user->ut_session on Darwin/FreeBSD */
|
||||
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",
|
||||
@@ -621,7 +615,7 @@ static int vgsvcVMInfoWriteUsers(void)
|
||||
}
|
||||
|
||||
# ifdef VBOX_WITH_DBUS
|
||||
-# if defined(RT_OS_LINUX) /* Not yet for Solaris/FreeBSB. */
|
||||
+# if defined(RT_OS_LINUX) || defined(RT_OS_FREEBSD) /* Not yet for Solaris. */
|
||||
DBusError dbErr;
|
||||
DBusConnection *pConnection = NULL;
|
||||
int rc2 = RTDBusLoadLib();
|
||||
@@ -830,7 +824,7 @@ static int vgsvcVMInfoWriteUsers(void)
|
||||
if ( fHaveLibDbus
|
||||
&& dbus_error_is_set(&dbErr))
|
||||
dbus_error_free(&dbErr);
|
||||
-# endif /* RT_OS_LINUX */
|
||||
+# endif /* RT_OS_LINUX || RT_OS_FREEBSD */
|
||||
# endif /* VBOX_WITH_DBUS */
|
||||
|
||||
/** @todo Fedora/others: Handle systemd-loginctl. */
|
||||
@@ -867,7 +861,7 @@ static int vgsvcVMInfoWriteUsers(void)
|
||||
RTMemFree(papszUsers);
|
||||
|
||||
endutxent(); /* Close utmpx file. */
|
||||
-#endif /* !RT_OS_WINDOWS && !RT_OS_FREEBSD && !RT_OS_HAIKU && !RT_OS_OS2 */
|
||||
+#endif /* !RT_OS_WINDOWS && !RT_OS_HAIKU && !RT_OS_OS2 */
|
||||
|
||||
Assert(RT_FAILURE(rc) || cUsersInList == 0 || (pszUserList && *pszUserList));
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
--- src/VBox/Additions/common/pam/pam_vbox.cpp.orig 2021-01-07 15:34:21 UTC
|
||||
+++ src/VBox/Additions/common/pam/pam_vbox.cpp
|
||||
@@ -104,7 +104,7 @@ static void pam_vbox_writesyslog(char *pszBuf)
|
||||
openlog("pam_vbox", LOG_PID, LOG_AUTHPRIV);
|
||||
syslog(LOG_ERR, "%s", pszBuf);
|
||||
closelog();
|
||||
-#elif defined(RT_OS_SOLARIS)
|
||||
+#elif defined(RT_OS_FREEBSD) || defined(RT_OS_SOLARIS)
|
||||
syslog(LOG_ERR, "pam_vbox: %s\n", pszBuf);
|
||||
#endif
|
||||
}
|
||||
@@ -183,7 +183,7 @@ static int vbox_set_msg(pam_handle_t *hPAM, int iStyle
|
||||
|
||||
pam_message msg;
|
||||
msg.msg_style = iStyle;
|
||||
-#ifdef RT_OS_SOLARIS
|
||||
+#if defined(RT_OS_FREEBSD) || defined(RT_OS_SOLARIS)
|
||||
msg.msg = (char*)pszText;
|
||||
#else
|
||||
msg.msg = pszText;
|
|
@ -0,0 +1,38 @@
|
|||
--- src/VBox/Additions/freebsd/Makefile.orig 2020-05-13 19:37:06 UTC
|
||||
+++ src/VBox/Additions/freebsd/Makefile
|
||||
@@ -30,6 +30,14 @@ all:
|
||||
cp vboxvfs/vboxvfs.ko .; \
|
||||
fi; \
|
||||
fi
|
||||
+ @echo
|
||||
+ @if [ -d mount_vboxvfs ]; then \
|
||||
+ echo "=== Building mount_vboxvfs binary ==="; \
|
||||
+ $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C mount_vboxvfs clean obj depend all; \
|
||||
+ if [ -f mount_vboxvfs ]; then \
|
||||
+ cp mount_vboxvfs/mount_vboxvfs .; \
|
||||
+ fi; \
|
||||
+ fi
|
||||
|
||||
|
||||
install:
|
||||
@@ -37,13 +45,19 @@ install:
|
||||
@if [ -d vboxvfs ]; then \
|
||||
$(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxvfs install; \
|
||||
fi
|
||||
+ @if [ -d mount_vboxvfs ]; then \
|
||||
+ $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C mount_vboxvfs install; \
|
||||
+ fi
|
||||
|
||||
clean:
|
||||
@$(MAKE) -C vboxguest clean
|
||||
@if [ -d vboxvfs ]; then \
|
||||
$(MAKE) -C vboxvfs clean; \
|
||||
fi
|
||||
- rm -f vboxguest.*o vboxvfs.*o
|
||||
+ @if [ -d mount_vboxvfs ]; then \
|
||||
+ $(MAKE) -C mount_vboxvfs clean; \
|
||||
+ fi
|
||||
+ rm -f vboxguest.*o vboxvfs.*o mount_vboxvfs
|
||||
|
||||
load:
|
||||
@/sbin/kldunload vboxvfs || true
|
|
@ -0,0 +1,31 @@
|
|||
--- src/VBox/Additions/freebsd/Makefile.kmk.orig 2021-01-07 15:34:22 UTC
|
||||
+++ src/VBox/Additions/freebsd/Makefile.kmk
|
||||
@@ -23,8 +23,9 @@ $(error "The FreeBSD guest additions installer can onl
|
||||
endif
|
||||
|
||||
# Include sub-makefiles.
|
||||
-#include $(PATH_SUB_CURRENT)/vboxvfs/Makefile.kmk
|
||||
-include $(PATH_SUB_CURRENT)/drm/Makefile.kmk
|
||||
+include $(PATH_SUB_CURRENT)/vboxvfs/Makefile.kmk
|
||||
+#include $(PATH_SUB_CURRENT)/drm/Makefile.kmk
|
||||
+include $(PATH_SUB_CURRENT)/mount_vboxvfs/Makefile.kmk
|
||||
|
||||
#
|
||||
# Globals
|
||||
@@ -66,11 +67,14 @@ VBOX_FBSD_ADD_STRIP_BIN = \
|
||||
vboxvideo_drv_14.so \
|
||||
vboxvideo_drv_15.so \
|
||||
vboxvideo_drv_16.so \
|
||||
- vboxvideo_drv_17.so
|
||||
+ vboxvideo_drv_17.so \
|
||||
+ $(if $(VBOX_WITH_PAM),pam_vbox.so,) \
|
||||
+ VBoxOGL.so \
|
||||
+ mount_vboxvfs
|
||||
|
||||
VBOX_FBSD_ADD_MODULES = \
|
||||
vboxguest \
|
||||
- vboxvideo_drm
|
||||
+ vboxvfs
|
||||
|
||||
#
|
||||
# All the bin files that go into the archives.
|
|
@ -0,0 +1,17 @@
|
|||
--- src/VBox/Additions/freebsd/drm/vboxvideo_drm.c.orig 2022-07-26 18:05:21 UTC
|
||||
+++ src/VBox/Additions/freebsd/drm/vboxvideo_drm.c
|
||||
@@ -154,10 +154,14 @@ static driver_t vboxvideo_driver = {
|
||||
sizeof(struct drm_device)
|
||||
};
|
||||
|
||||
+#if __FreeBSD_version >= 1400058
|
||||
+DRIVER_MODULE(vboxvideo, vgapci, vboxvideo_driver, 0, 0);
|
||||
+#else
|
||||
extern devclass_t drm_devclass;
|
||||
#if __FreeBSD_version >= 700010
|
||||
DRIVER_MODULE(vboxvideo, vgapci, vboxvideo_driver, drm_devclass, 0, 0);
|
||||
#else
|
||||
DRIVER_MODULE(vboxvideo, pci, vboxvideo_driver, drm_devclass, 0, 0);
|
||||
+#endif
|
||||
#endif
|
||||
MODULE_DEPEND(vboxvideo, drm, 1, 1, 1);
|
|
@ -0,0 +1,26 @@
|
|||
--- src/VBox/Additions/freebsd/mount_vboxvfs/Makefile.kmk.orig 2018-11-29 19:03:21 UTC
|
||||
+++ src/VBox/Additions/freebsd/mount_vboxvfs/Makefile.kmk
|
||||
@@ -0,0 +1,23 @@
|
||||
+# $Id: Makefile.kmk $
|
||||
+## @file
|
||||
+# Sub-Makefile for the FreeBSD Shared folder mount utility.
|
||||
+#
|
||||
+
|
||||
+SUB_DEPTH = ../../../../..
|
||||
+include $(KBUILD_PATH)/subheader.kmk
|
||||
+
|
||||
+ifneq ($(KBUILD_HOST),freebsd)
|
||||
+$(error "The FreeBSD guest additions can only be built on FreeBSD!")
|
||||
+endif
|
||||
+
|
||||
+MOUNT= $(VBOX_FREEBSD_SRC)/../sbin/mount
|
||||
+
|
||||
+CFLAGS+=-I$(MOUNT)
|
||||
+
|
||||
+PROGRAMS += mount_vboxvfs
|
||||
+mount_vboxvfs_TEMPLATE = NewVBoxGuestR3Exe
|
||||
+mount_vboxvfs_SOURCES = $(MOUNT)/getmntopts.c \
|
||||
+ mount_vboxvfs.c
|
||||
+
|
||||
+include $(FILE_KBUILD_SUB_FOOTER)
|
||||
+
|
|
@ -0,0 +1,56 @@
|
|||
--- 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
|
||||
@@ -0,0 +1,53 @@
|
||||
+.\"
|
||||
+.\" Copyright (c) 1992, 1993, 1994
|
||||
+.\" The Regents of the University of California. All rights reserved.
|
||||
+.\"
|
||||
+.\" Redistribution and use in source and binary forms, with or without
|
||||
+.\" modification, are permitted provided that the following conditions
|
||||
+.\" are met:
|
||||
+.\" 1. Redistributions of source code must retain the above copyright
|
||||
+.\" notice, this list of conditions and the following disclaimer.
|
||||
+.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
+.\" notice, this list of conditions and the following disclaimer in the
|
||||
+.\" documentation and/or other materials provided with the distribution.
|
||||
+.\" 4. Neither the name of the University nor the names of its contributors
|
||||
+.\" may be used to endorse or promote products derived from this software
|
||||
+.\" without specific prior written permission.
|
||||
+.\"
|
||||
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
+.\" SUCH DAMAGE.
|
||||
+.\"
|
||||
+.Dd August 5, 2013
|
||||
+.Dt MOUNT_VBOXFS 8
|
||||
+.Os
|
||||
+.Sh NAME
|
||||
+.Nm mount_vboxfs
|
||||
+.Nd "Mount the VirtualBox shared folder NAME from the host system to MOUNTPOINT"
|
||||
+.Sh SYNOPSIS
|
||||
+.Nm
|
||||
+.Op Fl o Ar options
|
||||
+.Ar NAME
|
||||
+.Ar MOUNTPOINT
|
||||
+.Sh DESCRIPTION
|
||||
+The
|
||||
+.Nm
|
||||
+Mount the VirtualBox shared folder NAME from the host system to MOUNTPOINT
|
||||
+.Pp
|
||||
+The options are as follows:
|
||||
+.Bl -tag -width indent
|
||||
+.Fl w
|
||||
+mount the shared folder writably (the default)
|
||||
+.Fl r
|
||||
+mount the shared folder read-only
|
||||
+.Fl o
|
||||
+OPTION[,OPTION...] use the mount options specified
|
||||
+.El
|
|
@ -0,0 +1,171 @@
|
|||
--- 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
|
||||
@@ -0,0 +1,168 @@
|
||||
+/*
|
||||
+* Copyright (c) 1992, 1993, 1994
|
||||
+* The Regents of the University of California. All rights reserved.
|
||||
+*
|
||||
+* Redistribution and use in source and binary forms, with or without
|
||||
+* modification, are permitted provided that the following conditions
|
||||
+* are met:
|
||||
+* 1. Redistributions of source code must retain the above copyright
|
||||
+* notice, this list of conditions and the following disclaimer.
|
||||
+* 2. Redistributions in binary form must reproduce the above copyright
|
||||
+* notice, this list of conditions and the following disclaimer in the
|
||||
+* documentation and/or other materials provided with the distribution.
|
||||
+* 4. Neither the name of the University nor the names of its contributors
|
||||
+* may be used to endorse or promote products derived from this software
|
||||
+* without specific prior written permission.
|
||||
+*
|
||||
+* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
+* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
+* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
+* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
+* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
+* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
+* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
+* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
+* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
+* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
+* SUCH DAMAGE.
|
||||
+*/
|
||||
+
|
||||
+#include <sys/cdio.h>
|
||||
+#include <sys/stat.h>
|
||||
+#include <sys/file.h>
|
||||
+#include <sys/iconv.h>
|
||||
+#include <sys/param.h>
|
||||
+#include <sys/linker.h>
|
||||
+#include <sys/module.h>
|
||||
+#include <sys/mount.h>
|
||||
+#include <sys/uio.h>
|
||||
+
|
||||
+#include <err.h>
|
||||
+#include <errno.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <stdio.h>
|
||||
+#include <string.h>
|
||||
+#include <sysexits.h>
|
||||
+#include <unistd.h>
|
||||
+
|
||||
+#include "mntopts.h"
|
||||
+
|
||||
+#define MAX_HOST_NAME 256
|
||||
+static char mount_point[MAXPATHLEN + 1];
|
||||
+static char vboxfs_vfsname[] = "vboxvfs";
|
||||
+static struct mntopt mopts[] = {
|
||||
+ MOPT_STDOPTS,
|
||||
+ MOPT_END
|
||||
+};
|
||||
+
|
||||
+static void usage(void) __dead2;
|
||||
+
|
||||
+static void
|
||||
+usage(void)
|
||||
+{
|
||||
+ fprintf(stderr,
|
||||
+ "Usage: [OPTIONS] NAME MOUNTPOINT\n"
|
||||
+ "Mount the VirtualBox shared folder NAME to MOUNTPOINT.\n"
|
||||
+ "\nOptions:\n"
|
||||
+ " -w mount the shared folder writable \n"
|
||||
+ " -r mount the shared folder read-only (the default)\n");
|
||||
+ exit(1);
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+main(int argc, char *argv[])
|
||||
+{
|
||||
+ struct iovec *iov;
|
||||
+ struct stat st;
|
||||
+ char *host_name;
|
||||
+ char errmsg[255];
|
||||
+ uid_t uid;
|
||||
+ gid_t gid;
|
||||
+ mode_t dir_mode, file_mode;
|
||||
+ int iovlen;
|
||||
+ int ronly = 0;
|
||||
+ int error, ch;
|
||||
+ int mntflags = 0;
|
||||
+
|
||||
+ iov = NULL;
|
||||
+ iovlen = 0;
|
||||
+ errmsg[0] = '\0';
|
||||
+ uid = (uid_t)-1;
|
||||
+ gid = (gid_t)-1;
|
||||
+ file_mode = 0;
|
||||
+ dir_mode = 0;
|
||||
+
|
||||
+ while ((ch = getopt(argc, argv, "rwo:h")) != -1)
|
||||
+ switch(ch) {
|
||||
+ default:
|
||||
+ fprintf(stderr, "unknown option `%c:%#x'\n", ch, ch);
|
||||
+ return (1);
|
||||
+
|
||||
+ case '?':
|
||||
+ case 'h':
|
||||
+ usage();
|
||||
+ case 'r':
|
||||
+ ronly = 1;
|
||||
+ break;
|
||||
+ case 'w':
|
||||
+ ronly = 0;
|
||||
+ break;
|
||||
+ case 'o':
|
||||
+ getmntopts(optarg, mopts, &mntflags, 0);
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ if (argc - optind < 2)
|
||||
+ usage();
|
||||
+
|
||||
+ host_name = argv[optind];
|
||||
+ realpath(argv[optind+1], mount_point);
|
||||
+
|
||||
+ if (stat(mount_point, &st) == -1)
|
||||
+ err(EX_OSERR, "could not find mount point %s", mount_point);
|
||||
+
|
||||
+ if (!S_ISDIR(st.st_mode)) {
|
||||
+ errno = ENOTDIR;
|
||||
+ err(EX_OSERR, "can't mount on %s", mount_point);
|
||||
+ }
|
||||
+
|
||||
+ if (strlen(host_name) > MAX_HOST_NAME - 1)
|
||||
+ err(EX_OSERR, "host name is too big %s", host_name);
|
||||
+
|
||||
+ if (ronly == 0)
|
||||
+ mntflags |= MNT_ASYNC;
|
||||
+ if (uid == (uid_t)-1)
|
||||
+ uid = st.st_uid;
|
||||
+ if (gid == (gid_t)-1)
|
||||
+ gid = st.st_gid;
|
||||
+ if (file_mode == 0)
|
||||
+ file_mode = st.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO);
|
||||
+ if (dir_mode == 0) {
|
||||
+ dir_mode = file_mode;
|
||||
+ if (dir_mode & S_IRUSR)
|
||||
+ dir_mode |= S_IXUSR;
|
||||
+ if (dir_mode & S_IRGRP)
|
||||
+ dir_mode |= S_IXGRP;
|
||||
+ if (dir_mode & S_IROTH)
|
||||
+ dir_mode |= S_IXOTH;
|
||||
+ }
|
||||
+
|
||||
+ build_iovec(&iov, &iovlen, "fstype", vboxfs_vfsname, (size_t)-1);
|
||||
+ build_iovec(&iov, &iovlen, "fspath", mount_point, (size_t)-1);
|
||||
+ build_iovec(&iov, &iovlen, "from", host_name, (size_t)-1);
|
||||
+ build_iovec_argf(&iov, &iovlen, "uid", "%d", uid);
|
||||
+ build_iovec_argf(&iov, &iovlen, "gid", "%d", gid);
|
||||
+ build_iovec_argf(&iov, &iovlen, "file_mode", "%o", file_mode);
|
||||
+ build_iovec_argf(&iov, &iovlen, "dir_mode", "%o", dir_mode);
|
||||
+ build_iovec(&iov, &iovlen, "errmsg", errmsg, sizeof(errmsg));
|
||||
+
|
||||
+ error = nmount(iov, iovlen, mntflags);
|
||||
+ if (error == -1) {
|
||||
+ if (errmsg[0] != '\0')
|
||||
+ err(1, "%s: error: %s", mount_point, errmsg);
|
||||
+ else
|
||||
+ err(1, "%s: error %d", mount_point, error);
|
||||
+ }
|
||||
+
|
||||
+ return (0);
|
||||
+}
|
|
@ -0,0 +1,50 @@
|
|||
--- src/VBox/Additions/freebsd/vboxvfs/Makefile.kmk.orig 2021-01-07 15:34:22 UTC
|
||||
+++ src/VBox/Additions/freebsd/vboxvfs/Makefile.kmk
|
||||
@@ -33,32 +33,37 @@ vboxvfs_INCS = \
|
||||
$(vboxvfs_0_OUTDIR)
|
||||
vboxvfs_SOURCES = \
|
||||
vboxvfs_vfsops.c \
|
||||
- vboxvfs_vnops.c
|
||||
+ bcmp.c \
|
||||
+ vboxvfs_vnops.c \
|
||||
+ vboxvfs_prov.c
|
||||
vboxvfs_LIBS = \
|
||||
$(VBOX_LIB_VBGL_R0) \
|
||||
$(VBOX_LIB_IPRT_GUEST_R0)
|
||||
vboxvfs_DEPS = \
|
||||
- $$(vboxvfs_0_OUTDIR)/vnode_if.h \
|
||||
- $$(vboxvfs_0_OUTDIR)/vnode_if_newproto.h \
|
||||
- $$(vboxvfs_0_OUTDIR)/vnode_if_typedef.h
|
||||
+ $(vboxvfs_0_OUTDIR)/vnode_if.h \
|
||||
+ $(vboxvfs_0_OUTDIR)/vnode_if_newproto.h \
|
||||
+ $(vboxvfs_0_OUTDIR)/vnode_if_typedef.h
|
||||
vboxvfs_CLEAN += $(vboxvfs_DEPS)
|
||||
|
||||
VBOX_AWK := /usr/bin/awk
|
||||
|
||||
-$$(vboxvfs_0_OUTDIR)/vnode_if.h: $(VBOX_FREEBSD_SRC)/kern/vnode_if.src
|
||||
+$$(vboxvfs_0_OUTDIR):
|
||||
+ $(QUIET)$(MKDIR) -p $(vboxvfs_0_OUTDIR)
|
||||
+
|
||||
+$$(vboxvfs_0_OUTDIR)/vnode_if.h: $$(vboxvfs_0_OUTDIR) $(VBOX_FREEBSD_SRC)/kern/vnode_if.src
|
||||
$(call MSG_TOOL,awk,VBoxGuest,$<,$@)
|
||||
$(QUIET)$(VBOX_AWK) -f $(VBOX_FREEBSD_SRC)/tools/vnode_if.awk $(VBOX_FREEBSD_SRC)/kern/vnode_if.src -h
|
||||
- $(QUIET)$(MV) $(vboxvfs_0_OUTDIR)/vnode_if.h $(vboxvfs_0_OUTDIR)/vnode_if.h
|
||||
+ $(QUIET)$(MV) vnode_if.h $(vboxvfs_0_OUTDIR)/vnode_if.h
|
||||
|
||||
-$$(vboxvfs_0_OUTDIR)/vnode_if_newproto.h: $(VBOX_FREEBSD_SRC)/kern/vnode_if.src
|
||||
+$$(vboxvfs_0_OUTDIR)/vnode_if_newproto.h: $$(vboxvfs_0_OUTDIR) $(VBOX_FREEBSD_SRC)/kern/vnode_if.src
|
||||
$(call MSG_TOOL,awk,VBoxGuest,$<,$@)
|
||||
$(QUIET)$(VBOX_AWK) -f $(VBOX_FREEBSD_SRC)/tools/vnode_if.awk $(VBOX_FREEBSD_SRC)/kern/vnode_if.src -p
|
||||
- $(QUIET)$(MV) $(vboxvfs_0_OUTDIR)/vnode_if_newproto.h $(vboxvfs_0_OUTDIR)/vnode_if_newproto.h
|
||||
+ $(QUIET)$(MV) vnode_if_newproto.h $(vboxvfs_0_OUTDIR)/vnode_if_newproto.h
|
||||
|
||||
-$$(vboxvfs_0_OUTDIR)/vnode_if_typedef.h: $(VBOX_FREEBSD_SRC)/kern/vnode_if.src
|
||||
+$$(vboxvfs_0_OUTDIR)/vnode_if_typedef.h: $$(vboxvfs_0_OUTDIR) $(VBOX_FREEBSD_SRC)/kern/vnode_if.src
|
||||
$(call MSG_TOOL,awk,VBoxGuest,$<,$@)
|
||||
$(QUIET)$(VBOX_AWK) -f $(VBOX_FREEBSD_SRC)/tools/vnode_if.awk $(VBOX_FREEBSD_SRC)/kern/vnode_if.src -q
|
||||
- $(QUIET)$(MV) $(vboxvfs_0_OUTDIR)/vnode_if_typedef.h $(vboxvfs_0_OUTDIR)/vnode_if_typedef.h
|
||||
+ $(QUIET)$(MV) vnode_if_typedef.h $(vboxvfs_0_OUTDIR)/vnode_if_typedef.h
|
||||
|
||||
include $(FILE_KBUILD_SUB_FOOTER)
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
--- src/VBox/Additions/freebsd/vboxvfs/bcmp.c.orig 2021-02-21 19:09:22 UTC
|
||||
+++ src/VBox/Additions/freebsd/vboxvfs/bcmp.c
|
||||
@@ -0,0 +1,9 @@
|
||||
+#include <sys/types.h>
|
||||
+
|
||||
+int bcmp(const void *b1, const void *b2, size_t len);
|
||||
+
|
||||
+int
|
||||
+bcmp(const void *b1, const void *b2, size_t len)
|
||||
+{
|
||||
+ return __builtin_memcmp((b1), (b2), (len));
|
||||
+}
|
|
@ -0,0 +1,428 @@
|
|||
--- src/VBox/Additions/freebsd/vboxvfs/vboxvfs.h.orig 2021-01-07 15:34:22 UTC
|
||||
+++ src/VBox/Additions/freebsd/vboxvfs/vboxvfs.h
|
||||
@@ -1,8 +1,3 @@
|
||||
-/* $Id: vboxvfs.h $ */
|
||||
-/** @file
|
||||
- * Description.
|
||||
- */
|
||||
-
|
||||
/*
|
||||
* Copyright (C) 2010-2020 Oracle Corporation
|
||||
*
|
||||
@@ -24,72 +19,378 @@
|
||||
#define VBOXVFS_VFSNAME "vboxvfs"
|
||||
#define VBOXVFS_VERSION 1
|
||||
|
||||
-#define MAX_HOST_NAME 256
|
||||
-#define MAX_NLS_NAME 32
|
||||
+#define MAX_HOST_NAME 256
|
||||
+#define MAX_NLS_NAME 32
|
||||
+//#define MODEMASK 07777 /* mode bits plus permission bits */
|
||||
+/** Helper macros */
|
||||
+#define VFSTOVBOXFS(mp) ((struct vboxfs_mnt *)((mp)->mnt_data))
|
||||
+#define VP_TO_VBOXFS_NODE(vp) ((struct vboxfs_node *)(vp)->v_data)
|
||||
+#define VBOXTOV(np) ((struct vnode *)(np)->n_vnode)
|
||||
|
||||
-struct vboxvfs_mount_info {
|
||||
- char name[MAX_HOST_NAME];
|
||||
- char nls_name[MAX_NLS_NAME];
|
||||
- int uid;
|
||||
- int gid;
|
||||
- int ttl;
|
||||
-};
|
||||
+#define ROOTDIR_INO 1
|
||||
+#define THEFILE_INO 2
|
||||
+#define THEFILE_NAME "thefile"
|
||||
|
||||
+#define VBOXFS_NODE_LOCK(node) mtx_lock(&(node)->sf_interlock)
|
||||
+#define VBOXFS_NODE_UNLOCK(node) mtx_unlock(&(node)->sf_interlock)
|
||||
+#define VBOXFS_NODE_MTX(node) (&(node)->sf_interlock)
|
||||
+#define VBOXFS_NODE_ASSERT_LOCKED(node) mtx_assert(VBOXFS_NODE_MTX(node), \
|
||||
+ MA_OWNED)
|
||||
+
|
||||
+#ifdef INVARIANTS
|
||||
+#define VBOXFS_ASSERT_LOCKED(node) do { \
|
||||
+ MPASS(node != NULL); \
|
||||
+ MPASS(node->sf_vnode != NULL); \
|
||||
+ if (!VOP_ISLOCKED(node->sf_vnode) && \
|
||||
+ !mtx_owned(VBOXFS_NODE_MTX(node))) \
|
||||
+ panic("vboxfs: node is not locked: %p", node); \
|
||||
+ } while (0)
|
||||
+#define VBOXFS_ASSERT_ELOCKED(node) do { \
|
||||
+ MPASS((node) != NULL); \
|
||||
+ MPASS((node)->sf_vnode != NULL); \
|
||||
+ mtx_assert(VBOXFS_NODE_MTX(node), MA_OWNED); \
|
||||
+ ASSERT_VOP_LOCKED((node)->sf_vnode, "vboxfs"); \
|
||||
+ } while (0)
|
||||
+#else
|
||||
+#define VBOXFS_ASSERT_LOCKED(node) (void)0
|
||||
+#define VBOXFS_ASSERT_ELOCKED(node) (void)0
|
||||
+#endif
|
||||
+
|
||||
+#define VBOXFS_VNODE_ALLOCATING 1
|
||||
+#define VBOXFS_VNODE_WANT 2
|
||||
+#define VBOXFS_VNODE_DOOMED 4
|
||||
+#define VBOXFS_VNODE_WRECLAIM 8
|
||||
+
|
||||
+MALLOC_DECLARE(M_VBOXVFS);
|
||||
+
|
||||
#ifdef _KERNEL
|
||||
+#ifndef FREEBSD_STYLE
|
||||
+#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/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 <VBox/VBoxGuestLibSharedFolders.h>
|
||||
+#else
|
||||
+
|
||||
+#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"
|
||||
+
|
||||
+#endif /* !FREEBSD_STYLE */
|
||||
+
|
||||
#include <sys/mount.h>
|
||||
#include <sys/vnode.h>
|
||||
+#include <sys/_timespec.h>
|
||||
|
||||
-struct vboxvfsmount {
|
||||
- uid_t uid;
|
||||
- gid_t gid;
|
||||
- mode_t file_mode;
|
||||
- mode_t dir_mode;
|
||||
- struct mount *mp;
|
||||
- struct ucred *owner;
|
||||
- u_int flags;
|
||||
- long nextino;
|
||||
- int caseopt;
|
||||
- int didrele;
|
||||
+#include <VBox/VBoxGuestLibSharedFolders.h>
|
||||
+
|
||||
+#if __FreeBSD_version >= 1400093
|
||||
+typedef __enum_uint8(vtype) enum_vtype_t;
|
||||
+#else
|
||||
+typedef enum vtype enum_vtype_t;
|
||||
+#endif
|
||||
+
|
||||
+#define VBOXVFS_DEBUG(lvl, ...) do { \
|
||||
+ if (vboxvfs_debug >= (lvl)) { \
|
||||
+ printf("VBOXVFS[%u]: ", lvl); \
|
||||
+ printf(__VA_ARGS__); \
|
||||
+ printf("\n"); \
|
||||
+ } \
|
||||
+} while (0)
|
||||
+
|
||||
+/*
|
||||
+ * representation of an active mount point
|
||||
+ */
|
||||
+struct sfp_mount {
|
||||
+ VBGLSFMAP map;
|
||||
};
|
||||
|
||||
-/* structs - stolen from the linux shared module code */
|
||||
+/*
|
||||
+ * Mount / Unmount a shared folder.
|
||||
+ *
|
||||
+ * sfprov_mount() takes as input the connection pointer and the name of
|
||||
+ * the shared folder. On success, it returns zero and supplies an
|
||||
+ * sfp_mount_t handle. On failure it returns any relevant errno value.
|
||||
+ *
|
||||
+ * sfprov_unmount() unmounts the mounted file system. It returns 0 on
|
||||
+ * success and any relevant errno on failure.
|
||||
+ */
|
||||
+typedef struct sfp_mount sfp_mount_t;
|
||||
+
|
||||
+struct sfp_file {
|
||||
+ SHFLHANDLE handle;
|
||||
+ VBGLSFMAP map; /* need this again for the close operation */
|
||||
+};
|
||||
+
|
||||
+typedef struct sfp_file sfp_file_t;
|
||||
+
|
||||
+/*
|
||||
+ * File operations: open/close/read/write/etc.
|
||||
+ *
|
||||
+ * open/create can return any relevant errno, however ENOENT
|
||||
+ * generally means that the host file didn't exist.
|
||||
+ */
|
||||
+typedef struct sffs_stat {
|
||||
+ mode_t sf_mode;
|
||||
+ off_t sf_size;
|
||||
+ off_t sf_alloc;
|
||||
+ struct timespec sf_atime;
|
||||
+ struct timespec sf_mtime;
|
||||
+ struct timespec sf_ctime;
|
||||
+} sffs_stat_t;
|
||||
+
|
||||
+/*
|
||||
+ * Read directory entries.
|
||||
+ */
|
||||
+/*
|
||||
+ * a singly linked list of buffers, each containing an array of stat's+dirent's.
|
||||
+ * sf_len is length of the sf_entries array, in bytes.
|
||||
+ */
|
||||
+typedef struct sffs_dirents {
|
||||
+ struct sffs_dirents *sf_next;
|
||||
+ long long sf_len;
|
||||
+ struct sffs_dirent {
|
||||
+ sffs_stat_t sf_stat;
|
||||
+ struct dirent sf_entry; /* this is variable length */
|
||||
+ off_t sf_off;
|
||||
+ } sf_entries[1];
|
||||
+} sffs_dirents_t;
|
||||
+
|
||||
+/*
|
||||
+ * Shared Folders filesystem per-mount data structure.
|
||||
+ */
|
||||
+struct vboxfs_mnt {
|
||||
+ struct mount *sf_vfsp; /* filesystem's vfs struct */
|
||||
+ sfp_mount_t *sf_handle; /* guest-host communication handle */
|
||||
+ uid_t sf_uid; /* owner of all shared folders */
|
||||
+ gid_t sf_gid; /* group of all shared folders */
|
||||
+ mode_t sf_dmode; /* mode of all directories */
|
||||
+ mode_t sf_fmode; /* mode of all files */
|
||||
+ mode_t sf_dmask; /* mask of all directories */
|
||||
+ mode_t sf_fmask; /* mask of all files */
|
||||
+ int sf_stat_ttl; /* ttl for stat caches (in ms) */
|
||||
+ int sf_fsync; /* whether to honor fsync or not */
|
||||
+ uint64_t sf_ino; /* per FS ino generator */
|
||||
+ uma_zone_t sf_node_pool;
|
||||
+ struct vboxfs_node *sf_root;
|
||||
+};
|
||||
+
|
||||
+/*
|
||||
+ * vboxfs_node is the file system dependent vnode data for vboxfs.
|
||||
+ * vboxfs_node's also track all files ever accessed, both open and closed.
|
||||
+ * It duplicates some of the information in vnode, since it holds
|
||||
+ * information for files that may have been completely closed.
|
||||
+ *
|
||||
+ */
|
||||
+struct vboxfs_node {
|
||||
+ struct vboxfs_mnt *vboxfsmp; /* containing mounted file system */
|
||||
+ char *sf_path; /* full pathname to file or dir */
|
||||
+ uint64_t sf_ino; /* assigned unique ID number */
|
||||
+ struct vnode *sf_vnode; /* vnode if active */
|
||||
+ sfp_file_t *sf_file; /* non NULL if open */
|
||||
+ struct vboxfs_node *sf_parent; /* parent sfnode of this one */
|
||||
+ uint32_t sf_opencnt; /* sf_file reference counter */
|
||||
+ uint16_t sf_children; /* number of children sfnodes */
|
||||
+ uint8_t sf_type; /* VDIR or VREG */
|
||||
+ uint8_t sf_vpstate; /* XXX: ADD COMMENT */
|
||||
+ uint8_t sf_is_stale; /* this is stale and should be purged */
|
||||
+ sffs_stat_t sf_stat; /* cached file attrs for this node */
|
||||
+ uint64_t sf_stat_time; /* last-modified time of sf_stat */
|
||||
+ sffs_dirents_t *sf_dir_list; /* list of entries for this directory */
|
||||
+
|
||||
+ /* interlock to protect sf_vpstate, sf_file and sf_opencnt */
|
||||
+ struct mtx sf_interlock;
|
||||
+};
|
||||
+
|
||||
+struct vboxfs_mount_info {
|
||||
+ char name[MAX_HOST_NAME]; /* share name */
|
||||
+ char nls_name[MAX_NLS_NAME];/* name of an I/O charset */
|
||||
+ int uid; /* user ID for all entries, default 0=root */
|
||||
+ int gid; /* group ID for all entries, default 0=root */
|
||||
+ int ttl; /* time to live */
|
||||
+ int dmode; /* mode for directories if != 0xffffffff */
|
||||
+ int fmode; /* mode for regular files if != 0xffffffff */
|
||||
+ int dmask; /* umask applied to directories */
|
||||
+ int fmask; /* umask applied to regular files */
|
||||
+};
|
||||
+
|
||||
struct sf_glob_info {
|
||||
- VBGLSFMAP map;
|
||||
-/* struct nls_table *nls;*/
|
||||
- int ttl;
|
||||
- int uid;
|
||||
- int gid;
|
||||
- struct vnode *vnode_root;
|
||||
+ VBGLSFMAP map;
|
||||
+/* struct nls_table *nls;*/
|
||||
+ int ttl;
|
||||
+ int uid;
|
||||
+ int gid;
|
||||
+ struct vnode *vnode_root;
|
||||
};
|
||||
|
||||
+/** Per-file system mount instance data. */
|
||||
+typedef struct vboxfs_globinfo
|
||||
+{
|
||||
+ VBGLSFMAP Map;
|
||||
+ int Ttl;
|
||||
+ int Uid;
|
||||
+ int Gid;
|
||||
+ struct mount *pVFS;
|
||||
+ struct vboxfs_node *pVNodeRoot;
|
||||
+} vboxfs_globinfo_t;
|
||||
+
|
||||
struct sf_inode_info {
|
||||
- SHFLSTRING *path;
|
||||
- int force_restat;
|
||||
+ SHFLSTRING *path;
|
||||
+ int force_restat;
|
||||
};
|
||||
|
||||
#if 0
|
||||
struct sf_dir_info {
|
||||
- struct list_head info_list;
|
||||
+ struct list_head info_list;
|
||||
};
|
||||
#endif
|
||||
|
||||
struct sf_dir_buf {
|
||||
- size_t nb_entries;
|
||||
- size_t free_bytes;
|
||||
- size_t used_bytes;
|
||||
- void *buf;
|
||||
+ size_t nb_entries;
|
||||
+ size_t free_bytes;
|
||||
+ size_t used_bytes;
|
||||
+ void *buf;
|
||||
#if 0
|
||||
- struct list_head head;
|
||||
+ struct list_head head;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct sf_reg_info {
|
||||
- SHFLHANDLE handle;
|
||||
+ SHFLHANDLE handle;
|
||||
};
|
||||
|
||||
+int vboxfs_alloc_vp(struct mount *, struct vboxfs_node *, int,
|
||||
+ struct vnode **);
|
||||
+void vboxfs_free_vp(struct vnode *);
|
||||
+
|
||||
+int vboxfs_alloc_node(struct mount *, struct vboxfs_mnt *, const char*,
|
||||
+ enum_vtype_t, uid_t, gid_t, mode_t, struct vboxfs_node *,
|
||||
+ struct vboxfs_node **);
|
||||
+void vboxfs_free_node(struct vboxfs_mnt *, struct vboxfs_node *);
|
||||
+
|
||||
+/*
|
||||
+ * These are the provider interfaces used by sffs to access the underlying
|
||||
+ * shared file system.
|
||||
+ */
|
||||
+#define SFPROV_VERSION 1
|
||||
+
|
||||
+/*
|
||||
+ * Initialization and termination.
|
||||
+ * sfprov_connect() is called once before any other interfaces and returns
|
||||
+ * a handle used in further calls. The argument should be SFPROV_VERSION
|
||||
+ * from above. On failure it returns a NULL pointer.
|
||||
+ *
|
||||
+ * sfprov_disconnect() must only be called after all sf file systems have been
|
||||
+ * unmounted.
|
||||
+ */
|
||||
+typedef struct sfp_connection sfp_connection_t;
|
||||
+
|
||||
+extern sfp_connection_t *sfprov_connect(int);
|
||||
+extern void sfprov_disconnect(void);
|
||||
+
|
||||
+extern int sfprov_mount(char *, sfp_mount_t **);
|
||||
+extern int sfprov_unmount(sfp_mount_t *);
|
||||
+
|
||||
+/*
|
||||
+ * query information about a mounted file system
|
||||
+ */
|
||||
+typedef struct sffs_fsinfo {
|
||||
+ uint64_t blksize;
|
||||
+ uint64_t blksused;
|
||||
+ uint64_t blksavail;
|
||||
+ uint32_t maxnamesize;
|
||||
+ uint32_t readonly;
|
||||
+ uint32_t serial;
|
||||
+} sffs_fsinfo_t;
|
||||
+
|
||||
+extern int sfprov_get_fsinfo(sfp_mount_t *, sffs_fsinfo_t *);
|
||||
+
|
||||
+extern int sfprov_create(sfp_mount_t *, char *path, mode_t mode,
|
||||
+ sffs_stat_t *stat);
|
||||
+extern int sfprov_open(sfp_mount_t *, char *path, sfp_file_t **fp);
|
||||
+extern int sfprov_close(sfp_file_t *fp);
|
||||
+extern int sfprov_read(sfp_file_t *, char * buffer, uint64_t offset,
|
||||
+ uint32_t *numbytes, int buflocked);
|
||||
+extern int sfprov_write(sfp_file_t *, char * buffer, uint64_t offset,
|
||||
+ uint32_t *numbytes, int buflocked);
|
||||
+extern int sfprov_fsync(sfp_file_t *fp);
|
||||
+
|
||||
+
|
||||
+/*
|
||||
+ * get/set information about a file (or directory) using pathname
|
||||
+ */
|
||||
+extern int sfprov_get_mode(sfp_mount_t *, char *, mode_t *);
|
||||
+extern int sfprov_get_size(sfp_mount_t *, char *, uint64_t *);
|
||||
+extern int sfprov_get_atime(sfp_mount_t *, char *, struct timespec *);
|
||||
+extern int sfprov_get_mtime(sfp_mount_t *, char *, struct timespec *);
|
||||
+extern int sfprov_get_ctime(sfp_mount_t *, char *, struct timespec *);
|
||||
+extern int sfprov_get_attr(sfp_mount_t *, char *, sffs_stat_t *);
|
||||
+extern int sfprov_set_attr(sfp_mount_t *, char *, mode_t,
|
||||
+ struct timespec, struct timespec, struct timespec);
|
||||
+extern int sfprov_set_size(sfp_mount_t *, char *, uint64_t);
|
||||
+
|
||||
+
|
||||
+/*
|
||||
+ * File/Directory operations
|
||||
+ */
|
||||
+extern int sfprov_trunc(sfp_mount_t *, char *);
|
||||
+extern int sfprov_remove(sfp_mount_t *, char *path, u_int is_link);
|
||||
+extern int sfprov_mkdir(sfp_mount_t *, char *path, mode_t mode,
|
||||
+ sffs_stat_t *stat);
|
||||
+extern int sfprov_rmdir(sfp_mount_t *, char *path);
|
||||
+extern int sfprov_rename(sfp_mount_t *, char *from, char *to, u_int is_dir);
|
||||
+
|
||||
+
|
||||
+/*
|
||||
+ * Symbolic link operations
|
||||
+ */
|
||||
+extern int sfprov_set_show_symlinks(void);
|
||||
+extern int sfprov_readlink(sfp_mount_t *, char *path, char *target,
|
||||
+ size_t tgt_size);
|
||||
+extern int sfprov_symlink(sfp_mount_t *, char *linkname, char *target,
|
||||
+ sffs_stat_t *stat);
|
||||
+
|
||||
+#define SFFS_DIRENTS_SIZE 8192
|
||||
+#define SFFS_DIRENTS_OFF (offsetof(sffs_dirents_t, sf_entries[0]))
|
||||
+
|
||||
+extern int sfprov_readdir(sfp_mount_t *mnt, char *path,
|
||||
+ sffs_dirents_t **dirents);
|
||||
+
|
||||
#endif /* KERNEL */
|
||||
|
||||
#endif /* !GA_INCLUDED_SRC_freebsd_vboxvfs_vboxvfs_h */
|
||||
-
|
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,645 @@
|
|||
--- src/VBox/Additions/freebsd/vboxvfs/vboxvfs_vfsops.c.orig 2021-04-28 16:24:46 UTC
|
||||
+++ src/VBox/Additions/freebsd/vboxvfs/vboxvfs_vfsops.c
|
||||
@@ -1,8 +1,3 @@
|
||||
-/* $Id: vboxvfs_vfsops.c $ */
|
||||
-/** @file
|
||||
- * Description.
|
||||
- */
|
||||
-
|
||||
/*
|
||||
* Copyright (C) 2008-2020 Oracle Corporation
|
||||
*
|
||||
@@ -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.
|
||||
*/
|
||||
-
|
||||
-#include "vboxvfs.h"
|
||||
+#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/bio.h>
|
||||
#include <sys/buf.h>
|
||||
+#include <sys/conf.h>
|
||||
+#include <sys/dirent.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/vnode.h>
|
||||
#include <sys/mount.h>
|
||||
+#include <sys/namei.h>
|
||||
+#include <sys/fcntl.h>
|
||||
+#include <sys/priv.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/module.h>
|
||||
+#include <sys/sbuf.h>
|
||||
|
||||
-#include <iprt/mem.h>
|
||||
+#include <geom/geom.h>
|
||||
+#include <geom/geom_vfs.h>
|
||||
-
|
||||
+#include <vm/uma.h>
|
||||
+#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, "");
|
||||
+static sfp_connection_t *sfprov = NULL;
|
||||
|
||||
-/* global connection to the host service. */
|
||||
-static VBGLSFCLIENT g_vboxSFClient;
|
||||
+static int vboxfs_version = VBOXVFS_VERSION;
|
||||
+u_int vboxvfs_debug = 1;
|
||||
|
||||
-static vfs_init_t vboxvfs_init;
|
||||
-static vfs_uninit_t vboxvfs_uninit;
|
||||
-static vfs_cmount_t vboxvfs_cmount;
|
||||
-static vfs_mount_t vboxvfs_mount;
|
||||
-static vfs_root_t vboxvfs_root;
|
||||
-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,
|
||||
- .vfs_mount = vboxvfs_mount,
|
||||
- .vfs_quotactl = vboxvfs_quotactl,
|
||||
- .vfs_root = vboxvfs_root,
|
||||
- .vfs_statfs = vboxvfs_statfs,
|
||||
- .vfs_sync = vfs_stdsync,
|
||||
- .vfs_uninit = vboxvfs_uninit,
|
||||
- .vfs_unmount = vboxvfs_unmount,
|
||||
+static vfs_init_t vboxfs_init;
|
||||
+static vfs_uninit_t vboxfs_uninit;
|
||||
+static vfs_cmount_t vboxfs_cmount;
|
||||
+static vfs_mount_t vboxfs_mount;
|
||||
+static vfs_root_t vboxfs_root;
|
||||
+static vfs_quotactl_t vboxfs_quotactl;
|
||||
+static vfs_statfs_t vboxfs_statfs;
|
||||
+static vfs_unmount_t vboxfs_unmount;
|
||||
+
|
||||
+static struct vfsops vboxfs_vfsops = {
|
||||
+ .vfs_init = vboxfs_init,
|
||||
+ .vfs_cmount = vboxfs_cmount,
|
||||
+ .vfs_mount = vboxfs_mount,
|
||||
+ .vfs_quotactl = vboxfs_quotactl,
|
||||
+ .vfs_root = vboxfs_root,
|
||||
+ .vfs_statfs = vboxfs_statfs,
|
||||
+ .vfs_sync = vfs_stdsync,
|
||||
+ .vfs_uninit = vboxfs_uninit,
|
||||
+ .vfs_unmount = vboxfs_unmount
|
||||
};
|
||||
|
||||
|
||||
-VFS_SET(vboxvfs_vfsops, vboxvfs, VFCF_NETWORK);
|
||||
+VFS_SET(vboxfs_vfsops, vboxvfs, VFCF_NETWORK);
|
||||
MODULE_DEPEND(vboxvfs, vboxguest, 1, 1, 1);
|
||||
|
||||
-static int vboxvfs_cmount(struct mntarg *ma, void * data, int flags, struct thread *td)
|
||||
+/*
|
||||
+ * Allocates a new node of type 'type' inside the 'tmp' mount point, with
|
||||
+ * its owner set to 'uid', its group to 'gid' and its mode set to 'mode',
|
||||
+ * using the credentials of the process 'p'.
|
||||
+ *
|
||||
+ * If the node type is set to 'VDIR', then the parent parameter must point
|
||||
+ * to the parent directory of the node being created. It may only be NULL
|
||||
+ * while allocating the root node.
|
||||
+ *
|
||||
+ * If the node type is set to 'VBLK' or 'VCHR', then the rdev parameter
|
||||
+ * specifies the device the node represents.
|
||||
+ *
|
||||
+ * If the node type is set to 'VLNK', then the parameter target specifies
|
||||
+ * the file name of the target file for the symbolic link that is being
|
||||
+ * created.
|
||||
+ *
|
||||
+ * Note that new nodes are retrieved from the available list if it has
|
||||
+ * items or, if it is empty, from the node pool as long as there is enough
|
||||
+ * space to create them.
|
||||
+ *
|
||||
+ * Returns zero on success or an appropriate error code on failure.
|
||||
+ */
|
||||
+int
|
||||
+vboxfs_alloc_node(struct mount *mp, struct vboxfs_mnt *vsfmp, const char *fullpath,
|
||||
+ enum_vtype_t type, uid_t uid, gid_t gid, mode_t mode, struct vboxfs_node *parent,
|
||||
+ struct vboxfs_node **node)
|
||||
{
|
||||
- struct vboxvfs_mount_info args;
|
||||
- int rc = 0;
|
||||
+ struct vboxfs_node *nnode;
|
||||
|
||||
- printf("%s: Enter\n", __FUNCTION__);
|
||||
+ if ((mp->mnt_kern_flag & MNTK_UNMOUNT) != 0) {
|
||||
+ /*
|
||||
+ * When a new tmpfs node is created for fully
|
||||
+ * constructed mount point, there must be a parent
|
||||
+ * node, which vnode is locked exclusively. As
|
||||
+ * consequence, if the unmount is executing in
|
||||
+ * parallel, vflush() cannot reclaim the parent vnode.
|
||||
+ * Due to this, the check for MNTK_UNMOUNT flag is not
|
||||
+ * racy: if we did not see MNTK_UNMOUNT flag, then tmp
|
||||
+ * cannot be destroyed until node construction is
|
||||
+ * finished and the parent vnode unlocked.
|
||||
+ *
|
||||
+ * Tmpfs does not need to instantiate new nodes during
|
||||
+ * unmount.
|
||||
+ */
|
||||
+ 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++;
|
||||
+ 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:
|
||||
+ case VCHR:
|
||||
+ case VDIR:
|
||||
+ case VFIFO:
|
||||
+ case VSOCK:
|
||||
+ 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);
|
||||
+ }
|
||||
|
||||
- return rc;
|
||||
+ *node = nnode;
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
-static const char *vboxvfs_opts[] = {
|
||||
- "uid", "gid", "from", "fstype", "fspath", "errmsg", NULL
|
||||
-};
|
||||
-
|
||||
-static int vboxvfs_mount(struct mount *mp, struct thread *td)
|
||||
+void
|
||||
+vboxfs_free_node(struct vboxfs_mnt *vboxfs, struct vboxfs_node *node)
|
||||
{
|
||||
- int rc;
|
||||
- char *pszShare;
|
||||
- int cbShare, cbOption;
|
||||
- int uid = 0, gid = 0;
|
||||
- struct sf_glob_info *pShFlGlobalInfo;
|
||||
- SHFLSTRING *pShFlShareName = NULL;
|
||||
- int cbShFlShareName;
|
||||
|
||||
- printf("%s: Enter\n", __FUNCTION__);
|
||||
+#ifdef INVARIANTS
|
||||
+ TMPFS_NODE_LOCK(node);
|
||||
+ MPASS(node->sf_vnode == NULL);
|
||||
+ MPASS((node->sf_vpstate & TMPFS_VNODE_ALLOCATING) == 0);
|
||||
+ TMPFS_NODE_UNLOCK(node);
|
||||
+#endif
|
||||
+ if (node->sf_path)
|
||||
+ free(node->sf_path, M_VBOXVFS);
|
||||
|
||||
- if (mp->mnt_flag & (MNT_UPDATE | MNT_ROOTFS))
|
||||
- return EOPNOTSUPP;
|
||||
+ uma_zfree(vboxfs->sf_node_pool, node);
|
||||
+}
|
||||
|
||||
- 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)
|
||||
+{
|
||||
+ struct vboxfs_mount_info args;
|
||||
+ int error = 0;
|
||||
|
||||
- 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);
|
||||
+ ma = mount_argf(ma, "dir_mode", "%d", args.dmode);
|
||||
+ ma = mount_arg(ma, "from", args.name, -1);
|
||||
|
||||
- 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 = RTMemAllocZ(sizeof(struct sf_glob_info));
|
||||
- if (!pShFlGlobalInfo)
|
||||
- return ENOMEM;
|
||||
+static const char *vboxfs_opts[] = {
|
||||
+ "fstype",
|
||||
+ "fspath",
|
||||
+ "from",
|
||||
+ "uid",
|
||||
+ "gid",
|
||||
+ "file_mode",
|
||||
+ "dir_mode",
|
||||
+ "errmsg",
|
||||
+ NULL
|
||||
+};
|
||||
|
||||
- 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) { \
|
||||
+ if (optarg != NULL && *optarg == '\0') \
|
||||
+ optarg = NULL; \
|
||||
+ if (optarg != NULL) \
|
||||
+ val = strtoul(optarg, &ep, base); \
|
||||
+ if (optarg == NULL || *ep != '\0') { \
|
||||
+ struct sbuf *sb = sbuf_new_auto(); \
|
||||
+ sbuf_printf(sb, "Invalid %s: \"%s\"", optname, \
|
||||
+ optarg); \
|
||||
+ sbuf_finish(sb); \
|
||||
+ vfs_mount_error(mp, sbuf_data(sb)); \
|
||||
+ sbuf_delete(sb); \
|
||||
+ return (EINVAL); \
|
||||
+ } \
|
||||
+ } \
|
||||
+} while (0)
|
||||
|
||||
- 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;
|
||||
|
||||
- rc = VbglR0SfMapFolder (&g_vboxSFClient, pShFlShareName, &pShFlGlobalInfo->map);
|
||||
- RTMemFree(pShFlShareName);
|
||||
+ node->sf_vnode = NULL;
|
||||
+ node->sf_vpstate = 0;
|
||||
|
||||
- if (RT_FAILURE (rc))
|
||||
- {
|
||||
- RTMemFree(pShFlGlobalInfo);
|
||||
- printf("VbglR0SfMapFolder failed rc=%d\n", rc);
|
||||
- return EPROTO;
|
||||
- }
|
||||
+ 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;
|
||||
+}
|
||||
|
||||
- mp->mnt_data = pShFlGlobalInfo;
|
||||
+static int
|
||||
+vboxfs_node_init(void *mem, int size, int flags)
|
||||
+{
|
||||
+ struct vboxfs_node *node = (struct vboxfs_node *)mem;
|
||||
+ node->sf_ino = 0;
|
||||
|
||||
- /** @todo root vnode. */
|
||||
+ mtx_init(&node->sf_interlock, "tmpfs node interlock", NULL, MTX_DEF);
|
||||
|
||||
- vfs_getnewfsid(mp);
|
||||
- vfs_mountedfrom(mp, pszShare);
|
||||
+ return (0);
|
||||
+}
|
||||
|
||||
- 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);
|
||||
}
|
||||
|
||||
-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;
|
||||
+ int readonly = 0;
|
||||
+ sffs_fsinfo_t fsinfo;
|
||||
+ int error, share_len;
|
||||
+ char *share_name;
|
||||
+ mode_t file_mode = 0, dir_mode = 0;
|
||||
+ 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;
|
||||
+ vboxfsmp->sf_fmode = file_mode & (S_IRWXU | S_IRWXG | S_IRWXO);
|
||||
+ 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)
|
||||
+ return (error);
|
||||
+
|
||||
+ /* Determine whether the filesystem must be read-only. */
|
||||
+ error = sfprov_get_fsinfo(handle, &fsinfo);
|
||||
+ if (error != 0) {
|
||||
+ sfprov_unmount(handle);
|
||||
+ return (error);
|
||||
+ }
|
||||
+ if (readonly == 0)
|
||||
+ readonly = (fsinfo.readonly != 0);
|
||||
+
|
||||
+ vboxfsmp->sf_handle = handle;
|
||||
+ vboxfsmp->sf_vfsp = mp;
|
||||
+
|
||||
+ vboxfsmp->sf_node_pool = uma_zcreate("VBOXFS node",
|
||||
+ sizeof(struct vboxfs_node),
|
||||
+ vboxfs_node_ctor, vboxfs_node_dtor,
|
||||
+ vboxfs_node_init, vboxfs_node_fini,
|
||||
+ UMA_ALIGN_PTR, 0);
|
||||
+
|
||||
+ /* Allocate the root node. */
|
||||
+ error = vboxfs_alloc_node(mp, vboxfsmp, "", VDIR, 0,
|
||||
+ 0, 0755, NULL, &root);
|
||||
+
|
||||
+ if (error != 0 || root == NULL) {
|
||||
+ uma_zdestroy(vboxfsmp->sf_node_pool);
|
||||
+ free(vboxfsmp, M_VBOXVFS);
|
||||
+ return error;
|
||||
+ }
|
||||
+
|
||||
+ root->sf_parent = root;
|
||||
+ vboxfsmp->sf_root = root;
|
||||
+
|
||||
+ MNT_ILOCK(mp);
|
||||
+ mp->mnt_data = vboxfsmp;
|
||||
+ mp->mnt_stat.f_fsid.val[0] = fsinfo.serial;
|
||||
+ mp->mnt_stat.f_fsid.val[1] = 0;
|
||||
+ mp->mnt_flag |= MNT_LOCAL;
|
||||
+ if (readonly != 0)
|
||||
+ mp->mnt_flag |= MNT_RDONLY;
|
||||
+
|
||||
+ mp->mnt_kern_flag |= MNTK_LOOKUP_SHARED | MNTK_EXTENDED_SHARED;
|
||||
+ MNT_IUNLOCK(mp);
|
||||
+ vfs_mountedfrom(mp, share_name);
|
||||
+
|
||||
+ return (0);
|
||||
}
|
||||
|
||||
-static int vboxvfs_root(struct mount *mp, int flags, struct vnode **vpp, struct thread *td)
|
||||
+/*
|
||||
+ * Unmount a shared folder.
|
||||
+ *
|
||||
+ * vboxfs_unmount umounts the mounted file system. It return 0
|
||||
+ * on sucess and any relevant errno on failure.
|
||||
+ */
|
||||
+static int
|
||||
+vboxfs_unmount(struct mount *mp, int mntflags)
|
||||
{
|
||||
- int rc = 0;
|
||||
- struct sf_glob_info *pShFlGlobalInfo = VFSMP2SFGLOBINFO(mp);
|
||||
- struct vnode *vp;
|
||||
+ struct vboxfs_mnt *vboxfsmp;
|
||||
+ 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);
|
||||
+
|
||||
+ return (0);
|
||||
}
|
||||
|
||||
-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);
|
||||
+
|
||||
+ if (!error)
|
||||
+ (*vpp)->v_vflag |= VV_ROOT;
|
||||
+
|
||||
+ return error;
|
||||
}
|
||||
|
||||
-int vboxvfs_init(struct vfsconf *vfsp)
|
||||
+/*
|
||||
+ * Do operation associated with quotas, not supported
|
||||
+ */
|
||||
+static int
|
||||
+vboxfs_quotactl(struct mount *mp, int cmd, uid_t uid, void *arg
|
||||
+#if __FreeBSD_version >= 1400018
|
||||
+ , bool *mp_busy
|
||||
+#endif
|
||||
+ )
|
||||
{
|
||||
- int rc;
|
||||
+ return (EOPNOTSUPP);
|
||||
+}
|
||||
|
||||
- /* 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 error;
|
||||
|
||||
- /* Connect to the host service. */
|
||||
- rc = VbglR0SfConnect(&g_vboxSFClient);
|
||||
- if (RT_FAILURE(rc))
|
||||
- {
|
||||
- printf("Failed to get connection to host! rc=%d\n", rc);
|
||||
- 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);
|
||||
|
||||
- return 0;
|
||||
+ PICKUP_GIANT();
|
||||
+ return (0);
|
||||
}
|
||||
|
||||
-int vboxvfs_uninit(struct vfsconf *vfsp)
|
||||
+/*
|
||||
+ * Undo the work of vboxfs_init().
|
||||
+ */
|
||||
+static int
|
||||
+vboxfs_uninit(struct vfsconf *vfsp)
|
||||
{
|
||||
- VbglR0SfDisconnect(&g_vboxSFClient);
|
||||
- VbglR0SfTerm();
|
||||
|
||||
- return 0;
|
||||
+ DROP_GIANT();
|
||||
+ sfprov_disconnect();
|
||||
+ PICKUP_GIANT();
|
||||
+ return (0);
|
||||
}
|
||||
|
||||
-int vboxvfs_statfs(struct mount *mp, struct statfs *sbp, struct thread *td)
|
||||
+/*
|
||||
+ * Get filesystem statistics.
|
||||
+ */
|
||||
+static int
|
||||
+vboxfs_statfs(struct mount *mp, struct statfs *sbp)
|
||||
{
|
||||
- return 0;
|
||||
+ struct vboxfs_mnt *vboxfsmp;
|
||||
+ sffs_fsinfo_t fsinfo;
|
||||
+ int error;
|
||||
+
|
||||
+ vboxfsmp = VFSTOVBOXFS(mp);
|
||||
+
|
||||
+ error = sfprov_get_fsinfo(vboxfsmp->sf_handle, &fsinfo);
|
||||
+ if (error != 0)
|
||||
+ return (error);
|
||||
+
|
||||
+ sbp->f_iosize = fsinfo.blksize;
|
||||
+ sbp->f_bsize = fsinfo.blksize;
|
||||
+
|
||||
+ sbp->f_bfree = fsinfo.blksavail;
|
||||
+ sbp->f_bavail = fsinfo.blksavail;
|
||||
+ sbp->f_files = fsinfo.blksavail / 4; /* some kind of reasonable value */
|
||||
+ sbp->f_ffree = fsinfo.blksavail / 4;
|
||||
+
|
||||
+ sbp->f_blocks = fsinfo.blksused + sbp->f_bavail;
|
||||
+ sbp->f_fsid.val[0] = mp->mnt_stat.f_fsid.val[0];
|
||||
+ sbp->f_fsid.val[1] = mp->mnt_stat.f_fsid.val[1];
|
||||
+ sbp->f_namemax = fsinfo.maxnamesize;
|
||||
+
|
||||
+ return (0);
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,10 @@
|
|||
--- src/VBox/Additions/x11/VBoxClient/logging.cpp.orig 2021-01-07 15:34:30 UTC
|
||||
+++ src/VBox/Additions/x11/VBoxClient/logging.cpp
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
+#include <sys/wait.h>
|
||||
#include <iprt/buildconfig.h>
|
||||
#include <iprt/file.h>
|
||||
#include <iprt/process.h>
|
|
@ -0,0 +1,29 @@
|
|||
--- src/VBox/Additions/x11/vboxmouse/Makefile.kmk.orig 2019-01-25 18:24:30 UTC
|
||||
+++ src/VBox/Additions/x11/vboxmouse/Makefile.kmk
|
||||
@@ -227,10 +227,22 @@ endif # neq ($(KBUILD_TARGET),linux)
|
||||
|
||||
|
||||
ifdef VBOX_USE_SYSTEM_XORG_HEADERS
|
||||
- # As vboxmouse_drv is not needed at all for X.Org Server 1.7 and later do not
|
||||
- # build it in this case.
|
||||
- DLLS := $(filter-out vboxmouse_drv_%,$(DLLS))
|
||||
- SYSMODS := $(filter-out vboxmouse_drv%,$(SYSMODS))
|
||||
+ ifeq ($(KBUILD_TARGET),freebsd)
|
||||
+ DLLS += vboxmouse_drv_system
|
||||
+ vboxmouse_drv_system_TEMPLATE = VBOXGUESTR3XORGMOD
|
||||
+ vboxmouse_drv_system_DEFS := $(vboxmouse_drv_70_DEFS) NO_ANSIC
|
||||
+ vboxmouse_drv_system_INCS := \
|
||||
+ /usr/local/include/pixman-1 \
|
||||
+ /usr/local/include/xorg \
|
||||
+ $(PATH_SUB_CURRENT)
|
||||
+ vboxmouse_drv_system_SOURCES = \
|
||||
+ vboxmouse.c
|
||||
+ else
|
||||
+ # As vboxmouse_drv is not needed at all for X.Org Server 1.7 and later do not
|
||||
+ # build it in this case.
|
||||
+ DLLS := $(filter-out vboxmouse_drv_%,$(DLLS))
|
||||
+ SYSMODS := $(filter-out vboxmouse_drv%,$(SYSMODS))
|
||||
+ endif
|
||||
endif
|
||||
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
--- src/VBox/Additions/x11/vboxvideo/Makefile.kmk.orig 2019-01-25 18:24:30 UTC
|
||||
+++ src/VBox/Additions/x11/vboxvideo/Makefile.kmk
|
||||
@@ -406,9 +406,10 @@ ifdef VBOX_USE_SYSTEM_XORG_HEADERS
|
||||
vboxvideo_drv_system_INCS += \
|
||||
$(PATH_ROOT)/src/VBox/Runtime/include \
|
||||
$(VBOX_GRAPHICS_INCS) \
|
||||
- /usr/include/xorg \
|
||||
- /usr/include/pixman-1
|
||||
+ /usr/local/include/xorg \
|
||||
+ /usr/local/include/pixman-1
|
||||
vboxvideo_drv_system_SOURCES := $(vboxvideo_drv_17_SOURCES)
|
||||
+ vboxvideo_drv_system_LIBS += $(vboxvideo_drv_70_LIBS)
|
||||
endif
|
||||
|
||||
|
|
@ -0,0 +1,230 @@
|
|||
--- src/VBox/Additions/x11/x11include/xproto-7.0.18/X11/Xfuncproto.h.orig 2021-01-07 15:37:10 UTC
|
||||
+++ src/VBox/Additions/x11/x11include/xproto-7.0.18/X11/Xfuncproto.h
|
||||
@@ -48,6 +48,227 @@ in this Software without prior written authorization f
|
||||
#endif /* _Xconst */
|
||||
|
||||
/* Function prototype configuration (see configure for more info) */
|
||||
+#if !defined(NARROWPROTO) && \
|
||||
+ (defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__))
|
||||
+#define NARROWPROTO
|
||||
+#endif
|
||||
+#ifndef FUNCPROTO
|
||||
+#define FUNCPROTO 15
|
||||
+#endif
|
||||
+
|
||||
+#ifndef NeedWidePrototypes
|
||||
+#ifdef NARROWPROTO
|
||||
+#define NeedWidePrototypes 0
|
||||
+#else
|
||||
+#define NeedWidePrototypes 1 /* default to make interropt. easier */
|
||||
+#endif
|
||||
+#endif /* NeedWidePrototypes */
|
||||
+
|
||||
+#endif /* NeedFunctionPrototypes */
|
||||
+
|
||||
+#ifndef _XFUNCPROTOBEGIN
|
||||
+#if defined(__cplusplus) || defined(c_plusplus) /* for C++ V2.0 */
|
||||
+#define _XFUNCPROTOBEGIN extern "C" { /* do not leave open across includes */
|
||||
+#define _XFUNCPROTOEND }
|
||||
+#else
|
||||
+#define _XFUNCPROTOBEGIN
|
||||
+#define _XFUNCPROTOEND
|
||||
+#endif
|
||||
+#endif /* _XFUNCPROTOBEGIN */
|
||||
+
|
||||
+/* http://clang.llvm.org/docs/LanguageExtensions.html#has-attribute */
|
||||
+#ifndef __has_attribute
|
||||
+# define __has_attribute(x) 0 /* Compatibility with non-clang compilers. */
|
||||
+#endif
|
||||
+#ifndef __has_feature
|
||||
+# define __has_feature(x) 0 /* Compatibility with non-clang compilers. */
|
||||
+#endif
|
||||
+#ifndef __has_extension
|
||||
+# define __has_extension(x) 0 /* Compatibility with non-clang compilers. */
|
||||
+#endif
|
||||
+
|
||||
+/* Added in X11R6.9, so available in any version of modular xproto */
|
||||
+#if __has_attribute(__sentinel__) || (defined(__GNUC__) && (__GNUC__ >= 4))
|
||||
+# define _X_SENTINEL(x) __attribute__ ((__sentinel__(x)))
|
||||
+#else
|
||||
+# define _X_SENTINEL(x)
|
||||
+#endif /* GNUC >= 4 */
|
||||
+
|
||||
+/* Added in X11R6.9, so available in any version of modular xproto */
|
||||
+#if (__has_attribute(visibility) || (defined(__GNUC__) && (__GNUC__ >= 4))) \
|
||||
+ && !defined(__CYGWIN__) && !defined(__MINGW32__)
|
||||
+# define _X_EXPORT __attribute__((visibility("default")))
|
||||
+# define _X_HIDDEN __attribute__((visibility("hidden")))
|
||||
+# define _X_INTERNAL __attribute__((visibility("internal")))
|
||||
+#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
|
||||
+# define _X_EXPORT __global
|
||||
+# define _X_HIDDEN __hidden
|
||||
+# define _X_INTERNAL __hidden
|
||||
+#else /* not gcc >= 4 and not Sun Studio >= 8 */
|
||||
+# define _X_EXPORT
|
||||
+# define _X_HIDDEN
|
||||
+# define _X_INTERNAL
|
||||
+#endif /* GNUC >= 4 */
|
||||
+
|
||||
+/* Branch prediction hints for individual conditionals */
|
||||
+/* requires xproto >= 7.0.9 */
|
||||
+#if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 303)
|
||||
+# define _X_LIKELY(x) __builtin_expect(!!(x), 1)
|
||||
+# define _X_UNLIKELY(x) __builtin_expect(!!(x), 0)
|
||||
+#else /* not gcc >= 3.3 */
|
||||
+# define _X_LIKELY(x) (x)
|
||||
+# define _X_UNLIKELY(x) (x)
|
||||
+#endif
|
||||
+
|
||||
+/* Bulk branch prediction hints via marking error path functions as "cold" */
|
||||
+/* requires xproto >= 7.0.25 */
|
||||
+#if __has_attribute(__cold__) || \
|
||||
+ (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 403)) /* 4.3+ */
|
||||
+# define _X_COLD __attribute__((__cold__))
|
||||
+#else
|
||||
+# define _X_COLD /* nothing */
|
||||
+#endif
|
||||
+
|
||||
+/* Added in X11R6.9, so available in any version of modular xproto */
|
||||
+#if __has_attribute(deprecated) \
|
||||
+ || (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 301)) \
|
||||
+ || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5130))
|
||||
+# define _X_DEPRECATED __attribute__((deprecated))
|
||||
+#else /* not gcc >= 3.1 */
|
||||
+# define _X_DEPRECATED
|
||||
+#endif
|
||||
+
|
||||
+/* requires xproto >= 7.0.30 */
|
||||
+#if __has_extension(attribute_deprecated_with_message) || \
|
||||
+ (defined(__GNUC__) && ((__GNUC__ >= 5) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5))))
|
||||
+# define _X_DEPRECATED_MSG(_msg) __attribute__((deprecated(_msg)))
|
||||
+#else
|
||||
+# define _X_DEPRECATED_MSG(_msg) _X_DEPRECATED
|
||||
+#endif
|
||||
+
|
||||
+/* requires xproto >= 7.0.17 */
|
||||
+#if __has_attribute(noreturn) \
|
||||
+ || (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 205)) \
|
||||
+ || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
|
||||
+# define _X_NORETURN __attribute((noreturn))
|
||||
+#else
|
||||
+# define _X_NORETURN
|
||||
+#endif /* GNUC */
|
||||
+
|
||||
+/* Added in X11R6.9, so available in any version of modular xproto */
|
||||
+#if __has_attribute(__format__) \
|
||||
+ || defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 203)
|
||||
+# define _X_ATTRIBUTE_PRINTF(x,y) __attribute__((__format__(__printf__,x,y)))
|
||||
+#else /* not gcc >= 2.3 */
|
||||
+# define _X_ATTRIBUTE_PRINTF(x,y)
|
||||
+#endif
|
||||
+
|
||||
+/* requires xproto >= 7.0.22 - since this uses either gcc or C99 variable
|
||||
+ argument macros, must be only used inside #ifdef _X_NONNULL guards, as
|
||||
+ many legacy X clients are compiled in C89 mode still. */
|
||||
+#if __has_attribute(nonnull) \
|
||||
+ && defined(__STDC_VERSION__) && (__STDC_VERSION__ - 0 >= 199901L) /* C99 */
|
||||
+#define _X_NONNULL(...) __attribute__((nonnull(__VA_ARGS__)))
|
||||
+#elif __has_attribute(nonnull) \
|
||||
+ || defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 303)
|
||||
+#define _X_NONNULL(args...) __attribute__((nonnull(args)))
|
||||
+#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ - 0 >= 199901L) /* C99 */
|
||||
+#define _X_NONNULL(...) /* */
|
||||
+#endif
|
||||
+
|
||||
+/* requires xproto >= 7.0.22 */
|
||||
+#if __has_attribute(__unused__) \
|
||||
+ || defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 205)
|
||||
+#define _X_UNUSED __attribute__((__unused__))
|
||||
+#else
|
||||
+#define _X_UNUSED /* */
|
||||
+#endif
|
||||
+
|
||||
+/* C99 keyword "inline" or equivalent extensions in pre-C99 compilers */
|
||||
+/* requires xproto >= 7.0.9
|
||||
+ (introduced in 7.0.8 but didn't support all compilers until 7.0.9) */
|
||||
+#if defined(inline) /* assume autoconf set it correctly */ || \
|
||||
+ (defined(__STDC_VERSION__) && (__STDC_VERSION__ - 0 >= 199901L)) /* C99 */ || \
|
||||
+ (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550))
|
||||
+# define _X_INLINE inline
|
||||
+#elif defined(__GNUC__) && !defined(__STRICT_ANSI__) /* gcc w/C89+extensions */
|
||||
+# define _X_INLINE __inline__
|
||||
+#else
|
||||
+# define _X_INLINE
|
||||
+#endif
|
||||
+
|
||||
+/* C99 keyword "restrict" or equivalent extensions in pre-C99 compilers */
|
||||
+/* requires xproto >= 7.0.21 */
|
||||
+#ifndef _X_RESTRICT_KYWD
|
||||
+# if defined(restrict) /* assume autoconf set it correctly */ || \
|
||||
+ (defined(__STDC_VERSION__) && (__STDC_VERSION__ - 0 >= 199901L) /* C99 */ \
|
||||
+ && !defined(__cplusplus)) /* Workaround g++ issue on Solaris */
|
||||
+# define _X_RESTRICT_KYWD restrict
|
||||
+# elif defined(__GNUC__) && !defined(__STRICT_ANSI__) /* gcc w/C89+extensions */
|
||||
+# define _X_RESTRICT_KYWD __restrict__
|
||||
+# else
|
||||
+# define _X_RESTRICT_KYWD
|
||||
+# endif
|
||||
+#endif
|
||||
+
|
||||
+/* requires xproto >= 7.0.30 */
|
||||
+#if __has_attribute(no_sanitize_thread)
|
||||
+# define _X_NOTSAN __attribute__((no_sanitize_thread))
|
||||
+#else
|
||||
+# define _X_NOTSAN
|
||||
+#endif
|
||||
+
|
||||
+#endif /* _XFUNCPROTO_H_ */
|
||||
+/*
|
||||
+ *
|
||||
+Copyright 1989, 1991, 1998 The Open Group
|
||||
+
|
||||
+Permission to use, copy, modify, distribute, and sell this software and its
|
||||
+documentation for any purpose is hereby granted without fee, provided that
|
||||
+the above copyright notice appear in all copies and that both that
|
||||
+copyright notice and this permission notice appear in supporting
|
||||
+documentation.
|
||||
+
|
||||
+The above copyright notice and this permission notice shall be included in
|
||||
+all copies or substantial portions of the Software.
|
||||
+
|
||||
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
+
|
||||
+Except as contained in this notice, the name of The Open Group shall not be
|
||||
+used in advertising or otherwise to promote the sale, use or other dealings
|
||||
+in this Software without prior written authorization from The Open Group.
|
||||
+ *
|
||||
+ */
|
||||
+
|
||||
+/* Definitions to make function prototypes manageable */
|
||||
+
|
||||
+#ifndef _XFUNCPROTO_H_
|
||||
+#define _XFUNCPROTO_H_
|
||||
+
|
||||
+#ifndef NeedFunctionPrototypes
|
||||
+#define NeedFunctionPrototypes 1
|
||||
+#endif /* NeedFunctionPrototypes */
|
||||
+
|
||||
+#ifndef NeedVarargsPrototypes
|
||||
+#define NeedVarargsPrototypes 1
|
||||
+#endif /* NeedVarargsPrototypes */
|
||||
+
|
||||
+#if NeedFunctionPrototypes
|
||||
+
|
||||
+#ifndef NeedNestedPrototypes
|
||||
+#define NeedNestedPrototypes 1
|
||||
+#endif /* NeedNestedPrototypes */
|
||||
+
|
||||
+#ifndef _Xconst
|
||||
+#define _Xconst const
|
||||
+#endif /* _Xconst */
|
||||
+
|
||||
+/* Function prototype configuration (see configure for more info) */
|
||||
#ifndef NARROWPROTO
|
||||
#undef NARROWPROTO
|
||||
#endif
|
|
@ -0,0 +1,10 @@
|
|||
--- src/VBox/Debugger/Makefile.kmk.orig 2021-01-07 15:37:12 UTC
|
||||
+++ src/VBox/Debugger/Makefile.kmk
|
||||
@@ -110,6 +110,7 @@ VBoxDbg_SOURCES = \
|
||||
VBoxDbgBase.cpp \
|
||||
VBoxDbgConsole.cpp \
|
||||
VBoxDbgStatsQt.cpp
|
||||
+VBoxDbg_CXXFLAGS.freebsd += -std=c++11
|
||||
VBoxDbg_LIBS = \
|
||||
$(VBOX_LIB_VMM_LAZY)
|
||||
VBoxDbg_LDFLAGS.darwin = \
|
|
@ -0,0 +1,29 @@
|
|||
--- src/VBox/Devices/Graphics/DevVGA-SVGA3d-glLdr.cpp.orig 2021-01-07 15:39:16 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;
|
||||
@@ -296,7 +296,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);
|
||||
@@ -397,7 +397,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;
|
|
@ -0,0 +1,11 @@
|
|||
--- src/VBox/Devices/Graphics/DevVGA-SVGA3d-glLdr.h.orig 2021-01-07 15:39:17 UTC
|
||||
+++ src/VBox/Devices/Graphics/DevVGA-SVGA3d-glLdr.h
|
||||
@@ -338,7 +338,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
|
||||
*/
|
|
@ -0,0 +1,38 @@
|
|||
--- src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp.orig 2021-01-07 15:39:17 UTC
|
||||
+++ src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp
|
||||
@@ -1189,7 +1189,7 @@ int vmsvga3dTerminate(PVGASTATECC pThisCC)
|
||||
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 */
|
||||
@@ -3194,7 +3194,7 @@ int vmsvga3dGenerateMipmaps(PVGASTATECC pThisCC, uint3
|
||||
}
|
||||
|
||||
|
||||
-#ifdef RT_OS_LINUX
|
||||
+#if defined(RT_OS_FREEBSD) || defined(RT_OS_LINUX)
|
||||
/**
|
||||
* X11 event handling thread.
|
||||
*
|
||||
@@ -3224,7 +3224,7 @@ DECLCALLBACK(int) vmsvga3dXEventThread(RTTHREAD hThrea
|
||||
}
|
||||
return VINF_SUCCESS;
|
||||
}
|
||||
-#endif // RT_OS_LINUX
|
||||
+#endif // RT_OS_FREEBSD || RT_OS_LINUX
|
||||
|
||||
|
||||
/**
|
||||
@@ -4052,7 +4052,7 @@ static int vmsvga3dContextDestroyOgl(PVGASTATECC 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);
|
|
@ -0,0 +1,44 @@
|
|||
--- src/VBox/Devices/Makefile.kmk.orig 2021-01-07 15:39:35 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)
|
||||
|
||||
@@ -245,6 +246,7 @@ if !defined(VBOX_ONLY_EXTPACKS) && "$(intersects $(KBU
|
||||
-framework SystemConfiguration \
|
||||
-framework AVFoundation \
|
||||
-framework Foundation
|
||||
+ VBoxDD_LDFLAGS.freebsd = $(VBOX_GCC_NO_UNDEFINED)
|
||||
VBoxDD_LDFLAGS.linux = $(VBOX_GCC_NO_UNDEFINED)
|
||||
|
||||
# --- Tracing bits. ---
|
||||
@@ -287,7 +289,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
|
||||
@@ -329,6 +331,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
|
||||
@@ -1526,6 +1529,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 := \
|
|
@ -0,0 +1,29 @@
|
|||
--- src/VBox/Devices/PC/ipxe/Makefile.kmk.orig 2024-01-11 12:19:38 UTC
|
||||
+++ src/VBox/Devices/PC/ipxe/Makefile.kmk
|
||||
@@ -35,7 +35,7 @@ iPxeBiosBin_CLEAN = \
|
||||
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 $< $@
|
||||
@@ -121,7 +121,7 @@ endif
|
||||
-falign-loops=1 \
|
||||
-Os \
|
||||
-falign-functions=1 \
|
||||
- -mpreferred-stack-boundary=2 \
|
||||
+ -mstack-alignment=2 \
|
||||
-mregparm=3 \
|
||||
-mrtd \
|
||||
-freg-struct-return \
|
||||
@@ -144,7 +144,7 @@ endif
|
||||
-falign-jumps=1 \
|
||||
-falign-loops=1 \
|
||||
-falign-functions=1 \
|
||||
- -mpreferred-stack-boundary=2 \
|
||||
+ -mstack-alignment=2 \
|
||||
-mregparm=3 \
|
||||
-mrtd \
|
||||
-freg-struct-return \
|
|
@ -0,0 +1,11 @@
|
|||
--- src/VBox/Devices/USB/freebsd/USBProxyDevice-freebsd.cpp.orig 2024-01-11 12:23:15 UTC
|
||||
+++ src/VBox/Devices/USB/freebsd/USBProxyDevice-freebsd.cpp
|
||||
@@ -57,7 +57,7 @@
|
||||
#include "../USBProxyDevice.h"
|
||||
|
||||
/** Maximum endpoints supported. */
|
||||
-#define USBFBSD_MAXENDPOINTS 127
|
||||
+#define USBFBSD_MAXENDPOINTS 126
|
||||
#define USBFBSD_MAXFRAMES 56
|
||||
|
||||
/** This really needs to be defined in vusb.h! */
|
|
@ -0,0 +1,58 @@
|
|||
--- src/VBox/ExtPacks/VNC/VBoxVNC.cpp.orig 2024-01-11 12:24:04 UTC
|
||||
+++ src/VBox/ExtPacks/VNC/VBoxVNC.cpp
|
||||
@@ -45,7 +45,7 @@
|
||||
|
||||
#ifdef LIBVNCSERVER_IPv6
|
||||
// enable manually!
|
||||
-// #define VBOX_USE_IPV6
|
||||
+#define VBOX_USE_IPV6
|
||||
#endif
|
||||
|
||||
|
||||
@@ -421,7 +421,7 @@ DECLCALLBACK(int) VNCServerImpl::VRDEEnableConnections
|
||||
|
||||
// get address
|
||||
char *pszTCPAddress = (char *)RTMemTmpAllocZ(VNC_ADDRESS_OPTION_MAX);
|
||||
- rc = instance->mCallbacks->VRDECallbackProperty(instance->mCallback,
|
||||
+ int rc = instance->mCallbacks->VRDECallbackProperty(instance->mCallback,
|
||||
VRDE_QP_NETWORK_ADDRESS,
|
||||
pszTCPAddress,
|
||||
VNC_ADDRESS_OPTION_MAX,
|
||||
@@ -582,19 +582,35 @@ DECLCALLBACK(int) VNCServerImpl::VRDEEnableConnections
|
||||
pszServerAddress6 = szIPv6ListenAll;
|
||||
}
|
||||
|
||||
- if (pszVNCPort4 && uServerPort4 == 0)
|
||||
+ if (strlen(pszVNCPort4) > 0 && uServerPort4 == 0)
|
||||
{
|
||||
rc = RTStrToUInt32Ex(pszVNCPort4, NULL, 10, &uServerPort4);
|
||||
if (!RT_SUCCESS(rc) || uServerPort4 > 65535)
|
||||
uServerPort4 = 0;
|
||||
}
|
||||
|
||||
- if (pszVNCPort6 && uServerPort6 == 0)
|
||||
+ if (strlen(pszVNCPort6) > 0 && uServerPort6 == 0)
|
||||
{
|
||||
rc = RTStrToUInt32Ex(pszVNCPort6, NULL, 10, &uServerPort6);
|
||||
if (!RT_SUCCESS(rc) || uServerPort6 > 65535)
|
||||
uServerPort6 = 0;
|
||||
}
|
||||
+
|
||||
+/* Backward compatibility with set port in "TCP/Ports" only { */
|
||||
+ if (uServerPort4 == 0 && strlen(pszTCPPort) > 0)
|
||||
+ {
|
||||
+ rc = RTStrToUInt32Ex(pszTCPPort, NULL, 10, &uServerPort4);
|
||||
+ if (!RT_SUCCESS(rc) || uServerPort4 > 65535)
|
||||
+ uServerPort4 = 0;
|
||||
+ }
|
||||
+
|
||||
+ if (uServerPort6 == 0 && strlen(pszTCPPort) > 0)
|
||||
+ {
|
||||
+ rc = RTStrToUInt32Ex(pszTCPPort, NULL, 10, &uServerPort6);
|
||||
+ if (!RT_SUCCESS(rc) || uServerPort6 > 65535)
|
||||
+ uServerPort6 = 0;
|
||||
+ }
|
||||
+/* } */
|
||||
|
||||
if (uServerPort4 == 0 || uServerPort6 == 0)
|
||||
vncServer->autoPort = 1;
|
|
@ -0,0 +1,43 @@
|
|||
--- src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp.orig 2021-01-07 15:40:48 UTC
|
||||
+++ src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp
|
||||
@@ -646,7 +646,7 @@ void printUsage(USAGECATEGORY enmCommand, uint64_t fSu
|
||||
" file <file>|\n"
|
||||
" <devicename>]\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|<I/O base> <IRQ>]\n"
|
||||
" [--lptmode<1-N> <devicename>]\n"
|
||||
#endif
|
||||
@@ -661,7 +661,7 @@ void printUsage(USAGECATEGORY enmCommand, uint64_t fSu
|
||||
RTStrmPrintf(pStrm, "|dsound");
|
||||
#endif
|
||||
}
|
||||
- if (fLinux || fSolaris)
|
||||
+ if (fLinux || fFreeBSD || fSolaris)
|
||||
{
|
||||
RTStrmPrintf(pStrm, ""
|
||||
#ifdef VBOX_WITH_AUDIO_OSS
|
||||
@@ -674,22 +674,6 @@ void printUsage(USAGECATEGORY enmCommand, uint64_t fSu
|
||||
"|pulse"
|
||||
#endif
|
||||
);
|
||||
- }
|
||||
- if (fFreeBSD)
|
||||
- {
|
||||
-#ifdef VBOX_WITH_AUDIO_OSS
|
||||
- /* Get the line break sorted when dumping all option variants. */
|
||||
- if (fDumpOpts)
|
||||
- {
|
||||
- RTStrmPrintf(pStrm, "|\n"
|
||||
- " oss");
|
||||
- }
|
||||
- else
|
||||
- RTStrmPrintf(pStrm, "|oss");
|
||||
-#endif
|
||||
-#ifdef VBOX_WITH_AUDIO_PULSE
|
||||
- RTStrmPrintf(pStrm, "|pulse");
|
||||
-#endif
|
||||
}
|
||||
if (fDarwin)
|
||||
{
|
|
@ -0,0 +1,29 @@
|
|||
--- src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp.orig 2021-01-07 15:40:49 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
|
||||
@@ -2278,7 +2278,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<IParallelPort> lpt;
|
|
@ -0,0 +1,18 @@
|
|||
--- src/VBox/Frontends/VirtualBox/Makefile.kmk.orig 2021-01-07 15:40:49 UTC
|
||||
+++ src/VBox/Frontends/VirtualBox/Makefile.kmk
|
||||
@@ -1186,6 +1186,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
|
||||
|
||||
$(call VBOX_SET_VER_INFO_EXE,VirtualBox,VirtualBox Manager,$(VBOX_WINDOWS_ICON_FILE))
|
||||
@@ -1862,6 +1863,7 @@ if defined(VBOX_WITH_VIDEOHWACCEL)
|
||||
VBoxOGL2D_SOURCES = \
|
||||
src/VBoxGLSupportInfo.cpp
|
||||
VBoxOGL2D_INCS = include
|
||||
+ VBoxOGL2D_CXXFLAGS.freebsd += -std=c++11
|
||||
endif
|
||||
endif
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
--- src/VBox/HostDrivers/Support/SUPDrv.cpp.orig 2018-10-15 14:30:56 UTC
|
||||
+++ src/VBox/HostDrivers/Support/SUPDrv.cpp
|
||||
@@ -104,7 +104,7 @@
|
||||
/** @def SUPDRV_CHECK_SMAP_CHECK
|
||||
* Checks that the AC flag is set if SMAP is enabled. If AC is not set, it
|
||||
* will be logged and @a a_BadExpr is executed. */
|
||||
-#if (defined(RT_OS_DARWIN) || defined(RT_OS_LINUX)) && !defined(VBOX_WITHOUT_EFLAGS_AC_SET_IN_VBOXDRV)
|
||||
+#if (defined(RT_OS_DARWIN) || defined(RT_OS_FREEBSD) || defined(RT_OS_LINUX)) && !defined(VBOX_WITHOUT_EFLAGS_AC_SET_IN_VBOXDRV)
|
||||
# define SUPDRV_CHECK_SMAP_SETUP() uint32_t const fKernelFeatures = SUPR0GetKernelFeatures()
|
||||
# define SUPDRV_CHECK_SMAP_CHECK(a_pDevExt, a_BadExpr) \
|
||||
do { \
|
|
@ -0,0 +1,11 @@
|
|||
--- src/VBox/HostDrivers/Support/SUPDrvInternal.h.orig 2021-01-07 15:41:25 UTC
|
||||
+++ src/VBox/HostDrivers/Support/SUPDrvInternal.h
|
||||
@@ -217,7 +217,7 @@
|
||||
# define SUPDRV_WITHOUT_MSR_PROBER
|
||||
#endif
|
||||
|
||||
-#if 1
|
||||
+#if 0
|
||||
/** @def SUPDRV_USE_TSC_DELTA_THREAD
|
||||
* Use a dedicated kernel thread to service TSC-delta measurement requests.
|
||||
* @todo Test on servers with many CPUs and sockets. */
|
|
@ -0,0 +1,30 @@
|
|||
--- src/VBox/HostDrivers/Support/freebsd/Makefile.orig 2021-10-18 17:58:03 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,16 +95,17 @@ SRCS += \
|
||||
RTStrCopy.c \
|
||||
RTStrCopyEx.c \
|
||||
RTStrCopyP.c \
|
||||
+ memchr.c \
|
||||
strformat.c \
|
||||
RTStrFormat.c \
|
||||
strformatnum.c \
|
||||
strformatrt.c \
|
||||
strformattype.c \
|
||||
+ stringalloc.c \
|
||||
strprintf.c \
|
||||
strprintf-ellipsis.c \
|
||||
strtonum.c \
|
||||
- memchr.c \
|
||||
- stringalloc.c
|
||||
+ utf-8.c
|
||||
|
||||
.PATH: ${.CURDIR}/common/rand
|
||||
SRCS += \
|
|
@ -0,0 +1,224 @@
|
|||
--- src/VBox/HostDrivers/Support/freebsd/SUPDrv-freebsd.c.orig 2022-07-19 20:58:42 UTC
|
||||
+++ src/VBox/HostDrivers/Support/freebsd/SUPDrv-freebsd.c
|
||||
@@ -44,8 +44,11 @@
|
||||
#include <sys/fcntl.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/uio.h>
|
||||
+#include <sys/mutex.h>
|
||||
+#include <sys/smp.h> /* mp_maxcpus */
|
||||
|
||||
#include "../SUPDrvInternal.h"
|
||||
+#include "freebsd/the-freebsd-kernel.h"
|
||||
#include <VBox/version.h>
|
||||
#include <iprt/initterm.h>
|
||||
#include <iprt/string.h>
|
||||
@@ -57,7 +60,14 @@
|
||||
#include <iprt/alloc.h>
|
||||
#include <iprt/err.h>
|
||||
#include <iprt/asm.h>
|
||||
+#include <iprt/x86.h>
|
||||
|
||||
+#ifdef VBOX_WITH_EFLAGS_AC_SET_IN_VBOXDRV
|
||||
+# include <machine/cpufunc.h>
|
||||
+# include <machine/md_var.h>
|
||||
+# include <machine/specialreg.h>
|
||||
+#endif
|
||||
+
|
||||
#ifdef VBOX_WITH_HARDENING
|
||||
# define VBOXDRV_PERM 0600
|
||||
#else
|
||||
@@ -76,7 +86,9 @@ static d_ioctl_t VBoxDrvFreeBSDIOCtl;
|
||||
static d_open_t VBoxDrvFreeBSDOpenSys;
|
||||
static void vboxdrvFreeBSDDtr(void *pvData);
|
||||
static d_ioctl_t VBoxDrvFreeBSDIOCtl;
|
||||
+static d_ioctl_t VBoxDrvFreeBSDIOCtlSMAP;
|
||||
static int VBoxDrvFreeBSDIOCtlSlow(PSUPDRVSESSION pSession, u_long ulCmd, caddr_t pvData, struct thread *pTd);
|
||||
+static bool VBoxDrvFreeBSDCpuHasSMAP(void);
|
||||
|
||||
|
||||
/*********************************************************************************************************************************
|
||||
@@ -93,7 +105,8 @@ static moduledata_t g_VBoxDrvFreeBSDModule =
|
||||
};
|
||||
|
||||
/** Declare the module as a pseudo device. */
|
||||
-DECLARE_MODULE(vboxdrv, g_VBoxDrvFreeBSDModule, SI_SUB_PSEUDO, SI_ORDER_ANY);
|
||||
+#define KERNEL_RELBRANCHEND (roundup(__FreeBSD_version, 500) - 1)
|
||||
+DECLARE_MODULE_WITH_MAXVER(vboxdrv, g_VBoxDrvFreeBSDModule, SI_SUB_PSEUDO, SI_ORDER_ANY, KERNEL_RELBRANCHEND);
|
||||
MODULE_VERSION(vboxdrv, 1);
|
||||
|
||||
/**
|
||||
@@ -140,6 +153,13 @@ static int VBoxDrvFreeBSDModuleEvent(struct module *pM
|
||||
static int VBoxDrvFreeBSDModuleEvent(struct module *pMod, int enmEventType, void *pvArg)
|
||||
{
|
||||
int rc;
|
||||
+
|
||||
+ /* Refuse to load if mp_maxcpus is wrong */
|
||||
+ if (MAXCPU != mp_maxcpus) {
|
||||
+ printf("vboxdrv: MAXCPU != mp_maxcpus (%d != %d)\n", MAXCPU, mp_maxcpus);
|
||||
+ return EINVAL;
|
||||
+ }
|
||||
+
|
||||
switch (enmEventType)
|
||||
{
|
||||
case MOD_LOAD:
|
||||
@@ -182,6 +202,13 @@ static int VBoxDrvFreeBSDLoad(void)
|
||||
rc = supdrvInitDevExt(&g_VBoxDrvFreeBSDDevExt, sizeof(SUPDRVSESSION));
|
||||
if (RT_SUCCESS(rc))
|
||||
{
|
||||
+ if (VBoxDrvFreeBSDCpuHasSMAP())
|
||||
+ {
|
||||
+ LogRel(("disabling SMAP for VBoxDrvFreeBSDIOCtl\n"));
|
||||
+ g_VBoxDrvFreeBSDChrDevSwSys.d_ioctl = VBoxDrvFreeBSDIOCtlSMAP;
|
||||
+ g_VBoxDrvFreeBSDChrDevSwUsr.d_ioctl = VBoxDrvFreeBSDIOCtlSMAP;
|
||||
+ }
|
||||
+
|
||||
/*
|
||||
* Configure character devices. Add symbolic links for compatibility.
|
||||
*/
|
||||
@@ -324,6 +351,45 @@ static int VBoxDrvFreeBSDIOCtl(struct cdev *pDev, u_lo
|
||||
|
||||
|
||||
/**
|
||||
+ * Alternative Device I/O Control entry point on hosts with SMAP support.
|
||||
+ *
|
||||
+ * @returns depends...
|
||||
+ * @param pDev The device.
|
||||
+ * @param ulCmd The command.
|
||||
+ * @param pvData Pointer to the data.
|
||||
+ * @param fFile The file descriptor flags.
|
||||
+ * @param pTd The calling thread.
|
||||
+ */
|
||||
+static int VBoxDrvFreeBSDIOCtlSMAP(struct cdev *pDev, u_long ulCmd, caddr_t pvData, int fFile, struct thread *pTd)
|
||||
+{
|
||||
+ /*
|
||||
+ * Allow VBox R0 code to touch R3 memory. Setting the AC bit disables the
|
||||
+ * SMAP check.
|
||||
+ */
|
||||
+ RTCCUINTREG fSavedEfl = ASMAddFlags(X86_EFL_AC);
|
||||
+
|
||||
+ int rc = VBoxDrvFreeBSDIOCtl(pDev, ulCmd, pvData, fFile, pTd);
|
||||
+
|
||||
+#ifdef VBOX_WITH_EFLAGS_AC_SET_IN_VBOXDRV
|
||||
+ /*
|
||||
+ * Before we restore AC and the rest of EFLAGS, check if the IOCtl handler code
|
||||
+ * accidentially modified it or some other important flag.
|
||||
+ */
|
||||
+ if (RT_UNLIKELY( (ASMGetFlags() & (X86_EFL_AC | X86_EFL_IF | X86_EFL_DF | X86_EFL_IOPL))
|
||||
+ != ((fSavedEfl & (X86_EFL_AC | X86_EFL_IF | X86_EFL_DF | X86_EFL_IOPL)) | X86_EFL_AC) ))
|
||||
+ {
|
||||
+ char szTmp[48];
|
||||
+ RTStrPrintf(szTmp, sizeof(szTmp), "ulCmd=%#x: %#x->%#x!", ulCmd, (uint32_t)fSavedEfl, (uint32_t)ASMGetFlags());
|
||||
+ supdrvBadContext(&g_VBoxDrvFreeBSDDevExt, "SUPDrv-freebsd.c", __LINE__, szTmp);
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
+ ASMSetFlags(fSavedEfl);
|
||||
+ return rc;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/**
|
||||
* Deal with the 'slow' I/O control requests.
|
||||
*
|
||||
* @returns 0 on success, appropriate errno on failure.
|
||||
@@ -372,11 +438,10 @@ static int VBoxDrvFreeBSDIOCtlSlow(PSUPDRVSESSION pSes
|
||||
*/
|
||||
SUPREQHDR Hdr;
|
||||
pvUser = *(void **)pvData;
|
||||
- int rc = copyin(pvUser, &Hdr, sizeof(Hdr));
|
||||
- if (RT_UNLIKELY(rc))
|
||||
+ if (RT_FAILURE(RTR0MemUserCopyFrom(&Hdr, (uintptr_t)pvUser, sizeof(Hdr))))
|
||||
{
|
||||
- OSDBGPRINT(("VBoxDrvFreeBSDIOCtlSlow: copyin(%p,Hdr,) -> %#x; ulCmd=%#lx\n", pvUser, rc, ulCmd));
|
||||
- return rc;
|
||||
+ OSDBGPRINT(("VBoxDrvFreeBSDIOCtlSlow: copyin(%p,Hdr,); ulCmd=%#lx\n", pvUser, ulCmd));
|
||||
+ return EFAULT;
|
||||
}
|
||||
if (RT_UNLIKELY((Hdr.fFlags & SUPREQHDR_FLAGS_MAGIC_MASK) != SUPREQHDR_FLAGS_MAGIC))
|
||||
{
|
||||
@@ -401,13 +466,12 @@ static int VBoxDrvFreeBSDIOCtlSlow(PSUPDRVSESSION pSes
|
||||
OSDBGPRINT(("VBoxDrvFreeBSDIOCtlSlow: failed to allocate buffer of %d bytes; ulCmd=%#lx\n", cbReq, ulCmd));
|
||||
return ENOMEM;
|
||||
}
|
||||
- rc = copyin(pvUser, pHdr, Hdr.cbIn);
|
||||
- if (RT_UNLIKELY(rc))
|
||||
+ if (RT_FAILURE(RTR0MemUserCopyFrom(pHdr, (uintptr_t)pvUser, Hdr.cbIn)))
|
||||
{
|
||||
- OSDBGPRINT(("VBoxDrvFreeBSDIOCtlSlow: copyin(%p,%p,%#x) -> %#x; ulCmd=%#lx\n",
|
||||
- pvUser, pHdr, Hdr.cbIn, rc, ulCmd));
|
||||
+ OSDBGPRINT(("VBoxDrvFreeBSDIOCtlSlow: copyin(%p,%p,%#x); ulCmd=%#lx\n",
|
||||
+ pvUser, pHdr, Hdr.cbIn, ulCmd));
|
||||
RTMemTmpFree(pHdr);
|
||||
- return rc;
|
||||
+ return EFAULT;
|
||||
}
|
||||
if (Hdr.cbIn < cbReq)
|
||||
RT_BZERO((uint8_t *)pHdr + Hdr.cbIn, cbReq - Hdr.cbIn);
|
||||
@@ -435,9 +499,8 @@ static int VBoxDrvFreeBSDIOCtlSlow(PSUPDRVSESSION pSes
|
||||
OSDBGPRINT(("VBoxDrvFreeBSDIOCtlSlow: too much output! %#x > %#x; uCmd=%#lx!\n", cbOut, cbReq, ulCmd));
|
||||
cbOut = cbReq;
|
||||
}
|
||||
- rc = copyout(pHdr, pvUser, cbOut);
|
||||
- if (RT_UNLIKELY(rc))
|
||||
- OSDBGPRINT(("VBoxDrvFreeBSDIOCtlSlow: copyout(%p,%p,%#x) -> %d; uCmd=%#lx!\n", pHdr, pvUser, cbOut, rc, ulCmd));
|
||||
+ if (RT_FAILURE(RTR0MemUserCopyTo((uintptr_t)pvUser, pHdr, cbOut)))
|
||||
+ OSDBGPRINT(("VBoxDrvFreeBSDIOCtlSlow: copyout(%p,%p,%#x); uCmd=%#lx!\n", pHdr, pvUser, cbOut, ulCmd));
|
||||
|
||||
Log(("VBoxDrvFreeBSDIOCtlSlow: returns %d / %d ulCmd=%lx\n", 0, pHdr->rc, ulCmd));
|
||||
|
||||
@@ -540,8 +603,7 @@ bool VBOXCALL supdrvOSAreCpusOfflinedOnSuspend(void)
|
||||
|
||||
bool VBOXCALL supdrvOSAreCpusOfflinedOnSuspend(void)
|
||||
{
|
||||
- /** @todo verify this. */
|
||||
- return false;
|
||||
+ return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -624,20 +686,44 @@ int VBOXCALL supdrvOSMsrProberModify(RTCPUID idCpu,
|
||||
#endif /* SUPDRV_WITH_MSR_PROBER */
|
||||
|
||||
|
||||
+/**
|
||||
+ * Check if the CPU has SMAP support.
|
||||
+ */
|
||||
+static bool VBoxDrvFreeBSDCpuHasSMAP(void)
|
||||
+{
|
||||
+#ifdef VBOX_WITH_EFLAGS_AC_SET_IN_VBOXDRV
|
||||
+ if ((cpu_stdext_feature & CPUID_STDEXT_SMAP) != 0)
|
||||
+ return true;
|
||||
+#endif
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
+
|
||||
SUPR0DECL(int) SUPR0PrintfV(const char *pszFormat, va_list va)
|
||||
{
|
||||
char szMsg[256];
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
+
|
||||
RTStrPrintfV(szMsg, sizeof(szMsg), pszFormat, va);
|
||||
szMsg[sizeof(szMsg) - 1] = '\0';
|
||||
|
||||
printf("%s", szMsg);
|
||||
+
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
SUPR0DECL(uint32_t) SUPR0GetKernelFeatures(void)
|
||||
{
|
||||
- return 0;
|
||||
+ uint32_t fFlags = 0;
|
||||
+#ifdef VBOX_WITH_EFLAGS_AC_SET_IN_VBOXDRV
|
||||
+ if (g_VBoxDrvFreeBSDChrDevSwSys.d_ioctl == VBoxDrvFreeBSDIOCtlSMAP)
|
||||
+ fFlags |= SUPKERNELFEATURES_SMAP;
|
||||
+ else
|
||||
+ Assert(!(ASMGetCR4() & X86_CR4_SMAP));
|
||||
+#endif
|
||||
+ return fFlags;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
--- src/VBox/HostDrivers/Support/freebsd/files_vboxdrv.orig 2021-10-18 17:58:03 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,16 +129,17 @@ 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/RTStrFormat.cpp=>common/string/RTStrFormat.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/strprintf-ellipsis.cpp=>common/string/strprintf-ellipsis.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 \
|
|
@ -0,0 +1,11 @@
|
|||
--- src/VBox/HostDrivers/VBoxNetAdp/freebsd/Makefile.orig 2019-05-13 13:33:07 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
|
|
@ -0,0 +1,147 @@
|
|||
--- src/VBox/HostDrivers/VBoxNetAdp/freebsd/VBoxNetAdp-freebsd.c.orig 2024-01-11 12:25:08 UTC
|
||||
+++ src/VBox/HostDrivers/VBoxNetAdp/freebsd/VBoxNetAdp-freebsd.c
|
||||
@@ -216,7 +216,11 @@ static void VBoxNetAdpFreeBSDNetinit(void *priv)
|
||||
PVBOXNETADP pThis = priv;
|
||||
struct ifnet *ifp = pThis->u.s.ifp;
|
||||
|
||||
+#if __FreeBSD_version >= 1500000
|
||||
+ if_setdrvflagbits(ifp, IFF_DRV_RUNNING, 0);
|
||||
+#else
|
||||
ifp->if_drv_flags |= IFF_DRV_RUNNING;
|
||||
+#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -226,25 +230,46 @@ static void VBoxNetAdpFreeBSDNetstart(struct ifnet *if
|
||||
*/
|
||||
static void VBoxNetAdpFreeBSDNetstart(struct ifnet *ifp)
|
||||
{
|
||||
+#if __FreeBSD_version >= 1500000
|
||||
+ PVBOXNETADP pThis = if_getsoftc(ifp);
|
||||
+#else
|
||||
PVBOXNETADP pThis = ifp->if_softc;
|
||||
+#endif
|
||||
struct mbuf *m;
|
||||
|
||||
+#if __FreeBSD_version >= 1500000
|
||||
+ if ((if_getdrvflags(ifp) & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != IFF_DRV_RUNNING)
|
||||
+#else
|
||||
if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != IFF_DRV_RUNNING)
|
||||
+#endif
|
||||
return;
|
||||
|
||||
+#if __FreeBSD_version >= 1500000
|
||||
+ if_setdrvflagbits(ifp, IFF_DRV_OACTIVE, 0);
|
||||
+ while (!if_sendq_empty(ifp))
|
||||
+#else
|
||||
ifp->if_drv_flags |= IFF_DRV_OACTIVE;
|
||||
while (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
|
||||
+#endif
|
||||
{
|
||||
#if __FreeBSD_version >= 1100036
|
||||
if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
|
||||
#else
|
||||
ifp->if_opackets++;
|
||||
#endif
|
||||
+#if __FreeBSD_version >= 1500000
|
||||
+ m = if_dequeue(ifp);
|
||||
+#else
|
||||
IFQ_DRV_DEQUEUE(&ifp->if_snd, m);
|
||||
+#endif
|
||||
BPF_MTAP(ifp, m);
|
||||
m_freem(m);
|
||||
}
|
||||
+#if __FreeBSD_version >= 1500000
|
||||
+ if_setdrvflagbits(ifp, 0, IFF_DRV_OACTIVE);
|
||||
+#else
|
||||
ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
|
||||
+#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -257,6 +282,18 @@ static int VBoxNetAdpFreeBSDNetioctl(struct ifnet *ifp
|
||||
switch (cmd)
|
||||
{
|
||||
case SIOCSIFFLAGS:
|
||||
+#if __FreeBSD_version >= 1500000
|
||||
+ if (if_getflags(ifp) & IFF_UP)
|
||||
+ {
|
||||
+ if (!(if_getdrvflags(ifp) & IFF_DRV_RUNNING))
|
||||
+ if_init(ifp, if_getsoftc(ifp));
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ if (if_getdrvflags(ifp) & IFF_DRV_RUNNING)
|
||||
+ if_setdrvflagbits(ifp, 0, IFF_DRV_RUNNING);
|
||||
+ }
|
||||
+#else
|
||||
if (ifp->if_flags & IFF_UP)
|
||||
{
|
||||
if (!(ifp->if_drv_flags & IFF_DRV_RUNNING))
|
||||
@@ -267,6 +304,7 @@ static int VBoxNetAdpFreeBSDNetioctl(struct ifnet *ifp
|
||||
if (ifp->if_drv_flags & IFF_DRV_RUNNING)
|
||||
ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
|
||||
}
|
||||
+#endif
|
||||
break;
|
||||
case SIOCGIFMEDIA:
|
||||
{
|
||||
@@ -301,7 +339,11 @@ int vboxNetAdpOsCreate(PVBOXNETADP pThis, PCRTMAC pMac
|
||||
|
||||
int vboxNetAdpOsCreate(PVBOXNETADP pThis, PCRTMAC pMac)
|
||||
{
|
||||
+#if __FreeBSD_version >= 1500000
|
||||
+ if_t ifp;
|
||||
+#else
|
||||
struct ifnet *ifp;
|
||||
+#endif
|
||||
|
||||
VBOXCURVNET_SET_FROM_UCRED();
|
||||
ifp = if_alloc(IFT_ETHER);
|
||||
@@ -309,6 +351,16 @@ int vboxNetAdpOsCreate(PVBOXNETADP pThis, PCRTMAC pMac
|
||||
return VERR_NO_MEMORY;
|
||||
|
||||
if_initname(ifp, VBOXNETADP_NAME, pThis->iUnit);
|
||||
+#if __FreeBSD_version >= 1500000
|
||||
+ if_setsoftc(ifp, pThis);
|
||||
+ if_setmtu(ifp, ETHERMTU);
|
||||
+ if_setflagbits(ifp, IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST, 0);
|
||||
+ if_setioctlfn(ifp, VBoxNetAdpFreeBSDNetioctl);
|
||||
+ if_setstartfn(ifp, VBoxNetAdpFreeBSDNetstart);
|
||||
+ if_setinitfn(ifp, VBoxNetAdpFreeBSDNetinit);
|
||||
+ if_setsendqlen(ifp, IFQ_MAXLEN);
|
||||
+ if_setsendqready(ifp);
|
||||
+#else
|
||||
ifp->if_softc = pThis;
|
||||
ifp->if_mtu = ETHERMTU;
|
||||
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
|
||||
@@ -318,10 +370,17 @@ int vboxNetAdpOsCreate(PVBOXNETADP pThis, PCRTMAC pMac
|
||||
IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN);
|
||||
ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN;
|
||||
IFQ_SET_READY(&ifp->if_snd);
|
||||
+#endif
|
||||
ether_ifattach(ifp, (void *)pMac);
|
||||
+#if __FreeBSD_version >= 1500000
|
||||
+ (void)if_setbaudrate(ifp, 0);
|
||||
+
|
||||
+ strncpy(pThis->szName, if_name(ifp), VBOXNETADP_MAX_NAME_LEN);
|
||||
+#else
|
||||
ifp->if_baudrate = 0;
|
||||
|
||||
strncpy(pThis->szName, ifp->if_xname, VBOXNETADP_MAX_NAME_LEN);
|
||||
+#endif
|
||||
pThis->u.s.ifp = ifp;
|
||||
VBOXCURVNET_RESTORE();
|
||||
return 0;
|
||||
@@ -332,7 +391,11 @@ void vboxNetAdpOsDestroy(PVBOXNETADP pThis)
|
||||
struct ifnet *ifp;
|
||||
|
||||
ifp = pThis->u.s.ifp;
|
||||
+#if __FreeBSD_version >= 1500000
|
||||
+ VBOXCURVNET_SET(if_getvnet(ifp));
|
||||
+#else
|
||||
VBOXCURVNET_SET(ifp->if_vnet);
|
||||
+#endif
|
||||
ether_ifdetach(ifp);
|
||||
if_free(ifp);
|
||||
VBOXCURVNET_RESTORE();
|
|
@ -0,0 +1,11 @@
|
|||
--- src/VBox/HostDrivers/VBoxNetFlt/Makefile.kmk.orig 2019-05-13 13:33:07 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
|
|
@ -0,0 +1,11 @@
|
|||
--- src/VBox/HostDrivers/VBoxNetFlt/freebsd/Makefile.orig 2019-05-13 13:33:07 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
|
|
@ -0,0 +1,471 @@
|
|||
--- src/VBox/HostDrivers/VBoxNetFlt/freebsd/VBoxNetFlt-freebsd.c.orig 2024-01-11 12:25:08 UTC
|
||||
+++ src/VBox/HostDrivers/VBoxNetFlt/freebsd/VBoxNetFlt-freebsd.c
|
||||
@@ -52,6 +52,7 @@
|
||||
#include <net/if_dl.h>
|
||||
#include <net/if_types.h>
|
||||
#include <net/ethernet.h>
|
||||
+#include <net/if_vlan_var.h>
|
||||
|
||||
#include <netgraph/ng_message.h>
|
||||
#include <netgraph/netgraph.h>
|
||||
@@ -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;
|
||||
@@ -149,6 +151,7 @@ MODULE_DEPEND(ng_vboxnetflt, vboxdrv, 1, 1, 1);
|
||||
*/
|
||||
MODULE_VERSION(vboxnetflt, 1);
|
||||
MODULE_DEPEND(ng_vboxnetflt, vboxdrv, 1, 1, 1);
|
||||
+MODULE_DEPEND(ng_vboxnetflt, ng_ether, 1, 1, 1);
|
||||
|
||||
/**
|
||||
* The (common) global data.
|
||||
@@ -181,8 +184,6 @@ static int vboxnetflt_modevent(struct module *pMod, in
|
||||
printf("vboxNetFltInitGlobalsAndIdc failed %d\n", rc);
|
||||
return RTErrConvertToErrno(rc);
|
||||
}
|
||||
- /* No MODULE_VERSION in ng_ether so we can't MODULE_DEPEND it */
|
||||
- kern_kldload(curthread, "ng_ether", NULL);
|
||||
break;
|
||||
|
||||
case MOD_UNLOAD:
|
||||
@@ -334,12 +335,20 @@ static int ng_vboxnetflt_rcvdata(hook_p hook, item_p i
|
||||
{
|
||||
const node_p node = NG_HOOK_NODE(hook);
|
||||
PVBOXNETFLTINS pThis = NG_NODE_PRIVATE(node);
|
||||
+#if __FreeBSD_version >= 1500000
|
||||
+ if_t ifp = pThis->u.s.ifp;
|
||||
+#else
|
||||
struct ifnet *ifp = pThis->u.s.ifp;
|
||||
+#endif
|
||||
struct mbuf *m;
|
||||
struct m_tag *mtag;
|
||||
bool fActive;
|
||||
|
||||
+#if __FreeBSD_version >= 1500000
|
||||
+ VBOXCURVNET_SET(if_getvnet(ifp));
|
||||
+#else
|
||||
VBOXCURVNET_SET(ifp->if_vnet);
|
||||
+#endif
|
||||
fActive = vboxNetFltTryRetainBusyActive(pThis);
|
||||
|
||||
NGI_GET_M(item, m);
|
||||
@@ -361,7 +370,14 @@ static int ng_vboxnetflt_rcvdata(hook_p hook, item_p i
|
||||
{
|
||||
if (mtag != NULL || !fActive)
|
||||
{
|
||||
+#if __FreeBSD_version >= 1300049
|
||||
+ struct epoch_tracker et;
|
||||
+ NET_EPOCH_ENTER(et);
|
||||
+#endif
|
||||
ether_demux(ifp, m);
|
||||
+#if __FreeBSD_version >= 1300049
|
||||
+ NET_EPOCH_EXIT(et);
|
||||
+#endif
|
||||
if (fActive)
|
||||
vboxNetFltRelease(pThis, true /*fBusy*/);
|
||||
VBOXCURVNET_RESTORE();
|
||||
@@ -433,12 +449,22 @@ static void vboxNetFltFreeBSDinput(void *arg, int pend
|
||||
{
|
||||
PVBOXNETFLTINS pThis = (PVBOXNETFLTINS)arg;
|
||||
struct mbuf *m, *m0;
|
||||
+#if __FreeBSD_version >= 1500000
|
||||
+ if_t ifp = pThis->u.s.ifp;
|
||||
+#else
|
||||
struct ifnet *ifp = pThis->u.s.ifp;
|
||||
+#endif
|
||||
unsigned int cSegs = 0;
|
||||
bool fDropIt = false, fActive;
|
||||
+ bool is_vl_tagged = false;
|
||||
+ uint16_t vl_tag;
|
||||
PINTNETSG pSG;
|
||||
|
||||
+#if __FreeBSD_version >= 1500000
|
||||
+ VBOXCURVNET_SET(if_getvnet(ifp));
|
||||
+#else
|
||||
VBOXCURVNET_SET(ifp->if_vnet);
|
||||
+#endif
|
||||
vboxNetFltRetain(pThis, true /* fBusy */);
|
||||
for (;;)
|
||||
{
|
||||
@@ -448,6 +474,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,10 +501,39 @@ 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
|
||||
+ else {
|
||||
+#if __FreeBSD_version >= 1300049
|
||||
+ struct epoch_tracker et;
|
||||
+ NET_EPOCH_ENTER(et);
|
||||
+#endif
|
||||
ether_demux(ifp, m);
|
||||
+#if __FreeBSD_version >= 1300049
|
||||
+ NET_EPOCH_EXIT(et);
|
||||
+#endif
|
||||
+ }
|
||||
}
|
||||
vboxNetFltRelease(pThis, true /* fBusy */);
|
||||
VBOXCURVNET_RESTORE();
|
||||
@@ -478,12 +546,20 @@ static void vboxNetFltFreeBSDoutput(void *arg, int pen
|
||||
{
|
||||
PVBOXNETFLTINS pThis = (PVBOXNETFLTINS)arg;
|
||||
struct mbuf *m, *m0;
|
||||
+#if __FreeBSD_version >= 1500000
|
||||
+ if_t ifp = pThis->u.s.ifp;
|
||||
+#else
|
||||
struct ifnet *ifp = pThis->u.s.ifp;
|
||||
+#endif
|
||||
unsigned int cSegs = 0;
|
||||
bool fDropIt = false, fActive;
|
||||
PINTNETSG pSG;
|
||||
|
||||
+#if __FreeBSD_version >= 1500000
|
||||
+ VBOXCURVNET_SET(if_getvnet(ifp));
|
||||
+#else
|
||||
VBOXCURVNET_SET(ifp->if_vnet);
|
||||
+#endif
|
||||
vboxNetFltRetain(pThis, true /* fBusy */);
|
||||
for (;;)
|
||||
{
|
||||
@@ -521,26 +597,41 @@ int vboxNetFltPortOsXmit(PVBOXNETFLTINS pThis, void *p
|
||||
*/
|
||||
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 *);
|
||||
+#if __FreeBSD_version >= 1500000
|
||||
+ if_t ifp;
|
||||
+#else
|
||||
struct ifnet *ifp;
|
||||
+#endif
|
||||
struct mbuf *m;
|
||||
struct m_tag *mtag;
|
||||
bool fActive;
|
||||
int error;
|
||||
|
||||
ifp = ASMAtomicUoReadPtrT(&pThis->u.s.ifp, struct ifnet *);
|
||||
+#if __FreeBSD_version >= 1500000
|
||||
+ VBOXCURVNET_SET(if_getvnet(ifp));
|
||||
+#else
|
||||
VBOXCURVNET_SET(ifp->if_vnet);
|
||||
+#endif
|
||||
|
||||
if (fDst & INTNETTRUNKDIR_WIRE)
|
||||
{
|
||||
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 +641,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 +661,7 @@ int vboxNetFltPortOsXmit(PVBOXNETFLTINS pThis, void *p
|
||||
if (mtag == NULL)
|
||||
{
|
||||
m_freem(m);
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
return VERR_NO_MEMORY;
|
||||
}
|
||||
|
||||
@@ -571,9 +669,21 @@ int vboxNetFltPortOsXmit(PVBOXNETFLTINS pThis, void *p
|
||||
m_tag_prepend(m, mtag);
|
||||
m->m_flags |= M_PKTHDR;
|
||||
m->m_pkthdr.rcvif = ifp;
|
||||
+#if __FreeBSD_version >= 1300049
|
||||
+ struct epoch_tracker et;
|
||||
+ NET_EPOCH_ENTER(et);
|
||||
+#endif
|
||||
+#if __FreeBSD_version >= 1500000
|
||||
+ if_input(ifp, m);
|
||||
+#else
|
||||
ifp->if_input(ifp, m);
|
||||
+#endif
|
||||
+#if __FreeBSD_version >= 1300049
|
||||
+ NET_EPOCH_EXIT(et);
|
||||
+#endif
|
||||
}
|
||||
VBOXCURVNET_RESTORE();
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
return VINF_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -586,15 +696,23 @@ int vboxNetFltOsInitInstance(PVBOXNETFLTINS pThis, voi
|
||||
|
||||
int vboxNetFltOsInitInstance(PVBOXNETFLTINS pThis, void *pvContext)
|
||||
{
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
char nam[NG_NODESIZ];
|
||||
+#if __FreeBSD_version >= 1500000
|
||||
+ if_t ifp;
|
||||
+#else
|
||||
struct ifnet *ifp;
|
||||
+#endif
|
||||
node_p node;
|
||||
|
||||
VBOXCURVNET_SET_FROM_UCRED();
|
||||
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)
|
||||
@@ -604,7 +722,11 @@ int vboxNetFltOsInitInstance(PVBOXNETFLTINS pThis, voi
|
||||
|
||||
ASMAtomicUoWritePtr(&pThis->u.s.ifp, ifp);
|
||||
pThis->u.s.node = node;
|
||||
+#if __FreeBSD_version >= 1500000
|
||||
+ bcopy(if_getlladdr(ifp), &pThis->u.s.MacAddr, ETHER_ADDR_LEN);
|
||||
+#else
|
||||
bcopy(IF_LLADDR(ifp), &pThis->u.s.MacAddr, ETHER_ADDR_LEN);
|
||||
+#endif
|
||||
ASMAtomicUoWriteBool(&pThis->fDisconnectedFromHost, false);
|
||||
|
||||
/* Initialize deferred input queue */
|
||||
@@ -638,16 +760,26 @@ 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();
|
||||
+#if __FreeBSD_version >= 1500000
|
||||
+ if_t ifp, ifp0;
|
||||
+#else
|
||||
struct ifnet *ifp, *ifp0;
|
||||
+#endif
|
||||
|
||||
ifp = ASMAtomicUoReadPtrT(&pThis->u.s.ifp, struct ifnet *);
|
||||
+#if __FreeBSD_version >= 1500000
|
||||
+ VBOXCURVNET_SET(if_getvnet(ifp));
|
||||
+#else
|
||||
VBOXCURVNET_SET(ifp->if_vnet);
|
||||
+#endif
|
||||
/*
|
||||
* Attempt to check if the interface is still there and re-initialize if
|
||||
* something has changed.
|
||||
@@ -660,6 +792,7 @@ bool vboxNetFltOsMaybeRediscovered(PVBOXNETFLTINS pThi
|
||||
pThis->u.s.node = NULL;
|
||||
}
|
||||
VBOXCURVNET_RESTORE();
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
|
||||
if (ifp0 != NULL)
|
||||
{
|
||||
@@ -672,6 +805,7 @@ void vboxNetFltOsDeleteInstance(PVBOXNETFLTINS pThis)
|
||||
|
||||
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 +818,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,7 +832,12 @@ void vboxNetFltPortOsSetActive(PVBOXNETFLTINS pThis, b
|
||||
|
||||
void vboxNetFltPortOsSetActive(PVBOXNETFLTINS pThis, bool fActive)
|
||||
{
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
+#if __FreeBSD_version >= 1500000
|
||||
+ if_t ifp;
|
||||
+#else
|
||||
struct ifnet *ifp;
|
||||
+#endif
|
||||
struct ifreq ifreq;
|
||||
int error;
|
||||
node_p node;
|
||||
@@ -709,18 +849,30 @@ void vboxNetFltPortOsSetActive(PVBOXNETFLTINS pThis, b
|
||||
Log(("%s: fActive:%d\n", __func__, fActive));
|
||||
|
||||
ifp = ASMAtomicUoReadPtrT(&pThis->u.s.ifp, struct ifnet *);
|
||||
+#if __FreeBSD_version >= 1500000
|
||||
+ VBOXCURVNET_SET(if_getvnet(ifp));
|
||||
+#else
|
||||
VBOXCURVNET_SET(ifp->if_vnet);
|
||||
+#endif
|
||||
node = ASMAtomicUoReadPtrT(&pThis->u.s.node, node_p);
|
||||
|
||||
memset(&ifreq, 0, sizeof(struct ifreq));
|
||||
/* Activate interface */
|
||||
if (fActive)
|
||||
{
|
||||
+#if __FreeBSD_version >= 1500000
|
||||
+ pThis->u.s.flags = if_getflags(ifp);
|
||||
+#else
|
||||
pThis->u.s.flags = ifp->if_flags;
|
||||
+#endif
|
||||
ifpromisc(ifp, 1);
|
||||
|
||||
/* ng_ether nodes are named after the interface name */
|
||||
+#if __FreeBSD_version >= 1500000
|
||||
+ snprintf(path, sizeof(path), "%s:", if_name(ifp));
|
||||
+#else
|
||||
snprintf(path, sizeof(path), "%s:", ifp->if_xname);
|
||||
+#endif
|
||||
|
||||
/*
|
||||
* Send a netgraph connect message to the ng_ether node
|
||||
@@ -730,9 +882,16 @@ 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;
|
||||
+#if __FreeBSD_version >= 1500000
|
||||
+ snprintf(con->path, NG_PATHSIZ, "vboxnetflt_%s:", if_name(ifp));
|
||||
+#else
|
||||
snprintf(con->path, NG_PATHSIZ, "vboxnetflt_%s:", ifp->if_xname);
|
||||
+#endif
|
||||
strlcpy(con->ourhook, "lower", NG_HOOKSIZ);
|
||||
strlcpy(con->peerhook, "input", NG_HOOKSIZ);
|
||||
NG_SEND_MSG_PATH(error, node, msg, path, 0);
|
||||
@@ -744,10 +903,17 @@ 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:",
|
||||
+#if __FreeBSD_version >= 1500000
|
||||
+ if_name(ifp));
|
||||
+#else
|
||||
ifp->if_xname);
|
||||
+#endif
|
||||
strlcpy(con->ourhook, "upper", sizeof(con->ourhook));
|
||||
strlcpy(con->peerhook, "output", sizeof(con->peerhook));
|
||||
NG_SEND_MSG_PATH(error, node, msg, path, 0);
|
||||
@@ -759,7 +925,11 @@ void vboxNetFltPortOsSetActive(PVBOXNETFLTINS pThis, b
|
||||
ifpromisc(ifp, 0);
|
||||
|
||||
/* Disconnect msgs are addressed to ourself */
|
||||
+#if __FreeBSD_version >= 1500000
|
||||
+ snprintf(path, sizeof(path), "vboxnetflt_%s:", if_name(ifp));
|
||||
+#else
|
||||
snprintf(path, sizeof(path), "vboxnetflt_%s:", ifp->if_xname);
|
||||
+#endif
|
||||
|
||||
/*
|
||||
* Send a netgraph message to disconnect our 'input' hook
|
||||
@@ -767,7 +937,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 +951,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)
|
|
@ -0,0 +1,11 @@
|
|||
--- src/VBox/HostDrivers/adpctl/VBoxNetAdpCtl.cpp.orig 2022-01-13 18:57:40 UTC
|
||||
+++ src/VBox/HostDrivers/adpctl/VBoxNetAdpCtl.cpp
|
||||
@@ -737,7 +737,7 @@ int Adapter::doIOCtl(unsigned long iCmd, VBOXNETADPREQ
|
||||
* Global config file implementation *
|
||||
*********************************************************************************************************************************/
|
||||
|
||||
-#define VBOX_GLOBAL_NETWORK_CONFIG_PATH "/etc/vbox/networks.conf"
|
||||
+#define VBOX_GLOBAL_NETWORK_CONFIG_PATH "%%VBOX_ETC%%/networks.conf"
|
||||
#define VBOXNET_DEFAULT_IPV4MASK "255.255.255.0"
|
||||
|
||||
class NetworkAddress
|
|
@ -0,0 +1,10 @@
|
|||
--- src/VBox/Main/Makefile.kmk.orig 2021-01-07 15:41:36 UTC
|
||||
+++ src/VBox/Main/Makefile.kmk
|
||||
@@ -646,6 +646,7 @@ VBoxSVC_SOURCES.os2 = \
|
||||
|
||||
VBoxSVC_SOURCES.freebsd = \
|
||||
src-server/freebsd/HostHardwareFreeBSD.cpp \
|
||||
+ $(if $(VBOX_WITH_DBUS),src-server/linux/HostPowerLinux.cpp) \
|
||||
src-server/HostDnsServiceResolvConf.cpp
|
||||
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
--- src/VBox/Main/include/HostPower.h.orig 2021-01-07 15:41:38 UTC
|
||||
+++ src/VBox/Main/include/HostPower.h
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
-#ifdef RT_OS_LINUX
|
||||
+#if defined(RT_OS_LINUX) || defined(RT_OS_FREEBSD)
|
||||
# include <VBox/dbus.h>
|
||||
#endif
|
||||
|
||||
@@ -67,7 +67,7 @@ class HostPowerServiceWin : public HostPowerService (p
|
||||
RTTHREAD mThread;
|
||||
};
|
||||
# endif
|
||||
-# if defined(RT_OS_LINUX) || defined(DOXYGEN_RUNNING)
|
||||
+# if defined(RT_OS_LINUX) || defined(RT_OS_FREEBSD) || defined(DOXYGEN_RUNNING)
|
||||
/**
|
||||
* The Linux hosted Power Service.
|
||||
*/
|
|
@ -0,0 +1,11 @@
|
|||
--- src/VBox/Main/src-server/HostImpl.cpp.orig 2021-01-07 15:41:42 UTC
|
||||
+++ src/VBox/Main/src-server/HostImpl.cpp
|
||||
@@ -286,7 +286,7 @@ HRESULT Host::init(VirtualBox *aParent)
|
||||
|
||||
#if defined(RT_OS_WINDOWS)
|
||||
m->pHostPowerService = new HostPowerServiceWin(m->pParent);
|
||||
-#elif defined(RT_OS_LINUX) && defined(VBOX_WITH_DBUS)
|
||||
+#elif (defined(RT_OS_LINUX) || defined(RT_OS_FREEBSD)) && defined(VBOX_WITH_DBUS)
|
||||
m->pHostPowerService = new HostPowerServiceLinux(m->pParent);
|
||||
#elif defined(RT_OS_DARWIN)
|
||||
m->pHostPowerService = new HostPowerServiceDarwin(m->pParent);
|
|
@ -0,0 +1,24 @@
|
|||
--- src/VBox/Main/src-server/freebsd/PerformanceFreeBSD.cpp.orig 2017-07-27 13:18:27 UTC
|
||||
+++ src/VBox/Main/src-server/freebsd/PerformanceFreeBSD.cpp
|
||||
@@ -80,8 +80,10 @@ int CollectorFreeBSD::getHostMemoryUsage(ULONG *total,
|
||||
cbParameter = sizeof(cPagesMemInactive);
|
||||
if (!sysctlbyname("vm.stats.vm.v_inactive_count", &cPagesMemInactive, &cbParameter, NULL, 0))
|
||||
cProcessed++;
|
||||
+#if __FreeBSD_version < 1200016
|
||||
cbParameter = sizeof(cPagesMemCached);
|
||||
if (!sysctlbyname("vm.stats.vm.v_cache_count", &cPagesMemCached, &cbParameter, NULL, 0))
|
||||
+#endif
|
||||
cProcessed++;
|
||||
cbParameter = sizeof(cbPage);
|
||||
if (!sysctlbyname("hw.pagesize", &cbPage, &cbParameter, NULL, 0))
|
||||
@@ -90,8 +92,8 @@ int CollectorFreeBSD::getHostMemoryUsage(ULONG *total,
|
||||
if (cProcessed == 6)
|
||||
{
|
||||
*total = cbMemPhys / _1K;
|
||||
- *used = cPagesMemUsed * (cbPage / _1K);
|
||||
- *available = (cPagesMemFree + cPagesMemInactive + cPagesMemCached ) * (cbPage / _1K);
|
||||
+ *used = (uint64_t)cPagesMemUsed * (cbPage / _1K);
|
||||
+ *available = ((uint64_t)cPagesMemFree + cPagesMemInactive + cPagesMemCached) * (cbPage / _1K);
|
||||
}
|
||||
else
|
||||
rc = VERR_NOT_SUPPORTED;
|
|
@ -0,0 +1,11 @@
|
|||
--- src/VBox/NetworkServices/Dhcpd/VBoxNetDhcpd.cpp.orig 2021-01-07 15:41:46 UTC
|
||||
+++ src/VBox/NetworkServices/Dhcpd/VBoxNetDhcpd.cpp
|
||||
@@ -394,7 +394,7 @@ void VBoxNetDhcpd::ifPump()
|
||||
WaitReq.Hdr.cbReq = sizeof(WaitReq);
|
||||
WaitReq.pSession = m_pSession;
|
||||
WaitReq.hIf = m_hIf;
|
||||
- WaitReq.cMillies = RT_INDEFINITE_WAIT;
|
||||
+ WaitReq.cMillies = 2000;
|
||||
int rc = CALL_VMMR0(VMMR0_DO_INTNET_IF_WAIT, WaitReq);
|
||||
|
||||
/*
|
|
@ -0,0 +1,13 @@
|
|||
--- src/VBox/RDP/client-1.8.4/Makefile.kmk.orig 2021-01-07 15:41:47 UTC
|
||||
+++ src/VBox/RDP/client-1.8.4/Makefile.kmk
|
||||
@@ -117,8 +117,8 @@ rdesktop-vrdp_SOURCES.solaris = \
|
||||
rdesktop-vrdp_SOURCES.freebsd = \
|
||||
rdpsnd_oss.c
|
||||
rdesktop-vrdp_LIBPATH = \
|
||||
- /usr/lib \
|
||||
- $(VBOX_LIBPATH_X11)
|
||||
+ $(VBOX_LIBPATH_X11)/lib \
|
||||
+ /usr/lib
|
||||
rdesktop-vrdp_LIBS = \
|
||||
X11 \
|
||||
$(LIB_RUNTIME)
|
|
@ -0,0 +1,73 @@
|
|||
--- src/VBox/Runtime/r0drv/freebsd/alloc-r0drv-freebsd.c.orig 2021-01-07 15:42:08 UTC
|
||||
+++ src/VBox/Runtime/r0drv/freebsd/alloc-r0drv-freebsd.c
|
||||
@@ -78,6 +78,7 @@ MALLOC_DEFINE(M_IPRTCONT, "iprtcont", "IPRT - contiguo
|
||||
|
||||
DECLHIDDEN(int) rtR0MemAllocEx(size_t cb, uint32_t fFlags, PRTMEMHDR *ppHdr)
|
||||
{
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
size_t cbAllocated = cb;
|
||||
PRTMEMHDR pHdr = NULL;
|
||||
|
||||
@@ -100,8 +101,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);
|
||||
- if (!pVmObject)
|
||||
+ if (!pVmObject) {
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
return VERR_NO_EXEC_MEMORY;
|
||||
+ }
|
||||
|
||||
/* Addr contains a start address vm_map_find will start searching for suitable space at. */
|
||||
#if __FreeBSD_version >= 1000055
|
||||
@@ -138,6 +141,8 @@ DECLHIDDEN(int) rtR0MemAllocEx(size_t cb, uint32_t fFl
|
||||
fFlags & RTMEMHDR_FLAG_ZEROED ? M_NOWAIT | M_ZERO : M_NOWAIT);
|
||||
}
|
||||
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
+
|
||||
if (RT_UNLIKELY(!pHdr))
|
||||
return VERR_NO_MEMORY;
|
||||
|
||||
@@ -153,6 +158,8 @@ DECLHIDDEN(int) rtR0MemAllocEx(size_t cb, uint32_t fFl
|
||||
|
||||
DECLHIDDEN(void) rtR0MemFree(PRTMEMHDR pHdr)
|
||||
{
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
+
|
||||
pHdr->u32Magic += 1;
|
||||
|
||||
#ifdef RT_ARCH_AMD64
|
||||
@@ -165,11 +172,14 @@ DECLHIDDEN(void) rtR0MemFree(PRTMEMHDR pHdr)
|
||||
else
|
||||
#endif
|
||||
free(pHdr, M_IPRTHEAP);
|
||||
+
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
}
|
||||
|
||||
|
||||
RTR0DECL(void *) RTMemContAlloc(PRTCCPHYS pPhys, size_t cb)
|
||||
{
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
void *pv;
|
||||
|
||||
/*
|
||||
@@ -194,6 +204,7 @@ RTR0DECL(void *) RTMemContAlloc(PRTCCPHYS pPhys, size_
|
||||
*pPhys = vtophys(pv);
|
||||
Assert(!(*pPhys & PAGE_OFFSET_MASK));
|
||||
}
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
return pv;
|
||||
}
|
||||
|
||||
@@ -203,7 +214,9 @@ RTR0DECL(void) RTMemContFree(void *pv, size_t cb)
|
||||
if (pv)
|
||||
{
|
||||
AssertMsg(!((uintptr_t)pv & PAGE_OFFSET_MASK), ("pv=%p\n", pv));
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
contigfree(pv, cb, M_IPRTCONT);
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
--- src/VBox/Runtime/r0drv/freebsd/assert-r0drv-freebsd.c.orig 2021-01-07 15:42:08 UTC
|
||||
+++ src/VBox/Runtime/r0drv/freebsd/assert-r0drv-freebsd.c
|
||||
@@ -68,15 +68,18 @@
|
||||
|
||||
DECLHIDDEN(void) rtR0AssertNativeMsg1(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction)
|
||||
{
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
printf("\r\n!!Assertion Failed!!\r\n"
|
||||
"Expression: %s\r\n"
|
||||
"Location : %s(%d) %s\r\n",
|
||||
pszExpr, pszFile, uLine, pszFunction);
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
}
|
||||
|
||||
|
||||
DECLHIDDEN(void) rtR0AssertNativeMsg2V(bool fInitial, const char *pszFormat, va_list va)
|
||||
{
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
char szMsg[256];
|
||||
|
||||
RTStrPrintfV(szMsg, sizeof(szMsg) - 1, pszFormat, va);
|
||||
@@ -84,6 +87,7 @@ DECLHIDDEN(void) rtR0AssertNativeMsg2V(bool fInitial,
|
||||
printf("%s", szMsg);
|
||||
|
||||
NOREF(fInitial);
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,412 @@
|
|||
--- src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c.orig 2021-10-18 17:58:41 UTC
|
||||
+++ src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c
|
||||
@@ -129,6 +129,7 @@ static vm_map_t rtR0MemObjFreeBSDGetMap(PRTR0MEMOBJINT
|
||||
|
||||
DECLHIDDEN(int) rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
|
||||
{
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)pMem;
|
||||
int rc;
|
||||
|
||||
@@ -145,16 +146,15 @@ DECLHIDDEN(int) rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
|
||||
|
||||
case RTR0MEMOBJTYPE_LOCK:
|
||||
{
|
||||
- vm_map_t pMap = kernel_map;
|
||||
+ if (pMemFreeBSD->Core.u.Lock.R0Process != NIL_RTR0PROCESS) {
|
||||
+ vm_map_t pMap = &((struct proc *)pMemFreeBSD->Core.u.Lock.R0Process)->p_vmspace->vm_map;
|
||||
|
||||
- if (pMemFreeBSD->Core.u.Lock.R0Process != NIL_RTR0PROCESS)
|
||||
- pMap = &((struct proc *)pMemFreeBSD->Core.u.Lock.R0Process)->p_vmspace->vm_map;
|
||||
-
|
||||
- rc = vm_map_unwire(pMap,
|
||||
+ rc = vm_map_unwire(pMap,
|
||||
(vm_offset_t)pMemFreeBSD->Core.pv,
|
||||
(vm_offset_t)pMemFreeBSD->Core.pv + pMemFreeBSD->Core.cb,
|
||||
VM_MAP_WIRE_SYSTEM | VM_MAP_WIRE_NOHOLES);
|
||||
- AssertMsg(rc == KERN_SUCCESS, ("%#x", rc));
|
||||
+ AssertMsg(rc == KERN_SUCCESS, ("%#x", rc));
|
||||
+ }
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -210,6 +210,7 @@ DECLHIDDEN(int) rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
|
||||
return VERR_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
return VINF_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -320,8 +321,10 @@ static int rtR0MemObjFreeBSDAllocHelper(PRTR0MEMOBJFRE
|
||||
size_t cPages = atop(pMemFreeBSD->Core.cb);
|
||||
int rc;
|
||||
|
||||
- pMemFreeBSD->pObject = vm_object_allocate(OBJT_PHYS, cPages);
|
||||
+ pMemFreeBSD->pObject = vm_pager_allocate(OBJT_PHYS, NULL,
|
||||
+ pMemFreeBSD->Core.cb, VM_PROT_ALL, 0, curthread->td_ucred);
|
||||
|
||||
+
|
||||
/* No additional object reference for auto-deallocation upon unmapping. */
|
||||
#if __FreeBSD_version >= 1000055
|
||||
rc = vm_map_find(kernel_map, pMemFreeBSD->pObject, 0,
|
||||
@@ -361,19 +364,25 @@ static int rtR0MemObjFreeBSDAllocHelper(PRTR0MEMOBJFRE
|
||||
}
|
||||
DECLHIDDEN(int) rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
|
||||
{
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD),
|
||||
RTR0MEMOBJTYPE_PAGE, NULL, cb);
|
||||
if (!pMemFreeBSD)
|
||||
+ {
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
return VERR_NO_MEMORY;
|
||||
+ }
|
||||
|
||||
int rc = rtR0MemObjFreeBSDAllocHelper(pMemFreeBSD, fExecutable, ~(vm_paddr_t)0, false, VERR_NO_MEMORY);
|
||||
if (RT_FAILURE(rc))
|
||||
{
|
||||
rtR0MemObjDelete(&pMemFreeBSD->Core);
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
return rc;
|
||||
}
|
||||
|
||||
*ppMem = &pMemFreeBSD->Core;
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -387,39 +396,51 @@ DECLHIDDEN(int) rtR0MemObjNativeAllocLarge(PPRTR0MEMOB
|
||||
|
||||
DECLHIDDEN(int) rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
|
||||
{
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD),
|
||||
RTR0MEMOBJTYPE_LOW, NULL, cb);
|
||||
if (!pMemFreeBSD)
|
||||
+ {
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
return VERR_NO_MEMORY;
|
||||
+ }
|
||||
|
||||
int rc = rtR0MemObjFreeBSDAllocHelper(pMemFreeBSD, fExecutable, _4G - 1, false, VERR_NO_LOW_MEMORY);
|
||||
if (RT_FAILURE(rc))
|
||||
{
|
||||
rtR0MemObjDelete(&pMemFreeBSD->Core);
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
return rc;
|
||||
}
|
||||
|
||||
*ppMem = &pMemFreeBSD->Core;
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
DECLHIDDEN(int) rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
|
||||
{
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD),
|
||||
RTR0MEMOBJTYPE_CONT, NULL, cb);
|
||||
if (!pMemFreeBSD)
|
||||
+ {
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
return VERR_NO_MEMORY;
|
||||
+ }
|
||||
|
||||
int rc = rtR0MemObjFreeBSDAllocHelper(pMemFreeBSD, fExecutable, _4G - 1, true, VERR_NO_CONT_MEMORY);
|
||||
if (RT_FAILURE(rc))
|
||||
{
|
||||
rtR0MemObjDelete(&pMemFreeBSD->Core);
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
return rc;
|
||||
}
|
||||
|
||||
pMemFreeBSD->Core.u.Cont.Phys = vtophys(pMemFreeBSD->Core.pv);
|
||||
*ppMem = &pMemFreeBSD->Core;
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -429,6 +450,7 @@ static int rtR0MemObjFreeBSDAllocPhysPages(PPRTR0MEMOB
|
||||
RTHCPHYS PhysHighest, size_t uAlignment,
|
||||
bool fContiguous, int rcNoMem)
|
||||
{
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
uint32_t cPages = atop(cb);
|
||||
vm_paddr_t VmPhysAddrHigh;
|
||||
|
||||
@@ -436,9 +458,13 @@ static int rtR0MemObjFreeBSDAllocPhysPages(PPRTR0MEMOB
|
||||
PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD),
|
||||
enmType, NULL, cb);
|
||||
if (!pMemFreeBSD)
|
||||
+ {
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
return VERR_NO_MEMORY;
|
||||
+ }
|
||||
|
||||
- pMemFreeBSD->pObject = vm_object_allocate(OBJT_PHYS, atop(cb));
|
||||
+ pMemFreeBSD->pObject = vm_pager_allocate(OBJT_PHYS, NULL,
|
||||
+ pMemFreeBSD->Core.cb, VM_PROT_ALL, 0, curthread->td_ucred);
|
||||
|
||||
if (PhysHighest != NIL_RTHCPHYS)
|
||||
VmPhysAddrHigh = PhysHighest;
|
||||
@@ -466,6 +492,7 @@ static int rtR0MemObjFreeBSDAllocPhysPages(PPRTR0MEMOB
|
||||
rtR0MemObjDelete(&pMemFreeBSD->Core);
|
||||
}
|
||||
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -485,17 +512,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);
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
|
||||
/* create the object. */
|
||||
PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD), RTR0MEMOBJTYPE_PHYS, NULL, cb);
|
||||
if (!pMemFreeBSD)
|
||||
+ {
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
return VERR_NO_MEMORY;
|
||||
+ }
|
||||
|
||||
/* there is no allocation here, it needs to be mapped somewhere first. */
|
||||
pMemFreeBSD->Core.u.Phys.fAllocated = false;
|
||||
pMemFreeBSD->Core.u.Phys.PhysBase = Phys;
|
||||
pMemFreeBSD->Core.u.Phys.uCachePolicy = uCachePolicy;
|
||||
*ppMem = &pMemFreeBSD->Core;
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
return VINF_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -507,6 +539,7 @@ static int rtR0MemObjNativeLockInMap(PPRTR0MEMOBJINTER
|
||||
vm_offset_t AddrStart, size_t cb, uint32_t fAccess,
|
||||
RTR0PROCESS R0Process, int fFlags)
|
||||
{
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
int rc;
|
||||
NOREF(fAccess);
|
||||
|
||||
@@ -515,21 +548,28 @@ static int rtR0MemObjNativeLockInMap(PPRTR0MEMOBJINTER
|
||||
if (!pMemFreeBSD)
|
||||
return VERR_NO_MEMORY;
|
||||
|
||||
- /*
|
||||
- * We could've used vslock here, but we don't wish to be subject to
|
||||
- * resource usage restrictions, so we'll call vm_map_wire directly.
|
||||
- */
|
||||
- rc = vm_map_wire(pVmMap, /* the map */
|
||||
- AddrStart, /* start */
|
||||
- AddrStart + cb, /* end */
|
||||
- fFlags); /* flags */
|
||||
+ if (pVmMap != kernel_map) {
|
||||
+ /*
|
||||
+ * We could've used vslock here, but we don't wish to be subject to
|
||||
+ * resource usage restrictions, so we'll call vm_map_wire directly.
|
||||
+ */
|
||||
+ rc = vm_map_wire(pVmMap, /* the map */
|
||||
+ AddrStart, /* start */
|
||||
+ AddrStart + cb, /* end */
|
||||
+ fFlags); /* flags */
|
||||
+ }
|
||||
+ else
|
||||
+ rc = KERN_SUCCESS;
|
||||
+
|
||||
if (rc == KERN_SUCCESS)
|
||||
{
|
||||
pMemFreeBSD->Core.u.Lock.R0Process = R0Process;
|
||||
*ppMem = &pMemFreeBSD->Core;
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
return VINF_SUCCESS;
|
||||
}
|
||||
rtR0MemObjDelete(&pMemFreeBSD->Core);
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
return VERR_NO_MEMORY;/** @todo fix mach -> vbox error conversion for freebsd. */
|
||||
}
|
||||
|
||||
@@ -565,6 +605,7 @@ DECLHIDDEN(int) rtR0MemObjNativeLockKernel(PPRTR0MEMOB
|
||||
*/
|
||||
static int rtR0MemObjNativeReserveInMap(PPRTR0MEMOBJINTERNAL ppMem, void *pvFixed, size_t cb, size_t uAlignment, RTR0PROCESS R0Process, vm_map_t pMap)
|
||||
{
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
int rc;
|
||||
|
||||
/*
|
||||
@@ -622,11 +663,13 @@ static int rtR0MemObjNativeReserveInMap(PPRTR0MEMOBJIN
|
||||
pMemFreeBSD->Core.pv = (void *)MapAddress;
|
||||
pMemFreeBSD->Core.u.ResVirt.R0Process = R0Process;
|
||||
*ppMem = &pMemFreeBSD->Core;
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
return VINF_SUCCESS;
|
||||
}
|
||||
|
||||
rc = VERR_NO_MEMORY; /** @todo fix translation (borrow from darwin) */
|
||||
rtR0MemObjDelete(&pMemFreeBSD->Core);
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
return rc;
|
||||
|
||||
}
|
||||
@@ -648,6 +691,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)
|
||||
{
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
+
|
||||
// AssertMsgReturn(!offSub && !cbSub, ("%#x %#x\n", offSub, cbSub), VERR_NOT_SUPPORTED);
|
||||
AssertMsgReturn(pvFixed == (void *)-1, ("%p\n", pvFixed), VERR_NOT_SUPPORTED);
|
||||
|
||||
@@ -704,6 +749,7 @@ DECLHIDDEN(int) rtR0MemObjNativeMapKernel(PPRTR0MEMOBJ
|
||||
Assert((vm_offset_t)pMemFreeBSD->Core.pv == Addr);
|
||||
pMemFreeBSD->Core.u.Mapping.R0Process = NIL_RTR0PROCESS;
|
||||
*ppMem = &pMemFreeBSD->Core;
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
return VINF_SUCCESS;
|
||||
}
|
||||
rc = vm_map_remove(kernel_map, Addr, Addr + cbSub);
|
||||
@@ -712,6 +758,7 @@ DECLHIDDEN(int) rtR0MemObjNativeMapKernel(PPRTR0MEMOBJ
|
||||
else
|
||||
vm_object_deallocate(pMemToMapFreeBSD->pObject);
|
||||
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
return VERR_NO_MEMORY;
|
||||
}
|
||||
|
||||
@@ -719,6 +766,8 @@ DECLHIDDEN(int) rtR0MemObjNativeMapKernel(PPRTR0MEMOBJ
|
||||
DECLHIDDEN(int) rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, RTR3PTR R3PtrFixed, size_t uAlignment,
|
||||
unsigned fProt, RTR0PROCESS R0Process, size_t offSub, size_t cbSub)
|
||||
{
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
+
|
||||
/*
|
||||
* Check for unsupported stuff.
|
||||
*/
|
||||
@@ -775,47 +824,53 @@ DECLHIDDEN(int) rtR0MemObjNativeMapUser(PPRTR0MEMOBJIN
|
||||
0); /* copy-on-write and similar flags */
|
||||
|
||||
if (rc == KERN_SUCCESS)
|
||||
+ rc = vm_map_wire(pProcMap, AddrR3, AddrR3 + cbSub, VM_MAP_WIRE_USER|VM_MAP_WIRE_NOHOLES);
|
||||
+ if (rc == KERN_SUCCESS)
|
||||
{
|
||||
- rc = vm_map_wire(pProcMap, AddrR3, AddrR3 + pMemToMap->cb, VM_MAP_WIRE_USER|VM_MAP_WIRE_NOHOLES);
|
||||
+ rc = vm_map_inherit(pProcMap, AddrR3, AddrR3 + cbSub, VM_INHERIT_SHARE);
|
||||
AssertMsg(rc == KERN_SUCCESS, ("%#x\n", rc));
|
||||
|
||||
- rc = vm_map_inherit(pProcMap, AddrR3, AddrR3 + pMemToMap->cb, VM_INHERIT_SHARE);
|
||||
- AssertMsg(rc == KERN_SUCCESS, ("%#x\n", rc));
|
||||
-
|
||||
/*
|
||||
* Create a mapping object for it.
|
||||
*/
|
||||
PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(RTR0MEMOBJFREEBSD),
|
||||
RTR0MEMOBJTYPE_MAPPING,
|
||||
(void *)AddrR3,
|
||||
- pMemToMap->cb);
|
||||
+ cbSub);
|
||||
if (pMemFreeBSD)
|
||||
{
|
||||
Assert((vm_offset_t)pMemFreeBSD->Core.pv == AddrR3);
|
||||
pMemFreeBSD->Core.u.Mapping.R0Process = R0Process;
|
||||
*ppMem = &pMemFreeBSD->Core;
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
return VINF_SUCCESS;
|
||||
}
|
||||
|
||||
- rc = vm_map_remove(pProcMap, AddrR3, AddrR3 + pMemToMap->cb);
|
||||
+ rc = vm_map_remove(pProcMap, AddrR3, AddrR3 + cbSub /* XXX pMemToMap->cb*/ );
|
||||
AssertMsg(rc == KERN_SUCCESS, ("Deleting mapping failed\n"));
|
||||
}
|
||||
else
|
||||
vm_object_deallocate(pMemToMapFreeBSD->pObject);
|
||||
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
return VERR_NO_MEMORY;
|
||||
}
|
||||
|
||||
|
||||
DECLHIDDEN(int) rtR0MemObjNativeProtect(PRTR0MEMOBJINTERNAL pMem, size_t offSub, size_t cbSub, uint32_t fProt)
|
||||
{
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
+
|
||||
vm_prot_t ProtectionFlags = 0;
|
||||
vm_offset_t AddrStart = (uintptr_t)pMem->pv + offSub;
|
||||
vm_offset_t AddrEnd = AddrStart + cbSub;
|
||||
vm_map_t pVmMap = rtR0MemObjFreeBSDGetMap(pMem);
|
||||
|
||||
if (!pVmMap)
|
||||
+ {
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
return VERR_NOT_SUPPORTED;
|
||||
+ }
|
||||
|
||||
if ((fProt & RTMEM_PROT_NONE) == RTMEM_PROT_NONE)
|
||||
ProtectionFlags = VM_PROT_NONE;
|
||||
@@ -826,7 +881,12 @@ DECLHIDDEN(int) rtR0MemObjNativeProtect(PRTR0MEMOBJINT
|
||||
if ((fProt & RTMEM_PROT_EXEC) == RTMEM_PROT_EXEC)
|
||||
ProtectionFlags |= VM_PROT_EXECUTE;
|
||||
|
||||
+#if __FreeBSD_version >= 1300135
|
||||
+ int krc = vm_map_protect(pVmMap, AddrStart, AddrEnd, ProtectionFlags, 0, VM_MAP_PROTECT_SET_PROT);
|
||||
+#else
|
||||
int krc = vm_map_protect(pVmMap, AddrStart, AddrEnd, ProtectionFlags, FALSE);
|
||||
+#endif
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
if (krc == KERN_SUCCESS)
|
||||
return VINF_SUCCESS;
|
||||
|
||||
@@ -851,11 +911,19 @@ DECLHIDDEN(RTHCPHYS) rtR0MemObjNativeGetPagePhysAddr(P
|
||||
|
||||
vm_offset_t pb = (vm_offset_t)pMemFreeBSD->Core.pv + ptoa(iPage);
|
||||
|
||||
- struct proc *pProc = (struct proc *)pMemFreeBSD->Core.u.Lock.R0Process;
|
||||
- struct vm_map *pProcMap = &pProc->p_vmspace->vm_map;
|
||||
- pmap_t pPhysicalMap = vm_map_pmap(pProcMap);
|
||||
+ if (pMemFreeBSD->Core.u.Mapping.R0Process != NIL_RTR0PROCESS)
|
||||
+ {
|
||||
+ RTHCPHYS addr;
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
+ struct proc *pProc = (struct proc *)pMemFreeBSD->Core.u.Lock.R0Process;
|
||||
+ struct vm_map *pProcMap = &pProc->p_vmspace->vm_map;
|
||||
+ pmap_t pPhysicalMap = vm_map_pmap(pProcMap);
|
||||
|
||||
- return pmap_extract(pPhysicalMap, pb);
|
||||
+ addr = pmap_extract(pPhysicalMap, pb);
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
+ return addr;
|
||||
+ }
|
||||
+ return vtophys(pb);
|
||||
}
|
||||
|
||||
case RTR0MEMOBJTYPE_MAPPING:
|
||||
@@ -864,11 +932,16 @@ DECLHIDDEN(RTHCPHYS) rtR0MemObjNativeGetPagePhysAddr(P
|
||||
|
||||
if (pMemFreeBSD->Core.u.Mapping.R0Process != NIL_RTR0PROCESS)
|
||||
{
|
||||
+ RTHCPHYS addr;
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
struct proc *pProc = (struct proc *)pMemFreeBSD->Core.u.Mapping.R0Process;
|
||||
struct vm_map *pProcMap = &pProc->p_vmspace->vm_map;
|
||||
pmap_t pPhysicalMap = vm_map_pmap(pProcMap);
|
||||
|
||||
- return pmap_extract(pPhysicalMap, pb);
|
||||
+ addr = pmap_extract(pPhysicalMap, pb);
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
+ return addr;
|
||||
+
|
||||
}
|
||||
return vtophys(pb);
|
||||
}
|
||||
@@ -879,9 +952,11 @@ DECLHIDDEN(RTHCPHYS) rtR0MemObjNativeGetPagePhysAddr(P
|
||||
{
|
||||
RTHCPHYS addr;
|
||||
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
VM_OBJECT_WLOCK(pMemFreeBSD->pObject);
|
||||
addr = VM_PAGE_TO_PHYS(vm_page_lookup(pMemFreeBSD->pObject, iPage));
|
||||
VM_OBJECT_WUNLOCK(pMemFreeBSD->pObject);
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
return addr;
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
--- 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
|
||||
@@ -36,7 +36,9 @@
|
||||
|
||||
RTR0DECL(int) RTR0MemUserCopyFrom(void *pvDst, RTR3PTR R3PtrSrc, size_t cb)
|
||||
{
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
int rc = copyin((const void *)R3PtrSrc, pvDst, cb);
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
if (RT_LIKELY(rc == 0))
|
||||
return VINF_SUCCESS;
|
||||
return VERR_ACCESS_DENIED;
|
||||
@@ -45,7 +47,9 @@ RTR0DECL(int) RTR0MemUserCopyFrom(void *pvDst, RTR3PTR
|
||||
|
||||
RTR0DECL(int) RTR0MemUserCopyTo(RTR3PTR R3PtrDst, void const *pvSrc, size_t cb)
|
||||
{
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
int rc = copyout(pvSrc, (void *)R3PtrDst, cb);
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
if (RT_LIKELY(rc == 0))
|
||||
return VINF_SUCCESS;
|
||||
return VERR_ACCESS_DENIED;
|
|
@ -0,0 +1,92 @@
|
|||
--- src/VBox/Runtime/r0drv/freebsd/mp-r0drv-freebsd.c.orig 2019-04-16 10:17:21 UTC
|
||||
+++ src/VBox/Runtime/r0drv/freebsd/mp-r0drv-freebsd.c
|
||||
@@ -147,7 +147,9 @@ RTDECL(RTCPUID) RTMpGetOnlineCount(void)
|
||||
static void rtmpOnAllFreeBSDWrapper(void *pvArg)
|
||||
{
|
||||
PRTMPARGS pArgs = (PRTMPARGS)pvArg;
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
pArgs->pfnWorker(curcpu, pArgs->pvUser1, pArgs->pvUser2);
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
}
|
||||
|
||||
|
||||
@@ -159,7 +161,9 @@ RTDECL(int) RTMpOnAll(PFNRTMPWORKER pfnWorker, void *p
|
||||
Args.pvUser2 = pvUser2;
|
||||
Args.idCpu = NIL_RTCPUID;
|
||||
Args.cHits = 0;
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
smp_rendezvous(NULL, rtmpOnAllFreeBSDWrapper, smp_no_rendezvous_barrier, &Args);
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
return VINF_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -175,7 +179,11 @@ static void rtmpOnOthersFreeBSDWrapper(void *pvArg)
|
||||
PRTMPARGS pArgs = (PRTMPARGS)pvArg;
|
||||
RTCPUID idCpu = curcpu;
|
||||
if (pArgs->idCpu != idCpu)
|
||||
+ {
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
pArgs->pfnWorker(idCpu, pArgs->pvUser1, pArgs->pvUser2);
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
+ }
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
@@ -207,6 +216,7 @@ RTDECL(int) RTMpOnOthers(PFNRTMPWORKER pfnWorker, void
|
||||
#else
|
||||
smp_rendezvous(NULL, rtmpOnOthersFreeBSDWrapper, NULL, &Args);
|
||||
#endif
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
}
|
||||
return VINF_SUCCESS;
|
||||
}
|
||||
@@ -224,8 +234,10 @@ static void rtmpOnSpecificFreeBSDWrapper(void *pvArg)
|
||||
RTCPUID idCpu = curcpu;
|
||||
if (pArgs->idCpu == idCpu)
|
||||
{
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
pArgs->pfnWorker(idCpu, pArgs->pvUser1, pArgs->pvUser2);
|
||||
ASMAtomicIncU32(&pArgs->cHits);
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
@@ -258,6 +271,7 @@ RTDECL(int) RTMpOnSpecific(RTCPUID idCpu, PFNRTMPWORKE
|
||||
#else
|
||||
smp_rendezvous(NULL, rtmpOnSpecificFreeBSDWrapper, NULL, &Args);
|
||||
#endif
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
return Args.cHits == 1
|
||||
? VINF_SUCCESS
|
||||
: VERR_CPU_NOT_FOUND;
|
||||
@@ -287,12 +301,14 @@ RTDECL(int) RTMpPokeCpu(RTCPUID idCpu)
|
||||
if (!RTMpIsCpuOnline(idCpu))
|
||||
return VERR_CPU_NOT_FOUND;
|
||||
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
# 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;
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
--- src/VBox/Runtime/r0drv/freebsd/semevent-r0drv-freebsd.c.orig 2021-01-07 15:42:08 UTC
|
||||
+++ src/VBox/Runtime/r0drv/freebsd/semevent-r0drv-freebsd.c
|
||||
@@ -101,7 +101,9 @@ RTDECL(int) RTSemEventCreateEx(PRTSEMEVENT phEventSem
|
||||
Assert(!(fFlags & RTSEMEVENT_FLAGS_BOOTSTRAP_HACK) || (fFlags & RTSEMEVENT_FLAGS_NO_LOCK_VAL));
|
||||
AssertPtrReturn(phEventSem, VERR_INVALID_POINTER);
|
||||
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
PRTSEMEVENTINTERNAL pThis = (PRTSEMEVENTINTERNAL)RTMemAllocZ(sizeof(*pThis));
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
if (!pThis)
|
||||
return VERR_NO_MEMORY;
|
||||
|
||||
@@ -152,10 +154,12 @@ RTDECL(int) RTSemEventDestroy(RTSEMEVENT hEventSem)
|
||||
/*
|
||||
* Invalidate it and signal the object just in case.
|
||||
*/
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
ASMAtomicWriteU32(&pThis->u32Magic, ~RTSEMEVENT_MAGIC);
|
||||
ASMAtomicWriteU32(&pThis->fState, 0);
|
||||
rtR0SemBsdBroadcast(pThis);
|
||||
rtR0SemEventBsdRelease(pThis);
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
return VINF_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -173,9 +177,11 @@ RTDECL(int) RTSemEventSignal(RTSEMEVENT hEventSem)
|
||||
/*
|
||||
* Signal the event object.
|
||||
*/
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
ASMAtomicWriteU32(&pThis->fState, 1);
|
||||
rtR0SemBsdSignal(pThis);
|
||||
rtR0SemEventBsdRelease(pThis);
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
return VINF_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -199,6 +205,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);
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
rtR0SemEventBsdRetain(pThis);
|
||||
|
||||
/*
|
||||
@@ -248,6 +255,7 @@ static int rtR0SemEventWait(PRTSEMEVENTINTERNAL pThis,
|
||||
}
|
||||
|
||||
rtR0SemEventBsdRelease(pThis);
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
return rc;
|
||||
}
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
--- src/VBox/Runtime/r0drv/freebsd/semeventmulti-r0drv-freebsd.c.orig 2021-01-07 15:42:08 UTC
|
||||
+++ src/VBox/Runtime/r0drv/freebsd/semeventmulti-r0drv-freebsd.c
|
||||
@@ -120,7 +120,9 @@ RTDECL(int) RTSemEventMultiCreateEx(PRTSEMEVENTMULTI
|
||||
PRTSEMEVENTMULTIINTERNAL pThis;
|
||||
|
||||
AssertReturn(!(fFlags & ~RTSEMEVENTMULTI_FLAGS_NO_LOCK_VAL), VERR_INVALID_PARAMETER);
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
pThis = (PRTSEMEVENTMULTIINTERNAL)RTMemAlloc(sizeof(*pThis));
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
if (pThis)
|
||||
{
|
||||
pThis->u32Magic = RTSEMEVENTMULTI_MAGIC;
|
||||
@@ -176,10 +178,12 @@ RTDECL(int) RTSemEventMultiDestroy(RTSEMEVENTMULTI hE
|
||||
/*
|
||||
* Invalidate it and signal the object just in case.
|
||||
*/
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
ASMAtomicWriteU32(&pThis->u32Magic, ~RTSEMEVENTMULTI_MAGIC);
|
||||
ASMAtomicAndU32(&pThis->fStateAndGen, RTSEMEVENTMULTIBSD_GEN_MASK);
|
||||
rtR0SemBsdBroadcast(pThis);
|
||||
rtR0SemEventMultiBsdRelease(pThis);
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
return VINF_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -188,6 +192,7 @@ RTDECL(int) RTSemEventMultiSignal(RTSEMEVENTMULTI hEv
|
||||
{
|
||||
uint32_t fNew;
|
||||
uint32_t fOld;
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
|
||||
/*
|
||||
* Validate input.
|
||||
@@ -214,12 +219,15 @@ RTDECL(int) RTSemEventMultiSignal(RTSEMEVENTMULTI hEv
|
||||
|
||||
rtR0SemBsdBroadcast(pThis);
|
||||
rtR0SemEventMultiBsdRelease(pThis);
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
return VINF_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
RTDECL(int) RTSemEventMultiReset(RTSEMEVENTMULTI hEventMultiSem)
|
||||
{
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
+
|
||||
/*
|
||||
* Validate input.
|
||||
*/
|
||||
@@ -236,6 +244,7 @@ RTDECL(int) RTSemEventMultiReset(RTSEMEVENTMULTI hEve
|
||||
ASMAtomicAndU32(&pThis->fStateAndGen, ~RTSEMEVENTMULTIBSD_STATE_MASK);
|
||||
|
||||
rtR0SemEventMultiBsdRelease(pThis);
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
return VINF_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -252,6 +261,7 @@ RTDECL(int) RTSemEventMultiReset(RTSEMEVENTMULTI hEve
|
||||
static int rtR0SemEventMultiBsdWait(PRTSEMEVENTMULTIINTERNAL pThis, uint32_t fFlags, uint64_t uTimeout,
|
||||
PCRTLOCKVALSRCPOS pSrcPos)
|
||||
{
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
uint32_t fOrgStateAndGen;
|
||||
int rc;
|
||||
|
||||
@@ -311,6 +321,7 @@ static int rtR0SemEventMultiBsdWait(PRTSEMEVENTMULTIIN
|
||||
}
|
||||
|
||||
rtR0SemEventMultiBsdRelease(pThis);
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
return rc;
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
--- src/VBox/Runtime/r0drv/freebsd/semfastmutex-r0drv-freebsd.c.orig 2021-01-07 15:42:08 UTC
|
||||
+++ src/VBox/Runtime/r0drv/freebsd/semfastmutex-r0drv-freebsd.c
|
||||
@@ -86,6 +86,7 @@ RTDECL(int) RTSemFastMutexCreate(PRTSEMFASTMUTEX phFa
|
||||
{
|
||||
AssertCompile(sizeof(RTSEMFASTMUTEXINTERNAL) > sizeof(void *));
|
||||
AssertPtrReturn(phFastMtx, VERR_INVALID_POINTER);
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
|
||||
PRTSEMFASTMUTEXINTERNAL pThis = (PRTSEMFASTMUTEXINTERNAL)RTMemAllocZ(sizeof(*pThis));
|
||||
if (pThis)
|
||||
@@ -94,8 +95,10 @@ RTDECL(int) RTSemFastMutexCreate(PRTSEMFASTMUTEX phFa
|
||||
sx_init_flags(&pThis->SxLock, "IPRT Fast Mutex Semaphore", SX_DUPOK);
|
||||
|
||||
*phFastMtx = pThis;
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
return VINF_SUCCESS;
|
||||
}
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
return VERR_NO_MEMORY;
|
||||
}
|
||||
|
||||
@@ -107,11 +110,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);
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
|
||||
ASMAtomicWriteU32(&pThis->u32Magic, RTSEMFASTMUTEX_MAGIC_DEAD);
|
||||
sx_destroy(&pThis->SxLock);
|
||||
RTMemFree(pThis);
|
||||
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
return VINF_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -121,8 +126,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);
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
|
||||
sx_xlock(&pThis->SxLock);
|
||||
+
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
return VINF_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -132,8 +140,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);
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
|
||||
sx_xunlock(&pThis->SxLock);
|
||||
+
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
return VINF_SUCCESS;
|
||||
}
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
--- 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
|
||||
@@ -62,6 +62,7 @@ RTDECL(int) RTSemMutexCreate(PRTSEMMUTEX phMutexSem)
|
||||
{
|
||||
AssertCompile(sizeof(RTSEMMUTEXINTERNAL) > sizeof(void *));
|
||||
AssertPtrReturn(phMutexSem, VERR_INVALID_POINTER);
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
|
||||
PRTSEMMUTEXINTERNAL pThis = (PRTSEMMUTEXINTERNAL)RTMemAllocZ(sizeof(*pThis));
|
||||
if (pThis)
|
||||
@@ -70,8 +71,10 @@ RTDECL(int) RTSemMutexCreate(PRTSEMMUTEX phMutexSem)
|
||||
sx_init_flags(&pThis->SxLock, "IPRT Mutex Semaphore", SX_RECURSE);
|
||||
|
||||
*phMutexSem = pThis;
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
return VINF_SUCCESS;
|
||||
}
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
return VERR_NO_MEMORY;
|
||||
}
|
||||
|
||||
@@ -83,12 +86,14 @@ RTDECL(int) RTSemMutexDestroy(RTSEMMUTEX hMutexSem)
|
||||
return VINF_SUCCESS;
|
||||
AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
|
||||
AssertMsgReturn(pThis->u32Magic == RTSEMMUTEX_MAGIC, ("%p: u32Magic=%RX32\n", pThis, pThis->u32Magic), VERR_INVALID_HANDLE);
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
|
||||
AssertReturn(ASMAtomicCmpXchgU32(&pThis->u32Magic, RTSEMMUTEX_MAGIC_DEAD, RTSEMMUTEX_MAGIC), VERR_INVALID_HANDLE);
|
||||
|
||||
sx_destroy(&pThis->SxLock);
|
||||
RTMemFree(pThis);
|
||||
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
return VINF_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -99,6 +104,7 @@ RTDECL(int) RTSemMutexRequest(RTSEMMUTEX hMutexSem, R
|
||||
int rc;
|
||||
AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
|
||||
AssertMsgReturn(pThis->u32Magic == RTSEMMUTEX_MAGIC, ("%p: u32Magic=%RX32\n", pThis, pThis->u32Magic), VERR_INVALID_HANDLE);
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
|
||||
if (cMillies == RT_INDEFINITE_WAIT)
|
||||
{
|
||||
@@ -133,6 +139,7 @@ RTDECL(int) RTSemMutexRequest(RTSEMMUTEX hMutexSem, R
|
||||
} while (RTTimeSystemMilliTS() - StartTS < cMillies);
|
||||
}
|
||||
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_ONLY_AC();
|
||||
return VINF_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -149,6 +156,7 @@ RTDECL(int) RTSemMutexRequestNoResume(RTSEMMUTEX hMut
|
||||
int rc;
|
||||
AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
|
||||
AssertMsgReturn(pThis->u32Magic == RTSEMMUTEX_MAGIC, ("%p: u32Magic=%RX32\n", pThis, pThis->u32Magic), VERR_INVALID_HANDLE);
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
|
||||
if (cMillies == RT_INDEFINITE_WAIT)
|
||||
{
|
||||
@@ -186,6 +194,7 @@ RTDECL(int) RTSemMutexRequestNoResume(RTSEMMUTEX hMut
|
||||
} while (RTTimeSystemMilliTS() - StartTS < cMillies);
|
||||
}
|
||||
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_ONLY_AC();
|
||||
return VINF_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -201,8 +210,11 @@ RTDECL(int) RTSemMutexRelease(RTSEMMUTEX hMutexSem)
|
||||
PRTSEMMUTEXINTERNAL pThis = hMutexSem;
|
||||
AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
|
||||
AssertMsgReturn(pThis->u32Magic == RTSEMMUTEX_MAGIC, ("%p: u32Magic=%RX32\n", pThis, pThis->u32Magic), VERR_INVALID_HANDLE);
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
|
||||
sx_xunlock(&pThis->SxLock);
|
||||
+
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_ONLY_AC();
|
||||
return VINF_SUCCESS;
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
--- src/VBox/Runtime/r0drv/freebsd/spinlock-r0drv-freebsd.c.orig 2021-01-07 15:42:09 UTC
|
||||
+++ src/VBox/Runtime/r0drv/freebsd/spinlock-r0drv-freebsd.c
|
||||
@@ -106,7 +106,9 @@ RTDECL(int) RTSpinlockCreate(PRTSPINLOCK pSpinlock, u
|
||||
* Allocate.
|
||||
*/
|
||||
AssertCompile(sizeof(RTSPINLOCKINTERNAL) > sizeof(void *));
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
PRTSPINLOCKINTERNAL pThis = (PRTSPINLOCKINTERNAL)RTMemAllocZ(sizeof(*pThis));
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
if (!pThis)
|
||||
return VERR_NO_MEMORY;
|
||||
|
||||
@@ -140,7 +142,9 @@ RTDECL(int) RTSpinlockDestroy(RTSPINLOCK Spinlock)
|
||||
* Make the lock invalid and release the memory.
|
||||
*/
|
||||
ASMAtomicIncU32(&pThis->u32Magic);
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
RTMemFree(pThis);
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
return VINF_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -166,6 +170,7 @@ RTDECL(void) RTSpinlockAcquire(RTSPINLOCK Spinlock)
|
||||
{
|
||||
RT_ASSERT_PREEMPT_CPUID_SPIN_ACQUIRED(pThis);
|
||||
pThis->fIntSaved = fIntSaved;
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_ONLY_AC_EX(fIntSaved);
|
||||
return;
|
||||
}
|
||||
if (--c <= 0)
|
|
@ -0,0 +1,47 @@
|
|||
--- src/VBox/Runtime/r0drv/freebsd/the-freebsd-kernel.h.orig 2021-01-07 15:42:09 UTC
|
||||
+++ src/VBox/Runtime/r0drv/freebsd/the-freebsd-kernel.h
|
||||
@@ -87,6 +87,7 @@
|
||||
#include <sys/smp.h>
|
||||
#include <sys/sleepqueue.h>
|
||||
#include <sys/sx.h>
|
||||
+#include <sys/vmmeter.h> /* vm_cnt */
|
||||
#include <vm/vm.h>
|
||||
#include <vm/pmap.h> /* for vtophys */
|
||||
#include <vm/vm_map.h>
|
||||
@@ -94,10 +95,10 @@
|
||||
#include <vm/vm_kern.h>
|
||||
#include <vm/vm_param.h> /* KERN_SUCCESS ++ */
|
||||
#include <vm/vm_page.h>
|
||||
+#include <vm/vm_pager.h>
|
||||
#include <vm/vm_phys.h> /* vm_phys_alloc_* */
|
||||
#include <vm/vm_extern.h> /* kmem_alloc_attr */
|
||||
#include <vm/vm_pageout.h> /* vm_contig_grow_cache */
|
||||
-#include <sys/vmmeter.h> /* cnt */
|
||||
#include <sys/resourcevar.h>
|
||||
#include <machine/cpu.h>
|
||||
|
||||
@@ -155,6 +156,24 @@
|
||||
*/
|
||||
#if 0 /** @todo Not available yet. */
|
||||
# define USE_KMEM_ALLOC_PROT
|
||||
+#endif
|
||||
+
|
||||
+/**
|
||||
+ * Macros for preserving EFLAGS.AC (despair / paranoid)
|
||||
+ */
|
||||
+#if __FreeBSD_version >= 1200076 && defined(RT_ARCH_AMD64)
|
||||
+# include <iprt/asm-amd64-x86.h>
|
||||
+# include <iprt/x86.h>
|
||||
+# define IPRT_FREEBSD_SAVE_EFL_AC() RTCCUINTREG const fSavedEfl = ASMGetFlags()
|
||||
+# define IPRT_FREEBSD_RESTORE_EFL_AC() ASMSetFlags(fSavedEfl)
|
||||
+# define IPRT_FREEBSD_RESTORE_EFL_ONLY_AC() ASMChangeFlags(~X86_EFL_AC, fSavedEfl & X86_EFL_AC)
|
||||
+# define IPRT_FREEBSD_RESTORE_EFL_ONLY_AC_EX(f) ASMChangeFlags(~X86_EFL_AC, (f) & X86_EFL_AC)
|
||||
+# define VBOX_WITH_EFLAGS_AC_SET_IN_VBOXDRV
|
||||
+#else
|
||||
+# define IPRT_FREEBSD_SAVE_EFL_AC() do { } while (0)
|
||||
+# define IPRT_FREEBSD_RESTORE_EFL_AC() do { } while (0)
|
||||
+# define IPRT_FREEBSD_RESTORE_EFL_ONLY_AC() do { } while (0)
|
||||
+# define IPRT_FREEBSD_RESTORE_EFL_ONLY_AC_EX(f) do { } while (0)
|
||||
#endif
|
||||
|
||||
#endif /* !IPRT_INCLUDED_SRC_r0drv_freebsd_the_freebsd_kernel_h */
|
|
@ -0,0 +1,91 @@
|
|||
--- src/VBox/Runtime/r0drv/freebsd/thread-r0drv-freebsd.c.orig 2021-04-20 04:32:44 UTC
|
||||
+++ src/VBox/Runtime/r0drv/freebsd/thread-r0drv-freebsd.c
|
||||
@@ -49,7 +49,6 @@ RTDECL(RTNATIVETHREAD) RTThreadNativeSelf(void)
|
||||
static int rtR0ThreadFbsdSleepCommon(RTMSINTERVAL cMillies)
|
||||
{
|
||||
int rc;
|
||||
- int cTicks;
|
||||
|
||||
/*
|
||||
* 0 ms sleep -> yield.
|
||||
@@ -60,30 +59,34 @@ static int rtR0ThreadFbsdSleepCommon(RTMSINTERVAL cMil
|
||||
return VINF_SUCCESS;
|
||||
}
|
||||
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
+
|
||||
/*
|
||||
* Translate milliseconds into ticks and go to sleep.
|
||||
*/
|
||||
if (cMillies != RT_INDEFINITE_WAIT)
|
||||
{
|
||||
- if (hz == 1000)
|
||||
- cTicks = cMillies;
|
||||
- else if (hz == 100)
|
||||
- cTicks = cMillies / 10;
|
||||
- else
|
||||
- {
|
||||
- int64_t cTicks64 = ((uint64_t)cMillies * hz) / 1000;
|
||||
- cTicks = (int)cTicks64;
|
||||
- if (cTicks != cTicks64)
|
||||
- cTicks = INT_MAX;
|
||||
- }
|
||||
+ struct timeval tv;
|
||||
+
|
||||
+ tv.tv_sec = cMillies / 1000;
|
||||
+ tv.tv_usec = cMillies * 1000;
|
||||
+
|
||||
+ rc = tsleep_sbt((void *)RTThreadSleep,
|
||||
+ PZERO | PCATCH,
|
||||
+ "iprtsl", /* max 6 chars */
|
||||
+ tvtosbt(tv),
|
||||
+ 0,
|
||||
+ C_ABSOLUTE);
|
||||
}
|
||||
else
|
||||
- cTicks = 0; /* requires giant lock! */
|
||||
-
|
||||
- rc = tsleep((void *)RTThreadSleep,
|
||||
- PZERO | PCATCH,
|
||||
- "iprtsl", /* max 6 chars */
|
||||
- cTicks);
|
||||
+ {
|
||||
+ /* requires giant lock! */
|
||||
+ rc = tsleep((void *)RTThreadSleep,
|
||||
+ PZERO | PCATCH,
|
||||
+ "iprts0", /* max 6 chars */
|
||||
+ 0);
|
||||
+ }
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
switch (rc)
|
||||
{
|
||||
case 0:
|
||||
@@ -114,11 +117,13 @@ RTDECL(int) RTThreadSleepNoLog(RTMSINTERVAL cMillies)
|
||||
|
||||
RTDECL(bool) RTThreadYield(void)
|
||||
{
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
#if __FreeBSD_version >= 900032
|
||||
kern_yield(curthread->td_user_pri);
|
||||
#else
|
||||
uio_yield();
|
||||
#endif
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
return false; /** @todo figure this one ... */
|
||||
}
|
||||
|
||||
@@ -167,12 +172,14 @@ RTDECL(void) RTThreadPreemptDisable(PRTTHREADPREEMPTST
|
||||
|
||||
RTDECL(void) RTThreadPreemptRestore(PRTTHREADPREEMPTSTATE pState)
|
||||
{
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC(); /* paranoia */
|
||||
AssertPtr(pState);
|
||||
Assert(pState->u32Reserved == 42);
|
||||
pState->u32Reserved = 0;
|
||||
|
||||
RT_ASSERT_PREEMPT_CPUID_RESTORE(pState);
|
||||
critical_exit();
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_ONLY_AC(); /* paranoia */
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
--- src/VBox/Runtime/r0drv/freebsd/thread2-r0drv-freebsd.c.orig 2021-01-07 15:42:09 UTC
|
||||
+++ src/VBox/Runtime/r0drv/freebsd/thread2-r0drv-freebsd.c
|
||||
@@ -94,6 +94,8 @@ DECLHIDDEN(int) rtThreadNativeSetPriority(PRTTHREADINT
|
||||
return VERR_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
+
|
||||
#if __FreeBSD_version < 700000
|
||||
/* Do like they're doing in subr_ntoskrnl.c... */
|
||||
mtx_lock_spin(&sched_lock);
|
||||
@@ -110,6 +112,7 @@ DECLHIDDEN(int) rtThreadNativeSetPriority(PRTTHREADINT
|
||||
thread_unlock(curthread);
|
||||
#endif
|
||||
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
return VINF_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -159,6 +162,7 @@ static void rtThreadNativeMain(void *pvThreadInt)
|
||||
|
||||
DECLHIDDEN(int) rtThreadNativeCreate(PRTTHREADINT pThreadInt, PRTNATIVETHREAD pNativeThread)
|
||||
{
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
int rc;
|
||||
struct proc *pProc;
|
||||
|
||||
@@ -174,6 +178,7 @@ DECLHIDDEN(int) rtThreadNativeCreate(PRTTHREADINT pThr
|
||||
}
|
||||
else
|
||||
rc = RTErrConvertFromErrno(rc);
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
return rc;
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
--- src/VBox/Runtime/r0drv/freebsd/time-r0drv-freebsd.c.orig 2021-01-07 15:42:09 UTC
|
||||
+++ src/VBox/Runtime/r0drv/freebsd/time-r0drv-freebsd.c
|
||||
@@ -64,16 +64,23 @@
|
||||
|
||||
RTDECL(uint64_t) RTTimeNanoTS(void)
|
||||
{
|
||||
- struct timespec tsp;
|
||||
- nanouptime(&tsp);
|
||||
- return tsp.tv_sec * RT_NS_1SEC_64
|
||||
- + tsp.tv_nsec;
|
||||
+ struct bintime bt;
|
||||
+ uint64_t ns;
|
||||
+ binuptime(&bt);
|
||||
+ ns = RT_NS_1SEC_64 * bt.sec;
|
||||
+ ns += (RT_NS_1SEC_64 * (uint32_t)(bt.frac >> 32)) >> 32;
|
||||
+ return ns;
|
||||
}
|
||||
|
||||
|
||||
RTDECL(uint64_t) RTTimeMilliTS(void)
|
||||
{
|
||||
- return RTTimeNanoTS() / RT_NS_1MS;
|
||||
+ struct bintime bt;
|
||||
+ uint64_t ms;
|
||||
+ binuptime(&bt);
|
||||
+ ms = RT_MS_1SEC_64 * bt.sec;
|
||||
+ ms += (RT_MS_1SEC_64 * (uint32_t)(bt.frac >> 32)) >> 32;
|
||||
+ return ms;
|
||||
}
|
||||
|
||||
|
||||
@@ -91,8 +98,7 @@ RTDECL(uint64_t) RTTimeSystemMilliTS(void)
|
||||
|
||||
RTDECL(PRTTIMESPEC) RTTimeNow(PRTTIMESPEC pTime)
|
||||
{
|
||||
- struct timespec tsp;
|
||||
- nanotime(&tsp);
|
||||
- return RTTimeSpecSetTimespec(pTime, &tsp);
|
||||
+ struct timespec ts;
|
||||
+ nanotime(&ts);
|
||||
+ return RTTimeSpecSetTimespec(pTime, &ts);
|
||||
}
|
||||
-
|
|
@ -0,0 +1,68 @@
|
|||
--- src/VBox/Runtime/r0drv/freebsd/timer-r0drv-freebsd.c.orig 2021-01-07 15:42:09 UTC
|
||||
+++ src/VBox/Runtime/r0drv/freebsd/timer-r0drv-freebsd.c
|
||||
@@ -116,6 +116,7 @@ static void rtTimerFreeBSDCallback(void *pvTimer);
|
||||
RTDECL(int) RTTimerCreateEx(PRTTIMER *ppTimer, uint64_t u64NanoInterval, uint32_t fFlags, PFNRTTIMER pfnTimer, void *pvUser)
|
||||
{
|
||||
*ppTimer = NULL;
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
|
||||
/*
|
||||
* Validate flags.
|
||||
@@ -145,6 +146,7 @@ RTDECL(int) RTTimerCreateEx(PRTTIMER *ppTimer, uint64_
|
||||
callout_init(&pTimer->Callout, CALLOUT_MPSAFE);
|
||||
|
||||
*ppTimer = pTimer;
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
return VINF_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -165,6 +167,8 @@ DECLINLINE(bool) rtTimerIsValid(PRTTIMER pTimer)
|
||||
|
||||
RTDECL(int) RTTimerDestroy(PRTTIMER pTimer)
|
||||
{
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
+
|
||||
/* It's ok to pass NULL pointer. */
|
||||
if (pTimer == /*NIL_RTTIMER*/ NULL)
|
||||
return VINF_SUCCESS;
|
||||
@@ -177,6 +181,8 @@ RTDECL(int) RTTimerDestroy(PRTTIMER pTimer)
|
||||
pTimer->u32Magic++;
|
||||
callout_stop(&pTimer->Callout);
|
||||
RTMemFree(pTimer);
|
||||
+
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
return VINF_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -184,6 +190,7 @@ RTDECL(int) RTTimerDestroy(PRTTIMER pTimer)
|
||||
RTDECL(int) RTTimerStart(PRTTIMER pTimer, uint64_t u64First)
|
||||
{
|
||||
struct timeval tv;
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
|
||||
if (!rtTimerIsValid(pTimer))
|
||||
return VERR_INVALID_HANDLE;
|
||||
@@ -207,12 +214,15 @@ RTDECL(int) RTTimerStart(PRTTIMER pTimer, uint64_t u64
|
||||
tv.tv_usec = (u64First % 1000000000) / 1000;
|
||||
callout_reset(&pTimer->Callout, tvtohz(&tv), rtTimerFreeBSDCallback, pTimer);
|
||||
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
return VINF_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
RTDECL(int) RTTimerStop(PRTTIMER pTimer)
|
||||
{
|
||||
+ IPRT_FREEBSD_SAVE_EFL_AC();
|
||||
+
|
||||
if (!rtTimerIsValid(pTimer))
|
||||
return VERR_INVALID_HANDLE;
|
||||
if (pTimer->fSuspended)
|
||||
@@ -224,6 +234,7 @@ RTDECL(int) RTTimerStop(PRTTIMER pTimer)
|
||||
pTimer->fSuspended = true;
|
||||
callout_stop(&pTimer->Callout);
|
||||
|
||||
+ IPRT_FREEBSD_RESTORE_EFL_AC();
|
||||
return VINF_SUCCESS;
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
--- src/VBox/Runtime/r3/freebsd/systemmem-freebsd.cpp.orig 2017-07-27 13:18:46 UTC
|
||||
+++ src/VBox/Runtime/r3/freebsd/systemmem-freebsd.cpp
|
||||
@@ -65,7 +65,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;
|
||||
@@ -73,25 +72,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;
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
--- src/VBox/Runtime/r3/posix/process-creation-posix.cpp.orig 2022-01-13 18:58:24 UTC
|
||||
+++ src/VBox/Runtime/r3/posix/process-creation-posix.cpp
|
||||
@@ -30,7 +30,7 @@
|
||||
*********************************************************************************************************************************/
|
||||
#define LOG_GROUP RTLOGGROUP_PROCESS
|
||||
#include <iprt/cdefs.h>
|
||||
-#ifdef RT_OS_LINUX
|
||||
+#if defined(RT_OS_LINUX) || defined(RT_OS_FREEBSD)
|
||||
# define IPRT_WITH_DYNAMIC_CRYPT_R
|
||||
#endif
|
||||
#if (defined(RT_OS_LINUX) || defined(RT_OS_OS2)) && !defined(_GNU_SOURCE)
|
||||
@@ -69,7 +69,7 @@
|
||||
# include <shadow.h>
|
||||
#endif
|
||||
|
||||
-#if defined(RT_OS_LINUX) || defined(RT_OS_OS2)
|
||||
+#if defined(RT_OS_LINUX) || defined(RT_OS_OS2) || defined(RT_OS_FREEBSD)
|
||||
/* 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. */
|
||||
@@ -157,7 +157,7 @@
|
||||
# define IPRT_LIBPAM_FILE_3 "libpam.1.dylib"
|
||||
# define IPRT_LIBPAM_FILE_3_FIRST_VER 0
|
||||
# define IPRT_LIBPAM_FILE_3_END_VER 0
|
||||
-# elif RT_OS_LINUX
|
||||
+# elif RT_OS_LINUX || RT_OS_FREEBSD
|
||||
# define IPRT_LIBPAM_FILE_1 "libpam.so.0"
|
||||
# define IPRT_LIBPAM_FILE_1_FIRST_VER 0
|
||||
# define IPRT_LIBPAM_FILE_1_END_VER 0
|
||||
@@ -572,7 +572,7 @@ static int rtCheckCredentials(const char *pszUser, con
|
||||
if (pPw->pw_passwd && *pPw->pw_passwd)
|
||||
# endif
|
||||
{
|
||||
-# if defined(RT_OS_LINUX) || defined(RT_OS_OS2)
|
||||
+# if defined(RT_OS_LINUX) || defined(RT_OS_OS2) || defined(RT_OS_FREEBSD)
|
||||
# ifdef IPRT_WITH_DYNAMIC_CRYPT_R
|
||||
size_t const cbCryptData = RT_MAX(sizeof(struct crypt_data) * 2, _256K);
|
||||
# else
|
|
@ -0,0 +1,59 @@
|
|||
--- src/VBox/VMM/VMMR3/PDMAsyncCompletionFileNormal.cpp.orig 2021-04-19 21:33:04.000000000 -0700
|
||||
+++ src/VBox/VMM/VMMR3/PDMAsyncCompletionFileNormal.cpp 2021-05-18 11:45:08.396136000 -0700
|
||||
@@ -27,6 +27,13 @@
|
||||
#include <iprt/string.h>
|
||||
#include <iprt/assert.h>
|
||||
#include <VBox/log.h>
|
||||
+/* TBR: we need a complicated crawl through the data structure to get the AIO system limits
|
||||
+ to check when considering growing the number of active AIO requests.... */
|
||||
+/* We need the PDMInternal *before* the UVM, or it isn't visible afterwards. (src/VBox/VMM/include/PDMInternal.h) */
|
||||
+#include <PDMInternal.h>
|
||||
+#include <VBox/vmm/uvm.h>
|
||||
+#include <VBox/vmm/vm.h>
|
||||
+/* TBR: end of extra includes. */
|
||||
|
||||
#include "PDMAsyncCompletionFileInternal.h"
|
||||
|
||||
@@ -1120,8 +1127,40 @@
|
||||
*/
|
||||
pdmacFileAioMgrNormalBalanceLoad(pAioMgr);
|
||||
#else
|
||||
- /* Grow the I/O manager */
|
||||
- pAioMgr->enmState = PDMACEPFILEMGRSTATE_GROWING;
|
||||
+ /* TBR: Check the global AIO system limit before growing.
|
||||
+ This is the complicateds crawl through the data structure mentioned
|
||||
+ near the start of this file.
|
||||
+ There HAS to be a better way and better time to get this limit! */
|
||||
+ PPDMASYNCCOMPLETIONEPCLASS pEpClass = NULL;
|
||||
+ PCPDMASYNCCOMPLETIONEPCLASSOPS pEndpointOps = NULL;
|
||||
+ PDMASYNCCOMPLETIONEPCLASSTYPE enmClassType;
|
||||
+ PPDMASYNCCOMPLETIONEPCLASSFILE pEpClassFile = NULL;
|
||||
+ PVM pVM = NULL;
|
||||
+ PUVM pUVM = NULL;
|
||||
+ unsigned int aio_system_reqests_max = RTFILEAIO_UNLIMITED_REQS;
|
||||
+ pEpClass = pEndpoint->Core.pEpClass;
|
||||
+ AssertMsg((NULL != pEpClass),("ep->class is NULL"));
|
||||
+ pEndpointOps = pEpClass->pEndpointOps;
|
||||
+ AssertMsg((NULL != pEndpointOps),("ep->class->ops is NULL"));
|
||||
+ enmClassType = pEndpointOps->enmClassType;
|
||||
+ AssertMsg((PDMASYNCCOMPLETIONEPCLASSTYPE_FILE == enmClassType),
|
||||
+ ("ep->class->ops->type != PDMASYNCCOMPLETIONEPCLASSTYPE_FILE"));
|
||||
+ pVM = pEpClass->pVM;
|
||||
+ AssertMsg((NULL != pVM),("ep->class->VM is NULL"));
|
||||
+ pUVM = pVM->pUVM;
|
||||
+ AssertMsg((NULL != pUVM),("ep->class->VM->UVM is NULL"));
|
||||
+ pEpClassFile = (PPDMASYNCCOMPLETIONEPCLASSFILE) (pUVM->pdm.s.apAsyncCompletionEndpointClass[enmClassType]);
|
||||
+ AssertMsg((NULL != pEpClassFile),("ep->class->VM->UVM->pdn[globals] is NULL"));
|
||||
+ aio_system_reqests_max = pEpClassFile->cReqsOutstandingMax;
|
||||
+#if 0
|
||||
+ /* A one time check during development to verify getting the right number. */
|
||||
+ AssertMsg((256 != aio_system_reqests_max),
|
||||
+ ("aio_system_reqests_max != 256 (val=%u)",aio_system_reqests_max));
|
||||
+#endif
|
||||
+ if (RT_UNLIKELY( aio_system_reqests_max == RTFILEAIO_UNLIMITED_REQS
|
||||
+ || (pAioMgr->cRequestsActiveMax+PDMACEPFILEMGR_REQS_STEP) <= aio_system_reqests_max))
|
||||
+ /* Grow the I/O manager */
|
||||
+ pAioMgr->enmState = PDMACEPFILEMGRSTATE_GROWING;
|
||||
#endif
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
--- src/VBox/VMM/VMMR3/PGMPhys.cpp.orig 2022-01-13 18:58:38 UTC
|
||||
+++ src/VBox/VMM/VMMR3/PGMPhys.cpp
|
||||
@@ -3179,7 +3179,7 @@ VMMR3_INT_DECL(int) PGMR3PhysMmio2Register(PVM pVM, PP
|
||||
else
|
||||
#endif
|
||||
{
|
||||
-#ifndef VBOX_WITH_LINEAR_HOST_PHYS_MEM
|
||||
+#if defined(VBOX_WITH_RAM_IN_KERNEL) && !defined(VBOX_WITH_LINEAR_HOST_PHYS_MEM)
|
||||
rc = SUPR3PageAllocEx(cPages, 0 /*fFlags*/, &pvPages, &pvPagesR0, paPages);
|
||||
#else
|
||||
rc = SUPR3PageAllocEx(cPages, 0 /*fFlags*/, &pvPages, NULL /*pR0Ptr*/, paPages);
|
|
@ -0,0 +1,11 @@
|
|||
--- src/libs/xpcom18a4/Makefile.kmk.orig 2021-01-07 15:44:04 UTC
|
||||
+++ src/libs/xpcom18a4/Makefile.kmk
|
||||
@@ -985,6 +985,8 @@ VBoxXPCOM_LIBS = \
|
||||
$(VBox-xpcom-proxy_1_TARGET) \
|
||||
$(VBox-xpcom-nspr_1_TARGET) \
|
||||
$(VBoxXPCOMGlue_s_1_TARGET)
|
||||
+VBoxXPCOM_LIBS.freebsd = \
|
||||
+ pthread
|
||||
VBoxXPCOM_LIBS.linux = \
|
||||
pthread dl
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
--- src/libs/xpcom18a4/nsprpub/pr/src/pthreads/ptsynch.c.orig 2019-04-16 10:18:41 UTC
|
||||
+++ src/libs/xpcom18a4/nsprpub/pr/src/pthreads/ptsynch.c
|
||||
@@ -49,6 +49,9 @@
|
||||
#include <string.h>
|
||||
#include <pthread.h>
|
||||
#include <sys/time.h>
|
||||
+#ifdef FREEBSD
|
||||
+#include <sys/param.h>
|
||||
+#endif
|
||||
|
||||
static pthread_mutexattr_t _pt_mattr;
|
||||
static pthread_condattr_t _pt_cvar_attr;
|
||||
@@ -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) && __FreeBSD_version < 1200059) \
|
||||
|| defined(OPENBSD) || defined(BSDI)
|
||||
/* union semun is defined by including <sys/sem.h> */
|
||||
#else
|
|
@ -0,0 +1,17 @@
|
|||
--- src/libs/xpcom18a4/xpcom/io/nsLocalFileUnix.h.orig 2020-05-13 19:46:34 UTC
|
||||
+++ src/libs/xpcom18a4/xpcom/io/nsLocalFileUnix.h
|
||||
@@ -72,14 +72,6 @@
|
||||
#define STATFS statfs
|
||||
#endif
|
||||
|
||||
-// so we can statfs on freebsd
|
||||
-#if defined(__FreeBSD__)
|
||||
- #define HAVE_SYS_STATFS_H
|
||||
- #define STATFS statfs
|
||||
- #include <sys/param.h>
|
||||
- #include <sys/mount.h>
|
||||
-#endif
|
||||
-
|
||||
class NS_COM nsLocalFile : public nsILocalFile
|
||||
{
|
||||
public:
|
120
emulators/virtualbox-ose-70/files/pkg-message.in
Normal file
120
emulators/virtualbox-ose-70/files/pkg-message.in
Normal file
|
@ -0,0 +1,120 @@
|
|||
[
|
||||
{ type: install
|
||||
message: <<EOM
|
||||
VirtualBox was installed.
|
||||
|
||||
You need to load the vboxdrv kernel module via /boot/loader.conf:
|
||||
|
||||
vboxdrv_load="YES"
|
||||
|
||||
You also have to add all users to your vboxusers group in order to use vbox.
|
||||
|
||||
% pw groupmod vboxusers -m jerry
|
||||
|
||||
Reboot the machine to load the needed kernel modules.
|
||||
|
||||
|
||||
Bridging Support:
|
||||
=================
|
||||
|
||||
For bridged networking please add the following line to your /etc/rc.conf:
|
||||
|
||||
vboxnet_enable="YES"
|
||||
|
||||
|
||||
USB Support:
|
||||
============
|
||||
|
||||
For USB support your user needs to be in the operator group and needs read
|
||||
and write permissions to the USB device.
|
||||
|
||||
% pw groupmod operator -m jerry
|
||||
|
||||
Add the following to /etc/devfs.rules (create if it doesn't exist):
|
||||
|
||||
[system=10]
|
||||
add path 'usb/*' mode 0660 group operator
|
||||
|
||||
To load these new rule add the following to /etc/rc.conf:
|
||||
|
||||
devfs_system_ruleset="system"
|
||||
|
||||
Then restart devfs to load the new rules:
|
||||
|
||||
% /etc/rc.d/devfs restart
|
||||
|
||||
|
||||
Troubleshooting:
|
||||
================
|
||||
|
||||
Running VirtualBox as non-root user may fail with a fatal error
|
||||
NS_ERROR_FACTORY_NOT_REGISTERED. In this case delete /tmp/.vbox-*-ipc file.
|
||||
|
||||
If you experience "Network: write Failed: Cannot allocate memory" errors
|
||||
try to increase net.graph.maxdata in /boot/loader.conf
|
||||
|
||||
If you are using AIO, then increase these limits (https://bugs.freebsd.org/168298):
|
||||
vfs.aio.max_buf_aio=8192
|
||||
vfs.aio.max_aio_queue_per_proc=65536
|
||||
vfs.aio.max_aio_per_proc=8192
|
||||
vfs.aio.max_aio_queue=65536
|
||||
To check if AIO is used use: kldstat -v | grep aio
|
||||
|
||||
If you are experiencing VMs freezes with an error in VBox.log such as:
|
||||
"
|
||||
00:01:29.590192 AssertLogRel /usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.44
|
||||
/src/VBox/VMM/VMMR3/PGMPhys.cpp(5148) int PGMR3PhysAllocateHandyPages(PVM): RT_SUCCESS(rc)
|
||||
00:01:29.590221 87/128: idPage=0x3d400 HCPhysGCPhys=000000027eaed000 rc=VERR_NO_MEMORY
|
||||
00:01:29.590247 Changing the VM state from 'RUNNING' to 'GURU_MEDITATION'
|
||||
00:01:29.590261 Console: Machine state changed to 'GuruMeditation'
|
||||
00:01:29.590695 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
00:01:29.590696 !!
|
||||
00:01:29.590697 !! VCPU0: Guru Meditation -8 (VERR_NO_MEMORY)
|
||||
"
|
||||
and see a lot of free RAM, then increase sysctl vm.max_user_wired
|
||||
(https://bugs.freebsd.org/252227).
|
||||
For dedicated VM servers, a good start is:
|
||||
("RAM in GB" - max(1, "RAM in GB" / 32)) * 1024*1024*1024 / PAGE_SIZE
|
||||
PAGE_SIZE on x86 is 4096.
|
||||
Examples with different RAM sizes in GB:
|
||||
16: ( 16-max(1, 16/32)*1024*1024*1024/4096 = 3932160 => 15GB
|
||||
32: ( 32-max(1, 32/32)*1024*1024*1024/4096 = 8126464 => 31GB
|
||||
48: ( 48-max(1, 48/32)*1024*1024*1024/4096 = 12189696 => 46.5GB
|
||||
64: ( 64-max(1, 64/32)*1024*1024*1024/4096 = 16252928 => 62GB
|
||||
128: (128-max(1,128/32)*1024*1024*1024/4096 = 32505856 => 124GB
|
||||
256: (256-max(1,256/32)*1024*1024*1024/4096 = 65011712 => 248GB
|
||||
|
||||
When assigning IP addresses in host-only mode from ranges outside
|
||||
of VirtualBox's defaults, the respective ranges need to be listed
|
||||
in %%VBOX_ETC%%/networks.conf (https://bugs.freebsd.org/259399).
|
||||
|
||||
Check the wiki page for known issues and troubleshooting:
|
||||
https://wiki.freebsd.org/VirtualBox
|
||||
|
||||
Please report any problems to emulation@. Thanks!
|
||||
EOM
|
||||
}
|
||||
{ type: upgrade
|
||||
maximum_version: 6.1.22
|
||||
message: <<EOM
|
||||
The PULSEAUDIO option has been forcibly disabled since VirtualBox
|
||||
version 6.1.24 due to a bug in it preventing virtual machines
|
||||
configured to use it from starting.
|
||||
|
||||
When upgrading from a previous version please reconfigure any virtual
|
||||
machines using the Pulseaudio host audio driver to use another
|
||||
supported one.
|
||||
EOM
|
||||
}
|
||||
{ type: upgrade
|
||||
minimum_version: 6.1.26
|
||||
maximum_version: 6.1.32_1
|
||||
message: <<EOM
|
||||
To comply to hier(7) requirements, networks.conf's location changed
|
||||
to %%VBOX_ETC%%/networks.conf.
|
||||
|
||||
In case /etc/vbox/networks.conf exists, it needs to be moved to
|
||||
%%VBOX_ETC%% and /etc/vbox should be deleted.
|
||||
EOM
|
||||
}
|
||||
]
|
140
emulators/virtualbox-ose-70/files/vboxheadless.in
Normal file
140
emulators/virtualbox-ose-70/files/vboxheadless.in
Normal file
|
@ -0,0 +1,140 @@
|
|||
#!/bin/sh
|
||||
|
||||
# PROVIDE: vboxheadless
|
||||
# REQUIRE: LOGIN vboxnet
|
||||
# KEYWORD: shutdown
|
||||
#
|
||||
# Add the following line to /etc/rc.conf[.local] to enable vboxheadless
|
||||
#
|
||||
# vboxheadless_enable (bool): Set to "NO" by default.
|
||||
# Set it to "YES" to enable vboxheadless.
|
||||
# vboxheadless_machines (str): Space separated list of machines
|
||||
# vboxheadless_user (str): Default user account to run with.
|
||||
# (default: %%VBOXUSER%%)
|
||||
# vboxheadless_stop (str): Default stop cmd for VBoxManage controlvm.
|
||||
# (default: savestate)
|
||||
# vboxheadless_delay (int): Default startup/shutdown delay in seconds.
|
||||
# (default: 0)
|
||||
# vboxheadless_<machine>_name (str): Virtualbox machine name or UUID.
|
||||
# vboxheadless_<machine>_user (str): User account to run with.
|
||||
# vboxheadless_<machine>_flags (str): Additional flags for VBoxHeadless.
|
||||
# vboxheadless_<machine>_stop (str): Stop command for VBoxManage controlvm.
|
||||
# vboxheadless_<machine>_delay (int): Startup and shutdown delay in seconds.
|
||||
|
||||
. /etc/rc.subr
|
||||
|
||||
name="vboxheadless"
|
||||
rcvar=vboxheadless_enable
|
||||
rc_fast="YES"
|
||||
|
||||
command="%%VBOXDIR%%/VBoxHeadless"
|
||||
pidbase="/var/run/${name}"
|
||||
|
||||
start_cmd="${name}_start"
|
||||
stop_cmd="${name}_stop"
|
||||
status_cmd="${name}_status"
|
||||
|
||||
vboxheadless_start()
|
||||
{
|
||||
local machine mpidfile pid vmname vmuser vmflags vmdelay
|
||||
|
||||
echo "Starting Virtual Machines:"
|
||||
for machine in ${vboxheadless_machines}; do
|
||||
mpidfile="${pidbase}_${machine}.pid"
|
||||
pid=$(check_pidfile $mpidfile $command)
|
||||
eval vmname="\${vboxheadless_${machine}_name:-${machine}}"
|
||||
eval vmuser="\${vboxheadless_${machine}_user:-${vboxheadless_user}}"
|
||||
eval vmflags="\${vboxheadless_${machine}_flags:-}"
|
||||
eval vmdelay="\${vboxheadless_${machine}_delay:-${vboxheadless_delay}}"
|
||||
|
||||
HOME=$(/usr/sbin/pw usershow -7 -n "${vmuser}" | /usr/bin/cut -d: -f6)
|
||||
|
||||
/usr/bin/printf "%25s " "${vmname}"
|
||||
|
||||
/usr/bin/su ${vmuser} -c "%%VBOXDIR%%/VBoxManage showvminfo '${vmname}' >/dev/null" 2>/dev/null
|
||||
|
||||
if [ $? != 0 ]; then
|
||||
echo "Unknown machine"
|
||||
continue
|
||||
fi
|
||||
|
||||
if [ -n "${pid}" ]; then
|
||||
echo "Already running? (pid=${pid})"
|
||||
continue
|
||||
fi
|
||||
|
||||
/bin/sleep ${vmdelay}
|
||||
/usr/bin/install -o ${vmuser} -g %%VBOXGROUP%% -m 644 /dev/null ${mpidfile}
|
||||
/usr/sbin/daemon -f -p ${mpidfile} -u ${vmuser} ${command} --startvm "${vmname}" ${vmflags}
|
||||
echo "Started"
|
||||
done
|
||||
}
|
||||
|
||||
vboxheadless_stop()
|
||||
{
|
||||
local machine mpidfile pid pids vmname vmuser vmstop vmdelay
|
||||
|
||||
echo "Saving states for Virtual Machines:"
|
||||
for machine in ${vboxheadless_machines}; do
|
||||
mpidfile="${pidbase}_${machine}.pid"
|
||||
pid=$(check_pidfile $mpidfile $command)
|
||||
eval vmname="\${vboxheadless_${machine}_name:-${machine}}"
|
||||
eval vmuser="\${vboxheadless_${machine}_user:-${vboxheadless_user}}"
|
||||
eval vmstop="\${vboxheadless_${machine}_stop:-${vboxheadless_stop}}"
|
||||
eval vmdelay="\${vboxheadless_${machine}_delay:-${vboxheadless_delay}}"
|
||||
|
||||
/usr/bin/printf "%25s " "${vmname}"
|
||||
|
||||
if [ -n "${pid}" ]; then
|
||||
pids="${pids} ${pid}"
|
||||
/bin/sleep ${vmdelay}
|
||||
/usr/bin/su ${vmuser} -c "%%VBOXDIR%%/VBoxManage controlvm '${vmname}' ${vmstop} >/dev/null &" 2>/dev/null
|
||||
fi
|
||||
done
|
||||
if [ -n "${pids}" ]; then
|
||||
wait_for_pids $pids >/dev/null
|
||||
echo "Stopped"
|
||||
else
|
||||
echo "Not running?"
|
||||
fi
|
||||
}
|
||||
|
||||
vboxheadless_status()
|
||||
{
|
||||
local machine mpidfile pid vmname vmuser
|
||||
|
||||
/usr/bin/printf "%25s %s\n" "Machine" "Status"
|
||||
/usr/bin/printf "%25s %s\n" "-------------------------" "------------"
|
||||
|
||||
for machine in ${vboxheadless_machines}; do
|
||||
mpidfile="${pidbase}_${machine}.pid"
|
||||
pid=$(check_pidfile $mpidfile $command)
|
||||
eval vmname="\${vboxheadless_${machine}_name:-${machine}}"
|
||||
eval vmuser="\${vboxheadless_${machine}_user:-${vboxheadless_user}}"
|
||||
|
||||
/usr/bin/su ${vmuser} -c "%%VBOXDIR%%/VBoxManage showvminfo '${vmname}' >/dev/null" 2>/dev/null
|
||||
|
||||
if [ $? != 0 ]; then
|
||||
/usr/bin/printf "%20s %s\n" "${vmname}" "Unknown Machine"
|
||||
elif [ -n "${pid}" ]; then
|
||||
/usr/bin/printf "%25s %s\n" "${vmname}" "Running"
|
||||
else
|
||||
/usr/bin/printf "%25s %s\n" "${vmname}" "Powered Off"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
load_rc_config $name
|
||||
|
||||
: ${vboxheadless_enable="NO"}
|
||||
: ${vboxheadless_user="%%VBOXUSER%%"}
|
||||
: ${vboxheadless_stop="savestate"}
|
||||
: ${vboxheadless_delay="0"}
|
||||
|
||||
cmd_arg="$1" ; shift
|
||||
|
||||
if [ -n "$*" ]; then
|
||||
vboxheadless_machines="$*"
|
||||
fi
|
||||
|
||||
run_rc_command "${cmd_arg}"
|
91
emulators/virtualbox-ose-70/files/vboxinit.in
Normal file
91
emulators/virtualbox-ose-70/files/vboxinit.in
Normal file
|
@ -0,0 +1,91 @@
|
|||
#!/bin/sh
|
||||
|
||||
# PROVIDE: vboxinit
|
||||
# REQUIRE: LOGIN vboxnet vboxwebsrv sshd
|
||||
# KEYWORD: shutdown
|
||||
#
|
||||
# Add the following line to /etc/rc.conf[.local] to enable vboxinit
|
||||
#
|
||||
# vboxinit_enable (bool): Set to "NO" by default.
|
||||
# Set it to "YES" to enable vboxinit.
|
||||
# stop and faststop are always enabled.
|
||||
# vboxinit_user (str): Default user account to run with.
|
||||
# (default: %%VBOXUSER%%)
|
||||
# vboxinit_home (str): Default home directory to run with.
|
||||
# (default: home of user ${vboxinit_user}
|
||||
# vboxinit_stop (str): Default stop cmd for VBoxManage controlvm.
|
||||
# (default: savestate)
|
||||
# vboxinit_start_delay (int): Default startup delay in seconds.
|
||||
# (default: 0)
|
||||
# vboxinit_stop_delay (int): Default shutdown delay in seconds.
|
||||
# (default: 0)
|
||||
#
|
||||
# Set the "Startup Mode" to "Automatic" for the virtual machine in
|
||||
# phpvirtualbox to automatically start the virtual machine during OS boot.
|
||||
#
|
||||
|
||||
. /etc/rc.subr
|
||||
|
||||
name="vboxinit"
|
||||
rcvar="${name}_enable"
|
||||
|
||||
start_cmd="${name}_start"
|
||||
stop_cmd="${name}_stop"
|
||||
status_cmd="${name}_status"
|
||||
restart_cmd="${name}_restart"
|
||||
|
||||
vboxinit_start()
|
||||
{
|
||||
# Get a list of all machines with autorun enabled in phpvirtualbox
|
||||
${su_command} "${command} list vms | /usr/bin/tr -d '{}\"'" | while read VMNAME UUID; do
|
||||
STARTUP=$(${su_command} "${command} getextradata ${UUID} 'pvbx/startupMode'" | /usr/bin/cut -d' ' -f2)
|
||||
if [ "${STARTUP}" == "auto" ]; then
|
||||
echo "${name}: starting machine ${VMNAME} ..."
|
||||
${su_command} "${command} startvm ${UUID} --type headless"
|
||||
sleep "${vboxinit_start_delay}"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
vboxinit_stop()
|
||||
{
|
||||
# Get all running machines
|
||||
${su_command} "${command} list runningvms | /usr/bin/tr -d '{}\"'" | while read VMNAME UUID; do
|
||||
echo "${name}: stopping machine ${VMNAME} with action '${vboxinit_stop}' ..."
|
||||
${su_command} "${command} controlvm ${UUID} ${vboxinit_stop}"
|
||||
sleep "${vboxinit_stop_delay}"
|
||||
done
|
||||
}
|
||||
|
||||
vboxinit_status()
|
||||
{
|
||||
# List all running machines
|
||||
${su_command} "${command} list runningvms"
|
||||
}
|
||||
|
||||
vboxinit_restart()
|
||||
{
|
||||
vboxinit_stop
|
||||
vboxinit_start
|
||||
}
|
||||
|
||||
load_rc_config $name
|
||||
|
||||
: ${vboxinit_enable="NO"}
|
||||
: ${vboxinit_user="%%VBOXUSER%%"}
|
||||
: ${vboxinit_home=$(/usr/sbin/pw usershow -7 -n "${vboxinit_user}" | /usr/bin/cut -d: -f6)}
|
||||
: ${vboxinit_stop="savestate"}
|
||||
: ${vboxinit_start_delay="0"}
|
||||
: ${vboxinit_stop_delay="0"}
|
||||
HOME=${vboxinit_home}
|
||||
USER=${vboxinit_user}
|
||||
export HOME USER
|
||||
|
||||
command="%%VBOXDIR%%/VBoxManage"
|
||||
su_command="/usr/bin/su -m ${vboxinit_user} -c"
|
||||
|
||||
if [ "x$1" = "xstop" ] || [ "x$1" = "xfaststop" ]; then
|
||||
vboxinit_enable="YES"
|
||||
fi
|
||||
|
||||
run_rc_command "$1"
|
51
emulators/virtualbox-ose-70/files/vboxwatchdog.in
Normal file
51
emulators/virtualbox-ose-70/files/vboxwatchdog.in
Normal file
|
@ -0,0 +1,51 @@
|
|||
#!/bin/sh
|
||||
|
||||
# PROVIDE: vboxwatchdog
|
||||
# REQUIRE: LOGIN
|
||||
# KEYWORD: shutdown
|
||||
#
|
||||
# Add the following line to /etc/rc.conf[.local] to enable vboxwatchdog
|
||||
#
|
||||
# vboxwatchdog_enable (bool): Set to "NO" by default.
|
||||
# Set it to "YES" to enable vboxwatchdog.
|
||||
# vboxwatchdog_user (str): User account to run with.
|
||||
# vboxwatchdog_flags (str): Custom flags for VBoxWatchdog.
|
||||
|
||||
. /etc/rc.subr
|
||||
|
||||
name=vboxwatchdog
|
||||
rcvar=vboxwatchdog_enable
|
||||
|
||||
command="%%VBOXDIR%%/VBoxBalloonCtrl"
|
||||
pidfile="/var/run/${name}.pid"
|
||||
|
||||
start_cmd="${name}_start"
|
||||
|
||||
vboxwatchdog_start()
|
||||
{
|
||||
local pid
|
||||
|
||||
HOME=$(/usr/sbin/pw usershow -7 -n "${vboxwatchdog_user}" | /usr/bin/cut -d: -f6)
|
||||
pid=$(check_pidfile $pidfile $command)
|
||||
|
||||
if [ -n "${pid}" ]; then
|
||||
echo "${name} already running? (pid=${pid})."
|
||||
return 1
|
||||
fi
|
||||
|
||||
# prevent inheriting this setting to VBoxSVC
|
||||
unset VBOX_RELEASE_LOG_DEST
|
||||
|
||||
echo -n "Starting ${name}"
|
||||
/usr/bin/install -o ${vboxwatchdog_user} -g %%VBOXGROUP%% -m 644 /dev/null ${pidfile}
|
||||
/usr/sbin/daemon -f -p ${pidfile} -u ${vboxwatchdog_user} ${command} ${vboxwatchdog_flags}
|
||||
echo '.'
|
||||
}
|
||||
|
||||
load_rc_config $name
|
||||
|
||||
: ${vboxwatchdog_enable="NO"}
|
||||
: ${vboxwatchdog_user="%%VBOXUSER%%"}
|
||||
: ${vboxwatchdog_flags=""}
|
||||
|
||||
run_rc_command "$1"
|
47
emulators/virtualbox-ose-70/files/vboxwebsrv.in
Normal file
47
emulators/virtualbox-ose-70/files/vboxwebsrv.in
Normal file
|
@ -0,0 +1,47 @@
|
|||
#!/bin/sh
|
||||
|
||||
# PROVIDE: vboxwebsrv
|
||||
# REQUIRE: LOGIN
|
||||
# KEYWORD: shutdown
|
||||
#
|
||||
# Add the following line to /etc/rc.conf[.local] to enable vboxwebsrv
|
||||
#
|
||||
# vboxwebsrv_enable (bool): Set to "NO" by default.
|
||||
# Set it to "YES" to enable vboxwebsrv.
|
||||
# vboxwebsrv_user (str): User account to run with.
|
||||
# vboxwebsrv_flags (str): Custom flags for vboxwebsrv.
|
||||
|
||||
. /etc/rc.subr
|
||||
|
||||
name=vboxwebsrv
|
||||
rcvar=vboxwebsrv_enable
|
||||
|
||||
command="%%VBOXDIR%%/vboxwebsrv"
|
||||
pidfile="/var/run/${name}.pid"
|
||||
|
||||
start_cmd="${name}_start"
|
||||
|
||||
vboxwebsrv_start()
|
||||
{
|
||||
local pid
|
||||
|
||||
HOME=$(/usr/sbin/pw usershow -7 -n "${vboxwebsrv_user}" | /usr/bin/cut -d: -f6)
|
||||
pid=$(check_pidfile $pidfile $command)
|
||||
|
||||
if [ -n "${pid}" ]; then
|
||||
echo "${name} already running? (pid=${pid})."
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo -n "Starting ${name}"
|
||||
/usr/bin/install -o ${vboxwebsrv_user} -g %%VBOXGROUP%% -m 644 /dev/null ${pidfile}
|
||||
/usr/sbin/daemon -f -p ${pidfile} -u ${vboxwebsrv_user} ${command} ${vboxwebsrv_flags}
|
||||
echo '.'
|
||||
}
|
||||
|
||||
load_rc_config $name
|
||||
|
||||
: ${vboxwebsrv_enable="NO"}
|
||||
: ${vboxwebsrv_user="%%VBOXWSUSER%%"}
|
||||
|
||||
run_rc_command "$1"
|
8
emulators/virtualbox-ose-70/pkg-descr
Normal file
8
emulators/virtualbox-ose-70/pkg-descr
Normal file
|
@ -0,0 +1,8 @@
|
|||
Oracle VM VirtualBox is a hosted hypervisor for x86 virtualisation.
|
||||
Supported guests include BSD, Haiku, Linux, OS/2, ReactOS, Solaris and
|
||||
Windows.
|
||||
|
||||
Guest Additions are available from: emulators/virtualbox-ose-additions
|
||||
|
||||
For the Extension Pack: FreeBSD is not a supported host platform.
|
||||
Installation of the Pack will not extend the feature set.
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue