diff options
author | Bernhard Froehlich <decke@FreeBSD.org> | 2013-05-13 09:59:01 +0000 |
---|---|---|
committer | Bernhard Froehlich <decke@FreeBSD.org> | 2013-05-13 09:59:01 +0000 |
commit | 598d8aac1ee21b3bae1075e2193680dfe7abb002 (patch) | |
tree | 9e1b6c64ea20504ff36482a1073a6994576d0dea /emulators/virtualbox-ose-kmod-legacy | |
parent | e0378e173e4f2ac9fcc1807e3c87a403b1576cf2 (diff) | |
download | freebsd-ports-598d8aac1ee21b3bae1075e2193680dfe7abb002.zip |
- Add VM_OBJECT patch from virtualbox-ose-kmod to use WLOCK/WUNLOCK
on 10-CURRENT.
Submitted by: Gabor Pali <pgj@freebsd.org>
Diffstat (limited to 'emulators/virtualbox-ose-kmod-legacy')
2 files changed, 147 insertions, 0 deletions
diff --git a/emulators/virtualbox-ose-kmod-legacy/files/patch-src-VBox-Runtime-r0drv-freebsd-memobj-r0drv-freebsd_VM_OBJECT_RENAME.c b/emulators/virtualbox-ose-kmod-legacy/files/patch-src-VBox-Runtime-r0drv-freebsd-memobj-r0drv-freebsd_VM_OBJECT_RENAME.c new file mode 100644 index 000000000000..e4118df03498 --- /dev/null +++ b/emulators/virtualbox-ose-kmod-legacy/files/patch-src-VBox-Runtime-r0drv-freebsd-memobj-r0drv-freebsd_VM_OBJECT_RENAME.c @@ -0,0 +1,135 @@ +--- src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c.orig 2013-05-10 15:16:34.000000000 +0200 ++++ src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c 2013-05-10 12:43:20.000000000 +0200 +@@ -165,7 +165,11 @@ + case RTR0MEMOBJTYPE_PHYS: + case RTR0MEMOBJTYPE_PHYS_NC: + { ++#if __FreeBSD_version >= 1000030 ++ VM_OBJECT_WLOCK(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,8 +181,14 @@ + { + vm_page_unwire(pPage, 0); + } ++#if __FreeBSD_version < 900000 + vm_page_unlock_queues(); ++#endif ++#if __FreeBSD_version >= 1000030 ++ VM_OBJECT_WUNLOCK(pMemFreeBSD->pObject); ++#else + VM_OBJECT_UNLOCK(pMemFreeBSD->pObject); ++#endif + vm_object_deallocate(pMemFreeBSD->pObject); + break; + } +@@ -205,9 +215,17 @@ + flags |= VM_ALLOC_WIRED; + while (1) + { ++#if __FreeBSD_version >= 1000030 ++ VM_OBJECT_WLOCK(pObject); ++#else + VM_OBJECT_LOCK(pObject); ++#endif + pPages = vm_page_alloc_contig(pObject, iPIndex, flags, cPages, 0, VmPhysAddrHigh, uAlignment, 0, VM_MEMATTR_DEFAULT); ++#if __FreeBSD_version >= 1000030 ++ VM_OBJECT_WUNLOCK(pObject); ++#else + VM_OBJECT_UNLOCK(pObject); ++#endif + if (pPages || tries >= 1) + break; + vm_pageout_grow_cache(tries, 0, VmPhysAddrHigh); +@@ -226,7 +244,11 @@ + } + if (!pPages) + return pPages; ++#if __FreeBSD_version >= 1000030 ++ VM_OBJECT_WLOCK(pObject); ++#else + VM_OBJECT_LOCK(pObject); ++#endif + for (vm_pindex_t iPage = 0; iPage < cPages; iPage++) + { + vm_page_t pPage = pPages + iPage; +@@ -238,7 +260,11 @@ + atomic_add_int(&cnt.v_wire_count, 1); + } + } ++#if __FreeBSD_version >= 1000030 ++ VM_OBJECT_WUNLOCK(pObject); ++#else + VM_OBJECT_UNLOCK(pObject); ++#endif + return pPages; + #endif + } +@@ -261,7 +287,11 @@ + if (!pPage) + { + /* Free all allocated pages */ ++#if __FreeBSD_version >= 1000030 ++ VM_OBJECT_WLOCK(pObject); ++#else + VM_OBJECT_LOCK(pObject); ++#endif + while (iPage-- > 0) + { + pPage = vm_page_lookup(pObject, iPage); +@@ -271,9 +301,15 @@ + if (fWire) + vm_page_unwire(pPage, 0); + vm_page_free(pPage); ++#if __FreeBSD_version < 900000 + vm_page_unlock_queues(); ++#endif + } ++#if __FreeBSD_version >= 1000030 ++ VM_OBJECT_WUNLOCK(pObject); ++#else + VM_OBJECT_UNLOCK(pObject); ++#endif + return VERR_NO_MEMORY; + } + } +@@ -406,9 +442,17 @@ + if (fContiguous) + { + Assert(enmType == RTR0MEMOBJTYPE_PHYS); ++#if __FreeBSD_version >= 1000030 ++ VM_OBJECT_WLOCK(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)); ++#if __FreeBSD_version >= 1000030 ++ VM_OBJECT_WUNLOCK(pMemFreeBSD->pObject); ++#else + VM_OBJECT_UNLOCK(pMemFreeBSD->pObject); ++#endif + pMemFreeBSD->Core.u.Phys.fAllocated = true; + } + +@@ -813,9 +857,17 @@ + case RTR0MEMOBJTYPE_PHYS_NC: + { + RTHCPHYS addr; ++#if __FreeBSD_version >= 1000030 ++ VM_OBJECT_WLOCK(pMemFreeBSD->pObject); ++#else + VM_OBJECT_LOCK(pMemFreeBSD->pObject); ++#endif + addr = VM_PAGE_TO_PHYS(vm_page_lookup(pMemFreeBSD->pObject, iPage)); ++#if __FreeBSD_version >= 1000030 ++ VM_OBJECT_WUNLOCK(pMemFreeBSD->pObject); ++#else + VM_OBJECT_UNLOCK(pMemFreeBSD->pObject); ++#endif + return addr; + } + diff --git a/emulators/virtualbox-ose-kmod-legacy/files/patch-src-VBox-Runtime-r0drv-freebsd-the-freebsd-kernel.h b/emulators/virtualbox-ose-kmod-legacy/files/patch-src-VBox-Runtime-r0drv-freebsd-the-freebsd-kernel.h new file mode 100644 index 000000000000..a60b817cb21f --- /dev/null +++ b/emulators/virtualbox-ose-kmod-legacy/files/patch-src-VBox-Runtime-r0drv-freebsd-the-freebsd-kernel.h @@ -0,0 +1,12 @@ +--- src/VBox/Runtime/r0drv/freebsd/the-freebsd-kernel.h.orig 2012-12-19 20:51:59.000000000 +0100 ++++ src/VBox/Runtime/r0drv/freebsd/the-freebsd-kernel.h 2013-05-10 12:40:19.000000000 +0200 +@@ -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> |