1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-25 00:51:21 +00:00

Add wrapper FreeBSD_Version check at the break point for VM_OBJECT_RLOCK

name change so we still build on stable branches.

Suggested by: bdrewery
This commit is contained in:
Sean Bruno 2013-03-21 02:29:17 +00:00
parent 10dc43b694
commit 4f0bd6fb09
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=314796
3 changed files with 66 additions and 27 deletions

View File

@ -3,7 +3,7 @@
PORTNAME= virtualbox-ose
DISTVERSION= 4.2.6
PORTREVISION= 2
PORTREVISION= 3
CATEGORIES= emulators kld
MASTER_SITES= http://download.virtualbox.org/virtualbox/${DISTVERSION}/ \
http://tmp.chruetertee.ch/ \

View File

@ -1,95 +1,132 @@
$FreeBSD$
--- src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c 2013-03-20 14:45:46.594643103 -0700
+++ src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c 2013-03-20 14:33:00.483697105 -0700
@@ -162,7 +162,7 @@
--- /home/sbruno/ports/virtualbox-ose-kmod/work/VirtualBox-4.2.6/src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c 2013-03-20 19:19:36.795745576 -0700
+++ ../work/VirtualBox-4.2.6/src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c 2013-03-20 19:15:35.164791970 -0700
@@ -162,7 +162,11 @@
case RTR0MEMOBJTYPE_PHYS:
case RTR0MEMOBJTYPE_PHYS_NC:
{
- VM_OBJECT_LOCK(pMemFreeBSD->pObject);
+#if __FreeBSD_version >= 1000030
+ VM_OBJECT_RLOCK(pMemFreeBSD->pObject);
+#else
VM_OBJECT_LOCK(pMemFreeBSD->pObject);
+#endif
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 */
@@ -177,7 +177,7 @@
@@ -177,7 +181,12 @@
#if __FreeBSD_version < 900000
vm_page_unlock_queues();
#endif
- VM_OBJECT_UNLOCK(pMemFreeBSD->pObject);
+#if __FreeBSD_version >= 1000030
+ VM_OBJECT_RUNLOCK(pMemFreeBSD->pObject);
+#else
VM_OBJECT_UNLOCK(pMemFreeBSD->pObject);
+#endif
+
vm_object_deallocate(pMemFreeBSD->pObject);
break;
}
@@ -205,10 +205,10 @@
@@ -205,10 +214,18 @@
while (cTries <= 1)
{
- VM_OBJECT_LOCK(pObject);
+#if __FreeBSD_version >= 1000030
+ VM_OBJECT_RLOCK(pObject);
+#else
VM_OBJECT_LOCK(pObject);
+#endif
pPages = vm_page_alloc_contig(pObject, iPIndex, fFlags, cPages, 0,
VmPhysAddrHigh, uAlignment, 0, VM_MEMATTR_DEFAULT);
- VM_OBJECT_UNLOCK(pObject);
+#if __FreeBSD_version >= 1000030
+ VM_OBJECT_RUNLOCK(pObject);
+#else
VM_OBJECT_UNLOCK(pObject);
+#endif
if (pPages)
break;
vm_pageout_grow_cache(cTries, 0, VmPhysAddrHigh);
@@ -228,7 +228,7 @@
@@ -228,7 +245,11 @@
if (!pPages)
return pPages;
- VM_OBJECT_LOCK(pObject);
+#if __FreeBSD_version >= 1000030
+ VM_OBJECT_RLOCK(pObject);
+#else
VM_OBJECT_LOCK(pObject);
+#endif
for (vm_pindex_t iPage = 0; iPage < cPages; iPage++)
{
vm_page_t pPage = pPages + iPage;
@@ -240,7 +240,7 @@
@@ -240,7 +261,11 @@
atomic_add_int(&cnt.v_wire_count, 1);
}
}
- VM_OBJECT_UNLOCK(pObject);
+#if __FreeBSD_version >= 1000030
+ VM_OBJECT_RUNLOCK(pObject);
+#else
VM_OBJECT_UNLOCK(pObject);
+#endif
return pPages;
#endif
}
@@ -264,7 +264,7 @@
@@ -264,7 +289,11 @@
if (!pPage)
{
/* Free all allocated pages */
- VM_OBJECT_LOCK(pObject);
+#if __FreeBSD_version >= 1000030
+ VM_OBJECT_RLOCK(pObject);
+#else
VM_OBJECT_LOCK(pObject);
+#endif
while (iPage-- > 0)
{
pPage = vm_page_lookup(pObject, iPage);
@@ -278,7 +278,7 @@
@@ -278,7 +307,11 @@
vm_page_unlock_queues();
#endif
}
- VM_OBJECT_UNLOCK(pObject);
+#if __FreeBSD_version >= 1000030
+ VM_OBJECT_RUNLOCK(pObject);
+#else
VM_OBJECT_UNLOCK(pObject);
+#endif
return rcNoMem;
}
}
@@ -411,9 +411,9 @@
@@ -411,9 +444,17 @@
if (fContiguous)
{
Assert(enmType == RTR0MEMOBJTYPE_PHYS);
- VM_OBJECT_LOCK(pMemFreeBSD->pObject);
+#if __FreeBSD_version >= 1000030
+ VM_OBJECT_RLOCK(pMemFreeBSD->pObject);
+#else
VM_OBJECT_LOCK(pMemFreeBSD->pObject);
+#endif
pMemFreeBSD->Core.u.Phys.PhysBase = VM_PAGE_TO_PHYS(vm_page_find_least(pMemFreeBSD->pObject, 0));
- VM_OBJECT_UNLOCK(pMemFreeBSD->pObject);
+#if __FreeBSD_version >= 1000030
+ VM_OBJECT_RUNLOCK(pMemFreeBSD->pObject);
+#else
VM_OBJECT_UNLOCK(pMemFreeBSD->pObject);
+#endif
pMemFreeBSD->Core.u.Phys.fAllocated = true;
}
@@ -823,9 +823,9 @@
@@ -823,9 +864,17 @@
case RTR0MEMOBJTYPE_PHYS_NC:
{
RTHCPHYS addr;
- VM_OBJECT_LOCK(pMemFreeBSD->pObject);
+#if __FreeBSD_version >= 1000030
+ VM_OBJECT_RLOCK(pMemFreeBSD->pObject);
+#else
VM_OBJECT_LOCK(pMemFreeBSD->pObject);
+#endif
addr = VM_PAGE_TO_PHYS(vm_page_lookup(pMemFreeBSD->pObject, iPage));
- VM_OBJECT_UNLOCK(pMemFreeBSD->pObject);
+#if __FreeBSD_version >= 1000030
+ VM_OBJECT_RUNLOCK(pMemFreeBSD->pObject);
+#else
VM_OBJECT_UNLOCK(pMemFreeBSD->pObject);
+#endif
return addr;
}

View File

@ -1,12 +1,14 @@
$FreeBSD$
--- src/VBox/Runtime/r0drv/freebsd/the-freebsd-kernel.h 2012-12-19 10:27:29.000000000 -0800
+++ src/VBox/Runtime/r0drv/freebsd/the-freebsd-kernel.h 2013-03-20 14:50:35.330638254 -0700
@@ -50,6 +50,7 @@
--- /home/sbruno/ports/virtualbox-ose-kmod/work/VirtualBox-4.2.6/src/VBox/Runtime/r0drv/freebsd/the-freebsd-kernel.h 2012-12-19 10:27:29.000000000 -0800
+++ ../work/VirtualBox-4.2.6/src/VBox/Runtime/r0drv/freebsd/the-freebsd-kernel.h 2013-03-20 19:10:15.854804053 -0700
@@ -50,6 +50,9 @@
#include <sys/unistd.h>
#include <sys/kthread.h>
#include <sys/lock.h>
+#if __FreeBSD_version >= 1000030
+#include <sys/rwlock.h>
+#endif
#include <sys/mutex.h>
#include <sys/sched.h>
#include <sys/callout.h>