- Update to 4.1.8
- Mark broken on FreeBSD < 8.0 - Fix lib32 checks to use /usr/lib32/libc.so - R0 memobj rewrite [1] - Fix INVARIANTS warning: acquiring duplicate lock of same type: "IPRT Fast Mutex Semaphore" [1] Submitted by: Andriy Gapon <avg@FreeBSD.org> [1] Obtained from: redports.org/~virtualbox/
This commit is contained in:
parent
6d4369520d
commit
379ce3f230
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=292003
10
UPDATING
10
UPDATING
@ -5,6 +5,16 @@ they are unavoidable.
|
||||
You should get into the habit of checking this file for changes each time
|
||||
you update your ports collection, before attempting any port upgrades.
|
||||
|
||||
20120221:
|
||||
AFFECTS: users of emulators/virtualbox-ose
|
||||
AUTHOR: decke@FreeBSD.org
|
||||
|
||||
virtualbox-ose has been updated to 4.1.8 and requires the latest
|
||||
devel/kBuild-devel now. It is only a build dependency so it is safe
|
||||
to remove it before updating.
|
||||
|
||||
# pkg_delete -f kBuild-\*
|
||||
|
||||
20120220:
|
||||
AFFECTS: users of graphics/libungif
|
||||
AUTHOR: dinoex@FreeBSD.org
|
||||
|
@ -6,7 +6,7 @@
|
||||
#
|
||||
|
||||
PORTNAME= virtualbox-ose
|
||||
DISTVERSION= 4.0.14
|
||||
DISTVERSION= 4.1.8
|
||||
CATEGORIES= emulators kld
|
||||
MASTER_SITES= http://tmp.chruetertee.ch/ \
|
||||
http://freebsd.unixfreunde.de/sources/ \
|
||||
@ -19,7 +19,7 @@ COMMENT= VirtualBox additions for FreeBSD guests
|
||||
|
||||
BUILD_DEPENDS= yasm:${PORTSDIR}/devel/yasm \
|
||||
as86:${PORTSDIR}/devel/dev86 \
|
||||
kmk:${PORTSDIR}/devel/kBuild
|
||||
kmk:${PORTSDIR}/devel/kBuild-devel
|
||||
|
||||
LICENSE= GPLv2
|
||||
LICENSE_FILE= ${WRKSRC}/COPYING
|
||||
@ -38,11 +38,11 @@ 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= DEBUG "Build with debugging symbols" off \
|
||||
X11 "Build with X11 support" on \
|
||||
HAL "Install HAL policy file for additions" on \
|
||||
OPENGL "Build with OpenGL support" off
|
||||
|
||||
.include <bsd.port.options.mk>
|
||||
@ -70,20 +70,10 @@ VBOX_WITH_X11= 1
|
||||
USE_XORG= xcursor xmu inputproto xrandr
|
||||
PLIST_SUB+= X11=""
|
||||
.else
|
||||
.if !defined(WITHOUT_HAL)
|
||||
BROKEN= HAL requires X11 support. Run 'make config' again!
|
||||
.endif
|
||||
VBOX_WITH_X11=
|
||||
PLIST_SUB+= X11="@comment "
|
||||
.endif
|
||||
|
||||
.if !defined(WITHOUT_HAL)
|
||||
LIB_DEPENDS+= hal.1:${PORTSDIR}/sysutils/hal
|
||||
PLIST_SUB+= HAL=""
|
||||
.else
|
||||
PLIST_SUB+= HAL="@comment "
|
||||
.endif
|
||||
|
||||
.if defined(WITHOUT_OPENGL)
|
||||
CONFIGURE_ARGS+=--disable-opengl
|
||||
.else
|
||||
@ -108,7 +98,7 @@ EXTRA_PATCHES= ${FILESDIR}/extrapatch-include-iprt-string.h
|
||||
|
||||
pre-everything::
|
||||
.if ${ARCH} == "amd64"
|
||||
.if !exists(/usr/lib32)
|
||||
.if !exists(/usr/lib32/libc.so)
|
||||
@${ECHO} 'Requires 32-bit libraries installed under /usr/lib32.'
|
||||
@${ECHO} 'Do: cd /usr/src; make build32 install32; ldconfig -v -m -R /usr/lib32'
|
||||
@${FALSE}
|
||||
@ -171,11 +161,6 @@ do-install:
|
||||
${INSTALL_DATA} ${VBOX_BIN}/vboxmouse_drv_17.so ${INPUTDIR}/vboxmouse_drv.so
|
||||
.endif
|
||||
|
||||
.if !defined(WITHOUT_HAL)
|
||||
${INSTALL_DATA} ${WRKSRC}/src/VBox/Additions/linux/installer/90-vboxguest.fdi \
|
||||
${PREFIX}/share/hal/fdi/policy/10osvendor/
|
||||
.endif
|
||||
|
||||
post-install:
|
||||
@${CAT} ${PKGMESSAGE}
|
||||
|
||||
|
@ -1,2 +1,2 @@
|
||||
SHA256 (VirtualBox-4.0.14.tar.bz2) = d7719326ea2f4d492c6642cc3375665a1fcf53015d912292406a574283c02663
|
||||
SIZE (VirtualBox-4.0.14.tar.bz2) = 69959224
|
||||
SHA256 (VirtualBox-4.1.8.tar.bz2) = ef16d6729c9bcc298a33eff636549872dcfe291ac01bfa117cdf7aaf8a4004e0
|
||||
SIZE (VirtualBox-4.1.8.tar.bz2) = 73822230
|
||||
|
@ -1,11 +0,0 @@
|
||||
--- src/VBox/Additions/common/VBoxGuest/VBoxGuest-freebsd.c.orig 2011-04-21 10:29:52.000000000 +0000
|
||||
+++ src/VBox/Additions/common/VBoxGuest/VBoxGuest-freebsd.c 2011-04-27 20:52:04.000000000 +0000
|
||||
@@ -177,7 +177,7 @@
|
||||
iUnit,
|
||||
UID_ROOT,
|
||||
GID_WHEEL,
|
||||
- 0644,
|
||||
+ 0664,
|
||||
"vboxguest%d", iUnit);
|
||||
if (*ppDev)
|
||||
{
|
@ -1,79 +0,0 @@
|
||||
--- src/VBox/Runtime/r0drv/freebsd/mp-r0drv-freebsd.c.orig 2011-05-16 12:33:52.000000000 -0400
|
||||
+++ src/VBox/Runtime/r0drv/freebsd/mp-r0drv-freebsd.c 2011-06-24 13:57:31.000000000 -0400
|
||||
@@ -163,17 +163,26 @@ RTDECL(int) RTMpOnOthers(PFNRTMPWORKER p
|
||||
/* Will panic if no rendezvousing cpus, so check up front. */
|
||||
if (RTMpGetOnlineCount() > 1)
|
||||
{
|
||||
-#if __FreeBSD_version >= 700000
|
||||
- cpumask_t Mask = ~(cpumask_t)curcpu;
|
||||
+#if __FreeBSD_version >= 900000
|
||||
+ cpuset_t Mask;
|
||||
+#elif __FreeBSD_version >= 700000
|
||||
+ cpumask_t Mask;
|
||||
#endif
|
||||
+ RTCPUID idCpu = curcpu;
|
||||
RTMPARGS Args;
|
||||
|
||||
Args.pfnWorker = pfnWorker;
|
||||
Args.pvUser1 = pvUser1;
|
||||
Args.pvUser2 = pvUser2;
|
||||
- Args.idCpu = RTMpCpuId();
|
||||
+ Args.idCpu = idCpu;
|
||||
Args.cHits = 0;
|
||||
#if __FreeBSD_version >= 700000
|
||||
+ Mask = all_cpus;
|
||||
+#if __FreeBSD_version >= 900000
|
||||
+ CPU_CLR(idCpu, &Mask);
|
||||
+#else
|
||||
+ Mask &= ~((cpumask_t)1 << idCpu);
|
||||
+#endif
|
||||
smp_rendezvous_cpus(Mask, NULL, rtmpOnOthersFreeBSDWrapper, smp_no_rendevous_barrier, &Args);
|
||||
#else
|
||||
smp_rendezvous(NULL, rtmpOnOthersFreeBSDWrapper, NULL, &Args);
|
||||
@@ -203,8 +212,10 @@ static void rtmpOnSpecificFreeBSDWrapper
|
||||
|
||||
RTDECL(int) RTMpOnSpecific(RTCPUID idCpu, PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
|
||||
{
|
||||
-#if __FreeBSD_version >= 700000
|
||||
- cpumask_t Mask = 1 << idCpu;
|
||||
+#if __FreeBSD_version >= 900000
|
||||
+ cpuset_t Mask;
|
||||
+#elif __FreeBSD_version >= 700000
|
||||
+ cpumask_t Mask;
|
||||
#endif
|
||||
RTMPARGS Args;
|
||||
|
||||
@@ -218,7 +229,11 @@ RTDECL(int) RTMpOnSpecific(RTCPUID idCpu
|
||||
Args.idCpu = idCpu;
|
||||
Args.cHits = 0;
|
||||
#if __FreeBSD_version >= 700000
|
||||
+#if __FreeBSD_version >= 900000
|
||||
+ CPU_SETOF(idCpu, &Mask);
|
||||
+#else
|
||||
Mask = (cpumask_t)1 << idCpu;
|
||||
+#endif
|
||||
smp_rendezvous_cpus(Mask, NULL, rtmpOnSpecificFreeBSDWrapper, smp_no_rendevous_barrier, &Args);
|
||||
#else
|
||||
smp_rendezvous(NULL, rtmpOnSpecificFreeBSDWrapper, NULL, &Args);
|
||||
@@ -242,13 +257,21 @@ static void rtmpFreeBSDPokeCallback(void
|
||||
|
||||
RTDECL(int) RTMpPokeCpu(RTCPUID idCpu)
|
||||
{
|
||||
+#if __FreeBSD_version >= 900000
|
||||
+ cpuset_t Mask;
|
||||
+#else
|
||||
cpumask_t Mask;
|
||||
+#endif
|
||||
|
||||
/* Will panic if no rendezvousing cpus, so make sure the cpu is online. */
|
||||
if (!RTMpIsCpuOnline(idCpu))
|
||||
return VERR_CPU_NOT_FOUND;
|
||||
|
||||
+#if __FreeBSD_version >= 900000
|
||||
+ CPU_SETOF(idCpu, &Mask);
|
||||
+#else
|
||||
Mask = (cpumask_t)1 << idCpu;
|
||||
+#endif
|
||||
smp_rendezvous_cpus(Mask, NULL, rtmpFreeBSDPokeCallback, smp_no_rendevous_barrier, NULL);
|
||||
|
||||
return VINF_SUCCESS;
|
@ -7,7 +7,6 @@ sbin/VBoxService
|
||||
%%X11%%share/autostart/vboxclient.desktop
|
||||
%%X11%%lib/xorg/modules/drivers/vboxvideo_drv.so
|
||||
%%X11%%lib/xorg/modules/input/vboxmouse_drv.so
|
||||
%%HAL%%share/hal/fdi/policy/10osvendor/90-vboxguest.fdi
|
||||
%%X11%%@dirrmtry share/autostart
|
||||
%%X11%%@dirrmtry lib/xorg/modules/drivers
|
||||
%%X11%%@dirrmtry lib/xorg/modules/input
|
||||
|
@ -6,7 +6,7 @@
|
||||
#
|
||||
|
||||
PORTNAME= virtualbox-ose
|
||||
DISTVERSION= 4.0.14
|
||||
DISTVERSION= 4.1.8
|
||||
CATEGORIES= emulators kld
|
||||
MASTER_SITES= http://tmp.chruetertee.ch/ \
|
||||
http://freebsd.unixfreunde.de/sources/ \
|
||||
@ -22,7 +22,7 @@ LICENSE_FILE= ${WRKSRC}/COPYING
|
||||
|
||||
BUILD_DEPENDS= yasm:${PORTSDIR}/devel/yasm \
|
||||
as86:${PORTSDIR}/devel/dev86 \
|
||||
kmk:${PORTSDIR}/devel/kBuild
|
||||
kmk:${PORTSDIR}/devel/kBuild-devel
|
||||
|
||||
UNIQUENAME= ${PORTNAME}${PKGNAMESUFFIX}
|
||||
WRKSRC= ${WRKDIR}/VirtualBox-${PORTVERSION}_OSE
|
||||
@ -37,6 +37,7 @@ 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= DEBUG "Build with debugging symbols" off \
|
||||
@ -72,6 +73,10 @@ IGNORE= requires kernel sources
|
||||
|
||||
.include <bsd.port.pre.mk>
|
||||
|
||||
.if ${OSVERSION} < 800000
|
||||
BROKEN= Does not compile on FreeBSD 7.x
|
||||
.endif
|
||||
|
||||
.if ${OSVERSION} < 800500 && defined(WITH_VIMAGE)
|
||||
IGNORE= newer kernel is required to build with VIMAGE
|
||||
.endif
|
||||
|
@ -1,2 +1,2 @@
|
||||
SHA256 (VirtualBox-4.0.14.tar.bz2) = d7719326ea2f4d492c6642cc3375665a1fcf53015d912292406a574283c02663
|
||||
SIZE (VirtualBox-4.0.14.tar.bz2) = 69959224
|
||||
SHA256 (VirtualBox-4.1.8.tar.bz2) = ef16d6729c9bcc298a33eff636549872dcfe291ac01bfa117cdf7aaf8a4004e0
|
||||
SIZE (VirtualBox-4.1.8.tar.bz2) = 73822230
|
||||
|
@ -1,5 +1,14 @@
|
||||
--- src/VBox/HostDrivers/Support/freebsd/SUPDrv-freebsd.c.orig 2011-11-04 07:19:39.000000000 -0400
|
||||
+++ src/VBox/HostDrivers/Support/freebsd/SUPDrv-freebsd.c 2011-11-29 17:34:56.000000000 -0500
|
||||
- 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 =
|
||||
{
|
||||
@ -11,3 +20,12 @@
|
||||
.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.
|
||||
|
@ -1,64 +1,867 @@
|
||||
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.
|
||||
|
||||
Reviewed by: kib
|
||||
See: http://svnweb.freebsd.org/base?view=revision&revision=224746
|
||||
--- src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c.orig 2011-11-04 07:19:54.000000000 -0400
|
||||
+++ src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c 2011-11-29 18:13:32.000000000 -0500
|
||||
@@ -391,12 +391,18 @@
|
||||
--- src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c.orig 2011-11-04 12:19:54.000000000 +0100
|
||||
+++ src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c 2011-12-13 10:11:09.830245443 +0100
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
static void rtR0MemObjFreeBSDPhysPageInit(vm_page_t pPage, vm_pindex_t iPage)
|
||||
{
|
||||
+#if __FreeBSD_version <= 1000000
|
||||
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);
|
||||
+#endif
|
||||
+#endif
|
||||
/*
|
||||
* 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);
|
||||
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))
|
||||
{
|
||||
- vm_page_t pPage = pMemFreeBSD->u.Phys.apPages[iPage];
|
||||
vm_page_unwire(pPage, 0);
|
||||
- vm_page_free(pPage);
|
||||
}
|
||||
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,163 @@
|
||||
}
|
||||
|
||||
|
||||
@@ -408,6 +414,9 @@
|
||||
int rc = VINF_SUCCESS;
|
||||
uint32_t cPages = cb >> PAGE_SHIFT;
|
||||
vm_paddr_t VmPhysAddrHigh;
|
||||
+#if __FreeBSD_version >= 1000001
|
||||
+ int pFlags = VM_ALLOC_INTERRUPT | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED;
|
||||
-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;
|
||||
+#if __FreeBSD_version > 1000000
|
||||
+ int flags = VM_ALLOC_INTERRUPT | VM_ALLOC_NOBUSY;
|
||||
+ if (fWire)
|
||||
+ flags |= VM_ALLOC_WIRED;
|
||||
+ VM_OBJECT_LOCK(pObject);
|
||||
+ pPages = vm_page_alloc_contig(pObject, iPIndex, flags, cPages, 0, VmPhysAddrHigh, uAlignment, 0, VM_MEMATTR_DEFAULT);
|
||||
+ VM_OBJECT_UNLOCK(pObject);
|
||||
+ return pPages;
|
||||
+#else
|
||||
+ pPages = vm_phys_alloc_contig(cPages, 0, VmPhysAddrHigh, uAlignment, 0);
|
||||
+ 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)
|
||||
+ {
|
||||
+ pPage->wire_count = 1;
|
||||
+ atomic_add_int(&cnt.v_wire_count, 1);
|
||||
+ }
|
||||
+ }
|
||||
+ VM_OBJECT_UNLOCK(pObject);
|
||||
+ return pPages;
|
||||
+#endif
|
||||
+}
|
||||
|
||||
- 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)
|
||||
+static int FreeBSDPhysAllocHelper(vm_object_t pObject, u_long cPages,
|
||||
+ vm_paddr_t VmPhysAddrHigh, u_long uAlignment,
|
||||
+ bool fContiguous, bool fWire)
|
||||
+{
|
||||
+ if (fContiguous)
|
||||
{
|
||||
- rc = VINF_SUCCESS;
|
||||
+ if (FreeBSDContigPhysAllocHelper(pObject, 0, cPages, VmPhysAddrHigh, uAlignment, fWire) != NULL)
|
||||
+ return VINF_SUCCESS;
|
||||
+ else
|
||||
+ return VERR_NO_MEMORY;
|
||||
+ }
|
||||
|
||||
- for (size_t iPage = 0; iPage < cPages; iPage++)
|
||||
+ for (vm_pindex_t iPage = 0; iPage < cPages; iPage++)
|
||||
+ {
|
||||
+ vm_page_t pPage = FreeBSDContigPhysAllocHelper(pObject, iPage, 1, VmPhysAddrHigh, uAlignment, fWire);
|
||||
+ if (!pPage)
|
||||
{
|
||||
- vm_page_t pPage;
|
||||
-
|
||||
- pPage = vm_page_alloc(NULL, iPage,
|
||||
- VM_ALLOC_SYSTEM |
|
||||
- VM_ALLOC_WIRED | VM_ALLOC_NOOBJ);
|
||||
-
|
||||
- if (!pPage)
|
||||
+ /* Free all allocated pages */
|
||||
+ VM_OBJECT_LOCK(pObject);
|
||||
+ 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)
|
||||
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;
|
||||
|
||||
- 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;
|
||||
}
|
||||
+
|
||||
+ vm_map_remove(kernel_map, MapAddress, MapAddress + pMemFreeBSD->Core.cb);
|
||||
}
|
||||
rc = VERR_NO_MEMORY; /** @todo fix translation (borrow from darwin) */
|
||||
|
||||
+ vm_object_deallocate(pMemFreeBSD->pObject);
|
||||
rtR0MemObjDelete(&pMemFreeBSD->Core);
|
||||
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, 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, 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 +354,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]),
|
||||
@@ -424,7 +433,11 @@
|
||||
- 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;
|
||||
|
||||
if (fContiguous)
|
||||
- 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 __FreeBSD_version >= 1000001
|
||||
+ vm_page_t pPage = vm_page_alloc_contig(NULL, 0, pFlags, cPages, 0, VmPhysAddrHigh, uAlignment, 0, VM_MEMATTR_DEFAULT);
|
||||
+#else
|
||||
vm_page_t pPage = vm_phys_alloc_contig(cPages, 0, VmPhysAddrHigh, uAlignment, 0);
|
||||
+#endif
|
||||
|
||||
if (pPage)
|
||||
for (uint32_t iPage = 0; iPage < cPages; iPage++)
|
||||
@@ -440,7 +453,11 @@
|
||||
/* Allocate page by page */
|
||||
for (uint32_t iPage = 0; iPage < cPages; iPage++)
|
||||
- if (enmType == RTR0MEMOBJTYPE_PHYS)
|
||||
+ if (fContiguous)
|
||||
{
|
||||
+#if __FreeBSD_version >= 1000001
|
||||
+ vm_page_t pPage = vm_page_alloc_contig(NULL, iPage, pFlags, 1, 0, VmPhysAddrHigh, uAlignment, 0, VM_MEMATTR_DEFAULT);
|
||||
+#else
|
||||
vm_page_t pPage = vm_phys_alloc_contig(1, 0, VmPhysAddrHigh, uAlignment, 0);
|
||||
+#endif
|
||||
- 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;
|
||||
}
|
||||
|
||||
if (!pPage)
|
||||
@@ -480,42 +396,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 +512,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 +569,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 +578,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 +660,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 +707,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 +759,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);
|
||||
}
|
||||
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;
|
||||
|
@ -1,79 +0,0 @@
|
||||
--- src/VBox/Runtime/r0drv/freebsd/mp-r0drv-freebsd.c.orig 2011-05-16 12:33:52.000000000 -0400
|
||||
+++ src/VBox/Runtime/r0drv/freebsd/mp-r0drv-freebsd.c 2011-06-24 13:57:31.000000000 -0400
|
||||
@@ -163,17 +163,26 @@ RTDECL(int) RTMpOnOthers(PFNRTMPWORKER p
|
||||
/* Will panic if no rendezvousing cpus, so check up front. */
|
||||
if (RTMpGetOnlineCount() > 1)
|
||||
{
|
||||
-#if __FreeBSD_version >= 700000
|
||||
- cpumask_t Mask = ~(cpumask_t)curcpu;
|
||||
+#if __FreeBSD_version >= 900000
|
||||
+ cpuset_t Mask;
|
||||
+#elif __FreeBSD_version >= 700000
|
||||
+ cpumask_t Mask;
|
||||
#endif
|
||||
+ RTCPUID idCpu = curcpu;
|
||||
RTMPARGS Args;
|
||||
|
||||
Args.pfnWorker = pfnWorker;
|
||||
Args.pvUser1 = pvUser1;
|
||||
Args.pvUser2 = pvUser2;
|
||||
- Args.idCpu = RTMpCpuId();
|
||||
+ Args.idCpu = idCpu;
|
||||
Args.cHits = 0;
|
||||
#if __FreeBSD_version >= 700000
|
||||
+ Mask = all_cpus;
|
||||
+#if __FreeBSD_version >= 900000
|
||||
+ CPU_CLR(idCpu, &Mask);
|
||||
+#else
|
||||
+ Mask &= ~((cpumask_t)1 << idCpu);
|
||||
+#endif
|
||||
smp_rendezvous_cpus(Mask, NULL, rtmpOnOthersFreeBSDWrapper, smp_no_rendevous_barrier, &Args);
|
||||
#else
|
||||
smp_rendezvous(NULL, rtmpOnOthersFreeBSDWrapper, NULL, &Args);
|
||||
@@ -203,8 +212,10 @@ static void rtmpOnSpecificFreeBSDWrapper
|
||||
|
||||
RTDECL(int) RTMpOnSpecific(RTCPUID idCpu, PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
|
||||
{
|
||||
-#if __FreeBSD_version >= 700000
|
||||
- cpumask_t Mask = 1 << idCpu;
|
||||
+#if __FreeBSD_version >= 900000
|
||||
+ cpuset_t Mask;
|
||||
+#elif __FreeBSD_version >= 700000
|
||||
+ cpumask_t Mask;
|
||||
#endif
|
||||
RTMPARGS Args;
|
||||
|
||||
@@ -218,7 +229,11 @@ RTDECL(int) RTMpOnSpecific(RTCPUID idCpu
|
||||
Args.idCpu = idCpu;
|
||||
Args.cHits = 0;
|
||||
#if __FreeBSD_version >= 700000
|
||||
+#if __FreeBSD_version >= 900000
|
||||
+ CPU_SETOF(idCpu, &Mask);
|
||||
+#else
|
||||
Mask = (cpumask_t)1 << idCpu;
|
||||
+#endif
|
||||
smp_rendezvous_cpus(Mask, NULL, rtmpOnSpecificFreeBSDWrapper, smp_no_rendevous_barrier, &Args);
|
||||
#else
|
||||
smp_rendezvous(NULL, rtmpOnSpecificFreeBSDWrapper, NULL, &Args);
|
||||
@@ -242,13 +257,21 @@ static void rtmpFreeBSDPokeCallback(void
|
||||
|
||||
RTDECL(int) RTMpPokeCpu(RTCPUID idCpu)
|
||||
{
|
||||
+#if __FreeBSD_version >= 900000
|
||||
+ cpuset_t Mask;
|
||||
+#else
|
||||
cpumask_t Mask;
|
||||
+#endif
|
||||
|
||||
/* Will panic if no rendezvousing cpus, so make sure the cpu is online. */
|
||||
if (!RTMpIsCpuOnline(idCpu))
|
||||
return VERR_CPU_NOT_FOUND;
|
||||
|
||||
+#if __FreeBSD_version >= 900000
|
||||
+ CPU_SETOF(idCpu, &Mask);
|
||||
+#else
|
||||
Mask = (cpumask_t)1 << idCpu;
|
||||
+#endif
|
||||
smp_rendezvous_cpus(Mask, NULL, rtmpFreeBSDPokeCallback, smp_no_rendevous_barrier, NULL);
|
||||
|
||||
return VINF_SUCCESS;
|
@ -0,0 +1,15 @@
|
||||
- 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;
|
@ -6,8 +6,7 @@
|
||||
#
|
||||
|
||||
PORTNAME= virtualbox-ose
|
||||
DISTVERSION= 4.0.14
|
||||
PORTREVISION= 1
|
||||
DISTVERSION= 4.1.8
|
||||
CATEGORIES= emulators
|
||||
MASTER_SITES= http://tmp.chruetertee.ch/ \
|
||||
http://freebsd.unixfreunde.de/sources/ \
|
||||
@ -23,7 +22,8 @@ COMMENT= A general-purpose full virtualizer for x86 hardware
|
||||
BUILD_DEPENDS= yasm:${PORTSDIR}/devel/yasm \
|
||||
as86:${PORTSDIR}/devel/dev86 \
|
||||
xsltproc:${PORTSDIR}/textproc/libxslt \
|
||||
kmk:${PORTSDIR}/devel/kBuild
|
||||
kmk:${PORTSDIR}/devel/kBuild-devel \
|
||||
gtar:${PORTSDIR}/archivers/gtar
|
||||
LIB_DEPENDS= png.6:${PORTSDIR}/graphics/png \
|
||||
xslt.2:${PORTSDIR}/textproc/libxslt \
|
||||
curl.6:${PORTSDIR}/ftp/curl
|
||||
@ -48,6 +48,7 @@ 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
|
||||
@ -64,6 +65,7 @@ OPTIONS= QT4 "Build with QT4 Frontend" on \
|
||||
DBUS "Build with D-Bus and HAL support" on \
|
||||
PULSEAUDIO "Build with PulseAudio" off \
|
||||
X11 "Build with X11 support" on \
|
||||
UDPTUNNEL "Build with UDP tunnel support" on \
|
||||
VDE "Build with VDE support" off \
|
||||
VNC "Build with VNC support" off \
|
||||
WEBSERVICE "Build Webservice" off \
|
||||
@ -175,17 +177,21 @@ PLIST_SUB+= I386="@comment "
|
||||
|
||||
.include <bsd.port.pre.mk>
|
||||
|
||||
.if ${OSVERSION} < 800000
|
||||
BROKEN= Does not compile on FreeBSD 7.x
|
||||
.endif
|
||||
|
||||
.if ${OSVERSION} > 900012
|
||||
EXTRA_PATCHES+= ${FILESDIR}/extrapatch-include-iprt-string.h
|
||||
.endif
|
||||
|
||||
.if ${OSVERSION} > 900020 || ${OSVERSION} < 900000 && ${OSVERSION} > 801500
|
||||
.if ${OSVERSION} < 900000 && ${OSVERSION} > 801500
|
||||
EXTRA_PATCHES+= ${FILESDIR}/extrapatch-src-VBox-Devices-PC-vbox.dsl
|
||||
.endif
|
||||
|
||||
pre-everything::
|
||||
.if ${ARCH} == "amd64"
|
||||
.if !exists(/usr/lib32)
|
||||
.if !exists(/usr/lib32/libc.so)
|
||||
@${ECHO} 'Requires 32-bit libraries installed under /usr/lib32.'
|
||||
@${ECHO} 'Do: cd /usr/src; make build32 install32; /etc/rc.d/ldconfig restart'
|
||||
@${FALSE}
|
||||
@ -214,6 +220,9 @@ post-patch:
|
||||
.if ${OSVERSION} < 800069
|
||||
@${ECHO} 'VBOX_WITH_USB=' >> ${WRKSRC}/LocalConfig.kmk
|
||||
.endif
|
||||
.if defined(WITH_UDPTUNNEL)
|
||||
@${ECHO} 'VBOX_WITH_UDPTUNNEL = 1' >> ${WRKSRC}/LocalConfig.kmk
|
||||
.endif
|
||||
.if defined(WITH_WEBSERVICE)
|
||||
@${ECHO} 'VBOX_WITH_WEBSERVICES = 1' >> ${WRKSRC}/LocalConfig.kmk
|
||||
@${ECHO} 'VBOX_GSOAP_INSTALLED = 1' >> ${WRKSRC}/LocalConfig.kmk
|
||||
@ -252,7 +261,7 @@ do-install:
|
||||
.endif
|
||||
|
||||
${MKDIR} ${PREFIX}/bin
|
||||
.for f in VBoxManage VBoxNetAdpCtl VBoxNetDHCP VBoxSVC VBoxXPCOMIPCD ${VBOX_FRONTENDS} ${VBOX_WEB}
|
||||
.for f in VBoxManage VBoxNetAdpCtl VBoxNetDHCP VBoxSVC VBoxXPCOMIPCD VBoxBalloonCtrl ${VBOX_FRONTENDS} ${VBOX_WEB}
|
||||
${INSTALL_PROGRAM} ${WRKSRC}/out/${KMK_ARCH}/${KMK_BUILDTYPE}/bin/${f} ${PREFIX}/lib/virtualbox/
|
||||
${LN} -sf ${PREFIX}/lib/virtualbox/${f} ${PREFIX}/bin/
|
||||
.endfor
|
||||
@ -261,7 +270,7 @@ do-install:
|
||||
${CHMOD} 4511 ${PREFIX}/lib/virtualbox/${f}
|
||||
.endfor
|
||||
|
||||
.for f in VBoxManage VBoxSVC VBoxXPCOMIPCD VBoxExtPackHelperApp
|
||||
.for f in VBoxManage VBoxSVC VBoxXPCOMIPCD VBoxExtPackHelperApp VBoxBalloonCtrl
|
||||
${CHMOD} 0711 ${PREFIX}/lib/virtualbox/${f}
|
||||
.endfor
|
||||
|
||||
@ -286,7 +295,7 @@ do-install:
|
||||
${PYTHON_CMD} -mcompileall ${PYTHON_SITELIBDIR}/xpcom/
|
||||
|
||||
post-install:
|
||||
.for f in VBoxManage VBoxNetDHCP VBoxSVC VBoxXPCOMIPCD VBoxExtPackHelperApp ${VBOX_FRONTENDS}
|
||||
.for f in VBoxManage VBoxNetDHCP VBoxSVC VBoxXPCOMIPCD VBoxExtPackHelperApp VBoxBalloonCtrl ${VBOX_FRONTENDS}
|
||||
${CHOWN} root:${VBOXGROUP} ${PREFIX}/lib/virtualbox/${f}
|
||||
.endfor
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
SHA256 (VirtualBox-4.0.14.tar.bz2) = d7719326ea2f4d492c6642cc3375665a1fcf53015d912292406a574283c02663
|
||||
SIZE (VirtualBox-4.0.14.tar.bz2) = 69959224
|
||||
SHA256 (VBoxGuestAdditions_4.0.14.iso) = 74db91001a62c3933ea47532d0dc297092f4ad97285f3dd34e1e29fbc1bb3a17
|
||||
SIZE (VBoxGuestAdditions_4.0.14.iso) = 40962048
|
||||
SHA256 (VirtualBox-4.1.8.tar.bz2) = ef16d6729c9bcc298a33eff636549872dcfe291ac01bfa117cdf7aaf8a4004e0
|
||||
SIZE (VirtualBox-4.1.8.tar.bz2) = 73822230
|
||||
SHA256 (VBoxGuestAdditions_4.1.8.iso) = 2265aa350de2d62021e91ae6bbd1438c291a74494778bb443926e9b7b962c63d
|
||||
SIZE (VBoxGuestAdditions_4.1.8.iso) = 45471744
|
||||
|
@ -1,15 +1,6 @@
|
||||
--- configure.orig 2009-12-17 15:23:05.000000000 +0100
|
||||
+++ configure 2009-12-21 14:25:45.000000000 +0100
|
||||
@@ -107,7 +107,7 @@
|
||||
GENISOIMAGE="genisoimage"
|
||||
MKISOFS="mkisofs"
|
||||
INCCRYPTO=""
|
||||
-LIBCRYPTO="-lcrypto"
|
||||
+LIBCRYPTO="-lcrypto -lssl"
|
||||
LIBPTHREAD="-lpthread"
|
||||
LIBCAP="-lcap"
|
||||
GSOAP=""
|
||||
@@ -1773,7 +1775,7 @@
|
||||
--- configure.orig 2011-05-30 17:11:26.000000000 +0200
|
||||
+++ configure 2011-06-06 10:01:12.000000000 +0200
|
||||
@@ -1920,7 +1920,7 @@
|
||||
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
|
||||
|
@ -1,13 +0,0 @@
|
||||
--- src/VBox/Devices/Makefile.kmk.orig 2010-12-06 22:42:36.000000000 +0100
|
||||
+++ src/VBox/Devices/Makefile.kmk 2010-12-06 22:42:59.000000000 +0100
|
||||
@@ -22,7 +22,9 @@
|
||||
VBOX_PATH_DEVICES_SRC := $(PATH_SUB_CURRENT)
|
||||
|
||||
# Include sub-makefiles.
|
||||
-include $(PATH_SUB_CURRENT)/testcase/Makefile.kmk
|
||||
+ifdef VBOX_WITH_TESTCASES
|
||||
+ include $(PATH_SUB_CURRENT)/testcase/Makefile.kmk
|
||||
+endif
|
||||
if defined(VBOX_WITH_INTEL_PXE) || defined(VBOX_ONLY_EXTPACKS)
|
||||
include $(PATH_SUB_CURRENT)/PC/PXE/Makefile.kmk
|
||||
else ifndef VBOX_WITHOUT_ETHERBOOT
|
@ -0,0 +1,20 @@
|
||||
--- src/VBox/Devices/PC/vbox.dsl.orig 2011-04-28 10:00:53.000000000 +0200
|
||||
+++ src/VBox/Devices/PC/vbox.dsl 2011-07-25 19:36:06.000000000 +0200
|
||||
@@ -1161,7 +1161,7 @@
|
||||
// (all of low memory space)
|
||||
ResourceProducer, // bit 0 of general flags is 0
|
||||
PosDecode, // positive Decode
|
||||
- MinNotFixed, // Range is not fixed
|
||||
+ MinFixed, // Range is not fixed
|
||||
MaxFixed, // Range is fixed
|
||||
Cacheable,
|
||||
ReadWrite,
|
||||
@@ -1170,7 +1170,7 @@
|
||||
|
||||
0xffdfffff, // Max = 4GB - 2MB
|
||||
0x00000000, // Translation
|
||||
- 0x00000000, // Range Length (calculated
|
||||
+ 0xffe00000, // Range Length (calculated
|
||||
// dynamically)
|
||||
, // Optional field left blank
|
||||
, // Optional field left blank
|
@ -0,0 +1,25 @@
|
||||
- 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;
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
--- src/VBox/Main/src-server/freebsd/HostHardwareFreeBSD.cpp.orig 2011-05-16 12:33:46.000000000 -0400
|
||||
+++ src/VBox/Main/src-server/freebsd/HostHardwareFreeBSD.cpp 2011-06-24 16:03:37.000000000 -0400
|
||||
@@ -35,6 +35,7 @@
|
||||
#include <iprt/string.h>
|
||||
|
||||
#ifdef RT_OS_FREEBSD
|
||||
+# include <sys/param.h>
|
||||
# include <sys/types.h>
|
||||
# include <sys/stat.h>
|
||||
# include <unistd.h>
|
||||
@@ -186,11 +187,17 @@ static int getDVDInfoFromCAM(DriveInfoLi
|
||||
DeviceMatchPattern.pattern.device_pattern.target_id = CAM_TARGET_WILDCARD;
|
||||
DeviceMatchPattern.pattern.device_pattern.target_lun = CAM_LUN_WILDCARD;
|
||||
DeviceMatchPattern.pattern.device_pattern.flags = DEV_MATCH_INQUIRY;
|
||||
- DeviceMatchPattern.pattern.device_pattern.inq_pat.type = T_CDROM;
|
||||
- DeviceMatchPattern.pattern.device_pattern.inq_pat.media_type = SIP_MEDIA_REMOVABLE | SIP_MEDIA_FIXED;
|
||||
- DeviceMatchPattern.pattern.device_pattern.inq_pat.vendor[0] = '*'; /* Matches anything */
|
||||
- DeviceMatchPattern.pattern.device_pattern.inq_pat.product[0] = '*'; /* Matches anything */
|
||||
- DeviceMatchPattern.pattern.device_pattern.inq_pat.revision[0] = '*'; /* Matches anything */
|
||||
+#if __FreeBSD_version >= 900000
|
||||
+#define INQ_PAT data.inq_pat
|
||||
+#else
|
||||
+#define INQ_PAT inq_pat
|
||||
+#endif
|
||||
+ DeviceMatchPattern.pattern.device_pattern.INQ_PAT.type = T_CDROM;
|
||||
+ DeviceMatchPattern.pattern.device_pattern.INQ_PAT.media_type = SIP_MEDIA_REMOVABLE | SIP_MEDIA_FIXED;
|
||||
+ DeviceMatchPattern.pattern.device_pattern.INQ_PAT.vendor[0] = '*'; /* Matches anything */
|
||||
+ DeviceMatchPattern.pattern.device_pattern.INQ_PAT.product[0] = '*'; /* Matches anything */
|
||||
+ DeviceMatchPattern.pattern.device_pattern.INQ_PAT.revision[0] = '*'; /* Matches anything */
|
||||
+#undef INQ_PAT
|
||||
DeviceCCB.cdm.num_patterns = 1;
|
||||
DeviceCCB.cdm.pattern_buf_len = sizeof(struct dev_match_result);
|
||||
DeviceCCB.cdm.patterns = &DeviceMatchPattern;
|
@ -1,16 +0,0 @@
|
||||
Runtime/fileaio-freebsd: Fix error check for aio_error
|
||||
|
||||
Obtained-from: https://www.virtualbox.org/changeset/38332
|
||||
|
||||
--- src/VBox/Runtime/r3/freebsd/fileaio-freebsd.cpp.orig 2011-07-15 17:34:34.000000000 +0200
|
||||
+++ src/VBox/Runtime/r3/freebsd/fileaio-freebsd.cpp 2011-11-21 09:33:26.155092865 +0100
|
||||
@@ -416,7 +416,8 @@
|
||||
{
|
||||
pReqInt = pahReqs[i];
|
||||
rcBSD = aio_error(&pReqInt->AioCB);
|
||||
- if (rcBSD == EINVAL || rcBSD == EAGAIN)
|
||||
+ if ( rcBSD == -1
|
||||
+ && errno == EINVAL)
|
||||
{
|
||||
/* Was not submitted. */
|
||||
RTFILEAIOREQ_SET_STATE(pReqInt, PREPARED);
|
@ -1,12 +0,0 @@
|
||||
--- src/VBox/VMM/VMMR3/CPUM.cpp (Revision 71439)
|
||||
+++ src/VBox/VMM/VMMR3/CPUM.cpp (Revision 71440)
|
||||
@@ -999,7 +999,8 @@
|
||||
*/
|
||||
if (!fHWVirtExEnabled)
|
||||
{
|
||||
- Assert(pVM->cpum.s.aGuestCpuIdStd[4].eax == 0);
|
||||
+ Assert( pVM->cpum.s.aGuestCpuIdStd[4].eax == 0
|
||||
+ || pVM->cpum.s.aGuestCpuIdStd[0].eax < 0x4);
|
||||
pVM->cpum.s.aGuestCpuIdStd[4].eax = 0;
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
--- src/recompiler/Sun/testmath.c.orig 2011-01-14 21:15:07.000000000 +0100
|
||||
+++ src/recompiler/Sun/testmath.c 2011-08-05 13:54:49.000000000 +0200
|
||||
@@ -261,8 +261,6 @@
|
||||
#endif
|
||||
set_cw(0x27f);
|
||||
|
||||
- CHECK(logl(2.7182818284590452353602874713526625L), 1.0);
|
||||
-
|
||||
CHECK(remainderl(1.0L, 1.0L), 0.0);
|
||||
CHECK(remainderl(1.0L, 1.5L), -0.5);
|
||||
CHECK(remainderl(42.0L, 34.25L), 7.75);
|
||||
@@ -315,10 +313,6 @@
|
||||
CHECK(tanl(0.0L), 0.0);
|
||||
CHECK(tanl(0.7853981633974483096156608458198757L), 1.0);
|
||||
|
||||
- CHECK(powl(0.0, 0.0), 1.0);
|
||||
- CHECK(powl(2.0, 2.0), 4.0);
|
||||
- CHECK(powl(3.0, 3.0), 27.0);
|
||||
-
|
||||
return cErrors;
|
||||
}
|
||||
|
@ -1,11 +0,0 @@
|
||||
--- src/recompiler/target-i386/cpu.h.orig 2010-07-15 20:13:56.000000000 +0200
|
||||
+++ src/recompiler/target-i386/cpu.h 2010-11-01 12:23:16.000000000 +0100
|
||||
@@ -678,7 +678,7 @@
|
||||
user */
|
||||
struct APICState *apic_state;
|
||||
#else
|
||||
- uint32_t alignment2[3];
|
||||
+ uint32_t alignment2[2];
|
||||
/** Profiling tb_flush. */
|
||||
STAMPROFILE StatTbFlush;
|
||||
#endif
|
@ -1,3 +1,4 @@
|
||||
bin/VBoxBalloonCtrl
|
||||
%%X11%%bin/VBoxBFE
|
||||
bin/VBoxHeadless
|
||||
bin/VBoxManage
|
||||
@ -15,6 +16,7 @@ bin/VBoxXPCOMIPCD
|
||||
lib/virtualbox/DBGCPlugInDiggers.so
|
||||
lib/virtualbox/VBoxAuth.so
|
||||
lib/virtualbox/VBoxAuthSimple.so
|
||||
lib/virtualbox/VBoxBalloonCtrl
|
||||
%%QT4%%lib/virtualbox/VBoxDbg.so
|
||||
lib/virtualbox/VBoxDD.so
|
||||
lib/virtualbox/VBoxDD2.so
|
||||
|
Loading…
Reference in New Issue
Block a user