Hi guys, I am sending most of our patches that we collected during the last months and especially during the 4.3 development period. I am sorry that we did not manage to send them right on time before 4.3.0 but I hope we can do better in the future.
All patches are in the FreeBSD specific files so the risk to break any other host support is very low so I would also kindly ask to merge the changes to 4.3 after they were committed to trunk. The patches are from various authors as stated in the files and all are licensed under MIT License. All authors are CC'd for reference. Thanks a lot! -- Bernhard Fröhlich http://www.bluelife.at/
fbsd-HostDnsService.patch
Description: Binary data
- FreeBSD r248084 switched the vm_object mutex to be an rwlock. The changes to adopt that change are mostly mechanical. Patch kmod to include rwlock.h Patch kmod to change VM_OBJECT_LOCK to VM_OBJECT_WLOCK Patch kmod to change VM_OBJECT_UNLOCK to VM_OBJECT_WUNLOCK Submitted by: Sean Bruno <sbr...@freebsd.org> Reviewed by: Konstantin Belousov <k...@freebsd.org> See: http://svnweb.freebsd.org/base?view=revision&revision=248084 --- 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 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> --- src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c 2013-03-20 19:19:36.795745576 -0700 +++ 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: { +#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,7 +181,12 @@ #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,10 +214,18 @@ while (cTries <= 1) { +#if __FreeBSD_version >= 1000030 + VM_OBJECT_WLOCK(pObject); +#else VM_OBJECT_LOCK(pObject); +#endif pPages = vm_page_alloc_contig(pObject, iPIndex, fFlags, cPages, 0, VmPhysAddrHigh, uAlignment, 0, VM_MEMATTR_DEFAULT); +#if __FreeBSD_version >= 1000030 + VM_OBJECT_WUNLOCK(pObject); +#else VM_OBJECT_UNLOCK(pObject); +#endif if (pPages) break; vm_pageout_grow_cache(cTries, 0, VmPhysAddrHigh); @@ -228,7 +245,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; @@ -240,7 +261,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 } @@ -264,7 +289,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); @@ -278,7 +307,11 @@ vm_page_unlock_queues(); #endif } +#if __FreeBSD_version >= 1000030 + VM_OBJECT_WUNLOCK(pObject); +#else VM_OBJECT_UNLOCK(pObject); +#endif return rcNoMem; } } @@ -411,9 +444,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; } @@ -823,9 +864,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; }
fbsd-r3-RTSystemQueryTotalRam.patch
Description: Binary data
- Fix leftover parameter to supdrvSessionRelease() which seems to be a mistake
from vbox-ose r47537
Submitted by: Mikhail Tsatsenko <m.tsatse...@gmail.com>
--- src/VBox/HostDrivers/Support/freebsd/SUPDrv-freebsd.c.orig 2013-08-21 15:57:08.020410605 +0400
+++ src/VBox/HostDrivers/Support/freebsd/SUPDrv-freebsd.c 2013-08-21 15:57:30.806410706 +0400
@@ -291,7 +291,7 @@
/*
* Close the session.
*/
- supdrvSessionRelease(&g_VBoxDrvFreeBSDDevExt, pSession);
+ supdrvSessionRelease(pSession);
ASMAtomicDecU32(&g_cUsers);
}
- Add stub for getDiskByListByFs on FreeBSD to fix compiling
Submitted by: Mikhail Tsatsenko <m.tsatse...@gmail.com>
--- 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 */
- Include stdlib.h for malloc/free
- Fix typo in RTStrCopy
Submitted by: Mikhail Tsatsenko <m.tsatse...@gmail.com>
--- src/VBox/Main/src-server/freebsd/NetIf-freebsd.cpp.orig 2013-11-01 21:58:07.000000000 +0400
+++ src/VBox/Main/src-server/freebsd/NetIf-freebsd.cpp 2013-11-09 01:28:23.201085105 +0400
@@ -43,6 +43,7 @@
#include <net/if_dl.h>
#include <netinet/in.h>
+#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
@@ -388,7 +389,7 @@
pInfo->Uuid = uuid;
struct ifreq IfReq;
- RTSTrCopy(IfReq.ifr_name, sizeof(IfReq.ifr_name), pInfo->szShortName);
+ RTStrCopy(IfReq.ifr_name, sizeof(IfReq.ifr_name), pInfo->szShortName);
if (ioctl(sock, SIOCGIFFLAGS, &IfReq) < 0)
{
Log(("NetIfList: ioctl(SIOCGIFFLAGS) -> %d\n", errno));
- Fix calls of vm_map_find() after r255426 broke it and added
a mmap flag.
Submitted by: Lawrence Stewart <lstew...@freebsd.org>, Dan McGregor <dan.mcgre...@usask.ca>
--- src/VBox/Runtime/r0drv/freebsd/alloc-r0drv-freebsd.c 2013-09-06 06:30:30.000000000 -0600
+++ src/VBox/Runtime/r0drv/freebsd/alloc-r0drv-freebsd.c 2013-09-18 12:01:45.000000000 -0600
@@ -79,8 +79,13 @@
return VERR_NO_EXEC_MEMORY;
/* Addr contains a start address vm_map_find will start searching for suitable space at. */
+#if __FreeBSD_version >= 1000055
+ int rc = vm_map_find(kernel_map, pVmObject, 0, &Addr,
+ cbAllocated, 0, VMFS_ANY_SPACE, VM_PROT_ALL, VM_PROT_ALL, 0);
+#else
int rc = vm_map_find(kernel_map, pVmObject, 0, &Addr,
cbAllocated, TRUE, VM_PROT_ALL, VM_PROT_ALL, 0);
+#endif
if (rc == KERN_SUCCESS)
{
rc = vm_map_wire(kernel_map, Addr, Addr + cbAllocated,
--- src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c.orig 2013-09-06 12:30:30.000000000 +0000
+++ src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c 2013-09-21 18:12:53.000000000 +0000
@@ -286,9 +286,15 @@
pMemFreeBSD->pObject = vm_object_allocate(OBJT_PHYS, cPages);
/* No additional object reference for auto-deallocation upon unmapping. */
+#if __FreeBSD_version >= 1000055
+ rc = vm_map_find(kernel_map, pMemFreeBSD->pObject, 0,
+ &MapAddress, pMemFreeBSD->Core.cb, 0, VMFS_ANY_SPACE,
+ fExecutable ? VM_PROT_ALL : VM_PROT_RW, VM_PROT_ALL, 0);
+#else
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);
+#endif
if (rc == KERN_SUCCESS)
{
@@ -551,6 +557,9 @@
0, /* offset */
&MapAddress, /* addr (IN/OUT) */
cb, /* length */
+#if __FreeBSD_version >= 1000055
+ 0, /* max addr */
+#endif
pvFixed == (void *)-1 ? VMFS_ANY_SPACE : VMFS_NO_SPACE,
/* find_space */
VM_PROT_NONE, /* protection */
@@ -628,6 +637,9 @@
offSub, /* Start offset in the object */
&Addr, /* Start address IN/OUT */
cbSub, /* Size of the mapping */
+#if __FreeBSD_version >= 1000055
+ 0, /* Upper bound of mapping */
+#endif
VMFS_ANY_SPACE, /* Whether a suitable address should be searched for first */
ProtectionFlags, /* protection flags */
VM_PROT_ALL, /* Maximum protection flags */
@@ -704,6 +716,9 @@
0, /* Start offset in the object */
&AddrR3, /* Start address IN/OUT */
pMemToMap->cb, /* Size of the mapping */
+#if __FreeBSD_version >= 1000055
+ 0, /* Upper bound of the mapping */
+#endif
R3PtrFixed == (RTR3PTR)-1 ? VMFS_ANY_SPACE : VMFS_NO_SPACE,
/* Whether a suitable address should be searched for first */
ProtectionFlags, /* protection flags */
- Add stub for RTMpGetCoreCount() on FreeBSD
Submitted by: Mikhail Tsatsenko <m.tsatse...@gmail.com>
--- src/VBox/Runtime/r0drv/freebsd/mp-r0drv-freebsd.c.orig 2013-10-16 23:53:36.706402778 +0400
+++ src/VBox/Runtime/r0drv/freebsd/mp-r0drv-freebsd.c 2013-10-16 23:54:21.920399613 +0400
@@ -88,6 +88,11 @@
}
+RTDECL(RTCPUID) RTMpGetCoreCount(void)
+{
+ return mp_maxid + 1;
+}
+
RTDECL(bool) RTMpIsCpuOnline(RTCPUID idCpu)
{
return idCpu <= mp_maxid
_______________________________________________ vbox-dev mailing list vbox-dev@virtualbox.org https://www.virtualbox.org/mailman/listinfo/vbox-dev
