aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard Froehlich <decke@FreeBSD.org>2013-01-03 13:40:28 +0000
committerBernhard Froehlich <decke@FreeBSD.org>2013-01-03 13:40:28 +0000
commit1feafdfaa698293d4a2f3d20d706f62ac3be0e42 (patch)
tree59eff296e33d715a6d2a468dd75404beca0511d9
parentc99eac3bb883533949aa4699f3c272c5e7114d13 (diff)
downloadports-1feafdfaa698293d4a2f3d20d706f62ac3be0e42.tar.gz
ports-1feafdfaa698293d4a2f3d20d706f62ac3be0e42.zip
Notes
-rw-r--r--emulators/virtualbox-ose-additions/Makefile16
-rw-r--r--emulators/virtualbox-ose-additions/distinfo4
-rw-r--r--emulators/virtualbox-ose-additions/files/extrapatch-include-iprt-string.h10
-rw-r--r--emulators/virtualbox-ose-additions/files/patch-include-iprt-types.h19
-rw-r--r--emulators/virtualbox-ose-additions/files/patch-src-VBox-Additions-x11-vboxvideo-Makefile.kmk20
-rw-r--r--emulators/virtualbox-ose-additions/files/patch-src-VBox-Additions-x11-x11include-1.3-xorg-xf86_ansic.h10
-rw-r--r--emulators/virtualbox-ose-additions/files/patch-src-VBox-Additions-x11-x11include-1.4-xorg-xf86_ansic.h10
-rw-r--r--emulators/virtualbox-ose-additions/files/patch-src-VBox-Additions-x11-x11include-7.0-xorg-xf86_ansic.h10
-rw-r--r--emulators/virtualbox-ose-additions/files/patch-src-VBox-Additions-x11-x11include-7.1-xorg-xf86_ansic.h10
-rw-r--r--emulators/virtualbox-ose-additions/files/patch-src-VBox-Runtime-r0drv-freebsd-memobj-r0drv-freebsd.c77
-rw-r--r--emulators/virtualbox-ose-additions/files/patch-src-VBox-Runtime-r0drv-freebsd-the-freebsd-kernel.h10
-rw-r--r--emulators/virtualbox-ose-kmod/Makefile18
-rw-r--r--emulators/virtualbox-ose-kmod/distinfo4
-rw-r--r--emulators/virtualbox-ose-kmod/files/extrapatch-Config.kmk11
-rw-r--r--emulators/virtualbox-ose-kmod/files/extrapatch-src-VBox-HostDrivers-Support-freebsd-Makefile11
-rw-r--r--emulators/virtualbox-ose-kmod/files/patch-Config.kmk56
-rw-r--r--emulators/virtualbox-ose-kmod/files/patch-include-iprt-types.h19
-rw-r--r--emulators/virtualbox-ose-kmod/files/patch-src-VBox-HostDrivers-Support-freebsd-SUPDrv-freebsd.c31
-rw-r--r--emulators/virtualbox-ose-kmod/files/patch-src-VBox-HostDrivers-VBoxNetAdp-freebsd-Makefile16
-rw-r--r--emulators/virtualbox-ose-kmod/files/patch-src-VBox-HostDrivers-VBoxNetAdp-freebsd-VBoxNetAdp-freebsd.c54
-rw-r--r--emulators/virtualbox-ose-kmod/files/patch-src-VBox-HostDrivers-VBoxNetFlt-freebsd-VBoxNetFlt-freebsd.c50
-rw-r--r--emulators/virtualbox-ose-kmod/files/patch-src-VBox-Runtime-r0drv-freebsd-memobj-r0drv-freebsd.c926
-rw-r--r--emulators/virtualbox-ose-kmod/files/patch-src-VBox-Runtime-r0drv-freebsd-semfastmutex-r0drv-freebsd.c15
-rw-r--r--emulators/virtualbox-ose-kmod/files/patch-src-VBox-Runtime-r0drv-freebsd-sleepqueue-r0drv-freebsd.h20
-rw-r--r--emulators/virtualbox-ose-kmod/files/vboxnet.in3
-rw-r--r--emulators/virtualbox-ose/Makefile47
-rw-r--r--emulators/virtualbox-ose/distinfo8
-rw-r--r--emulators/virtualbox-ose/files/extrapatch-include-iprt-string.h10
-rw-r--r--emulators/virtualbox-ose/files/patch-Config.kmk56
-rw-r--r--emulators/virtualbox-ose/files/patch-configure19
-rw-r--r--emulators/virtualbox-ose/files/patch-include-iprt-types.h11
-rw-r--r--emulators/virtualbox-ose/files/patch-src-VBox-Devices-Audio-ossaudio.c19
-rw-r--r--emulators/virtualbox-ose/files/patch-src-VBox-Devices-Bus-DevPciIch9.cpp22
-rw-r--r--emulators/virtualbox-ose/files/patch-src-VBox-Frontends-VBoxManage-VBoxInternalManage.cpp25
-rw-r--r--emulators/virtualbox-ose/files/patch-src-VBox-HostDrivers-Makefile.kmk27
-rw-r--r--emulators/virtualbox-ose/files/patch-src-VBox-HostServices-auth-pam-VBoxAuthPAM.c15
-rw-r--r--emulators/virtualbox-ose/files/patch-src-VBox-Main-scr-server-freebsd-PerformanceFreeBSD.cpp13
-rw-r--r--emulators/virtualbox-ose/files/patch-src-VBox-Main-src-server-MachineImpl.cpp13
-rw-r--r--emulators/virtualbox-ose/files/patch-src-VBox-Main-src-server-freebsd-HostHardwareFreeBSD.cpp10
-rw-r--r--emulators/virtualbox-ose/files/patch-src-VBox-Main-src-server-freebsd-NetIf-freebsd.cpp32
-rw-r--r--emulators/virtualbox-ose/files/patch-src-VBox-Runtime-r0drv-freebsd-memobj-r0drv-freebsd.c56
-rw-r--r--emulators/virtualbox-ose/pkg-message2
-rw-r--r--emulators/virtualbox-ose/pkg-plist24
43 files changed, 518 insertions, 1321 deletions
diff --git a/emulators/virtualbox-ose-additions/Makefile b/emulators/virtualbox-ose-additions/Makefile
index 1ae783065758..88038a45665b 100644
--- a/emulators/virtualbox-ose-additions/Makefile
+++ b/emulators/virtualbox-ose-additions/Makefile
@@ -1,12 +1,8 @@
-# New ports collection makefile for: virtualbox-ose-additions
-# Date created: 2009-09-21
-# Whom: Bernhard Froehlich <decke@bluelife.at>
-#
+# Created by: Bernhard Froehlich <decke@bluelife.at>
# $FreeBSD$
-#
PORTNAME= virtualbox-ose
-DISTVERSION= 4.1.22
+DISTVERSION= 4.2.6
CATEGORIES= emulators kld
MASTER_SITES= http://download.virtualbox.org/virtualbox/${DISTVERSION}/ \
http://tmp.chruetertee.ch/ \
@@ -22,12 +18,13 @@ LICENSE_FILE= ${WRKSRC}/COPYING
BUILD_DEPENDS= yasm:${PORTSDIR}/devel/yasm \
as86:${PORTSDIR}/devel/dev86 \
- kmk:${PORTSDIR}/devel/kBuild-devel
+ kmk:${PORTSDIR}/devel/kBuild
UNIQUENAME= ${PORTNAME}${PKGNAMESUFFIX}
WRKSRC= ${WRKDIR}/VirtualBox-${PORTVERSION}
USE_RC_SUBR= vboxguest vboxservice
ONLY_FOR_ARCHS= i386 amd64
+FETCH_ARGS= -pRr
USE_BZIP2= yes
MAKE_JOBS_UNSAFE= yes
@@ -38,7 +35,6 @@ CONFIGURE_ARGS+=--with-gcc="${CC}" --with-g++="${CXX}" --nofatal \
--build-headless
CONFLICTS= bcc-[0-9]*
-CONFLICTS_BUILD= kBuild-[0-9]*
CONFLICTS_INSTALL= virtualbox-ose-additions-devel-[3,4]* virtualbox-ose-[3,4]* virtualbox-ose-devel-[3,4]* virtualbox-ose-legacy-[3,4]*
OPTIONS_DEFINE= DEBUG X11 OPENGL
@@ -93,10 +89,6 @@ IGNORE= requires kernel sources
.include <bsd.port.pre.mk>
-.if ${OSVERSION} > 900012
-EXTRA_PATCHES= ${FILESDIR}/extrapatch-include-iprt-string.h
-.endif
-
pre-everything::
.if ${ARCH} == "amd64"
.if !exists(/usr/lib32/libc.so)
diff --git a/emulators/virtualbox-ose-additions/distinfo b/emulators/virtualbox-ose-additions/distinfo
index 29da8afb570c..943900923e07 100644
--- a/emulators/virtualbox-ose-additions/distinfo
+++ b/emulators/virtualbox-ose-additions/distinfo
@@ -1,2 +1,2 @@
-SHA256 (VirtualBox-4.1.22.tar.bz2) = 7abb506203dd0d69b4b408fd999b5b9a479a9adce5f80e9b5569641c053dd153
-SIZE (VirtualBox-4.1.22.tar.bz2) = 73385514
+SHA256 (VirtualBox-4.2.6.tar.bz2) = 54526091bc2aa66b88ca878dd9ecc4466f96d607db2f6678a9d673ecf6646ae3
+SIZE (VirtualBox-4.2.6.tar.bz2) = 76291326
diff --git a/emulators/virtualbox-ose-additions/files/extrapatch-include-iprt-string.h b/emulators/virtualbox-ose-additions/files/extrapatch-include-iprt-string.h
deleted file mode 100644
index c22eebe25952..000000000000
--- a/emulators/virtualbox-ose-additions/files/extrapatch-include-iprt-string.h
+++ /dev/null
@@ -1,10 +0,0 @@
---- include/iprt/string.h.orig 2010-04-28 01:02:16.000000000 +0200
-+++ include/iprt/string.h 2010-06-17 16:20:14.000000000 +0200
-@@ -60,7 +60,6 @@
- #if (defined(RT_OS_DARWIN) && defined(KERNEL)) \
- || (defined(RT_OS_FREEBSD) && defined(_KERNEL))
- RT_C_DECLS_BEGIN
--void *memchr(const void *pv, int ch, size_t cb);
- char *strpbrk(const char *pszStr, const char *pszChars);
- RT_C_DECLS_END
- #endif
diff --git a/emulators/virtualbox-ose-additions/files/patch-include-iprt-types.h b/emulators/virtualbox-ose-additions/files/patch-include-iprt-types.h
deleted file mode 100644
index afa28bbb1461..000000000000
--- a/emulators/virtualbox-ose-additions/files/patch-include-iprt-types.h
+++ /dev/null
@@ -1,19 +0,0 @@
-- Fix build failure on FreeBSD 10-CURRENT after r228444
-
-include/iprt/types.h:174: error: redefinition of typedef 'bool'
-@/sys/types.h:271: error: previous declaration of 'bool' was here
-
-Submitted by: Daichi GOTO <daichi@freebsd.org>
---- include/iprt/types.h.orig 2011-10-28 16:29:51.000000000 +0200
-+++ include/iprt/types.h 2011-12-22 10:17:16.000000000 +0100
-@@ -167,6 +167,10 @@
- # if defined(__GNUC__)
- # if defined(RT_OS_LINUX) && __GNUC__ < 3
- typedef uint8_t bool;
-+# elif defined(RT_OS_FREEBSD)
-+# ifndef __bool_true_false_are_defined
-+typedef _Bool bool;
-+# endif
- # else
- # if defined(RT_OS_DARWIN) && defined(_STDBOOL_H)
- # undef bool
diff --git a/emulators/virtualbox-ose-additions/files/patch-src-VBox-Additions-x11-vboxvideo-Makefile.kmk b/emulators/virtualbox-ose-additions/files/patch-src-VBox-Additions-x11-vboxvideo-Makefile.kmk
new file mode 100644
index 000000000000..0525808f70c8
--- /dev/null
+++ b/emulators/virtualbox-ose-additions/files/patch-src-VBox-Additions-x11-vboxvideo-Makefile.kmk
@@ -0,0 +1,20 @@
+--- src/VBox/Additions/x11/vboxvideo/Makefile.kmk.orig 2012-10-26 18:23:35.000000000 +0200
++++ src/VBox/Additions/x11/vboxvideo/Makefile.kmk 2012-10-28 16:54:59.074303788 +0100
+@@ -196,7 +196,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
+ endif
+ vboxvideo_drv_15_INCS = \
+@@ -204,7 +204,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
diff --git a/emulators/virtualbox-ose-additions/files/patch-src-VBox-Additions-x11-x11include-1.3-xorg-xf86_ansic.h b/emulators/virtualbox-ose-additions/files/patch-src-VBox-Additions-x11-x11include-1.3-xorg-xf86_ansic.h
deleted file mode 100644
index b1dd2925cafa..000000000000
--- a/emulators/virtualbox-ose-additions/files/patch-src-VBox-Additions-x11-x11include-1.3-xorg-xf86_ansic.h
+++ /dev/null
@@ -1,10 +0,0 @@
---- src/VBox/Additions/x11/x11include/1.3/xorg/xf86_ansic.h.orig 2011-01-25 20:19:04.000000000 +0100
-+++ src/VBox/Additions/x11/x11include/1.3/xorg/xf86_ansic.h 2011-01-25 20:19:16.000000000 +0100
-@@ -259,7 +259,6 @@
- extern int xf86open(const char*, int,...);
- extern int xf86close(int);
- extern long xf86lseek(int, long, int);
--extern int xf86ioctl(int, unsigned long, pointer);
- extern xf86ssize_t xf86read(int, void *, xf86size_t);
- extern xf86ssize_t xf86write(int, const void *, xf86size_t);
- extern void* xf86mmap(void*, xf86size_t, int, int, int, xf86size_t /* off_t */);
diff --git a/emulators/virtualbox-ose-additions/files/patch-src-VBox-Additions-x11-x11include-1.4-xorg-xf86_ansic.h b/emulators/virtualbox-ose-additions/files/patch-src-VBox-Additions-x11-x11include-1.4-xorg-xf86_ansic.h
deleted file mode 100644
index 1e4fcf6a5a09..000000000000
--- a/emulators/virtualbox-ose-additions/files/patch-src-VBox-Additions-x11-x11include-1.4-xorg-xf86_ansic.h
+++ /dev/null
@@ -1,10 +0,0 @@
---- src/VBox/Additions/x11/x11include/1.4/xorg/xf86_ansic.h.orig 2011-01-25 20:28:21.000000000 +0100
-+++ src/VBox/Additions/x11/x11include/1.4/xorg/xf86_ansic.h 2011-01-25 20:28:43.000000000 +0100
-@@ -243,7 +243,6 @@
- extern int xf86open(const char*, int,...);
- extern int xf86close(int);
- extern long xf86lseek(int, long, int);
--extern int xf86ioctl(int, unsigned long, pointer);
- extern xf86ssize_t xf86read(int, void *, xf86size_t);
- extern xf86ssize_t xf86write(int, const void *, xf86size_t);
- extern void* xf86mmap(void*, xf86size_t, int, int, int, xf86size_t /* off_t */);
diff --git a/emulators/virtualbox-ose-additions/files/patch-src-VBox-Additions-x11-x11include-7.0-xorg-xf86_ansic.h b/emulators/virtualbox-ose-additions/files/patch-src-VBox-Additions-x11-x11include-7.0-xorg-xf86_ansic.h
deleted file mode 100644
index 52f98249067b..000000000000
--- a/emulators/virtualbox-ose-additions/files/patch-src-VBox-Additions-x11-x11include-7.0-xorg-xf86_ansic.h
+++ /dev/null
@@ -1,10 +0,0 @@
---- src/VBox/Additions/x11/x11include/7.0/xorg/xf86_ansic.h.orig 2011-01-18 22:29:29.000000000 +0100
-+++ src/VBox/Additions/x11/x11include/7.0/xorg/xf86_ansic.h 2011-01-18 22:32:34.000000000 +0100
-@@ -268,7 +268,6 @@
- extern int xf86open(const char*, int,...);
- extern int xf86close(int);
- extern long xf86lseek(int, long, int);
--extern int xf86ioctl(int, unsigned long, pointer);
- extern xf86ssize_t xf86read(int, void *, xf86size_t);
- extern xf86ssize_t xf86write(int, const void *, xf86size_t);
- extern void* xf86mmap(void*, xf86size_t, int, int, int, xf86size_t /* off_t */);
diff --git a/emulators/virtualbox-ose-additions/files/patch-src-VBox-Additions-x11-x11include-7.1-xorg-xf86_ansic.h b/emulators/virtualbox-ose-additions/files/patch-src-VBox-Additions-x11-x11include-7.1-xorg-xf86_ansic.h
deleted file mode 100644
index df00ce88d3e6..000000000000
--- a/emulators/virtualbox-ose-additions/files/patch-src-VBox-Additions-x11-x11include-7.1-xorg-xf86_ansic.h
+++ /dev/null
@@ -1,10 +0,0 @@
---- src/VBox/Additions/x11/x11include/7.1/xorg/xf86_ansic.h.orig 2011-01-25 20:04:06.000000000 +0100
-+++ src/VBox/Additions/x11/x11include/7.1/xorg/xf86_ansic.h 2011-01-25 20:04:15.000000000 +0100
-@@ -269,7 +269,6 @@
- extern int xf86open(const char*, int,...);
- extern int xf86close(int);
- extern long xf86lseek(int, long, int);
--extern int xf86ioctl(int, unsigned long, pointer);
- extern xf86ssize_t xf86read(int, void *, xf86size_t);
- extern xf86ssize_t xf86write(int, const void *, xf86size_t);
- extern void* xf86mmap(void*, xf86size_t, int, int, int, xf86size_t /* off_t */);
diff --git a/emulators/virtualbox-ose-additions/files/patch-src-VBox-Runtime-r0drv-freebsd-memobj-r0drv-freebsd.c b/emulators/virtualbox-ose-additions/files/patch-src-VBox-Runtime-r0drv-freebsd-memobj-r0drv-freebsd.c
index fd376f9b528b..b666b7ed0362 100644
--- a/emulators/virtualbox-ose-additions/files/patch-src-VBox-Runtime-r0drv-freebsd-memobj-r0drv-freebsd.c
+++ b/emulators/virtualbox-ose-additions/files/patch-src-VBox-Runtime-r0drv-freebsd-memobj-r0drv-freebsd.c
@@ -1,25 +1,56 @@
-Remove explicit initialization of m->flags and m->oflags because per
-default vm_phys_alloc_contig() already initializes the page as unmanaged.
-Chase move of PG_UNMANAGED flag from m->flags to m->oflags and renaming
-to VPO_UNMANAGED for an additional assert.
+From Alan L. Cox on FreeBSD-current:
-Reviewed by: kib
-See: http://svnweb.freebsd.org/base?view=revision&revision=224746
---- src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c.orig 2011-04-05 14:34:09.000000000 +0200
-+++ src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c 2011-08-11 15:06:46.000000000 +0200
-@@ -394,9 +394,13 @@
- pPage->wire_count = 1;
- pPage->pindex = iPage;
- pPage->act_count = 0;
-- pPage->oflags = 0;
-- pPage->flags = PG_UNMANAGED;
- atomic_add_int(&cnt.v_wire_count, 1);
-+
-+#if __FreeBSD_version >= 900040
-+ Assert(pPage->oflags & VPO_UNMANAGED != 0);
-+#else
-+ Assert(pPage->flags & PG_UNMANAGED != 0);
+ I just glanced at the virtualbox code for a couple minutes. For
+ FreeBSD 9 and 10, these lock acquires are completely unnecessary, and
+ have been since FreeBSD 9.0. Just delete them. They may be equally
+ unnecessary under FreeBSD 8, but I didn't look carefully enough to
+ answer that question.
+
+[1] http://lists.freebsd.org/pipermail/freebsd-current/2012-November/037963.html
+---
+ src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c b/src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c
+index 5c90cf3..1176b51 100644
+--- src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c
++++ src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c
+@@ -164,14 +164,19 @@ DECLHIDDEN(int) rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
+ {
+ VM_OBJECT_LOCK(pMemFreeBSD->pObject);
+ vm_page_t pPage = vm_page_find_least(pMemFreeBSD->pObject, 0);
++#if __FreeBSD_version < 900000
++ /* See http://lists.freebsd.org/pipermail/freebsd-current/2012-November/037963.html */
+ vm_page_lock_queues();
++#endif
+ for (vm_page_t pPage = vm_page_find_least(pMemFreeBSD->pObject, 0);
+ pPage != NULL;
+ pPage = vm_page_next(pPage))
+ {
+ vm_page_unwire(pPage, 0);
+ }
++#if __FreeBSD_version < 900000
+ vm_page_unlock_queues();
+#endif
- }
-
-
+ VM_OBJECT_UNLOCK(pMemFreeBSD->pObject);
+ vm_object_deallocate(pMemFreeBSD->pObject);
+ break;
+@@ -263,11 +268,15 @@ static int rtR0MemObjFreeBSDPhysAllocHelper(vm_object_t pObject, u_long cPages,
+ while (iPage-- > 0)
+ {
+ pPage = vm_page_lookup(pObject, iPage);
++#if __FreeBSD_version < 900000
+ vm_page_lock_queues();
++#endif
+ if (fWire)
+ vm_page_unwire(pPage, 0);
+ vm_page_free(pPage);
++#if __FreeBSD_version < 900000
+ vm_page_unlock_queues();
++#endif
+ }
+ VM_OBJECT_UNLOCK(pObject);
+ return rcNoMem;
+--
+1.7.11.5
+
diff --git a/emulators/virtualbox-ose-additions/files/patch-src-VBox-Runtime-r0drv-freebsd-the-freebsd-kernel.h b/emulators/virtualbox-ose-additions/files/patch-src-VBox-Runtime-r0drv-freebsd-the-freebsd-kernel.h
new file mode 100644
index 000000000000..98a8b960508e
--- /dev/null
+++ b/emulators/virtualbox-ose-additions/files/patch-src-VBox-Runtime-r0drv-freebsd-the-freebsd-kernel.h
@@ -0,0 +1,10 @@
+--- ./src/VBox/Runtime/r0drv/freebsd/the-freebsd-kernel.h.orig 2012-06-12 02:54:01.440878507 +0400
++++ ./src/VBox/Runtime/r0drv/freebsd/the-freebsd-kernel.h 2012-06-12 00:08:55.218232972 +0400
+@@ -64,6 +64,7 @@
+ #include <vm/vm_kern.h>
+ #include <vm/vm_param.h> /* KERN_SUCCESS ++ */
+ #include <vm/vm_page.h>
++#include <vm/vm_pageout.h>
+ #include <vm/vm_phys.h> /* vm_phys_alloc_* */
+ #include <vm/vm_extern.h> /* kmem_alloc_attr */
+ #include <sys/vmmeter.h> /* cnt */
diff --git a/emulators/virtualbox-ose-kmod/Makefile b/emulators/virtualbox-ose-kmod/Makefile
index dc87bf37ae06..8203fdd1e8d4 100644
--- a/emulators/virtualbox-ose-kmod/Makefile
+++ b/emulators/virtualbox-ose-kmod/Makefile
@@ -1,12 +1,8 @@
-# New ports collection makefile for: virtualbox-ose-kmod
-# Date created: 2009-09-21
-# Whom: Bernhard Froehlich <decke@bluelife.at>
-#
+# Created by: Bernhard Froehlich <decke@bluelife.at>
# $FreeBSD$
-#
PORTNAME= virtualbox-ose
-DISTVERSION= 4.1.22
+DISTVERSION= 4.2.6
CATEGORIES= emulators kld
MASTER_SITES= http://download.virtualbox.org/virtualbox/${DISTVERSION}/ \
http://tmp.chruetertee.ch/ \
@@ -22,12 +18,13 @@ LICENSE_FILE= ${WRKSRC}/COPYING
BUILD_DEPENDS= yasm:${PORTSDIR}/devel/yasm \
as86:${PORTSDIR}/devel/dev86 \
- kmk:${PORTSDIR}/devel/kBuild-devel
+ kmk:${PORTSDIR}/devel/kBuild
UNIQUENAME= ${PORTNAME}${PKGNAMESUFFIX}
WRKSRC= ${WRKDIR}/VirtualBox-${PORTVERSION}
USE_RC_SUBR= vboxnet
ONLY_FOR_ARCHS= i386 amd64
+FETCH_ARGS= -pRr
USE_BZIP2= yes
HAS_CONFIGURE= yes
@@ -37,30 +34,31 @@ CONFIGURE_ARGS+=--with-gcc="${CC}" --with-g++="${CXX}" --nofatal \
--build-headless
CONFLICTS= bcc-[0-9]*
-CONFLICTS_BUILD= kBuild-[0-9]*
CONFLICTS_INSTALL= virtualbox-ose-kmod-devel-[3,4]* virtualbox-ose-kmod-legacy-[3,4]*
OPTIONS_DEFINE= DEBUG VIMAGE
+DEBUG_DESC= Debug symbols, additional logs and assertions
VIMAGE_DESC= VIMAGE virtual networking support
.include <bsd.port.options.mk>
PLIST_SUB+= KMODDIR=${KMODDIR:C,^/,,}
-KMODDIR= /boot/modules
+KMODDIR?= /boot/modules
SRC_BASE?= /usr/src
VBOX_BIN= ${WRKSRC}/out/${KMK_ARCH}/${KMK_BUILDTYPE}/bin/src
KMK_BUILDTYPE= release
KMK_CONFIG= VBOX_LIBPATH_X11=${LOCALBASE} VBOX_FREEBSD_SRC=${SRC_BASE}/sys
-KMK_FLAGS= HostDrivers-src vboxdrv-mod VBoxNetFlt-src VBoxNetAdp-src
+KMK_FLAGS= HostDrivers-scripts vboxdrv-mod VBoxNetFlt-src VBoxNetAdp-src
MAKE_FLAGS= SYSDIR=${SRC_BASE}/sys
.if ${PORT_OPTIONS:MDEBUG}
KMK_FLAGS+= BUILD_TYPE=debug
KMK_BUILDTYPE= debug
+EXTRA_PATCHES+= ${FILESDIR}/extrapatch-Config.kmk ${FILESDIR}/extrapatch-src-VBox-HostDrivers-Support-freebsd-Makefile
MAKE_FLAGS+= DEBUG_FLAGS="-O1 -g"
PLIST_SUB+= WITH_DEBUG=""
.else
diff --git a/emulators/virtualbox-ose-kmod/distinfo b/emulators/virtualbox-ose-kmod/distinfo
index 29da8afb570c..943900923e07 100644
--- a/emulators/virtualbox-ose-kmod/distinfo
+++ b/emulators/virtualbox-ose-kmod/distinfo
@@ -1,2 +1,2 @@
-SHA256 (VirtualBox-4.1.22.tar.bz2) = 7abb506203dd0d69b4b408fd999b5b9a479a9adce5f80e9b5569641c053dd153
-SIZE (VirtualBox-4.1.22.tar.bz2) = 73385514
+SHA256 (VirtualBox-4.2.6.tar.bz2) = 54526091bc2aa66b88ca878dd9ecc4466f96d607db2f6678a9d673ecf6646ae3
+SIZE (VirtualBox-4.2.6.tar.bz2) = 76291326
diff --git a/emulators/virtualbox-ose-kmod/files/extrapatch-Config.kmk b/emulators/virtualbox-ose-kmod/files/extrapatch-Config.kmk
new file mode 100644
index 000000000000..7df1b0883f27
--- /dev/null
+++ b/emulators/virtualbox-ose-kmod/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-kmod/files/extrapatch-src-VBox-HostDrivers-Support-freebsd-Makefile b/emulators/virtualbox-ose-kmod/files/extrapatch-src-VBox-HostDrivers-Support-freebsd-Makefile
new file mode 100644
index 000000000000..90efbaeb2965
--- /dev/null
+++ b/emulators/virtualbox-ose-kmod/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 -DEBUG
+
+ .if (${MACHINE_ARCH} == "i386")
+ CFLAGS += -DRT_ARCH_X86
diff --git a/emulators/virtualbox-ose-kmod/files/patch-Config.kmk b/emulators/virtualbox-ose-kmod/files/patch-Config.kmk
new file mode 100644
index 000000000000..d7edc886bb4a
--- /dev/null
+++ b/emulators/virtualbox-ose-kmod/files/patch-Config.kmk
@@ -0,0 +1,56 @@
+--- Config.kmk.orig 2012-12-20 14:44:38.260858319 +0100
++++ Config.kmk 2012-12-20 14:55:59.491850177 +0100
+@@ -3239,7 +3239,7 @@
+ $(VBOX_GCC_WARN) -Wpointer-arith -Winline $(VBOX_GCC_Wno-pointer-sign) $(VBOX_GCC_fdiagnostics-show-option) \
+ -Wstrict-prototypes -Wmissing-prototypes -Wstrict-prototypes \
+ -Wimplicit-function-declaration -Werror-implicit-function-declaration \
+- -O2 -fformat-extensions -ffreestanding -fno-strict-aliasing -fno-common -finline-limit=8000 \
++ -O2 -ffreestanding -fno-strict-aliasing -fno-common -finline-limit=8000 \
+ $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) \
+ -nostdinc -std=c99
+ TEMPLATE_VBOXR0DRV_CFLAGS.x86 = -m32 -mno-align-long-strings -mpreferred-stack-boundary=2 -mno-mmx -mno-3dnow -mno-sse -mno-sse2
+@@ -3248,7 +3248,7 @@
+ -mno-3dnow -msoft-float -fno-asynchronous-unwind-tables -Wundef
+ TEMPLATE_VBOXR0DRV_CXXFLAGS = -fno-exceptions -fno-rtti \
+ $(VBOX_GCC_WARN) -Wpointer-arith -Winline \
+- -O2 -fno-format-extensions -fno-strict-aliasing -fno-common -finline-limit=8000 \
++ -O2 -fno-strict-aliasing -fno-common -finline-limit=8000 \
+ $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) \
+ -nostdinc
+ TEMPLATE_VBOXR0DRV_CXXFLAGS.x86 = $(TEMPLATE_VBOXR0DRV_CFLAGS.x86)
+@@ -3465,8 +3465,6 @@
+ /usr/X11R6/include \
+ /usr/local/include
+ TEMPLATE_VBOXR3EXE_LIBPATH += \
+- /usr/lib \
+- /usr/X11R6/lib \
+ /usr/local/lib
+ else ifeq ($(KBUILD_TARGET),solaris)
+ TEMPLATE_VBOXR3EXE_TOOL = GXX3PLAIN
+@@ -3955,8 +3953,6 @@
+ /usr/X11R6/include \
+ /usr/local/include
+ TEMPLATE_VBOXMAINEXE_LIBPATH += \
+- /usr/lib \
+- /usr/X11R6/lib \
+ /usr/local/lib
+ else ifeq ($(KBUILD_TARGET),solaris)
+ TEMPLATE_VBOXMAINEXE_TOOL = GXX3PLAIN
+@@ -4371,8 +4367,6 @@
+ /usr/X11R6/include \
+ /usr/local/include
+ TEMPLATE_VBOXQT4GUIEXE_LIBPATH += \
+- /usr/lib \
+- /usr/X11R6/lib \
+ /usr/local/lib
+ endif
+ ifeq ($(KBUILD_TARGET),solaris)
+@@ -4555,8 +4549,6 @@
+ /usr/X11R6/include \
+ /usr/local/include
+ TEMPLATE_VBOXBLDPROG_LIBPATH += \
+- /usr/lib \
+- /usr/X11R6/lib \
+ /usr/local/lib
+ else ifeq ($(KBUILD_HOST),solaris)
+ TEMPLATE_VBOXBLDPROG_TOOL = GXX3PLAIN
diff --git a/emulators/virtualbox-ose-kmod/files/patch-include-iprt-types.h b/emulators/virtualbox-ose-kmod/files/patch-include-iprt-types.h
deleted file mode 100644
index afa28bbb1461..000000000000
--- a/emulators/virtualbox-ose-kmod/files/patch-include-iprt-types.h
+++ /dev/null
@@ -1,19 +0,0 @@
-- Fix build failure on FreeBSD 10-CURRENT after r228444
-
-include/iprt/types.h:174: error: redefinition of typedef 'bool'
-@/sys/types.h:271: error: previous declaration of 'bool' was here
-
-Submitted by: Daichi GOTO <daichi@freebsd.org>
---- include/iprt/types.h.orig 2011-10-28 16:29:51.000000000 +0200
-+++ include/iprt/types.h 2011-12-22 10:17:16.000000000 +0100
-@@ -167,6 +167,10 @@
- # if defined(__GNUC__)
- # if defined(RT_OS_LINUX) && __GNUC__ < 3
- typedef uint8_t bool;
-+# elif defined(RT_OS_FREEBSD)
-+# ifndef __bool_true_false_are_defined
-+typedef _Bool bool;
-+# endif
- # else
- # if defined(RT_OS_DARWIN) && defined(_STDBOOL_H)
- # undef bool
diff --git a/emulators/virtualbox-ose-kmod/files/patch-src-VBox-HostDrivers-Support-freebsd-SUPDrv-freebsd.c b/emulators/virtualbox-ose-kmod/files/patch-src-VBox-HostDrivers-Support-freebsd-SUPDrv-freebsd.c
deleted file mode 100644
index 8bc13932892d..000000000000
--- a/emulators/virtualbox-ose-kmod/files/patch-src-VBox-HostDrivers-Support-freebsd-SUPDrv-freebsd.c
+++ /dev/null
@@ -1,31 +0,0 @@
-- Fix compile error: 'D_PSEUDO' undeclared here on 10-CURRENT
-
-Submitted by: Jung-uk Kim <jkim@FreeBSD.org>
-
-- Fix check that kernel module can not be unloaded when there
-are running VMs
-
-Submitted by: aeichner
-Reported by: avg
---- src/VBox/HostDrivers/Support/freebsd/SUPDrv-freebsd.c.orig 2011-11-04 12:19:39.000000000 +0100
-+++ src/VBox/HostDrivers/Support/freebsd/SUPDrv-freebsd.c 2011-12-13 12:22:44.325251163 +0100
-@@ -100,7 +100,9 @@
- static struct cdevsw g_VBoxDrvFreeBSDChrDevSW =
- {
- .d_version = D_VERSION,
--#if __FreeBSD_version > 800061
-+#if __FreeBSD_version >= 1000000
-+ .d_flags = D_TRACKCLOSE | D_NEEDMINOR,
-+#elif __FreeBSD_version > 800061
- .d_flags = D_PSEUDO | D_TRACKCLOSE | D_NEEDMINOR,
- #else
- .d_flags = D_PSEUDO | D_TRACKCLOSE,
-@@ -205,7 +207,7 @@
- Log(("VBoxDrvFreeBSDUnload:\n"));
-
- if (g_cUsers > 0)
-- return EBUSY;
-+ return VERR_RESOURCE_BUSY;
-
- /*
- * Reserve what we did in VBoxDrvFreeBSDInit.
diff --git a/emulators/virtualbox-ose-kmod/files/patch-src-VBox-HostDrivers-VBoxNetAdp-freebsd-Makefile b/emulators/virtualbox-ose-kmod/files/patch-src-VBox-HostDrivers-VBoxNetAdp-freebsd-Makefile
deleted file mode 100644
index 821c767192e1..000000000000
--- a/emulators/virtualbox-ose-kmod/files/patch-src-VBox-HostDrivers-VBoxNetAdp-freebsd-Makefile
+++ /dev/null
@@ -1,16 +0,0 @@
-This patch adds support for VIMAGE to VBoxNetAdp and thus
-also fixes that panic.
-
-Submitted by: Mikolaj Golub <trociny at freebsd.org>
---- src/VBox/HostDrivers/VBoxNetAdp/freebsd/Makefile 2012-03-13 15:15:44.000000000 +0200
-+++ src/VBox/HostDrivers/VBoxNetAdp/freebsd/Makefile 2012-04-01 13:27:16.000000000 +0300
-@@ -18,7 +18,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
-+CFLAGS += -DRT_OS_FREEBSD -DIN_RING0 -DIN_RT_R0 -DIN_SUP_R0 -DVBOX -DRT_WITH_VBOX -Iinclude -I. -Ir0drv -w -DVBOX_WITH_HARDENING -DVIMAGE
-
- .if (${MACHINE_ARCH} == "i386")
- CFLAGS += -DRT_ARCH_X86
-diff -rpu VirtualBox-4.1.10.orig/src/VBox/HostDrivers/VBoxNetAdp/freebsd/VBoxNetAdp-freebsd.c VirtualBox-4.1.10/src/VBox/HostDrivers/VBoxNetAdp/freebsd/VBoxNetAdp-freebsd.c
diff --git a/emulators/virtualbox-ose-kmod/files/patch-src-VBox-HostDrivers-VBoxNetAdp-freebsd-VBoxNetAdp-freebsd.c b/emulators/virtualbox-ose-kmod/files/patch-src-VBox-HostDrivers-VBoxNetAdp-freebsd-VBoxNetAdp-freebsd.c
deleted file mode 100644
index aa64625d47af..000000000000
--- a/emulators/virtualbox-ose-kmod/files/patch-src-VBox-HostDrivers-VBoxNetAdp-freebsd-VBoxNetAdp-freebsd.c
+++ /dev/null
@@ -1,54 +0,0 @@
-This patch adds support for VIMAGE to VBoxNetAdp and thus
-also fixes that panic.
-
-Submitted by: Mikolaj Golub <trociny at freebsd.org>
---- src/VBox/HostDrivers/VBoxNetAdp/freebsd/VBoxNetAdp-freebsd.c.orig 2012-06-20 15:17:03.000000000 +0200
-+++ src/VBox/HostDrivers/VBoxNetAdp/freebsd/VBoxNetAdp-freebsd.c 2012-07-25 18:30:13.695891353 +0200
-@@ -68,6 +68,22 @@
- #define VBOXNETADP_OS_SPECFIC 1
- #include "../VBoxNetAdpInternal.h"
-
-+#if defined(__FreeBSD_version) && __FreeBSD_version >= 800500
-+# include <sys/jail.h>
-+# include <net/vnet.h>
-+
-+# define VBOXCURVNET_SET(arg) CURVNET_SET_QUIET(arg)
-+# define VBOXCURVNET_SET_FROM_UCRED() VBOXCURVNET_SET(CRED_TO_VNET(curthread->td_ucred))
-+# define VBOXCURVNET_RESTORE() CURVNET_RESTORE()
-+
-+#else /* !defined(__FreeBSD_version) || __FreeBSD_version < 800500 */
-+
-+# define VBOXCURVNET_SET(arg)
-+# define VBOXCURVNET_SET_FROM_UCRED()
-+# define VBOXCURVNET_RESTORE()
-+
-+#endif /* !defined(__FreeBSD_version) || __FreeBSD_version < 800500 */
-+
- static int VBoxNetAdpFreeBSDCtrlioctl(struct cdev *, u_long, caddr_t, int flags,
- struct thread *);
- static struct cdevsw vboxnetadp_cdevsw =
-@@ -260,6 +276,7 @@
- {
- struct ifnet *ifp;
-
-+ VBOXCURVNET_SET_FROM_UCRED();
- ifp = if_alloc(IFT_ETHER);
- if (ifp == NULL)
- return VERR_NO_MEMORY;
-@@ -279,6 +296,7 @@
-
- strncpy(pThis->szName, ifp->if_xname, VBOXNETADP_MAX_NAME_LEN);
- pThis->u.s.ifp = ifp;
-+ VBOXCURVNET_RESTORE();
- return 0;
- }
-
-@@ -287,6 +305,8 @@
- struct ifnet *ifp;
-
- ifp = pThis->u.s.ifp;
-+ VBOXCURVNET_SET(ifp->if_vnet);
- ether_ifdetach(ifp);
- if_free(ifp);
-+ VBOXCURVNET_RESTORE();
- }
diff --git a/emulators/virtualbox-ose-kmod/files/patch-src-VBox-HostDrivers-VBoxNetFlt-freebsd-VBoxNetFlt-freebsd.c b/emulators/virtualbox-ose-kmod/files/patch-src-VBox-HostDrivers-VBoxNetFlt-freebsd-VBoxNetFlt-freebsd.c
index 185931e4f504..1778411e0f79 100644
--- a/emulators/virtualbox-ose-kmod/files/patch-src-VBox-HostDrivers-VBoxNetFlt-freebsd-VBoxNetFlt-freebsd.c
+++ b/emulators/virtualbox-ose-kmod/files/patch-src-VBox-HostDrivers-VBoxNetFlt-freebsd-VBoxNetFlt-freebsd.c
@@ -1,31 +1,23 @@
-The attached patch fixes a kernel crash on FreeBSD 10-CURRENT hosts
-with VIMAGE enabled when a VM is powered off.
+Add VLAN trunking support to vboxnetflt
-Submitted by: Mikolaj Golub <trociny at freebsd.org>
---- src/VBox/HostDrivers/VBoxNetFlt/freebsd/VBoxNetFlt-freebsd.c 2012-03-13 15:15:44.000000000 +0200
-+++ src/VBox/HostDrivers/VBoxNetFlt/freebsd/VBoxNetFlt-freebsd.c 2012-04-01 13:43:02.000000000 +0300
-@@ -651,13 +651,13 @@ bool vboxNetFltOsMaybeRediscovered(PVBOX
- ng_rmnode_self(pThis->u.s.node);
- pThis->u.s.node = NULL;
- }
-+ VBOXCURVNET_RESTORE();
+See: http://lists.freebsd.org/pipermail/freebsd-emulation/2012-April/009698.html
+Submitted by: Landon J Fuller <landonf at plausible.coop>
+--- src/VBox/HostDrivers/VBoxNetFlt/freebsd/VBoxNetFlt-freebsd.c.orig 2012-04-12 17:27:56.035382846 -0400
++++ src/VBox/HostDrivers/VBoxNetFlt/freebsd/VBoxNetFlt-freebsd.c 2012-04-12 17:30:13.038601065 -0400
+@@ -439,6 +439,16 @@
+ if (m == NULL)
+ break;
- if (ifp0 != NULL)
- {
- vboxNetFltOsDeleteInstance(pThis);
- vboxNetFltOsInitInstance(pThis, NULL);
- }
-- VBOXCURVNET_RESTORE();
-
- return !ASMAtomicUoReadBool(&pThis->fDisconnectedFromHost);
- }
-@@ -671,8 +671,10 @@ void vboxNetFltOsDeleteInstance(PVBOXNET
- mtx_destroy(&pThis->u.s.inq.ifq_mtx);
- mtx_destroy(&pThis->u.s.outq.ifq_mtx);
-
-+ VBOXCURVNET_SET_FROM_UCRED();
- if (pThis->u.s.node != NULL)
- ng_rmnode_self(pThis->u.s.node);
-+ VBOXCURVNET_RESTORE();
- pThis->u.s.node = NULL;
- }
++ /* Preprend a VLAN header for consumption by the virtual switch */
++ if (m->m_flags & M_VLANTAG) {
++ 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++;
diff --git a/emulators/virtualbox-ose-kmod/files/patch-src-VBox-Runtime-r0drv-freebsd-memobj-r0drv-freebsd.c b/emulators/virtualbox-ose-kmod/files/patch-src-VBox-Runtime-r0drv-freebsd-memobj-r0drv-freebsd.c
index f6ef95801f16..b666b7ed0362 100644
--- a/emulators/virtualbox-ose-kmod/files/patch-src-VBox-Runtime-r0drv-freebsd-memobj-r0drv-freebsd.c
+++ b/emulators/virtualbox-ose-kmod/files/patch-src-VBox-Runtime-r0drv-freebsd-memobj-r0drv-freebsd.c
@@ -1,888 +1,56 @@
---- src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c.orig 2012-06-20 15:18:10.000000000 +0200
-+++ src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c 2012-07-25 18:04:01.534886951 +0200
-@@ -5,6 +5,7 @@
-
- /*
- * Copyright (c) 2007 knut st. osmundsen <bird-src-spam@anduin.net>
-+ * Copyright (c) 2011 Andriy Gapon <avg@FreeBSD.org>
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
-@@ -54,23 +55,8 @@
- /** The core structure. */
- RTR0MEMOBJINTERNAL Core;
- /** Type dependent data */
-- union
-- {
-- /** Non physical memory allocations */
-- struct
-- {
-- /** The VM object associated with the allocation. */
-- vm_object_t pObject;
-- } NonPhys;
-- /** Physical memory allocations */
-- struct
-- {
-- /** Number of pages */
-- uint32_t cPages;
-- /** Array of pages - variable */
-- vm_page_t apPages[1];
-- } Phys;
-- } u;
-+ /** The VM object associated with the allocation. */
-+ vm_object_t pObject;
- } RTR0MEMOBJFREEBSD, *PRTR0MEMOBJFREEBSD;
-
-
-@@ -125,25 +111,14 @@
-
- switch (pMemFreeBSD->Core.enmType)
- {
-- case RTR0MEMOBJTYPE_CONT:
-- contigfree(pMemFreeBSD->Core.pv, pMemFreeBSD->Core.cb, M_IPRTMOBJ);
-- break;
--
- case RTR0MEMOBJTYPE_PAGE:
-+ case RTR0MEMOBJTYPE_LOW:
-+ case RTR0MEMOBJTYPE_CONT:
- {
- rc = vm_map_remove(kernel_map,
- (vm_offset_t)pMemFreeBSD->Core.pv,
- (vm_offset_t)pMemFreeBSD->Core.pv + pMemFreeBSD->Core.cb);
- AssertMsg(rc == KERN_SUCCESS, ("%#x", rc));
--
-- vm_page_lock_queues();
-- for (uint32_t iPage = 0; iPage < pMemFreeBSD->u.Phys.cPages; iPage++)
-- {
-- vm_page_t pPage = pMemFreeBSD->u.Phys.apPages[iPage];
-- vm_page_unwire(pPage, 0);
-- vm_page_free(pPage);
-- }
-- vm_page_unlock_queues();
- break;
- }
-
-@@ -165,8 +140,8 @@
- case RTR0MEMOBJTYPE_RES_VIRT:
- {
- vm_map_t pMap = kernel_map;
-- if (pMemFreeBSD->Core.u.Lock.R0Process != NIL_RTR0PROCESS)
-- pMap = &((struct proc *)pMemFreeBSD->Core.u.Lock.R0Process)->p_vmspace->vm_map;
-+ if (pMemFreeBSD->Core.u.ResVirt.R0Process != NIL_RTR0PROCESS)
-+ pMap = &((struct proc *)pMemFreeBSD->Core.u.ResVirt.R0Process)->p_vmspace->vm_map;
- rc = vm_map_remove(pMap,
- (vm_offset_t)pMemFreeBSD->Core.pv,
- (vm_offset_t)pMemFreeBSD->Core.pv + pMemFreeBSD->Core.cb);
-@@ -180,7 +155,6 @@
-
- if (pMemFreeBSD->Core.u.Mapping.R0Process != NIL_RTR0PROCESS)
- pMap = &((struct proc *)pMemFreeBSD->Core.u.Mapping.R0Process)->p_vmspace->vm_map;
--
- rc = vm_map_remove(pMap,
- (vm_offset_t)pMemFreeBSD->Core.pv,
- (vm_offset_t)pMemFreeBSD->Core.pv + pMemFreeBSD->Core.cb);
-@@ -191,26 +165,21 @@
- case RTR0MEMOBJTYPE_PHYS:
- case RTR0MEMOBJTYPE_PHYS_NC:
- {
-+ VM_OBJECT_LOCK(pMemFreeBSD->pObject);
-+ vm_page_t pPage = vm_page_find_least(pMemFreeBSD->pObject, 0);
+From Alan L. Cox on FreeBSD-current:
+
+ I just glanced at the virtualbox code for a couple minutes. For
+ FreeBSD 9 and 10, these lock acquires are completely unnecessary, and
+ have been since FreeBSD 9.0. Just delete them. They may be equally
+ unnecessary under FreeBSD 8, but I didn't look carefully enough to
+ answer that question.
+
+[1] http://lists.freebsd.org/pipermail/freebsd-current/2012-November/037963.html
+---
+ src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c b/src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c
+index 5c90cf3..1176b51 100644
+--- src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c
++++ src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c
+@@ -164,14 +164,19 @@ DECLHIDDEN(int) rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
+ {
+ VM_OBJECT_LOCK(pMemFreeBSD->pObject);
+ vm_page_t pPage = vm_page_find_least(pMemFreeBSD->pObject, 0);
++#if __FreeBSD_version < 900000
++ /* See http://lists.freebsd.org/pipermail/freebsd-current/2012-November/037963.html */
vm_page_lock_queues();
-- for (uint32_t iPage = 0; iPage < pMemFreeBSD->u.Phys.cPages; iPage++)
-+ for (vm_page_t pPage = vm_page_find_least(pMemFreeBSD->pObject, 0);
-+ pPage != NULL;
-+ pPage = vm_page_next(pPage))
++#endif
+ for (vm_page_t pPage = vm_page_find_least(pMemFreeBSD->pObject, 0);
+ pPage != NULL;
+ pPage = vm_page_next(pPage))
{
-- vm_page_t pPage = pMemFreeBSD->u.Phys.apPages[iPage];
vm_page_unwire(pPage, 0);
-- vm_page_free(pPage);
}
++#if __FreeBSD_version < 900000
vm_page_unlock_queues();
-+ VM_OBJECT_UNLOCK(pMemFreeBSD->pObject);
-+ vm_object_deallocate(pMemFreeBSD->pObject);
- break;
- }
-
--#ifdef USE_KMEM_ALLOC_ATTR
-- case RTR0MEMOBJTYPE_LOW:
-- {
-- kmem_free(kernel_map, (vm_offset_t)pMemFreeBSD->Core.pv, pMemFreeBSD->Core.cb);
-- break;
-- }
--#else
-- case RTR0MEMOBJTYPE_LOW: /* unused */
--#endif
- default:
- AssertMsgFailed(("enmType=%d\n", pMemFreeBSD->Core.enmType));
- return VERR_INTERNAL_ERROR;
-@@ -220,183 +189,183 @@
- }
-
-
--DECLHIDDEN(int) rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
--{
-- int rc;
-- size_t cPages = cb >> PAGE_SHIFT;
--
-- /* create the object. */
-- PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJFREEBSD, u.Phys.apPages[cPages]),
-- RTR0MEMOBJTYPE_PAGE, NULL, cb);
-- if (!pMemFreeBSD)
-- return VERR_NO_MEMORY;
--
-- pMemFreeBSD->u.Phys.cPages = cPages;
-+static vm_page_t FreeBSDContigPhysAllocHelper(vm_object_t pObject, vm_pindex_t iPIndex,
-+ u_long cPages, vm_paddr_t VmPhysAddrHigh,
-+ u_long uAlignment, bool fWire)
-+{
-+ vm_page_t pPages;
-+ int tries = 0;
-+#if __FreeBSD_version > 1000000
-+ int flags = VM_ALLOC_INTERRUPT | VM_ALLOC_NOBUSY;
-+
-+ if (fWire)
-+ flags |= VM_ALLOC_WIRED;
-+ while (1)
-+ {
-+ VM_OBJECT_LOCK(pObject);
-+ pPages = vm_page_alloc_contig(pObject, iPIndex, flags, cPages, 0, VmPhysAddrHigh, uAlignment, 0, VM_MEMATTR_DEFAULT);
-+ VM_OBJECT_UNLOCK(pObject);
-+ if (pPages || tries >= 1)
-+ break;
-+ vm_pageout_grow_cache(tries, 0, VmPhysAddrHigh);
-+ tries++;
-+ }
-+ return pPages;
-+#else
-
-- vm_offset_t MapAddress = vm_map_min(kernel_map);
-- rc = vm_map_find(kernel_map, /* map */
-- NULL, /* object */
-- 0, /* offset */
-- &MapAddress, /* addr (IN/OUT) */
-- cb, /* length */
-- TRUE, /* find_space */
-- fExecutable /* protection */
-- ? VM_PROT_ALL
-- : VM_PROT_RW,
-- VM_PROT_ALL, /* max(_prot) */
-- 0); /* cow (copy-on-write) */
-- if (rc == KERN_SUCCESS)
-+ while (1)
- {
-- rc = VINF_SUCCESS;
--
-- for (size_t iPage = 0; iPage < cPages; iPage++)
-+ pPages = vm_phys_alloc_contig(cPages, 0, VmPhysAddrHigh, uAlignment, 0);
-+ if (pPages || tries >= 1)
-+ break;
-+ vm_contig_grow_cache(tries, 0, VmPhysAddrHigh);
-+ tries++;
-+ }
-+ if (!pPages)
-+ return pPages;
-+ VM_OBJECT_LOCK(pObject);
-+ for (vm_pindex_t iPage = 0; iPage < cPages; iPage++)
-+ {
-+ vm_page_t pPage = pPages + iPage;
-+ vm_page_insert(pPage, pObject, iPIndex + iPage);
-+ pPage->valid = VM_PAGE_BITS_ALL;
-+ if (fWire)
- {
-- vm_page_t pPage;
-+ pPage->wire_count = 1;
-+ atomic_add_int(&cnt.v_wire_count, 1);
-+ }
-+ }
-+ VM_OBJECT_UNLOCK(pObject);
-+ return pPages;
+#endif
-+}
-
-- pPage = vm_page_alloc(NULL, iPage,
-- VM_ALLOC_SYSTEM |
-- VM_ALLOC_WIRED | VM_ALLOC_NOOBJ);
-+static int FreeBSDPhysAllocHelper(vm_object_t pObject, u_long cPages,
-+ vm_paddr_t VmPhysAddrHigh, u_long uAlignment,
-+ bool fContiguous, bool fWire)
-+{
-+ if (fContiguous)
-+ {
-+ if (FreeBSDContigPhysAllocHelper(pObject, 0, cPages, VmPhysAddrHigh, uAlignment, fWire) != NULL)
-+ return VINF_SUCCESS;
-+ else
-+ return VERR_NO_MEMORY;
-+ }
-
-- if (!pPage)
-+ for (vm_pindex_t iPage = 0; iPage < cPages; iPage++)
-+ {
-+ vm_page_t pPage = FreeBSDContigPhysAllocHelper(pObject, iPage, 1, VmPhysAddrHigh, uAlignment, fWire);
-+ if (!pPage)
-+ {
-+ /* Free all allocated pages */
-+ VM_OBJECT_LOCK(pObject);
-+ while (iPage-- > 0)
+ VM_OBJECT_UNLOCK(pMemFreeBSD->pObject);
+ vm_object_deallocate(pMemFreeBSD->pObject);
+ break;
+@@ -263,11 +268,15 @@ static int rtR0MemObjFreeBSDPhysAllocHelper(vm_object_t pObject, u_long cPages,
+ while (iPage-- > 0)
{
-- /*
-- * Out of pages
-- * Remove already allocated pages
-- */
-- while (iPage-- > 0)
-- {
-- pPage = pMemFreeBSD->u.Phys.apPages[iPage];
-- vm_page_lock_queues();
-+ pPage = vm_page_lookup(pObject, iPage);
-+ vm_page_lock_queues();
-+ if (fWire)
+ pPage = vm_page_lookup(pObject, iPage);
++#if __FreeBSD_version < 900000
+ vm_page_lock_queues();
++#endif
+ if (fWire)
vm_page_unwire(pPage, 0);
-- vm_page_free(pPage);
-- vm_page_unlock_queues();
-- }
-- rc = VERR_NO_MEMORY;
-- break;
-+ vm_page_free(pPage);
-+ vm_page_unlock_queues();
- }
--
-- pPage->valid = VM_PAGE_BITS_ALL;
-- pMemFreeBSD->u.Phys.apPages[iPage] = pPage;
-+ VM_OBJECT_UNLOCK(pObject);
-+ return VERR_NO_MEMORY;
- }
-+ }
-+ return VINF_SUCCESS;
-+}
-
-- if (rc == VINF_SUCCESS)
-- {
-- vm_offset_t AddressDst = MapAddress;
-+static int FreeBSDAllocHelper(PRTR0MEMOBJFREEBSD pMemFreeBSD, bool fExecutable,
-+ vm_paddr_t VmPhysAddrHigh, bool fContiguous)
-+{
-+ int rc;
-+ size_t cPages = atop(pMemFreeBSD->Core.cb);
-
-- for (size_t iPage = 0; iPage < cPages; iPage++)
-- {
-- vm_page_t pPage = pMemFreeBSD->u.Phys.apPages[iPage];
-+ pMemFreeBSD->pObject = vm_object_allocate(OBJT_PHYS, cPages);
-+ vm_offset_t MapAddress = vm_map_min(kernel_map);
-
-- MY_PMAP_ENTER(kernel_map->pmap, AddressDst, pPage,
-- fExecutable
-- ? VM_PROT_ALL
-- : VM_PROT_RW,
-- TRUE);
-+ // no additional object reference for auto-deallocation upon unmapping
-+ rc = vm_map_find(kernel_map, pMemFreeBSD->pObject, 0,
-+ &MapAddress, pMemFreeBSD->Core.cb, VMFS_ANY_SPACE,
-+ fExecutable ? VM_PROT_ALL : VM_PROT_RW, VM_PROT_ALL, 0);
-
-- AddressDst += PAGE_SIZE;
-- }
-+ if (rc == KERN_SUCCESS)
-+ {
-+ rc = FreeBSDPhysAllocHelper(pMemFreeBSD->pObject, cPages, VmPhysAddrHigh, PAGE_SIZE, fContiguous, false);
-+ if (RT_SUCCESS(rc))
-+ {
-+ vm_map_wire(kernel_map, MapAddress, MapAddress + pMemFreeBSD->Core.cb, VM_MAP_WIRE_SYSTEM|VM_MAP_WIRE_NOHOLES);
-
- /* Store start address */
- pMemFreeBSD->Core.pv = (void *)MapAddress;
-- *ppMem = &pMemFreeBSD->Core;
- return VINF_SUCCESS;
- }
-- }
-- rc = VERR_NO_MEMORY; /** @todo fix translation (borrow from darwin) */
-
-- rtR0MemObjDelete(&pMemFreeBSD->Core);
-+ vm_map_remove(kernel_map, MapAddress, MapAddress + pMemFreeBSD->Core.cb);
-+ }
-+ else
-+ {
-+ rc = VERR_NO_MEMORY; /** @todo fix translation (borrow from darwin) */
-+ vm_object_deallocate(pMemFreeBSD->pObject);
-+ }
- return rc;
- }
-
--
--DECLHIDDEN(int) rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
-+DECLHIDDEN(int) rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
- {
--#ifdef USE_KMEM_ALLOC_ATTR
-- /*
-- * Use kmem_alloc_attr, fExectuable is not needed because the
-- * memory will be executable by default
-- */
-- NOREF(fExecutable);
--
-- /* create the object. */
-- PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD), RTR0MEMOBJTYPE_LOW, NULL, cb);
-+ PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD),
-+ RTR0MEMOBJTYPE_PAGE, NULL, cb);
- if (!pMemFreeBSD)
- return VERR_NO_MEMORY;
-
-- pMemFreeBSD->Core.pv = (void *)kmem_alloc_attr(kernel_map, /* Kernel */
-- cb, /* Amount */
-- M_ZERO, /* Zero memory */
-- 0, /* Low physical address */
-- _4G - PAGE_SIZE, /* Highest physical address */
-- VM_MEMATTR_DEFAULT); /* Default memory attributes */
-- if (!pMemFreeBSD->Core.pv)
-- return VERR_NO_MEMORY;
--
-- *ppMem = &pMemFreeBSD->Core;
--
-- return VINF_SUCCESS;
--#else
-- /*
-- * Try a Alloc first and see if we get luck, if not try contigmalloc.
-- * Might wish to try find our own pages or something later if this
-- * turns into a problemspot on AMD64 boxes.
-- */
-- int rc = rtR0MemObjNativeAllocPage(ppMem, cb, fExecutable);
-- if (RT_SUCCESS(rc))
-+ int rc = FreeBSDAllocHelper(pMemFreeBSD, fExecutable, ~(vm_paddr_t)0, false);
-+ if (RT_FAILURE(rc))
- {
-- size_t iPage = cb >> PAGE_SHIFT;
-- while (iPage-- > 0)
-- if (rtR0MemObjNativeGetPagePhysAddr(*ppMem, iPage) > (_4G - PAGE_SIZE))
-- {
-- RTR0MemObjFree(*ppMem, false);
-- *ppMem = NULL;
-- rc = VERR_NO_MEMORY;
-- break;
-- }
-+ rtR0MemObjDelete(&pMemFreeBSD->Core);
-+ return rc;
- }
-- if (RT_FAILURE(rc))
-- rc = rtR0MemObjNativeAllocCont(ppMem, cb, fExecutable);
-+
-+ *ppMem = &pMemFreeBSD->Core;
- return rc;
--#endif
- }
-
-
--DECLHIDDEN(int) rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
-+DECLHIDDEN(int) rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
- {
-- /* create the object. */
-- PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD), RTR0MEMOBJTYPE_CONT, NULL, cb);
-+ PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD),
-+ RTR0MEMOBJTYPE_LOW, NULL, cb);
- if (!pMemFreeBSD)
- return VERR_NO_MEMORY;
-
-- /* do the allocation. */
-- pMemFreeBSD->Core.pv = contigmalloc(cb, /* size */
-- M_IPRTMOBJ, /* type */
-- M_NOWAIT | M_ZERO, /* flags */
-- 0, /* lowest physical address*/
-- _4G-1, /* highest physical address */
-- PAGE_SIZE, /* alignment. */
-- 0); /* boundary */
-- if (pMemFreeBSD->Core.pv)
-+ int rc = FreeBSDAllocHelper(pMemFreeBSD, fExecutable, _4G - 1, false);
-+ if (RT_FAILURE(rc))
- {
-- pMemFreeBSD->Core.u.Cont.Phys = vtophys(pMemFreeBSD->Core.pv);
-- *ppMem = &pMemFreeBSD->Core;
-- return VINF_SUCCESS;
-+ rtR0MemObjDelete(&pMemFreeBSD->Core);
-+ return rc;
- }
-
-- NOREF(fExecutable);
-- rtR0MemObjDelete(&pMemFreeBSD->Core);
-- return VERR_NO_MEMORY;
-+ *ppMem = &pMemFreeBSD->Core;
-+ return rc;
- }
-
-
--static void rtR0MemObjFreeBSDPhysPageInit(vm_page_t pPage, vm_pindex_t iPage)
-+DECLHIDDEN(int) rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
- {
-- pPage->wire_count = 1;
-- pPage->pindex = iPage;
-- pPage->act_count = 0;
-- pPage->oflags = 0;
-- pPage->flags = PG_UNMANAGED;
-- atomic_add_int(&cnt.v_wire_count, 1);
-+ PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD),
-+ RTR0MEMOBJTYPE_CONT, NULL, cb);
-+ if (!pMemFreeBSD)
-+ return VERR_NO_MEMORY;
-+
-+ int rc = FreeBSDAllocHelper(pMemFreeBSD, fExecutable, _4G - 1, true);
-+ if (RT_FAILURE(rc))
-+ {
-+ rtR0MemObjDelete(&pMemFreeBSD->Core);
-+ return rc;
-+ }
-+
-+ pMemFreeBSD->Core.u.Cont.Phys = vtophys(pMemFreeBSD->Core.pv);
-+ *ppMem = &pMemFreeBSD->Core;
-+ return rc;
- }
-
-
-@@ -405,69 +374,36 @@
- RTHCPHYS PhysHighest, size_t uAlignment,
- bool fContiguous)
- {
-- int rc = VINF_SUCCESS;
-- uint32_t cPages = cb >> PAGE_SHIFT;
-+ uint32_t cPages = atop(cb);
- vm_paddr_t VmPhysAddrHigh;
-
- /* create the object. */
-- PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJFREEBSD, u.Phys.apPages[cPages]),
-+ PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD),
- enmType, NULL, cb);
- if (!pMemFreeBSD)
- return VERR_NO_MEMORY;
-
-- pMemFreeBSD->u.Phys.cPages = cPages;
-+ pMemFreeBSD->pObject = vm_object_allocate(OBJT_PHYS, atop(cb));
-
- if (PhysHighest != NIL_RTHCPHYS)
- VmPhysAddrHigh = PhysHighest;
- else
- VmPhysAddrHigh = ~(vm_paddr_t)0;
-
-- if (fContiguous)
-- {
-- vm_page_t pPage = vm_phys_alloc_contig(cPages, 0, VmPhysAddrHigh, uAlignment, 0);
--
-- if (pPage)
-- for (uint32_t iPage = 0; iPage < cPages; iPage++)
-- {
-- rtR0MemObjFreeBSDPhysPageInit(&pPage[iPage], iPage);
-- pMemFreeBSD->u.Phys.apPages[iPage] = &pPage[iPage];
-- }
-- else
-- rc = VERR_NO_MEMORY;
-- }
-- else
-- {
-- /* Allocate page by page */
-- for (uint32_t iPage = 0; iPage < cPages; iPage++)
-- {
-- vm_page_t pPage = vm_phys_alloc_contig(1, 0, VmPhysAddrHigh, uAlignment, 0);
--
-- if (!pPage)
-- {
-- /* Free all allocated pages */
-- while (iPage-- > 0)
-- {
-- pPage = pMemFreeBSD->u.Phys.apPages[iPage];
-- vm_page_lock_queues();
-- vm_page_unwire(pPage, 0);
-- vm_page_free(pPage);
-- vm_page_unlock_queues();
-- }
-- rc = VERR_NO_MEMORY;
-- break;
-- }
-- rtR0MemObjFreeBSDPhysPageInit(pPage, iPage);
-- pMemFreeBSD->u.Phys.apPages[iPage] = pPage;
-- }
-- }
-+ int rc = FreeBSDPhysAllocHelper(pMemFreeBSD->pObject, cPages, VmPhysAddrHigh, uAlignment, fContiguous, true);
-
-- if (RT_FAILURE(rc))
-+ if (RT_FAILURE(rc)) {
-+ vm_object_deallocate(pMemFreeBSD->pObject);
- rtR0MemObjDelete(&pMemFreeBSD->Core);
-+ }
- else
- {
-- if (enmType == RTR0MEMOBJTYPE_PHYS)
-+ if (fContiguous)
- {
-- pMemFreeBSD->Core.u.Phys.PhysBase = VM_PAGE_TO_PHYS(pMemFreeBSD->u.Phys.apPages[0]);
-+ Assert(enmType == RTR0MEMOBJTYPE_PHYS);
-+ VM_OBJECT_LOCK(pMemFreeBSD->pObject);
-+ pMemFreeBSD->Core.u.Phys.PhysBase = VM_PAGE_TO_PHYS(vm_page_find_least(pMemFreeBSD->pObject, 0));
-+ VM_OBJECT_UNLOCK(pMemFreeBSD->pObject);
- pMemFreeBSD->Core.u.Phys.fAllocated = true;
- }
-
-@@ -480,42 +416,13 @@
-
- DECLHIDDEN(int) rtR0MemObjNativeAllocPhys(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest, size_t uAlignment)
- {
--#if 1
- return rtR0MemObjFreeBSDAllocPhysPages(ppMem, RTR0MEMOBJTYPE_PHYS, cb, PhysHighest, uAlignment, true);
--#else
-- /* create the object. */
-- PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD), RTR0MEMOBJTYPE_CONT, NULL, cb);
-- if (!pMemFreeBSD)
-- return VERR_NO_MEMORY;
--
-- /* do the allocation. */
-- pMemFreeBSD->Core.pv = contigmalloc(cb, /* size */
-- M_IPRTMOBJ, /* type */
-- M_NOWAIT | M_ZERO, /* flags */
-- 0, /* lowest physical address*/
-- _4G-1, /* highest physical address */
-- uAlignment, /* alignment. */
-- 0); /* boundary */
-- if (pMemFreeBSD->Core.pv)
-- {
-- pMemFreeBSD->Core.u.Cont.Phys = vtophys(pMemFreeBSD->Core.pv);
-- *ppMem = &pMemFreeBSD->Core;
-- return VINF_SUCCESS;
-- }
--
-- rtR0MemObjDelete(&pMemFreeBSD->Core);
-- return VERR_NO_MEMORY;
--#endif
- }
-
-
- DECLHIDDEN(int) rtR0MemObjNativeAllocPhysNC(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest)
- {
--#if 1
- return rtR0MemObjFreeBSDAllocPhysPages(ppMem, RTR0MEMOBJTYPE_PHYS_NC, cb, PhysHighest, PAGE_SIZE, false);
--#else
-- return VERR_NOT_SUPPORTED;
--#endif
- }
-
-
-@@ -625,49 +532,41 @@
- if (!pMemFreeBSD)
- return VERR_NO_MEMORY;
-
-- /*
-- * Allocate an empty VM object and map it into the requested map.
-- */
-- pMemFreeBSD->u.NonPhys.pObject = vm_object_allocate(OBJT_DEFAULT, cb >> PAGE_SHIFT);
-- if (pMemFreeBSD->u.NonPhys.pObject)
-+ vm_offset_t MapAddress = pvFixed != (void *)-1
-+ ? (vm_offset_t)pvFixed
-+ : vm_map_min(pMap);
-+ if (pvFixed != (void *)-1)
-+ vm_map_remove(pMap,
-+ MapAddress,
-+ MapAddress + cb);
-+
-+ rc = vm_map_find(pMap, /* map */
-+ NULL, /* object */
-+ 0, /* offset */
-+ &MapAddress, /* addr (IN/OUT) */
-+ cb, /* length */
-+ pvFixed == (void *)-1 ? VMFS_ANY_SPACE : VMFS_NO_SPACE,
-+ /* find_space */
-+ VM_PROT_NONE, /* protection */
-+ VM_PROT_ALL, /* max(_prot) ?? */
-+ 0); /* cow (copy-on-write) */
-+ if (rc == KERN_SUCCESS)
- {
-- vm_offset_t MapAddress = pvFixed != (void *)-1
-- ? (vm_offset_t)pvFixed
-- : vm_map_min(pMap);
-- if (pvFixed != (void *)-1)
-- vm_map_remove(pMap,
-- MapAddress,
-- MapAddress + cb);
--
-- rc = vm_map_find(pMap, /* map */
-- pMemFreeBSD->u.NonPhys.pObject, /* object */
-- 0, /* offset */
-- &MapAddress, /* addr (IN/OUT) */
-- cb, /* length */
-- pvFixed == (void *)-1, /* find_space */
-- VM_PROT_NONE, /* protection */
-- VM_PROT_ALL, /* max(_prot) ?? */
-- 0); /* cow (copy-on-write) */
-- if (rc == KERN_SUCCESS)
-+ if (R0Process != NIL_RTR0PROCESS)
- {
-- if (R0Process != NIL_RTR0PROCESS)
-- {
-- rc = vm_map_inherit(pMap,
-- MapAddress,
-- MapAddress + cb,
-- VM_INHERIT_SHARE);
-- AssertMsg(rc == KERN_SUCCESS, ("%#x\n", rc));
-- }
-- pMemFreeBSD->Core.pv = (void *)MapAddress;
-- pMemFreeBSD->Core.u.ResVirt.R0Process = R0Process;
-- *ppMem = &pMemFreeBSD->Core;
-- return VINF_SUCCESS;
-+ rc = vm_map_inherit(pMap,
-+ MapAddress,
-+ MapAddress + cb,
-+ VM_INHERIT_SHARE);
-+ AssertMsg(rc == KERN_SUCCESS, ("%#x\n", rc));
- }
-- vm_object_deallocate(pMemFreeBSD->u.NonPhys.pObject);
-- rc = VERR_NO_MEMORY; /** @todo fix translation (borrow from darwin) */
-+ pMemFreeBSD->Core.pv = (void *)MapAddress;
-+ pMemFreeBSD->Core.u.ResVirt.R0Process = R0Process;
-+ *ppMem = &pMemFreeBSD->Core;
-+ return VINF_SUCCESS;
- }
-- else
-- rc = VERR_NO_MEMORY;
-+
-+ rc = VERR_NO_MEMORY; /** @todo fix translation (borrow from darwin) */
- rtR0MemObjDelete(&pMemFreeBSD->Core);
- return rc;
-
-@@ -690,7 +589,7 @@
- DECLHIDDEN(int) rtR0MemObjNativeMapKernel(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, void *pvFixed, size_t uAlignment,
- unsigned fProt, size_t offSub, size_t cbSub)
- {
-- AssertMsgReturn(!offSub && !cbSub, ("%#x %#x\n", offSub, cbSub), VERR_NOT_SUPPORTED);
-+// AssertMsgReturn(!offSub && !cbSub, ("%#x %#x\n", offSub, cbSub), VERR_NOT_SUPPORTED);
- AssertMsgReturn(pvFixed == (void *)-1, ("%p\n", pvFixed), VERR_NOT_SUPPORTED);
-
- /*
-@@ -699,21 +598,68 @@
- if (uAlignment > PAGE_SIZE)
- return VERR_NOT_SUPPORTED;
-
--/* Phys: see pmap_mapdev in i386/i386/pmap.c (http://fxr.watson.org/fxr/source/i386/i386/pmap.c?v=RELENG62#L2860) */
--/** @todo finish the implementation. */
-+ int rc;
-+ PRTR0MEMOBJFREEBSD pMemToMapFreeBSD = (PRTR0MEMOBJFREEBSD)pMemToMap;
-
-- return VERR_NOT_SUPPORTED;
-+ /* calc protection */
-+ vm_prot_t ProtectionFlags = 0;
-+ if ((fProt & RTMEM_PROT_NONE) == RTMEM_PROT_NONE)
-+ ProtectionFlags = VM_PROT_NONE;
-+ if ((fProt & RTMEM_PROT_READ) == RTMEM_PROT_READ)
-+ ProtectionFlags |= VM_PROT_READ;
-+ if ((fProt & RTMEM_PROT_WRITE) == RTMEM_PROT_WRITE)
-+ ProtectionFlags |= VM_PROT_WRITE;
-+ if ((fProt & RTMEM_PROT_EXEC) == RTMEM_PROT_EXEC)
-+ ProtectionFlags |= VM_PROT_EXECUTE;
-+
-+ vm_offset_t Addr = vm_map_min(kernel_map);
-+ if (cbSub == 0)
-+ cbSub = pMemToMap->cb - offSub;
-+
-+ vm_object_reference(pMemToMapFreeBSD->pObject);
-+ rc = vm_map_find(kernel_map, /* Map to insert the object in */
-+ pMemToMapFreeBSD->pObject, /* Object to map */
-+ offSub, /* Start offset in the object */
-+ &Addr, /* Start address IN/OUT */
-+ cbSub, /* Size of the mapping */
-+ VMFS_ANY_SPACE, /* Whether a suitable address should be searched for first */
-+ ProtectionFlags, /* protection flags */
-+ VM_PROT_ALL, /* Maximum protection flags */
-+ 0); /* copy-on-write and similar flags */
-+
-+ if (rc == KERN_SUCCESS)
-+ {
-+ rc = vm_map_wire(kernel_map, Addr, Addr + cbSub, VM_MAP_WIRE_SYSTEM|VM_MAP_WIRE_NOHOLES);
-+ AssertMsg(rc == KERN_SUCCESS, ("%#x\n", rc));
-+
-+ PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(RTR0MEMOBJFREEBSD),
-+ RTR0MEMOBJTYPE_MAPPING,
-+ (void *)Addr,
-+ cbSub);
-+ if (pMemFreeBSD)
-+ {
-+ Assert((vm_offset_t)pMemFreeBSD->Core.pv == Addr);
-+ pMemFreeBSD->Core.u.Mapping.R0Process = NIL_RTR0PROCESS;
-+ *ppMem = &pMemFreeBSD->Core;
-+ return VINF_SUCCESS;
-+ }
-+ rc = vm_map_remove(kernel_map, Addr, Addr + cbSub);
-+ AssertMsg(rc == KERN_SUCCESS, ("Deleting mapping failed\n"));
-+ }
-+ else
-+ vm_object_deallocate(pMemToMapFreeBSD->pObject);
-+
-+ return VERR_NO_MEMORY;
- }
-
-
--/* see http://markmail.org/message/udhq33tefgtyfozs */
--DECLHIDDEN(int) rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, RTR3PTR R3PtrFixed, size_t uAlignment, unsigned fProt, RTR0PROCESS R0Process)
-+DECLHIDDEN(int) rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, RTR3PTR R3PtrFixed, size_t uAlignment,
-+ unsigned fProt, RTR0PROCESS R0Process)
- {
- /*
- * Check for unsupported stuff.
- */
- AssertMsgReturn(R0Process == RTR0ProcHandleSelf(), ("%p != %p\n", R0Process, RTR0ProcHandleSelf()), VERR_NOT_SUPPORTED);
-- AssertMsgReturn(R3PtrFixed == (RTR3PTR)-1, ("%p\n", R3PtrFixed), VERR_NOT_SUPPORTED);
- if (uAlignment > PAGE_SIZE)
- return VERR_NOT_SUPPORTED;
-
-@@ -734,62 +680,38 @@
- ProtectionFlags |= VM_PROT_EXECUTE;
-
- /* calc mapping address */
-- PROC_LOCK(pProc);
-- vm_offset_t AddrR3 = round_page((vm_offset_t)pProc->p_vmspace->vm_daddr + lim_max(pProc, RLIMIT_DATA));
-- PROC_UNLOCK(pProc);
-+ vm_offset_t AddrR3;
-+ if (R3PtrFixed == (RTR3PTR)-1)
-+ {
-+ // is this needed?
-+ PROC_LOCK(pProc);
-+ AddrR3 = round_page((vm_offset_t)pProc->p_vmspace->vm_daddr + lim_max(pProc, RLIMIT_DATA));
-+ PROC_UNLOCK(pProc);
-+ }
-+ else
-+ AddrR3 = (vm_offset_t)R3PtrFixed;
-
-- /* Insert the object in the map. */
-+ /* Insert the pObject in the map. */
-+ vm_object_reference(pMemToMapFreeBSD->pObject);
- rc = vm_map_find(pProcMap, /* Map to insert the object in */
-- NULL, /* Object to map */
-+ pMemToMapFreeBSD->pObject, /* Object to map */
- 0, /* Start offset in the object */
- &AddrR3, /* Start address IN/OUT */
- pMemToMap->cb, /* Size of the mapping */
-- TRUE, /* Whether a suitable address should be searched for first */
-+ R3PtrFixed == (RTR3PTR)-1 ? VMFS_ANY_SPACE : VMFS_NO_SPACE,
-+ /* Whether a suitable address should be searched for first */
- ProtectionFlags, /* protection flags */
- VM_PROT_ALL, /* Maximum protection flags */
-- 0); /* Copy on write */
-+ 0); /* copy-on-write and similar flags */
-
-- /* Map the memory page by page into the destination map. */
- if (rc == KERN_SUCCESS)
- {
-- size_t cPages = pMemToMap->cb >> PAGE_SHIFT;;
-- pmap_t pPhysicalMap = pProcMap->pmap;
-- vm_offset_t AddrR3Dst = AddrR3;
--
-- if ( pMemToMap->enmType == RTR0MEMOBJTYPE_PHYS
-- || pMemToMap->enmType == RTR0MEMOBJTYPE_PHYS_NC
-- || pMemToMap->enmType == RTR0MEMOBJTYPE_PAGE)
-- {
-- /* Mapping physical allocations */
-- Assert(cPages == pMemToMapFreeBSD->u.Phys.cPages);
-+ rc = vm_map_wire(pProcMap, AddrR3, AddrR3 + pMemToMap->cb, VM_MAP_WIRE_USER|VM_MAP_WIRE_NOHOLES);
-+ AssertMsg(rc == KERN_SUCCESS, ("%#x\n", rc));
-
-- /* Insert the memory page by page into the mapping. */
-- for (uint32_t iPage = 0; iPage < cPages; iPage++)
-- {
-- vm_page_t pPage = pMemToMapFreeBSD->u.Phys.apPages[iPage];
-+ rc = vm_map_inherit(pProcMap, AddrR3, AddrR3 + pMemToMap->cb, VM_INHERIT_SHARE);
-+ AssertMsg(rc == KERN_SUCCESS, ("%#x\n", rc));
-
-- MY_PMAP_ENTER(pPhysicalMap, AddrR3Dst, pPage, ProtectionFlags, TRUE);
-- AddrR3Dst += PAGE_SIZE;
-- }
-- }
-- else
-- {
-- /* Mapping cont or low memory types */
-- vm_offset_t AddrToMap = (vm_offset_t)pMemToMap->pv;
--
-- for (uint32_t iPage = 0; iPage < cPages; iPage++)
-- {
-- vm_page_t pPage = PHYS_TO_VM_PAGE(vtophys(AddrToMap));
--
-- MY_PMAP_ENTER(pPhysicalMap, AddrR3Dst, pPage, ProtectionFlags, TRUE);
-- AddrR3Dst += PAGE_SIZE;
-- AddrToMap += PAGE_SIZE;
-- }
-- }
-- }
--
-- if (RT_SUCCESS(rc))
-- {
- /*
- * Create a mapping object for it.
- */
-@@ -805,9 +727,11 @@
- return VINF_SUCCESS;
- }
-
-- rc = vm_map_remove(pProcMap, ((vm_offset_t)AddrR3), ((vm_offset_t)AddrR3) + pMemToMap->cb);
-+ rc = vm_map_remove(pProcMap, AddrR3, AddrR3 + pMemToMap->cb);
- AssertMsg(rc == KERN_SUCCESS, ("Deleting mapping failed\n"));
- }
-+ else
-+ vm_object_deallocate(pMemToMapFreeBSD->pObject);
-
- return VERR_NO_MEMORY;
- }
-@@ -855,49 +779,47 @@
- return NIL_RTHCPHYS;
- }
-
-- vm_offset_t pb = (vm_offset_t)pMemFreeBSD->Core.pv + (iPage << PAGE_SHIFT);
-+ 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 = pProcMap->pmap;
-+ pmap_t pPhysicalMap = vm_map_pmap(pProcMap);
-
- return pmap_extract(pPhysicalMap, pb);
- }
-
- case RTR0MEMOBJTYPE_MAPPING:
- {
-- vm_offset_t pb = (vm_offset_t)pMemFreeBSD->Core.pv + (iPage << PAGE_SHIFT);
-+ vm_offset_t pb = (vm_offset_t)pMemFreeBSD->Core.pv + ptoa(iPage);
-
- if (pMemFreeBSD->Core.u.Mapping.R0Process != NIL_RTR0PROCESS)
- {
- struct proc *pProc = (struct proc *)pMemFreeBSD->Core.u.Mapping.R0Process;
- struct vm_map *pProcMap = &pProc->p_vmspace->vm_map;
-- pmap_t pPhysicalMap = pProcMap->pmap;
-+ pmap_t pPhysicalMap = vm_map_pmap(pProcMap);
-
- return pmap_extract(pPhysicalMap, pb);
+ vm_page_free(pPage);
++#if __FreeBSD_version < 900000
+ vm_page_unlock_queues();
++#endif
}
- return vtophys(pb);
- }
-
-- case RTR0MEMOBJTYPE_CONT:
-- return pMemFreeBSD->Core.u.Cont.Phys + (iPage << PAGE_SHIFT);
--
-- case RTR0MEMOBJTYPE_PHYS:
-- return pMemFreeBSD->Core.u.Phys.PhysBase + (iPage << PAGE_SHIFT);
--
- case RTR0MEMOBJTYPE_PAGE:
-- case RTR0MEMOBJTYPE_PHYS_NC:
-- return VM_PAGE_TO_PHYS(pMemFreeBSD->u.Phys.apPages[iPage]);
--
--#ifdef USE_KMEM_ALLOC_ATTR
- case RTR0MEMOBJTYPE_LOW:
-+ case RTR0MEMOBJTYPE_PHYS_NC:
- {
-- vm_offset_t pb = (vm_offset_t)pMemFreeBSD->Core.pv + (iPage << PAGE_SHIFT);
-- return vtophys(pb);
-+ RTHCPHYS addr;
-+ VM_OBJECT_LOCK(pMemFreeBSD->pObject);
-+ addr = VM_PAGE_TO_PHYS(vm_page_lookup(pMemFreeBSD->pObject, iPage));
-+ VM_OBJECT_UNLOCK(pMemFreeBSD->pObject);
-+ return addr;
- }
--#else
-- case RTR0MEMOBJTYPE_LOW:
--#endif
-+
-+ case RTR0MEMOBJTYPE_PHYS:
-+ return pMemFreeBSD->Core.u.Cont.Phys + ptoa(iPage);
-+
-+ case RTR0MEMOBJTYPE_CONT:
-+ return pMemFreeBSD->Core.u.Phys.PhysBase + ptoa(iPage);
-+
- case RTR0MEMOBJTYPE_RES_VIRT:
- default:
- return NIL_RTHCPHYS;
+ VM_OBJECT_UNLOCK(pObject);
+ return rcNoMem;
+--
+1.7.11.5
+
diff --git a/emulators/virtualbox-ose-kmod/files/patch-src-VBox-Runtime-r0drv-freebsd-semfastmutex-r0drv-freebsd.c b/emulators/virtualbox-ose-kmod/files/patch-src-VBox-Runtime-r0drv-freebsd-semfastmutex-r0drv-freebsd.c
deleted file mode 100644
index 2f04d3adfafd..000000000000
--- a/emulators/virtualbox-ose-kmod/files/patch-src-VBox-Runtime-r0drv-freebsd-semfastmutex-r0drv-freebsd.c
+++ /dev/null
@@ -1,15 +0,0 @@
-- Fix INVARIANTS warning:
-acquiring duplicate lock of same type: "IPRT Fast Mutex Semaphore"
-
-Submitted by: avg
---- src/VBox/Runtime/r0drv/freebsd/semfastmutex-r0drv-freebsd.c.orig 2011-11-04 12:19:54.000000000 +0100
-+++ src/VBox/Runtime/r0drv/freebsd/semfastmutex-r0drv-freebsd.c 2011-12-06 23:12:49.233297685 +0100
-@@ -66,7 +66,7 @@
- if (pThis)
- {
- pThis->u32Magic = RTSEMFASTMUTEX_MAGIC;
-- sx_init(&pThis->SxLock, "IPRT Fast Mutex Semaphore");
-+ sx_init_flags(&pThis->SxLock, "IPRT Fast Mutex Semaphore", SX_DUPOK);
-
- *phFastMtx = pThis;
- return VINF_SUCCESS;
diff --git a/emulators/virtualbox-ose-kmod/files/patch-src-VBox-Runtime-r0drv-freebsd-sleepqueue-r0drv-freebsd.h b/emulators/virtualbox-ose-kmod/files/patch-src-VBox-Runtime-r0drv-freebsd-sleepqueue-r0drv-freebsd.h
new file mode 100644
index 000000000000..e1ae4d7ea855
--- /dev/null
+++ b/emulators/virtualbox-ose-kmod/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
diff --git a/emulators/virtualbox-ose-kmod/files/vboxnet.in b/emulators/virtualbox-ose-kmod/files/vboxnet.in
index cf4225486a30..cab5d14a7521 100644
--- a/emulators/virtualbox-ose-kmod/files/vboxnet.in
+++ b/emulators/virtualbox-ose-kmod/files/vboxnet.in
@@ -41,6 +41,9 @@ vboxnet_start()
return 1
fi
fi
+
+ # initialize configured host-only interfaces
+ %%PREFIX%%/bin/VBoxManage list hostonlyifs >/dev/null
}
vboxnet_stop()
diff --git a/emulators/virtualbox-ose/Makefile b/emulators/virtualbox-ose/Makefile
index cbc30aae1b86..10a28632770a 100644
--- a/emulators/virtualbox-ose/Makefile
+++ b/emulators/virtualbox-ose/Makefile
@@ -1,12 +1,8 @@
-# New ports collection makefile for: virtualbox-ose
-# Date created: 2009-05-02
-# Whom: Bernhard Froehlich <decke@bluelife.at>
-#
+# Created by: Bernhard Froehlich <decke@bluelife.at>
# $FreeBSD$
-#
PORTNAME= virtualbox-ose
-DISTVERSION= 4.1.22
+DISTVERSION= 4.2.6
CATEGORIES= emulators
MASTER_SITES= http://download.virtualbox.org/virtualbox/${DISTVERSION}/ \
http://tmp.chruetertee.ch/ \
@@ -25,15 +21,16 @@ LICENSE_FILE= ${WRKSRC}/COPYING
BUILD_DEPENDS= yasm:${PORTSDIR}/devel/yasm \
as86:${PORTSDIR}/devel/dev86 \
xsltproc:${PORTSDIR}/textproc/libxslt \
- kmk:${PORTSDIR}/devel/kBuild-devel \
+ kmk:${PORTSDIR}/devel/kBuild \
gtar:${PORTSDIR}/archivers/gtar
LIB_DEPENDS= png15:${PORTSDIR}/graphics/png \
xslt.2:${PORTSDIR}/textproc/libxslt \
curl.6:${PORTSDIR}/ftp/curl
-RUN_DEPENDS= /boot/modules/vboxdrv.ko:${PORTSDIR}/emulators/virtualbox-ose-kmod
+RUN_DEPENDS= ${KMODDIR}/vboxdrv.ko:${PORTSDIR}/emulators/virtualbox-ose-kmod
WRKSRC= ${WRKDIR}/VirtualBox-${PORTVERSION}
ONLY_FOR_ARCHS= i386 amd64
+FETCH_ARGS= -pRr
USE_CDRTOOLS= yes
USE_GCC= any
USE_GNOME= libidl
@@ -49,7 +46,6 @@ CONFIGURE_ARGS+=--with-gcc="${CC}" --with-g++="${CXX}" --passive-mesa
USE_LDCONFIG= ${PREFIX}/lib/virtualbox
CONFLICTS= bcc-[0-9]*
-CONFLICTS_BUILD= kBuild-[0-9]*
CONFLICTS_INSTALL= virtualbox-ose-devel-[3,4]* virtualbox-ose-legacy-[3,4]* virtualbox-ose-additions-[3,4]* virtualbox-ose-additions-devel-[3,4]*
VBOXUSER?= vboxusers
@@ -57,11 +53,12 @@ VBOXWSUSER?= vboxusers
VBOXGROUP?= vboxusers
USERS= ${VBOXUSER}
GROUPS= ${VBOXGROUP}
-VBOX_FRONTENDS= VBoxHeadless
+VBOX_FRONTENDS= VBoxAutostart VBoxHeadless
VBOX_GUEST_VER= ${PORTVERSION}
OPTIONS_DEFINE= QT4 DEBUG GUESTADDITIONS DBUS PULSEAUDIO UDPTUNNEL VDE VNC WEBSERVICE NLS X11
-OPTIONS_DEFAULT= QT4 DBUS X11 UDPTUNNEL
+OPTIONS_DEFAULT= QT4 DBUS X11 UDPTUNNEL VNC
+DEBUG_DESC= Debug symbols, additional logs and assertions
QT4_DESC= Build with QT4 Frontend
GUESTADDITIONS_DESC= Build with Guest Additions
UDPTUNNEL_DESC= Build with UDP tunnel support
@@ -69,8 +66,12 @@ VDE_DESC= Build with VDE support
VNC_DESC= Build with VNC support
WEBSERVICE_DESC= Build Webservice
+.SHELL: path="/bin/sh" unsetenv=true
+
.include <bsd.port.options.mk>
+KMODDIR?= /boot/modules
+
PLIST_SUB+= PYTHON_VER=${PYTHON_VER} \
PYTHON_VERU=${PYTHON_VER:S/./_/} \
GUEST_VER=${VBOX_GUEST_VER}
@@ -80,7 +81,7 @@ USE_RC_SUBR+= vboxheadless
KMK_BUILDTYPE= release
KMK_CONFIG= VBOX_LIBPATH_X11=${LOCALBASE} VBOX_FREEBSD_SRC=${SRC_BASE}/sys
-KMK_FLAGS=
+KMK_FLAGS= -j 1
.if empty(PORT_OPTIONS:MQT4) && !empty(PORT_OPTIONS:MNLS)
BROKEN= NLS support requires QT4 frontend. Run 'make config' again!
@@ -116,15 +117,14 @@ GUESTADDITIONS= VBoxGuestAdditions_${VBOX_GUEST_VER}.iso
GADISTFILES= ${GUESTADDITIONS}:guestadditions
RESTRICTED= for personal use only
RESTRICTED_FILES= ${GUESTADDITIONS}
-FETCH_ARGS= -pRr
PLIST_SUB+= GUESTADDITIONS=""
.else
PLIST_SUB+= GUESTADDITIONS="@comment "
.endif
.if ${PORT_OPTIONS:MDEBUG}
-KMK_FLAGS+= BUILD_TYPE=debug
KMK_BUILDTYPE= debug
+KMK_FLAGS+= BUILD_TYPE=debug
.endif
.if ${PORT_OPTIONS:MDBUS}
@@ -141,6 +141,10 @@ CONFIGURE_ARGS+=--disable-pulse
.if ${PORT_OPTIONS:MVNC}
LIB_DEPENDS+= vncserver.0:${PORTSDIR}/net/libvncserver
+CONFIGURE_ARGS+=--enable-vnc
+PLIST_SUB+= VNC=""
+.else
+PLIST_SUB+= VNC="@comment "
.endif
.if ${PORT_OPTIONS:MNLS}
@@ -172,16 +176,14 @@ KMK_ARCH= freebsd.${ARCH}
PLIST_SUB+= I386="@comment "
.endif
+PLIST_SUB+= ARCH="${KMK_ARCH}"
+
.include <bsd.port.pre.mk>
.if ${OSVERSION} < 802000
BROKEN= Does not compile on FreeBSD < 8.2
.endif
-.if ${OSVERSION} > 900012
-EXTRA_PATCHES+= ${FILESDIR}/extrapatch-include-iprt-string.h
-.endif
-
.if ${OSVERSION} < 900000 && ${OSVERSION} > 801500
EXTRA_PATCHES+= ${FILESDIR}/extrapatch-src-VBox-Devices-PC-vbox.dsl
.endif
@@ -212,7 +214,7 @@ post-patch:
@${ECHO} 'VBOX_WITH_ADDITIONS=' >> ${WRKSRC}/LocalConfig.kmk
@${ECHO} 'VBOX_WITH_X11_ADDITIONS=' >> ${WRKSRC}/LocalConfig.kmk
.if ${PORT_OPTIONS:MVNC}
- @${ECHO} 'VBOX_WITH_VNC = 1' >> ${WRKSRC}/LocalConfig.kmk
+ @${ECHO} 'VBOX_WITH_EXTPACK_VNC = 1' >> ${WRKSRC}/LocalConfig.kmk
.endif
.if ${OSVERSION} < 800069
@${ECHO} 'VBOX_WITH_USB=' >> ${WRKSRC}/LocalConfig.kmk
@@ -271,8 +273,13 @@ do-install:
${CHMOD} 0711 ${PREFIX}/lib/virtualbox/${f}
.endfor
+.if ${PORT_OPTIONS:MVNC}
+ ${MKDIR} ${PREFIX}/lib/virtualbox/ExtensionPacks
+ ${CP} -a ${WRKSRC}/out/${KMK_ARCH}/${KMK_BUILDTYPE}/bin/ExtensionPacks/VNC ${PREFIX}/lib/virtualbox/ExtensionPacks
+.endif
+
.if ${PORT_OPTIONS:MWEBSERVICE}
- ${MKDIR} -p ${DATADIR}/sdk/bindings/webservice
+ ${MKDIR} ${DATADIR}/sdk/bindings/webservice
.for f in vboxweb.wsdl vboxwebService.wsdl
${INSTALL_DATA} ${WRKSRC}/out/${KMK_ARCH}/${KMK_BUILDTYPE}/bin/sdk/bindings/webservice/${f} ${DATADIR}/sdk/bindings/webservice/
.endfor
diff --git a/emulators/virtualbox-ose/distinfo b/emulators/virtualbox-ose/distinfo
index 92a47201ad28..2f40b5284d39 100644
--- a/emulators/virtualbox-ose/distinfo
+++ b/emulators/virtualbox-ose/distinfo
@@ -1,4 +1,4 @@
-SHA256 (VirtualBox-4.1.22.tar.bz2) = 7abb506203dd0d69b4b408fd999b5b9a479a9adce5f80e9b5569641c053dd153
-SIZE (VirtualBox-4.1.22.tar.bz2) = 73385514
-SHA256 (VBoxGuestAdditions_4.1.22.iso) = 5c7d9a4a31c8a926ba6dbae2b9704a561638e94ea0fc4f805a9231dd4f932d46
-SIZE (VBoxGuestAdditions_4.1.22.iso) = 52207616
+SHA256 (VirtualBox-4.2.6.tar.bz2) = 54526091bc2aa66b88ca878dd9ecc4466f96d607db2f6678a9d673ecf6646ae3
+SIZE (VirtualBox-4.2.6.tar.bz2) = 76291326
+SHA256 (VBoxGuestAdditions_4.2.6.iso) = b9afd356d85fe6822fd28009fd63faddd2ac7cbd75c415ea4ce6a22925243ed3
+SIZE (VBoxGuestAdditions_4.2.6.iso) = 57401344
diff --git a/emulators/virtualbox-ose/files/extrapatch-include-iprt-string.h b/emulators/virtualbox-ose/files/extrapatch-include-iprt-string.h
deleted file mode 100644
index c22eebe25952..000000000000
--- a/emulators/virtualbox-ose/files/extrapatch-include-iprt-string.h
+++ /dev/null
@@ -1,10 +0,0 @@
---- include/iprt/string.h.orig 2010-04-28 01:02:16.000000000 +0200
-+++ include/iprt/string.h 2010-06-17 16:20:14.000000000 +0200
-@@ -60,7 +60,6 @@
- #if (defined(RT_OS_DARWIN) && defined(KERNEL)) \
- || (defined(RT_OS_FREEBSD) && defined(_KERNEL))
- RT_C_DECLS_BEGIN
--void *memchr(const void *pv, int ch, size_t cb);
- char *strpbrk(const char *pszStr, const char *pszChars);
- RT_C_DECLS_END
- #endif
diff --git a/emulators/virtualbox-ose/files/patch-Config.kmk b/emulators/virtualbox-ose/files/patch-Config.kmk
new file mode 100644
index 000000000000..d7edc886bb4a
--- /dev/null
+++ b/emulators/virtualbox-ose/files/patch-Config.kmk
@@ -0,0 +1,56 @@
+--- Config.kmk.orig 2012-12-20 14:44:38.260858319 +0100
++++ Config.kmk 2012-12-20 14:55:59.491850177 +0100
+@@ -3239,7 +3239,7 @@
+ $(VBOX_GCC_WARN) -Wpointer-arith -Winline $(VBOX_GCC_Wno-pointer-sign) $(VBOX_GCC_fdiagnostics-show-option) \
+ -Wstrict-prototypes -Wmissing-prototypes -Wstrict-prototypes \
+ -Wimplicit-function-declaration -Werror-implicit-function-declaration \
+- -O2 -fformat-extensions -ffreestanding -fno-strict-aliasing -fno-common -finline-limit=8000 \
++ -O2 -ffreestanding -fno-strict-aliasing -fno-common -finline-limit=8000 \
+ $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) \
+ -nostdinc -std=c99
+ TEMPLATE_VBOXR0DRV_CFLAGS.x86 = -m32 -mno-align-long-strings -mpreferred-stack-boundary=2 -mno-mmx -mno-3dnow -mno-sse -mno-sse2
+@@ -3248,7 +3248,7 @@
+ -mno-3dnow -msoft-float -fno-asynchronous-unwind-tables -Wundef
+ TEMPLATE_VBOXR0DRV_CXXFLAGS = -fno-exceptions -fno-rtti \
+ $(VBOX_GCC_WARN) -Wpointer-arith -Winline \
+- -O2 -fno-format-extensions -fno-strict-aliasing -fno-common -finline-limit=8000 \
++ -O2 -fno-strict-aliasing -fno-common -finline-limit=8000 \
+ $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) \
+ -nostdinc
+ TEMPLATE_VBOXR0DRV_CXXFLAGS.x86 = $(TEMPLATE_VBOXR0DRV_CFLAGS.x86)
+@@ -3465,8 +3465,6 @@
+ /usr/X11R6/include \
+ /usr/local/include
+ TEMPLATE_VBOXR3EXE_LIBPATH += \
+- /usr/lib \
+- /usr/X11R6/lib \
+ /usr/local/lib
+ else ifeq ($(KBUILD_TARGET),solaris)
+ TEMPLATE_VBOXR3EXE_TOOL = GXX3PLAIN
+@@ -3955,8 +3953,6 @@
+ /usr/X11R6/include \
+ /usr/local/include
+ TEMPLATE_VBOXMAINEXE_LIBPATH += \
+- /usr/lib \
+- /usr/X11R6/lib \
+ /usr/local/lib
+ else ifeq ($(KBUILD_TARGET),solaris)
+ TEMPLATE_VBOXMAINEXE_TOOL = GXX3PLAIN
+@@ -4371,8 +4367,6 @@
+ /usr/X11R6/include \
+ /usr/local/include
+ TEMPLATE_VBOXQT4GUIEXE_LIBPATH += \
+- /usr/lib \
+- /usr/X11R6/lib \
+ /usr/local/lib
+ endif
+ ifeq ($(KBUILD_TARGET),solaris)
+@@ -4555,8 +4549,6 @@
+ /usr/X11R6/include \
+ /usr/local/include
+ TEMPLATE_VBOXBLDPROG_LIBPATH += \
+- /usr/lib \
+- /usr/X11R6/lib \
+ /usr/local/lib
+ else ifeq ($(KBUILD_HOST),solaris)
+ TEMPLATE_VBOXBLDPROG_TOOL = GXX3PLAIN
diff --git a/emulators/virtualbox-ose/files/patch-configure b/emulators/virtualbox-ose/files/patch-configure
index d47c69b30074..4bea77d203cc 100644
--- a/emulators/virtualbox-ose/files/patch-configure
+++ b/emulators/virtualbox-ose/files/patch-configure
@@ -1,10 +1,21 @@
---- configure.orig 2011-05-30 17:11:26.000000000 +0200
-+++ configure 2011-06-06 10:01:12.000000000 +0200
-@@ -1920,7 +1920,7 @@
+--- configure.orig 2012-03-16 10:34:01.000000000 +0100
++++ configure 2012-03-24 18:52:57.271018829 +0100
+@@ -135,6 +135,8 @@
+ 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"
+@@ -1837,8 +1839,8 @@
+ 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
+- 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
diff --git a/emulators/virtualbox-ose/files/patch-include-iprt-types.h b/emulators/virtualbox-ose/files/patch-include-iprt-types.h
deleted file mode 100644
index 4c2070e3bb10..000000000000
--- a/emulators/virtualbox-ose/files/patch-include-iprt-types.h
+++ /dev/null
@@ -1,11 +0,0 @@
---- include/iprt/types.h.orig 2012-03-05 10:48:48.000000000 +0100
-+++ include/iprt/types.h 2012-03-05 11:21:25.000000000 +0100
-@@ -82,6 +82,8 @@
- # include <stddef.h>
- # define _UINT64_T_DECLARED
- # define _INT64_T_DECLARED
-+# define _UINTPTR_T_DECLARED
-+# define _INTPTR_T_DECLARED
- # include <sys/types.h>
-
- # elif defined(RT_OS_LINUX) && defined(__KERNEL__)
diff --git a/emulators/virtualbox-ose/files/patch-src-VBox-Devices-Audio-ossaudio.c b/emulators/virtualbox-ose/files/patch-src-VBox-Devices-Audio-ossaudio.c
new file mode 100644
index 000000000000..652430cb222e
--- /dev/null
+++ b/emulators/virtualbox-ose/files/patch-src-VBox-Devices-Audio-ossaudio.c
@@ -0,0 +1,19 @@
+Fix recording with OSS Audio backend to record at a proper volume
+
+Obtained from: https://www.virtualbox.org/ticket/10695
+--- src/VBox/Devices/Audio/ossaudio.c.orig 2012-12-19 19:26:32.000000000 +0100
++++ src/VBox/Devices/Audio/ossaudio.c 2012-12-20 12:23:18.476851732 +0100
+@@ -795,13 +795,8 @@
+ hw->info.align + 1);
+ }
+ read_samples += nread >> hwshift;
+-#ifndef VBOX
+ hw->conv (hw->conv_buf + bufs[i].add, p, nread >> hwshift,
+ &nominal_volume);
+-#else
+- hw->conv (hw->conv_buf + bufs[i].add, p, nread >> hwshift,
+- &pcm_in_volume);
+-#endif
+ }
+
+ if (bufs[i].len - nread) {
diff --git a/emulators/virtualbox-ose/files/patch-src-VBox-Devices-Bus-DevPciIch9.cpp b/emulators/virtualbox-ose/files/patch-src-VBox-Devices-Bus-DevPciIch9.cpp
new file mode 100644
index 000000000000..6354f1e1ca65
--- /dev/null
+++ b/emulators/virtualbox-ose/files/patch-src-VBox-Devices-Bus-DevPciIch9.cpp
@@ -0,0 +1,22 @@
+Fix ich9 bios to correctly configure pci bridge1 and pci bridge2
+
+avg: I think that it is a valid report, the patch is not perfect, but
+avg: it fixes the problem for most configurations and demonstrates the problem well
+avg: the explanation for them is that FreeBSD (unlike Linux and maybe other OSes)
+avg: entirely relies on platform doing correct bus numbering
+avg: currently we can not do any re-numbering/corrections
+
+See: http://article.gmane.org/gmane.os.freebsd.devel.emulation/10438
+Submitted by: Gustau Perez i Querol <gperez@entel.upc.edu>
+--- src/VBox/Devices/Bus/DevPciIch9.cpp.orig 2012-06-15 21:22:15.000000000 +0200
++++ src/VBox/Devices/Bus/DevPciIch9.cpp 2012-09-02 14:17:49.804118887 +0200
+@@ -1812,7 +1812,8 @@
+ PICH9PCIBUS pChildBus = PDMINS_2_DATA(pBridge->pDevIns, PICH9PCIBUS);
+ ich9pciInitBridgeTopology(pGlobals, pChildBus);
+ }
+- PCIDevSetByte(pBridgeDev, VBOX_PCI_SUBORDINATE_BUS, pGlobals->uBus);
++ PCIDevSetByte(pBridgeDev, VBOX_PCI_PRIMARY_BUS, 0);
++ PCIDevSetByte(pBridgeDev, VBOX_PCI_SUBORDINATE_BUS, (pGlobals->uBus)-1);
+ Log2(("ich9pciInitBridgeTopology: for bus %p: primary=%d secondary=%d subordinate=%d\n",
+ pBus,
+ PCIDevGetByte(pBridgeDev, VBOX_PCI_PRIMARY_BUS),
diff --git a/emulators/virtualbox-ose/files/patch-src-VBox-Frontends-VBoxManage-VBoxInternalManage.cpp b/emulators/virtualbox-ose/files/patch-src-VBox-Frontends-VBoxManage-VBoxInternalManage.cpp
deleted file mode 100644
index 00e3d32c29d5..000000000000
--- a/emulators/virtualbox-ose/files/patch-src-VBox-Frontends-VBoxManage-VBoxInternalManage.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-- Add support for files to VBoxManage createrawvmdk. Currently
-it only supports character devices so it failes like this:
-
-VBoxManage internalcommands createrawvmdk -filename test.vmdk -rawdisk /vbox/HardDisks/test.img
-VBoxManage: error: File '/vbox/HardDisks/test.img' is no character device
-VBoxManage: error: The raw disk vmdk file was not created
-
-Submitted by: Pawel Jakub Dawidek <pjd@FreeBSD.org>
---- src/VBox/Frontends/VBoxManage/VBoxInternalManage.cpp.orig 2011-12-13 11:18:43.424439415 +0100
-+++ src/VBox/Frontends/VBoxManage/VBoxInternalManage.cpp 2011-12-13 11:22:01.554438862 +0100
-@@ -1140,9 +1140,13 @@
- goto out;
- }
- }
-+ else if (S_ISREG(DevStat.st_mode))
-+ {
-+ cbSize = DevStat.st_size;
-+ }
- else
- {
-- RTMsgError("File '%s' is no character device", rawdisk.c_str());
-+ RTMsgError("File '%s' is neither character device nor regular file", rawdisk.c_str());
- vrc = VERR_INVALID_PARAMETER;
- goto out;
- }
diff --git a/emulators/virtualbox-ose/files/patch-src-VBox-HostDrivers-Makefile.kmk b/emulators/virtualbox-ose/files/patch-src-VBox-HostDrivers-Makefile.kmk
deleted file mode 100644
index 06c4a71db458..000000000000
--- a/emulators/virtualbox-ose/files/patch-src-VBox-HostDrivers-Makefile.kmk
+++ /dev/null
@@ -1,27 +0,0 @@
---- src/VBox/HostDrivers/Makefile.kmk.orig 2010-03-04 12:59:54.000000000 +0100
-+++ src/VBox/HostDrivers/Makefile.kmk 2010-03-09 12:54:09.000000000 +0100
-@@ -40,7 +40,7 @@
- endif
- endif
-
-- if1of ($(KBUILD_TARGET),linux freebsd)
-+ if1of ($(KBUILD_TARGET),linux)
- #
- # Install the Makefile for module compliation on Linux and FreeBSD hosts
- #
-@@ -51,6 +51,7 @@
- HostDrivers-src_SOURCES.freebsd = freebsd/Makefile
- endif
-
-+if 0
- if1of ($(KBUILD_TARGET),freebsd)
- #
- # Install the export_modules script for tar'ing the module sources on FreeBSD hosts
-@@ -60,6 +61,7 @@
- HostDrivers-sh_MODE = a+rx,u+w
- HostDrivers-sh_SOURCES.freebsd = freebsd/export_modules
- endif
-+endif
- endif # !defined(VBOX_ONLY_DOCS) && !defined(VBOX_ONLY_TESTSUITE)
-
- # Let kBuild generate the rules.
diff --git a/emulators/virtualbox-ose/files/patch-src-VBox-HostServices-auth-pam-VBoxAuthPAM.c b/emulators/virtualbox-ose/files/patch-src-VBox-HostServices-auth-pam-VBoxAuthPAM.c
deleted file mode 100644
index 1344f3f2bd60..000000000000
--- a/emulators/virtualbox-ose/files/patch-src-VBox-HostServices-auth-pam-VBoxAuthPAM.c
+++ /dev/null
@@ -1,15 +0,0 @@
-- Fix path for libpam.so on FreeBSD
-
-Submitted by: Landon Fuller <landonf at plausible.coop>
-Sponsored by: Plausible Labs Cooperative, Inc.
---- src/VBox/HostServices/auth/pam/VBoxAuthPAM.c.orig 2012-04-03 14:11:56.000000000 +0200
-+++ src/VBox/HostServices/auth/pam/VBoxAuthPAM.c 2012-04-05 12:44:48.000000000 +0200
-@@ -62,6 +62,8 @@
- /* The name of the PAM library */
- # ifdef RT_OS_SOLARIS
- # define PAM_LIB_NAME "libpam.so.1"
-+# elif defined(RT_OS_FREEBSD)
-+# define PAM_LIB_NAME "libpam.so"
- # else
- # define PAM_LIB_NAME "libpam.so.0"
- # endif
diff --git a/emulators/virtualbox-ose/files/patch-src-VBox-Main-scr-server-freebsd-PerformanceFreeBSD.cpp b/emulators/virtualbox-ose/files/patch-src-VBox-Main-scr-server-freebsd-PerformanceFreeBSD.cpp
new file mode 100644
index 000000000000..9ef5b64d7175
--- /dev/null
+++ b/emulators/virtualbox-ose/files/patch-src-VBox-Main-scr-server-freebsd-PerformanceFreeBSD.cpp
@@ -0,0 +1,13 @@
+--- src/VBox/Main/src-server/freebsd/PerformanceFreeBSD.cpp.orig 2012-10-19 19:51:26.256773940 +0400
++++ src/VBox/Main/src-server/freebsd/PerformanceFreeBSD.cpp 2012-10-19 19:51:49.835771918 +0400
+@@ -109,5 +109,10 @@
+ return E_NOTIMPL;
+ }
+
++int getDiskListByFs(const char *name, DiskList& list)
++{
++ return VERR_NOT_IMPLEMENTED;
++}
++
+ } /* namespace pm */
+
diff --git a/emulators/virtualbox-ose/files/patch-src-VBox-Main-src-server-MachineImpl.cpp b/emulators/virtualbox-ose/files/patch-src-VBox-Main-src-server-MachineImpl.cpp
deleted file mode 100644
index fce7b85eefa3..000000000000
--- a/emulators/virtualbox-ose/files/patch-src-VBox-Main-src-server-MachineImpl.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-- Remove debugging fprintf in MachineImpl.cpp to fix build with GCC 4.6
-
-Submitted by: Andriy Gapon <avg at FreeBSD.org>
---- src/VBox/Main/src-server/MachineImpl.cpp.orig 2012-04-03 14:12:01.000000000 +0200
-+++ src/VBox/Main/src-server/MachineImpl.cpp 2012-04-13 10:49:25.000000000 +0200
-@@ -6643,7 +6643,6 @@
-
- Utf8Str idStr = mData->mUuid.toString();
- const char * args[] = {szPath, "--comment", mUserData->s.strName.c_str(), "--startvm", idStr.c_str(), 0 };
-- fprintf(stderr, "SDL=%s\n", szPath);
- vrc = RTProcCreate(szPath, args, env, 0, &pid);
- }
- #else /* !VBOX_WITH_VBOXSDL */
diff --git a/emulators/virtualbox-ose/files/patch-src-VBox-Main-src-server-freebsd-HostHardwareFreeBSD.cpp b/emulators/virtualbox-ose/files/patch-src-VBox-Main-src-server-freebsd-HostHardwareFreeBSD.cpp
new file mode 100644
index 000000000000..c77c65da5b21
--- /dev/null
+++ b/emulators/virtualbox-ose/files/patch-src-VBox-Main-src-server-freebsd-HostHardwareFreeBSD.cpp
@@ -0,0 +1,10 @@
+--- src/VBox/Main/src-server/freebsd/HostHardwareFreeBSD.cpp.orig 2012-12-19 19:27:17.000000000 +0100
++++ src/VBox/Main/src-server/freebsd/HostHardwareFreeBSD.cpp 2012-12-20 14:55:59.501850255 +0100
+@@ -40,6 +40,7 @@
+ # include <sys/stat.h>
+ # include <unistd.h>
+ # include <sys/ioctl.h>
++# include <stdio.h>
+ # include <fcntl.h>
+ # include <cam/cam.h>
+ # include <cam/cam_ccb.h>
diff --git a/emulators/virtualbox-ose/files/patch-src-VBox-Main-src-server-freebsd-NetIf-freebsd.cpp b/emulators/virtualbox-ose/files/patch-src-VBox-Main-src-server-freebsd-NetIf-freebsd.cpp
index bf6264a3b578..e55f2d2bb100 100644
--- a/emulators/virtualbox-ose/files/patch-src-VBox-Main-src-server-freebsd-NetIf-freebsd.cpp
+++ b/emulators/virtualbox-ose/files/patch-src-VBox-Main-src-server-freebsd-NetIf-freebsd.cpp
@@ -1,26 +1,10 @@
-This patch adds support for IFT_L2VLAN interfaces in the
-FreeBSD implementation of NetIfList(), treating them
-identically as IFT_ETHER interfaces.
-
-Submitted by: Landon J Fuller <landonf at plausible dot coop>
-Sponsored by: Plausible Labs Cooperative, Inc
---- src/VBox/Main/src-server/freebsd/NetIf-freebsd.cpp.orig 2012-04-10 11:28:41.552067907 -0400
-+++ src/VBox/Main/src-server/freebsd/NetIf-freebsd.cpp 2012-04-10 11:28:45.872069027 -0400
-@@ -268,7 +268,7 @@
- pNext += pIfAddrMsg->ifam_msglen;
- }
+--- src/VBox/Main/src-server/freebsd/NetIf-freebsd.cpp.orig 2012-12-19 19:27:17.000000000 +0100
++++ src/VBox/Main/src-server/freebsd/NetIf-freebsd.cpp 2012-12-20 14:55:59.492850918 +0100
+@@ -44,6 +44,7 @@
+ #include <netinet/in.h>
-- if (pSdl->sdl_type == IFT_ETHER)
-+ if (pSdl->sdl_type == IFT_ETHER || pSdl->sdl_type == IFT_L2VLAN)
- {
- struct ifreq IfReq;
- strcpy(IfReq.ifr_name, pNew->szShortName);
-@@ -373,7 +373,7 @@
- pNext += pIfAddrMsg->ifam_msglen;
- }
+ #include <stdio.h>
++#include <stdlib.h>
+ #include <unistd.h>
+ #include <errno.h>
-- if (!fSkip && pSdl->sdl_type == IFT_ETHER)
-+ if (!fSkip && (pSdl->sdl_type == IFT_ETHER || pSdl->sdl_type == IFT_L2VLAN))
- {
- size_t cbNameLen = pSdl->sdl_nlen + 1;
- memcpy(pInfo->MACAddress.au8, LLADDR(pSdl), sizeof(pInfo->MACAddress.au8));
diff --git a/emulators/virtualbox-ose/files/patch-src-VBox-Runtime-r0drv-freebsd-memobj-r0drv-freebsd.c b/emulators/virtualbox-ose/files/patch-src-VBox-Runtime-r0drv-freebsd-memobj-r0drv-freebsd.c
new file mode 100644
index 000000000000..b666b7ed0362
--- /dev/null
+++ b/emulators/virtualbox-ose/files/patch-src-VBox-Runtime-r0drv-freebsd-memobj-r0drv-freebsd.c
@@ -0,0 +1,56 @@
+From Alan L. Cox on FreeBSD-current:
+
+ I just glanced at the virtualbox code for a couple minutes. For
+ FreeBSD 9 and 10, these lock acquires are completely unnecessary, and
+ have been since FreeBSD 9.0. Just delete them. They may be equally
+ unnecessary under FreeBSD 8, but I didn't look carefully enough to
+ answer that question.
+
+[1] http://lists.freebsd.org/pipermail/freebsd-current/2012-November/037963.html
+---
+ src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c b/src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c
+index 5c90cf3..1176b51 100644
+--- src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c
++++ src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c
+@@ -164,14 +164,19 @@ DECLHIDDEN(int) rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
+ {
+ VM_OBJECT_LOCK(pMemFreeBSD->pObject);
+ vm_page_t pPage = vm_page_find_least(pMemFreeBSD->pObject, 0);
++#if __FreeBSD_version < 900000
++ /* See http://lists.freebsd.org/pipermail/freebsd-current/2012-November/037963.html */
+ vm_page_lock_queues();
++#endif
+ for (vm_page_t pPage = vm_page_find_least(pMemFreeBSD->pObject, 0);
+ pPage != NULL;
+ pPage = vm_page_next(pPage))
+ {
+ vm_page_unwire(pPage, 0);
+ }
++#if __FreeBSD_version < 900000
+ vm_page_unlock_queues();
++#endif
+ VM_OBJECT_UNLOCK(pMemFreeBSD->pObject);
+ vm_object_deallocate(pMemFreeBSD->pObject);
+ break;
+@@ -263,11 +268,15 @@ static int rtR0MemObjFreeBSDPhysAllocHelper(vm_object_t pObject, u_long cPages,
+ while (iPage-- > 0)
+ {
+ pPage = vm_page_lookup(pObject, iPage);
++#if __FreeBSD_version < 900000
+ vm_page_lock_queues();
++#endif
+ if (fWire)
+ vm_page_unwire(pPage, 0);
+ vm_page_free(pPage);
++#if __FreeBSD_version < 900000
+ vm_page_unlock_queues();
++#endif
+ }
+ VM_OBJECT_UNLOCK(pObject);
+ return rcNoMem;
+--
+1.7.11.5
+
diff --git a/emulators/virtualbox-ose/pkg-message b/emulators/virtualbox-ose/pkg-message
index b850f64a86c3..93aa94f86927 100644
--- a/emulators/virtualbox-ose/pkg-message
+++ b/emulators/virtualbox-ose/pkg-message
@@ -50,7 +50,7 @@ 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.
Check wiki page for known issues and troubleshooting:
-http://wiki.freebsd.org/VirtualBox/ToDo
+http://wiki.freebsd.org/VirtualBox
Please report any problems to emulation@. Thanks!
diff --git a/emulators/virtualbox-ose/pkg-plist b/emulators/virtualbox-ose/pkg-plist
index 1e60acad9deb..4e6258648787 100644
--- a/emulators/virtualbox-ose/pkg-plist
+++ b/emulators/virtualbox-ose/pkg-plist
@@ -1,3 +1,4 @@
+bin/VBoxAutostart
bin/VBoxBalloonCtrl
%%X11%%bin/VBoxBFE
bin/VBoxHeadless
@@ -15,6 +16,7 @@ bin/VBoxXPCOMIPCD
%%X11%%lib/virtualbox/VBoxBFE.so
lib/virtualbox/DBGCPlugInDiggers.so
lib/virtualbox/VBoxAuth.so
+lib/virtualbox/VBoxAutostart
lib/virtualbox/VBoxAuthSimple.so
lib/virtualbox/VBoxBalloonCtrl
%%QT4%%lib/virtualbox/VBoxDbg.so
@@ -28,6 +30,7 @@ lib/virtualbox/VBoxGuestControlSvc.so
lib/virtualbox/VBoxGuestPropSvc.so
lib/virtualbox/VBoxHeadless
lib/virtualbox/VBoxHeadless.so
+lib/virtualbox/VBoxHostChannel.so
%%X11%%lib/virtualbox/VBoxKeyboard.so
lib/virtualbox/VBoxManage
lib/virtualbox/VBoxNetAdpCtl
@@ -49,6 +52,7 @@ lib/virtualbox/VBoxSharedClipboard.so
%%X11%%lib/virtualbox/VBoxSharedCrOpenGL.so
lib/virtualbox/VBoxSharedFolders.so
lib/virtualbox/VBoxVMM.so
+lib/virtualbox/VBoxVMMPreload.so
lib/virtualbox/VBoxXPCOM.so
lib/virtualbox/VBoxXPCOMC.so
lib/virtualbox/VBoxXPCOMIPCD
@@ -70,17 +74,22 @@ lib/virtualbox/components/VBoxXPCOMIPCC.so
lib/virtualbox/components/VBoxSVCM.so
lib/virtualbox/components/VBoxC.so
lib/virtualbox/components/VBoxXPCOMBase.xpt
-%%NLS%%%%DATADIR%%/nls/VirtualBox_ar.qm
+%%VNC%%lib/virtualbox/ExtensionPacks/VNC/%%ARCH%%/VBoxVNC.so
+%%VNC%%lib/virtualbox/ExtensionPacks/VNC/%%ARCH%%/VBoxVNCMain.so
+%%VNC%%lib/virtualbox/ExtensionPacks/VNC/ExtPack-license.html
+%%VNC%%lib/virtualbox/ExtensionPacks/VNC/ExtPack-license.rtf
+%%VNC%%lib/virtualbox/ExtensionPacks/VNC/ExtPack-license.txt
+%%VNC%%lib/virtualbox/ExtensionPacks/VNC/ExtPack.xml
%%NLS%%%%DATADIR%%/nls/VirtualBox_bg.qm
%%NLS%%%%DATADIR%%/nls/VirtualBox_ca.qm
%%NLS%%%%DATADIR%%/nls/VirtualBox_ca_VA.qm
%%NLS%%%%DATADIR%%/nls/VirtualBox_cs.qm
%%NLS%%%%DATADIR%%/nls/VirtualBox_da.qm
%%NLS%%%%DATADIR%%/nls/VirtualBox_de.qm
-%%NLS%%%%DATADIR%%/nls/VirtualBox_el.qm
%%NLS%%%%DATADIR%%/nls/VirtualBox_en.qm
%%NLS%%%%DATADIR%%/nls/VirtualBox_es.qm
%%NLS%%%%DATADIR%%/nls/VirtualBox_eu.qm
+%%NLS%%%%DATADIR%%/nls/VirtualBox_fa_IR.qm
%%NLS%%%%DATADIR%%/nls/VirtualBox_fi.qm
%%NLS%%%%DATADIR%%/nls/VirtualBox_fr.qm
%%NLS%%%%DATADIR%%/nls/VirtualBox_gl_ES.qm
@@ -104,17 +113,16 @@ lib/virtualbox/components/VBoxXPCOMBase.xpt
%%NLS%%%%DATADIR%%/nls/VirtualBox_uk.qm
%%NLS%%%%DATADIR%%/nls/VirtualBox_zh_CN.qm
%%NLS%%%%DATADIR%%/nls/VirtualBox_zh_TW.qm
-%%NLS%%%%DATADIR%%/nls/qt_ar.qm
%%NLS%%%%DATADIR%%/nls/qt_bg.qm
%%NLS%%%%DATADIR%%/nls/qt_ca.qm
%%NLS%%%%DATADIR%%/nls/qt_ca_VA.qm
%%NLS%%%%DATADIR%%/nls/qt_cs.qm
%%NLS%%%%DATADIR%%/nls/qt_da.qm
%%NLS%%%%DATADIR%%/nls/qt_de.qm
-%%NLS%%%%DATADIR%%/nls/qt_el.qm
%%NLS%%%%DATADIR%%/nls/qt_en.qm
%%NLS%%%%DATADIR%%/nls/qt_es.qm
%%NLS%%%%DATADIR%%/nls/qt_eu.qm
+%%NLS%%%%DATADIR%%/nls/qt_fa_IR.qm
%%NLS%%%%DATADIR%%/nls/qt_fi.qm
%%NLS%%%%DATADIR%%/nls/qt_fr.qm
%%NLS%%%%DATADIR%%/nls/qt_gl_ES.qm
@@ -242,6 +250,7 @@ include/virtualbox/VBoxCAPI_v3_1.h
include/virtualbox/VBoxCAPI_v3_2.h
include/virtualbox/VBoxCAPI_v4_0.h
include/virtualbox/VBoxCAPI_v4_1.h
+include/virtualbox/VBoxCAPI_v4_2.h
include/virtualbox/VirtualBox_XPCOM.h
include/virtualbox/ipcIClientObserver.h
include/virtualbox/ipcIDConnectService.h
@@ -610,14 +619,17 @@ include/virtualbox/xpcom/xpcom-config.h
@dirrm include/virtualbox/nsprpub
@dirrm include/virtualbox/ipcd
@dirrm include/virtualbox
+%%VNC%%@dirrm lib/virtualbox/ExtensionPacks/VNC/%%ARCH%%
+%%VNC%%@dirrm lib/virtualbox/ExtensionPacks/VNC
+%%VNC%%@dirrmtry lib/virtualbox/ExtensionPacks
%%NLS%%@dirrm %%DATADIR%%/nls
%%WEB%%@dirrm %%DATADIR%%/sdk/bindings/webservice
%%WEB%%@dirrm %%DATADIR%%/sdk/bindings
%%WEB%%@dirrm %%DATADIR%%/sdk
@dirrm %%DATADIR%%/samples
@dirrm %%DATADIR%%/idl
-@dirrm %%DATADIR%%
+@dirrmtry %%DATADIR%%
%%QT4%%@dirrmtry share/applications
@dirrm lib/virtualbox/components
%%GUESTADDITIONS%%@dirrm lib/virtualbox/additions
-@dirrm lib/virtualbox
+@dirrmtry lib/virtualbox