summaryrefslogtreecommitdiff
path: root/emulators/virtualbox-ose/files
diff options
context:
space:
mode:
Diffstat (limited to 'emulators/virtualbox-ose/files')
-rw-r--r--emulators/virtualbox-ose/files/extrapatch-Config.kmk11
-rw-r--r--emulators/virtualbox-ose/files/extrapatch-src-VBox-HostDrivers-Support-freebsd-Makefile11
-rw-r--r--emulators/virtualbox-ose/files/patch-src-VBox-Additions-common-VBoxGuest-VBoxGuest-freebsd.c255
-rw-r--r--emulators/virtualbox-ose/files/patch-src-VBox-Additions-common-VBoxGuest-freebsd-Makefile10
-rw-r--r--emulators/virtualbox-ose/files/patch-src-VBox-Additions-common-VBoxGuest-freebsd-files_vboxguest10
-rw-r--r--emulators/virtualbox-ose/files/patch-src-VBox-Additions-common-VBoxGuestLib-Makefile.kmk18
-rw-r--r--emulators/virtualbox-ose/files/patch-src-VBox-Additions-freebsd-Makefile19
-rw-r--r--emulators/virtualbox-ose/files/patch-src-VBox-Additions-x11-Installer-98vboxadd-xclient27
-rw-r--r--emulators/virtualbox-ose/files/patch-src-VBox-Additions-x11-Installer-vboxclient.desktop10
-rw-r--r--emulators/virtualbox-ose/files/patch-src-VBox-Additions-x11-vboxvideo-Makefile.kmk138
-rw-r--r--emulators/virtualbox-ose/files/patch-src-VBox-Devices-Network-slirp-resolv_conf_parser.c11
-rw-r--r--emulators/virtualbox-ose/files/patch-src-VBox-HostDrivers-Support-freebsd-Makefile10
-rw-r--r--emulators/virtualbox-ose/files/patch-src-VBox-HostDrivers-VBoxNetAdp-Makefile.kmk25
-rw-r--r--emulators/virtualbox-ose/files/patch-src-VBox-HostDrivers-VBoxNetFlt-freebsd-VBoxNetFlt-freebsd.c72
-rw-r--r--emulators/virtualbox-ose/files/patch-src-VBox-NetworkServices-NAT-VBoxNetLwipNAT.cpp11
-rw-r--r--emulators/virtualbox-ose/files/patch-src-VBox-Runtime-r0drv-freebsd-sleepqueue-r0drv-freebsd.h20
16 files changed, 658 insertions, 0 deletions
diff --git a/emulators/virtualbox-ose/files/extrapatch-Config.kmk b/emulators/virtualbox-ose/files/extrapatch-Config.kmk
new file mode 100644
index 000000000000..7df1b0883f27
--- /dev/null
+++ b/emulators/virtualbox-ose/files/extrapatch-Config.kmk
@@ -0,0 +1,11 @@
+--- Config.kmk.orig 2012-05-24 01:15:53.393052000 +0200
++++ Config.kmk 2012-05-24 01:16:15.883067161 +0200
+@@ -3188,7 +3188,7 @@
+ | 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
diff --git a/emulators/virtualbox-ose/files/extrapatch-src-VBox-HostDrivers-Support-freebsd-Makefile b/emulators/virtualbox-ose/files/extrapatch-src-VBox-HostDrivers-Support-freebsd-Makefile
new file mode 100644
index 000000000000..67361da543f7
--- /dev/null
+++ b/emulators/virtualbox-ose/files/extrapatch-src-VBox-HostDrivers-Support-freebsd-Makefile
@@ -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
diff --git a/emulators/virtualbox-ose/files/patch-src-VBox-Additions-common-VBoxGuest-VBoxGuest-freebsd.c b/emulators/virtualbox-ose/files/patch-src-VBox-Additions-common-VBoxGuest-VBoxGuest-freebsd.c
new file mode 100644
index 000000000000..269546e610d5
--- /dev/null
+++ b/emulators/virtualbox-ose/files/patch-src-VBox-Additions-common-VBoxGuest-VBoxGuest-freebsd.c
@@ -0,0 +1,255 @@
+--- src/VBox/Additions/common/VBoxGuest/VBoxGuest-freebsd.c.orig 2014-02-25 12:00:25.000000000 -0500
++++ src/VBox/Additions/common/VBoxGuest/VBoxGuest-freebsd.c 2014-03-01 03:23:16.000000000 -0500
+@@ -89,8 +89,7 @@
+ /*
+ * Character device file handlers.
+ */
+-static d_fdopen_t VBoxGuestFreeBSDOpen;
+-static d_close_t VBoxGuestFreeBSDClose;
++static d_open_t VBoxGuestFreeBSDOpen;
+ static d_ioctl_t VBoxGuestFreeBSDIOCtl;
+ static d_write_t VBoxGuestFreeBSDWrite;
+ static d_read_t VBoxGuestFreeBSDRead;
+@@ -121,8 +120,7 @@
+ {
+ .d_version = D_VERSION,
+ .d_flags = D_TRACKCLOSE | D_NEEDMINOR,
+- .d_fdopen = VBoxGuestFreeBSDOpen,
+- .d_close = VBoxGuestFreeBSDClose,
++ .d_open = VBoxGuestFreeBSDOpen,
+ .d_ioctl = VBoxGuestFreeBSDIOCtl,
+ .d_read = VBoxGuestFreeBSDRead,
+ .d_write = VBoxGuestFreeBSDWrite,
+@@ -130,106 +128,45 @@
+ .d_name = DEVICE_NAME
+ };
+
++/** 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_pVBoxGuestFreeBSDClones;
+-/** The dev_clone event handler tag. */
+-static eventhandler_tag g_VBoxGuestFreeBSDEHTag;
+ /** Reference counter */
+ static volatile uint32_t cUsers;
+ /** selinfo structure used for polling. */
+ static struct selinfo g_SelInfo;
+
+-/**
+- * DEVFS event handler.
+- */
+-static void VBoxGuestFreeBSDClone(void *pvArg, struct ucred *pCred, char *pszName, int cchName, struct cdev **ppDev)
++static void VBoxGuestFreeBSDDtr(void *pSession)
+ {
+- int iUnit;
+- int rc;
+-
+- Log(("VBoxGuestFreeBSDClone: 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(("VBoxGuestFreeBSDClone: iUnit=%d >= 256 - rejected\n", iUnit));
+- return;
+- }
+-
+- Log(("VBoxGuestFreeBSDClone: pszName=%s iUnit=%d\n", pszName, iUnit));
+-
+- rc = clone_create(&g_pVBoxGuestFreeBSDClones, &g_VBoxGuestFreeBSDChrDevSW, &iUnit, ppDev, 0);
+- Log(("VBoxGuestFreeBSDClone: clone_create -> %d; iUnit=%d\n", rc, iUnit));
+- if (rc)
+- {
+- *ppDev = make_dev(&g_VBoxGuestFreeBSDChrDevSW,
+- iUnit,
+- UID_ROOT,
+- GID_WHEEL,
+- 0664,
+- "vboxguest%d", iUnit);
+- if (*ppDev)
+- {
+- dev_ref(*ppDev);
+- (*ppDev)->si_flags |= SI_CHEAPCLONE;
+- Log(("VBoxGuestFreeBSDClone: 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(("VBoxGuestFreeBSDClone: make_dev iUnit=%d failed\n", iUnit));
+- }
+- else
+- Log(("VBoxGuestFreeBSDClone: Existing *ppDev=%p iUnit=%d si_drv1=%p si_drv2=%p\n",
+- *ppDev, iUnit, (*ppDev)->si_drv1, (*ppDev)->si_drv2));
++ VBoxGuestCloseSession(&g_DevExt, pSession);
++ ASMAtomicDecU32(&cUsers);
+ }
+
+ /**
+ * File open handler
+ *
+ */
+-#if __FreeBSD_version >= 700000
+-static int VBoxGuestFreeBSDOpen(struct cdev *pDev, int fOpen, struct thread *pTd, struct file *pFd)
+-#else
+-static int VBoxGuestFreeBSDOpen(struct cdev *pDev, int fOpen, struct thread *pTd)
+-#endif
++static int VBoxGuestFreeBSDOpen(struct cdev *pDev, int fOpen, int DevType, struct thread *pTd)
+ {
+- int rc;
+- PVBOXGUESTSESSION pSession;
++ PVBOXGUESTSESSION pSession;
++ int rc;
+
+ LogFlow((DEVICE_NAME ":VBoxGuestFreeBSDOpen\n"));
+
+ /*
+- * Try grab it (we don't grab the giant, remember).
+- */
+- if (!ASMAtomicCmpXchgPtr(&pDev->si_drv1, (void *)0x42, NULL))
+- return EBUSY;
+-
+- /*
+ * Create a new session.
+ */
+ rc = VBoxGuestCreateUserSession(&g_DevExt, &pSession);
+ if (RT_SUCCESS(rc))
+ {
+- if (ASMAtomicCmpXchgPtr(&pDev->si_drv1, pSession, (void *)0x42))
+- {
+- Log((DEVICE_NAME ":VBoxGuestFreeBSDOpen success: g_DevExt=%p pSession=%p rc=%d pid=%d\n", &g_DevExt, pSession, rc, (int)RTProcSelf()));
++ Log((DEVICE_NAME ":VBoxGuestFreeBSDOpen success: g_DevExt=%p pSession=%p rc=%d pid=%d\n", &g_DevExt, pSession, rc, (int)RTProcSelf()));
++ rc = devfs_set_cdevpriv(pSession, VBoxGuestFreeBSDDtr);
++ if (rc)
++ VBoxGuestCloseSession(&g_DevExt, pSession);
++ else
+ ASMAtomicIncU32(&cUsers);
+- return 0;
+- }
+-
+- VBoxGuestCloseSession(&g_DevExt, pSession);
++ return rc;
+ }
+
+ LogRel((DEVICE_NAME ":VBoxGuestFreeBSDOpen: failed. rc=%d\n", rc));
+@@ -237,47 +174,19 @@
+ }
+
+ /**
+- * File close handler
+- *
+- */
+-static int VBoxGuestFreeBSDClose(struct cdev *pDev, int fFile, int DevType, struct thread *pTd)
+-{
+- PVBOXGUESTSESSION pSession = (PVBOXGUESTSESSION)pDev->si_drv1;
+- Log(("VBoxGuestFreeBSDClose: fFile=%#x pSession=%p\n", fFile, pSession));
+-
+- /*
+- * Close the session if it's still hanging on to the device...
+- */
+- if (VALID_PTR(pSession))
+- {
+- VBoxGuestCloseSession(&g_DevExt, pSession);
+- if (!ASMAtomicCmpXchgPtr(&pDev->si_drv1, NULL, pSession))
+- Log(("VBoxGuestFreeBSDClose: 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(("VBoxGuestFreeBSDClose: si_drv1=%p!\n", pSession));
+- return 0;
+-}
+-
+-/**
+ * IOCTL handler
+ *
+ */
+ static int VBoxGuestFreeBSDIOCtl(struct cdev *pDev, u_long ulCmd, caddr_t pvData, int fFile, struct thread *pTd)
+ {
+- LogFlow((DEVICE_NAME ":VBoxGuestFreeBSDIOCtl\n"));
++ PVBOXGUESTSESSION pSession;
++ int rc;
+
+- int rc = 0;
++ LogFlow((DEVICE_NAME ":VBoxGuestFreeBSDIOCtl\n"));
+
+- /*
+- * Validate the input.
+- */
+- PVBOXGUESTSESSION pSession = (PVBOXGUESTSESSION)pDev->si_drv1;
+- if (RT_UNLIKELY(!VALID_PTR(pSession)))
+- return EINVAL;
++ rc = devfs_get_cdevpriv((void **)&pSession);
++ if (rc)
++ return rc;
+
+ /*
+ * Validate the request wrapper.
+@@ -361,12 +270,14 @@
+
+ static int VBoxGuestFreeBSDPoll (struct cdev *pDev, int fEvents, struct thread *td)
+ {
+- int fEventsProcessed;
++ PVBOXGUESTSESSION pSession;
++ int fEventsProcessed, rc;
+
+ LogFlow((DEVICE_NAME "::Poll: 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((DEVICE_NAME "::Poll: no state data for %s\n", devtoname(pDev)));
+ return (fEvents & (POLLHUP|POLLIN|POLLRDNORM|POLLOUT|POLLWRNORM));
+ }
+@@ -407,10 +318,7 @@
+ /*
+ * Reverse what we did in VBoxGuestFreeBSDAttach.
+ */
+- if (g_VBoxGuestFreeBSDEHTag != NULL)
+- EVENTHANDLER_DEREGISTER(dev_clone, g_VBoxGuestFreeBSDEHTag);
+-
+- clone_cleanup(&g_pVBoxGuestFreeBSDClones);
++ destroy_dev(g_pDev);
+
+ VBoxGuestFreeBSDRemoveIRQ(pDevice, pState);
+
+@@ -562,18 +470,21 @@
+ if (RT_SUCCESS(rc))
+ {
+ /*
+- * Configure device cloning.
++ * Configure device.
+ */
+- clone_setup(&g_pVBoxGuestFreeBSDClones);
+- g_VBoxGuestFreeBSDEHTag = EVENTHANDLER_REGISTER(dev_clone, VBoxGuestFreeBSDClone, 0, 1000);
+- if (g_VBoxGuestFreeBSDEHTag)
++ g_pDev = make_dev(&g_VBoxGuestFreeBSDChrDevSW,
++ 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_pVBoxGuestFreeBSDClones);
++ printf(DEVICE_NAME ": make_dev failed\n");
+ VBoxGuestFreeBSDRemoveIRQ(pDevice, pState);
+ }
+ else
diff --git a/emulators/virtualbox-ose/files/patch-src-VBox-Additions-common-VBoxGuest-freebsd-Makefile b/emulators/virtualbox-ose/files/patch-src-VBox-Additions-common-VBoxGuest-freebsd-Makefile
new file mode 100644
index 000000000000..ed9f2b80ce46
--- /dev/null
+++ b/emulators/virtualbox-ose/files/patch-src-VBox-Additions-common-VBoxGuest-freebsd-Makefile
@@ -0,0 +1,10 @@
+--- src/VBox/Additions/common/VBoxGuest/freebsd/Makefile.orig 2013-11-29 14:20:37.000000000 -0500
++++ src/VBox/Additions/common/VBoxGuest/freebsd/Makefile 2013-12-15 00:12:59.000000000 -0500
+@@ -155,6 +155,7 @@
+ SRCS += \
+ semspinmutex-r0drv-generic.c \
+ mpnotification-r0drv-generic.c \
++ threadctxhooks-r0drv-generic.c \
+ RTMpIsCpuWorkPending-r0drv-generic.c
+
+ .PATH: ${.CURDIR}/VBox
diff --git a/emulators/virtualbox-ose/files/patch-src-VBox-Additions-common-VBoxGuest-freebsd-files_vboxguest b/emulators/virtualbox-ose/files/patch-src-VBox-Additions-common-VBoxGuest-freebsd-files_vboxguest
new file mode 100644
index 000000000000..cde44a17359a
--- /dev/null
+++ b/emulators/virtualbox-ose/files/patch-src-VBox-Additions-common-VBoxGuest-freebsd-files_vboxguest
@@ -0,0 +1,10 @@
+--- src/VBox/Additions/common/VBoxGuest/freebsd/files_vboxguest.orig 2014-01-04 05:34:34.000000000 +0000
++++ src/VBox/Additions/common/VBoxGuest/freebsd/files_vboxguest 2014-01-04 05:34:41.000000000 +0000
+@@ -185,6 +185,7 @@
+ ${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 \
diff --git a/emulators/virtualbox-ose/files/patch-src-VBox-Additions-common-VBoxGuestLib-Makefile.kmk b/emulators/virtualbox-ose/files/patch-src-VBox-Additions-common-VBoxGuestLib-Makefile.kmk
new file mode 100644
index 000000000000..71e85c9b2012
--- /dev/null
+++ b/emulators/virtualbox-ose/files/patch-src-VBox-Additions-common-VBoxGuestLib-Makefile.kmk
@@ -0,0 +1,18 @@
+--- src/VBox/Additions/common/VBoxGuestLib/Makefile.kmk.orig 2010-10-07 11:37:10.000000000 +0200
++++ src/VBox/Additions/common/VBoxGuestLib/Makefile.kmk 2010-10-07 11:36:16.000000000 +0200
+@@ -140,6 +140,7 @@
+ # the X server runtime instead of IPRT, for use with old servers where the
+ # C library is not available.
+ #
++ifdef VBOX_WITH_X11_ADDITIONS
+ VBoxGuestR3LibXFree86_TEMPLATE = VBOXGUESTR3XF86LIB
+ VBoxGuestR3LibXFree86_DEFS = \
+ VBOX_WITH_HGCM \
+@@ -163,6 +164,7 @@
+ $(VBOX_PATH_X11_XFREE_4_3)/exports/include/X11
+
+ VBoxGuestR3LibRuntimeXF86.cpp_CXXFLAGS = -Wno-shadow
++endif
+
+ include $(KBUILD_PATH)/subfooter.kmk
+
diff --git a/emulators/virtualbox-ose/files/patch-src-VBox-Additions-freebsd-Makefile b/emulators/virtualbox-ose/files/patch-src-VBox-Additions-freebsd-Makefile
new file mode 100644
index 000000000000..0908c1b15eb2
--- /dev/null
+++ b/emulators/virtualbox-ose/files/patch-src-VBox-Additions-freebsd-Makefile
@@ -0,0 +1,19 @@
+--- src/VBox/Additions/freebsd/Makefile.orig 2014-02-25 12:00:30.000000000 -0500
++++ src/VBox/Additions/freebsd/Makefile 2014-03-03 15:27:32.000000000 -0500
+@@ -19,14 +19,14 @@
+
+ all:
+ @echo "*** Building 'vboxguest' module ***"
+- @$(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxguest
++ @$(MAKE) CC=cc LDFLAGS= KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxguest
+ @if [ -f vboxguest/vboxguest.ko ]; then \
+ cp vboxguest/vboxguest.ko .; \
+ fi
+ @echo
+ @if [ -d vboxvfs ]; then \
+ echo "*** Building 'vboxvfs' module ***"; \
+- $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxvfs; \
++ $(MAKE) CC=cc LDFLAGS= KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxvfs; \
+ if [ -f vboxvfs/vboxvfs.ko ]; then \
+ cp vboxvfs/vboxvfs.ko .; \
+ fi; \
diff --git a/emulators/virtualbox-ose/files/patch-src-VBox-Additions-x11-Installer-98vboxadd-xclient b/emulators/virtualbox-ose/files/patch-src-VBox-Additions-x11-Installer-98vboxadd-xclient
new file mode 100644
index 000000000000..edb9514f95c5
--- /dev/null
+++ b/emulators/virtualbox-ose/files/patch-src-VBox-Additions-x11-Installer-98vboxadd-xclient
@@ -0,0 +1,27 @@
+--- src/VBox/Additions/x11/Installer/98vboxadd-xclient.orig 2010-09-10 14:24:55.000000000 +0200
++++ src/VBox/Additions/x11/Installer/98vboxadd-xclient 2010-12-29 20:42:00.000000000 +0100
+@@ -28,8 +28,8 @@
+ xorgbin=Xorg
+ found=`which Xorg | grep "no Xorg"`
+ if test ! -z "$found"; then
+- if test -f "/usr/X11/bin/Xorg"; then
+- xorgbin=/usr/X11/bin/Xorg
++ if test -f "/usr/local/bin/Xorg"; then
++ xorgbin=/usr/local/bin/Xorg
+ else
+ exit 1
+ fi
+@@ -40,9 +40,9 @@
+ no_display=1
+ fi
+
+-/usr/bin/VBoxClient --clipboard
+-/usr/bin/VBoxClient --checkhostversion
++/usr/local/bin/VBoxClient --clipboard
++/usr/local/bin/VBoxClient --checkhostversion
+ test -z "$no_display" &&
+- /usr/bin/VBoxClient --display
++ /usr/local/bin/VBoxClient --display
+ test -z "$no_display" &&
+- /usr/bin/VBoxClient --seamless
++ /usr/local/bin/VBoxClient --seamless
diff --git a/emulators/virtualbox-ose/files/patch-src-VBox-Additions-x11-Installer-vboxclient.desktop b/emulators/virtualbox-ose/files/patch-src-VBox-Additions-x11-Installer-vboxclient.desktop
new file mode 100644
index 000000000000..fadd31bc4d48
--- /dev/null
+++ b/emulators/virtualbox-ose/files/patch-src-VBox-Additions-x11-Installer-vboxclient.desktop
@@ -0,0 +1,10 @@
+--- src/VBox/Additions/x11/Installer/vboxclient.desktop.orig 2009-06-12 12:34:57.000000000 +0000
++++ src/VBox/Additions/x11/Installer/vboxclient.desktop 2011-01-13 22:07:37.000000000 +0000
+@@ -8,6 +8,6 @@
+ Comment=VirtualBox User Session Services
+ Comment[it]=Servizi di sessione utente di VirtualBox
+ Comment[pl]=Usługi sesji użytkownika VirtualBox
+-Exec=/usr/bin/VBoxClient-all
++Exec=/usr/local/bin/VBoxClient-all
+ X-GNOME-Autostart-enabled=true
+ X-KDE-autostart-after=panel
diff --git a/emulators/virtualbox-ose/files/patch-src-VBox-Additions-x11-vboxvideo-Makefile.kmk b/emulators/virtualbox-ose/files/patch-src-VBox-Additions-x11-vboxvideo-Makefile.kmk
new file mode 100644
index 000000000000..7f5ea7b042dc
--- /dev/null
+++ b/emulators/virtualbox-ose/files/patch-src-VBox-Additions-x11-vboxvideo-Makefile.kmk
@@ -0,0 +1,138 @@
+--- src/VBox/Additions/x11/vboxvideo/Makefile.kmk.orig 2014-02-25 12:00:33.000000000 -0500
++++ src/VBox/Additions/x11/vboxvideo/Makefile.kmk 2014-02-26 16:10:28.000000000 -0500
+@@ -33,7 +33,7 @@
+ vboxvideo_13_DEFS := $(vboxvideo_70_DEFS) VBOXVIDEO_13
+ vboxvideo_15_DEFS := \
+ $(vboxvideo_13_DEFS) NO_ANSIC PCIACCESS XSERVER_LIBPCIACCESS
+-if1of ($(KBUILD_TARGET), linux solaris)
++if1of ($(KBUILD_TARGET), freebsd linux solaris)
+ vboxvideo_15_DEFS += \
+ VBOX_DRI
+ endif
+@@ -198,7 +198,7 @@
+ vboxvideo_drv_15_TEMPLATE = VBOXGUESTR3XORGMOD
+ vboxvideo_drv_15_CFLAGS := $(vboxvideo_drv_70_CFLAGS)
+ vboxvideo_drv_15_DEFS := $(vboxvideo_15_DEFS) XORG_VERSION_CURRENT=100503000
+-if1of ($(KBUILD_TARGET), linux solaris)
++if1of ($(KBUILD_TARGET), freebsd linux solaris)
+ vboxvideo_drv_15_DEFS += \
+ VBOX_DRI_OLD
+ endif
+@@ -207,7 +207,7 @@
+ $(VBOX_PATH_X11_ROOT)/xorg-server-1.5.3
+ vboxvideo_drv_15_INCS += $(PATH_ROOT)/src/VBox/Runtime/include
+ vboxvideo_drv_15_SOURCES = $(vboxvideo_drv_13_SOURCES)
+-if1of ($(KBUILD_TARGET), linux solaris)
++if1of ($(KBUILD_TARGET), freebsd linux solaris)
+ vboxvideo_drv_15_SOURCES += \
+ vboxvideo_dri.c
+ endif
+@@ -220,7 +220,7 @@
+ vboxvideo_drv_16_TEMPLATE = VBOXGUESTR3XORGMOD
+ vboxvideo_drv_16_CFLAGS := $(vboxvideo_drv_70_CFLAGS)
+ vboxvideo_drv_16_DEFS := $(vboxvideo_15_DEFS) XORG_VERSION_CURRENT=100600000
+-if1of ($(KBUILD_TARGET), linux solaris)
++if1of ($(KBUILD_TARGET), freebsd linux solaris)
+ vboxvideo_drv_16_DEFS += \
+ VBOX_DRI_OLD
+ endif
+@@ -238,11 +238,19 @@
+ vboxvideo_drv_17_TEMPLATE = VBOXGUESTR3XORGMOD
+ vboxvideo_drv_17_CFLAGS := $(vboxvideo_drv_70_CFLAGS)
+ vboxvideo_drv_17_DEFS := $(vboxvideo_15_DEFS) XORG_VERSION_CURRENT=100699000
++if1of ($(KBUILD_TARGET), freebsd)
++ vboxvideo_drv_17_DEFS += \
++ VBOX_DRI_OLD
++endif
+ vboxvideo_drv_17_INCS = \
+ $(vboxvideo_xorg_INCS) \
+ $(VBOX_PATH_X11_ROOT)/xorg-server-1.7.7
+ vboxvideo_drv_17_INCS += $(PATH_ROOT)/src/VBox/Runtime/include
+ vboxvideo_drv_17_SOURCES := $(vboxvideo_drv_13_SOURCES)
++if1of ($(KBUILD_TARGET), freebsd)
++ vboxvideo_drv_17_SOURCES += \
++ vboxvideo_dri.c
++endif
+ if1of ($(KBUILD_TARGET), linux solaris)
+ vboxvideo_drv_17_SOURCES += \
+ vboxvideo_dri2.c
+@@ -256,6 +264,10 @@
+ vboxvideo_drv_18_TEMPLATE = VBOXGUESTR3XORGMOD
+ vboxvideo_drv_18_CFLAGS := $(vboxvideo_drv_70_CFLAGS)
+ vboxvideo_drv_18_DEFS := $(vboxvideo_15_DEFS) XORG_VERSION_CURRENT=100800000
++if1of ($(KBUILD_TARGET), freebsd)
++ vboxvideo_drv_18_DEFS += \
++ VBOX_DRI_OLD
++endif
+ vboxvideo_drv_18_INCS = \
+ $(vboxvideo_xorg_INCS) \
+ $(VBOX_PATH_X11_ROOT)/xorg-server-1.8.0
+@@ -270,6 +282,10 @@
+ vboxvideo_drv_19_TEMPLATE = VBOXGUESTR3XORGMOD
+ vboxvideo_drv_19_CFLAGS := $(vboxvideo_drv_70_CFLAGS)
+ vboxvideo_drv_19_DEFS := $(vboxvideo_15_DEFS) XORG_VERSION_CURRENT=100900000
++if1of ($(KBUILD_TARGET), freebsd)
++ vboxvideo_drv_19_DEFS += \
++ VBOX_DRI_OLD
++endif
+ vboxvideo_drv_19_INCS = \
+ $(vboxvideo_xorg_INCS) \
+ $(VBOX_PATH_X11_ROOT)/xorg-server-1.9.0
+@@ -288,7 +304,11 @@
+ $(vboxvideo_xorg_INCS) \
+ $(VBOX_PATH_X11_ROOT)/xorg-server-1.10.0
+ vboxvideo_drv_110_INCS += $(PATH_ROOT)/src/VBox/Runtime/include
+-vboxvideo_drv_110_SOURCES := $(vboxvideo_drv_17_SOURCES)
++vboxvideo_drv_110_SOURCES := $(vboxvideo_drv_13_SOURCES)
++if1of ($(KBUILD_TARGET), freebsd linux solaris)
++ vboxvideo_drv_110_SOURCES += \
++ vboxvideo_dri2.c
++endif
+
+
+ #
+@@ -302,7 +322,7 @@
+ $(vboxvideo_xorg_INCS) \
+ $(VBOX_PATH_X11_ROOT)/xorg-server-1.11.0
+ vboxvideo_drv_111_INCS += $(PATH_ROOT)/src/VBox/Runtime/include
+-vboxvideo_drv_111_SOURCES := $(vboxvideo_drv_17_SOURCES)
++vboxvideo_drv_111_SOURCES := $(vboxvideo_drv_110_SOURCES)
+
+
+ #
+@@ -316,7 +336,7 @@
+ $(vboxvideo_xorg_INCS) \
+ $(VBOX_PATH_X11_ROOT)/xorg-server-1.12.0
+ vboxvideo_drv_112_INCS += $(PATH_ROOT)/src/VBox/Runtime/include
+-vboxvideo_drv_112_SOURCES := $(vboxvideo_drv_17_SOURCES)
++vboxvideo_drv_112_SOURCES := $(vboxvideo_drv_110_SOURCES)
+
+
+ #
+@@ -330,7 +350,7 @@
+ $(vboxvideo_xorg_INCS) \
+ $(VBOX_PATH_X11_ROOT)/xorg-server-1.13.0
+ vboxvideo_drv_113_INCS += $(PATH_ROOT)/src/VBox/Runtime/include
+-vboxvideo_drv_113_SOURCES := $(vboxvideo_drv_17_SOURCES)
++vboxvideo_drv_113_SOURCES := $(vboxvideo_drv_110_SOURCES)
+
+
+ #
+@@ -344,7 +364,7 @@
+ $(vboxvideo_xorg_INCS) \
+ $(VBOX_PATH_X11_ROOT)/xorg-server-1.14.0
+ vboxvideo_drv_114_INCS += $(PATH_ROOT)/src/VBox/Runtime/include
+-vboxvideo_drv_114_SOURCES := $(vboxvideo_drv_17_SOURCES)
++vboxvideo_drv_114_SOURCES := $(vboxvideo_drv_110_SOURCES)
+
+
+ #
+@@ -358,7 +378,7 @@
+ $(vboxvideo_xorg_INCS) \
+ $(VBOX_PATH_X11_ROOT)/xorg-server-1.15.0
+ vboxvideo_drv_115_INCS += $(PATH_ROOT)/src/VBox/Runtime/include
+-vboxvideo_drv_115_SOURCES := $(vboxvideo_drv_17_SOURCES)
++vboxvideo_drv_115_SOURCES := $(vboxvideo_drv_110_SOURCES)
+
+
+ ifdef VBOX_USE_SYSTEM_XORG_HEADERS
diff --git a/emulators/virtualbox-ose/files/patch-src-VBox-Devices-Network-slirp-resolv_conf_parser.c b/emulators/virtualbox-ose/files/patch-src-VBox-Devices-Network-slirp-resolv_conf_parser.c
new file mode 100644
index 000000000000..0248be948790
--- /dev/null
+++ b/emulators/virtualbox-ose/files/patch-src-VBox-Devices-Network-slirp-resolv_conf_parser.c
@@ -0,0 +1,11 @@
+--- src/VBox/Devices/Network/slirp/resolv_conf_parser.c.orig 2014-01-30 22:19:47.429683181 +0400
++++ src/VBox/Devices/Network/slirp/resolv_conf_parser.c 2014-01-30 22:22:08.149672985 +0400
+@@ -15,6 +15,8 @@
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
++#include <sys/socket.h>
++
+ #include <iprt/assert.h>
+ #include <iprt/initterm.h>
+ #include <iprt/net.h>
diff --git a/emulators/virtualbox-ose/files/patch-src-VBox-HostDrivers-Support-freebsd-Makefile b/emulators/virtualbox-ose/files/patch-src-VBox-HostDrivers-Support-freebsd-Makefile
new file mode 100644
index 000000000000..56fa83e858e0
--- /dev/null
+++ b/emulators/virtualbox-ose/files/patch-src-VBox-HostDrivers-Support-freebsd-Makefile
@@ -0,0 +1,10 @@
+--- src/VBox/HostDrivers/Support/freebsd/Makefile.orig 2013-10-17 00:51:57.724397794 +0400
++++ src/VBox/HostDrivers/Support/freebsd/Makefile 2013-10-17 00:52:05.491398026 +0400
+@@ -170,6 +170,7 @@
+ SRCS += \
+ semspinmutex-r0drv-generic.c \
+ mpnotification-r0drv-generic.c \
++ threadctxhooks-r0drv-generic.c \
+ RTMpIsCpuWorkPending-r0drv-generic.c
+
+ .PATH: ${.CURDIR}/VBox
diff --git a/emulators/virtualbox-ose/files/patch-src-VBox-HostDrivers-VBoxNetAdp-Makefile.kmk b/emulators/virtualbox-ose/files/patch-src-VBox-HostDrivers-VBoxNetAdp-Makefile.kmk
new file mode 100644
index 000000000000..01d25b3ac02a
--- /dev/null
+++ b/emulators/virtualbox-ose/files/patch-src-VBox-HostDrivers-VBoxNetAdp-Makefile.kmk
@@ -0,0 +1,25 @@
+Fix kmod panic when VIMAGE is disabled in the kernel and port
+
+Submitted by: Gleb Kurtsou <gleb@freebsd.org>
+--- src/VBox/HostDrivers/VBoxNetAdp/Makefile.kmk.orig 2013-04-12 03:38:10.000000000 -0700
++++ src/VBox/HostDrivers/VBoxNetAdp/Makefile.kmk 2013-06-11 21:24:05.000000000 -0700
+@@ -143,12 +143,15 @@
+ $$(if $$(eq $$(VBoxNetAdp/freebsd/Makefile_VBOX_HARDENED),$$(VBOX_WITH_HARDENING)),,FORCE) \
+ | $$(dir $$@)
+ $(QUIET)$(RM) -f -- $@
+- ifndef VBOX_WITH_HARDENING
+- $(QUIET)$(SED) -e "s;-DVBOX_WITH_HARDENING;;g" --output $@ $<
+- else
+ $(QUIET)$(CP) -f $< $@
++ ifndef VBOX_WITH_HARDENING
++ $(QUIET)$(SED) -e "s;-DVBOX_WITH_HARDENING;;g" --output $@.tmp $@
++ ${QUIET}$(MV) -f $@.tmp $@
++ endif
++ ifndef VBOX_WITH_NETFLT_VIMAGE
++ $(QUIET)$(SED) -e "s;-DVIMAGE;;g" --output $@.tmp $@
++ ${QUIET}$(MV) -f $@.tmp $@
+ endif
+-
+ endif # freebsd
+
+ include $(FILE_KBUILD_SUB_FOOTER)
diff --git a/emulators/virtualbox-ose/files/patch-src-VBox-HostDrivers-VBoxNetFlt-freebsd-VBoxNetFlt-freebsd.c b/emulators/virtualbox-ose/files/patch-src-VBox-HostDrivers-VBoxNetFlt-freebsd-VBoxNetFlt-freebsd.c
new file mode 100644
index 000000000000..6cb5a1ebd30c
--- /dev/null
+++ b/emulators/virtualbox-ose/files/patch-src-VBox-HostDrivers-VBoxNetFlt-freebsd-VBoxNetFlt-freebsd.c
@@ -0,0 +1,72 @@
+Add VLAN trunking support to vboxnetflt
+
+See: http://lists.freebsd.org/pipermail/freebsd-emulation/2012-April/009698.html
+See: http://lists.freebsd.org/pipermail/freebsd-emulation/2013-May/010605.html
+Submitted by: Landon J Fuller <landonf at plausible.coop>
+--- ./src/VBox/HostDrivers/VBoxNetFlt/freebsd/VBoxNetFlt-freebsd.c.orig 2013-04-12 06:38:11.000000000 -0400
++++ ./src/VBox/HostDrivers/VBoxNetFlt/freebsd/VBoxNetFlt-freebsd.c 2013-05-25 20:14:52.152180452 -0400
+@@ -51,6 +51,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>
+@@ -427,6 +428,8 @@
+ struct ifnet *ifp = pThis->u.s.ifp;
+ unsigned int cSegs = 0;
+ bool fDropIt = false, fActive;
++ bool is_vl_tagged = false;
++ uint16_t vl_tag;
+ PINTNETSG pSG;
+
+ VBOXCURVNET_SET(ifp->if_vnet);
+@@ -439,6 +442,19 @@
+ 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++;
+@@ -453,6 +469,27 @@
+ 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
diff --git a/emulators/virtualbox-ose/files/patch-src-VBox-NetworkServices-NAT-VBoxNetLwipNAT.cpp b/emulators/virtualbox-ose/files/patch-src-VBox-NetworkServices-NAT-VBoxNetLwipNAT.cpp
new file mode 100644
index 000000000000..aff879d1cd90
--- /dev/null
+++ b/emulators/virtualbox-ose/files/patch-src-VBox-NetworkServices-NAT-VBoxNetLwipNAT.cpp
@@ -0,0 +1,11 @@
+--- src/VBox/NetworkServices/NAT/VBoxNetLwipNAT.cpp.orig 2014-02-25 12:09:19.000000000 -0500
++++ src/VBox/NetworkServices/NAT/VBoxNetLwipNAT.cpp 2014-03-03 14:50:41.000000000 -0500
+@@ -73,6 +73,8 @@
+ #include <vector>
+ #include <string>
+
++#include <stdio.h>
++
+ #include "../NetLib/VBoxNetLib.h"
+ #include "../NetLib/VBoxNetBaseService.h"
+ #include "../NetLib/utils.h"
diff --git a/emulators/virtualbox-ose/files/patch-src-VBox-Runtime-r0drv-freebsd-sleepqueue-r0drv-freebsd.h b/emulators/virtualbox-ose/files/patch-src-VBox-Runtime-r0drv-freebsd-sleepqueue-r0drv-freebsd.h
new file mode 100644
index 000000000000..e1ae4d7ea855
--- /dev/null
+++ b/emulators/virtualbox-ose/files/patch-src-VBox-Runtime-r0drv-freebsd-sleepqueue-r0drv-freebsd.h
@@ -0,0 +1,20 @@
+Without this patch any waits for periods shorter than a single tick return
+immediately leading to a lot of unnecessary spinning. For example, I observe that
+my guest's idle loop does a lot of sleeps with periods slightly shorter than 1 ms
+(1/hz), e.g. 900us. All that waiting turns into pure spinning and VirtualBox eats
+100% of a core.
+The patch improves the situation significantly. Also, it (approximately) follows
+what tvtohz does.
+
+Submitted by: Andriy Gapon <avg@FreeBSD.org>
+--- src/VBox/Runtime/r0drv/freebsd/sleepqueue-r0drv-freebsd.h.orig 2012-12-19 19:27:29.000000000 +0100
++++ src/VBox/Runtime/r0drv/freebsd/sleepqueue-r0drv-freebsd.h 2012-12-20 12:07:48.941861966 +0100
+@@ -82,6 +82,8 @@
+ uint64_t cTicks = ASMMultU64ByU32DivByU32(uTimeout, hz, UINT32_C(1000000000));
+ if (cTicks >= INT_MAX)
+ return RTSEMWAIT_FLAGS_INDEFINITE;
++ else if (cTicks == 0 && uTimeout > 0)
++ pWait->iTimeout = 1;
+ else
+ pWait->iTimeout = (int)cTicks;
+ #endif