mirror of
https://git.freebsd.org/ports.git
synced 2025-04-28 01:26:39 -04:00
emulators/virtualbox-ose-kmod{,-70,-legacy}: Fix the build after FreeBSD kernel changes in 1500038
Update to chase removal of vm_page_next() PR: 286206 286193 286204 Tested by: Graham Perrin <grahamperrin@gmail.com> MFH: 2025Q2
This commit is contained in:
parent
b2b492ce9c
commit
271cb6e766
6 changed files with 162 additions and 90 deletions
|
@ -1,6 +1,6 @@
|
|||
--- src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c.orig 2024-11-22 11:30:43.777055000 +0100
|
||||
+++ src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c 2024-11-22 22:12:10.608369000 +0100
|
||||
@@ -139,8 +139,10 @@
|
||||
--- src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c.orig 2025-01-21 14:07:00 UTC
|
||||
+++ src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c
|
||||
@@ -139,8 +139,10 @@ DECLHIDDEN(int) rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
|
||||
|
||||
DECLHIDDEN(int) rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
|
||||
{
|
||||
|
@ -11,7 +11,7 @@
|
|||
|
||||
switch (pMemFreeBSD->Core.enmType)
|
||||
{
|
||||
@@ -155,8 +157,6 @@
|
||||
@@ -155,8 +157,6 @@ DECLHIDDEN(int) rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
|
||||
|
||||
case RTR0MEMOBJTYPE_LOCK:
|
||||
{
|
||||
|
@ -20,7 +20,30 @@
|
|||
if (pMemFreeBSD->Core.u.Lock.R0Process != NIL_RTR0PROCESS)
|
||||
pMap = &((struct proc *)pMemFreeBSD->Core.u.Lock.R0Process)->p_vmspace->vm_map;
|
||||
|
||||
@@ -220,6 +220,7 @@
|
||||
@@ -197,6 +197,7 @@ DECLHIDDEN(int) rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
|
||||
case RTR0MEMOBJTYPE_PHYS_NC:
|
||||
{
|
||||
VM_OBJECT_WLOCK(pMemFreeBSD->pObject);
|
||||
+#if __FreeBSD_version < 1500038
|
||||
vm_page_t pPage = vm_page_find_least(pMemFreeBSD->pObject, 0);
|
||||
#if __FreeBSD_version < 1000000
|
||||
vm_page_lock_queues();
|
||||
@@ -210,6 +211,14 @@ DECLHIDDEN(int) rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
|
||||
#if __FreeBSD_version < 1000000
|
||||
vm_page_unlock_queues();
|
||||
#endif
|
||||
+#else /* __FreeBSD_version >= 1500038 */
|
||||
+ struct pctrie_iter pages;
|
||||
+ vm_page_t page;
|
||||
+
|
||||
+ pctrie_iter_init(&pages, pMemFreeBSD->pObject);
|
||||
+ VM_RADIX_FORALL(page, &pages)
|
||||
+ vm_page_unwire(page, PQ_INACTIVE);
|
||||
+#endif
|
||||
VM_OBJECT_WUNLOCK(pMemFreeBSD->pObject);
|
||||
vm_object_deallocate(pMemFreeBSD->pObject);
|
||||
break;
|
||||
@@ -220,6 +229,7 @@ DECLHIDDEN(int) rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
|
||||
return VERR_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
|
@ -28,7 +51,7 @@
|
|||
return VINF_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -329,7 +330,8 @@
|
||||
@@ -329,7 +339,8 @@ static int rtR0MemObjFreeBSDAllocHelper(PRTR0MEMOBJFRE
|
||||
size_t cPages = atop(pMemFreeBSD->Core.cb);
|
||||
int rc;
|
||||
|
||||
|
@ -38,7 +61,7 @@
|
|||
|
||||
/* No additional object reference for auto-deallocation upon unmapping. */
|
||||
#if __FreeBSD_version >= 1000055
|
||||
@@ -371,6 +373,7 @@
|
||||
@@ -371,6 +382,7 @@ DECLHIDDEN(int) rtR0MemObjNativeAllocPage(PPRTR0MEMOBJ
|
||||
|
||||
DECLHIDDEN(int) rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable, const char *pszTag)
|
||||
{
|
||||
|
@ -46,7 +69,7 @@
|
|||
PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD), RTR0MEMOBJTYPE_PAGE,
|
||||
NULL, cb, pszTag);
|
||||
if (pMemFreeBSD)
|
||||
@@ -380,8 +383,10 @@
|
||||
@@ -380,8 +392,10 @@ DECLHIDDEN(int) rtR0MemObjNativeAllocPage(PPRTR0MEMOBJ
|
||||
*ppMem = &pMemFreeBSD->Core;
|
||||
else
|
||||
rtR0MemObjDelete(&pMemFreeBSD->Core);
|
||||
|
@ -57,7 +80,7 @@
|
|||
return VERR_NO_MEMORY;
|
||||
}
|
||||
|
||||
@@ -395,6 +400,7 @@
|
||||
@@ -395,6 +409,7 @@ DECLHIDDEN(int) rtR0MemObjNativeAllocLow(PPRTR0MEMOBJI
|
||||
|
||||
DECLHIDDEN(int) rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable, const char *pszTag)
|
||||
{
|
||||
|
@ -65,7 +88,7 @@
|
|||
PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD), RTR0MEMOBJTYPE_LOW, NULL, cb, pszTag);
|
||||
if (pMemFreeBSD)
|
||||
{
|
||||
@@ -403,14 +409,17 @@
|
||||
@@ -403,14 +418,17 @@ DECLHIDDEN(int) rtR0MemObjNativeAllocLow(PPRTR0MEMOBJI
|
||||
*ppMem = &pMemFreeBSD->Core;
|
||||
else
|
||||
rtR0MemObjDelete(&pMemFreeBSD->Core);
|
||||
|
@ -83,7 +106,7 @@
|
|||
PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD), RTR0MEMOBJTYPE_CONT,
|
||||
NULL, cb, pszTag);
|
||||
if (pMemFreeBSD)
|
||||
@@ -423,8 +432,10 @@
|
||||
@@ -423,8 +441,10 @@ DECLHIDDEN(int) rtR0MemObjNativeAllocCont(PPRTR0MEMOBJ
|
||||
}
|
||||
else
|
||||
rtR0MemObjDelete(&pMemFreeBSD->Core);
|
||||
|
@ -94,7 +117,7 @@
|
|||
return VERR_NO_MEMORY;
|
||||
}
|
||||
|
||||
@@ -432,6 +443,7 @@
|
||||
@@ -432,6 +452,7 @@ static int rtR0MemObjFreeBSDAllocPhysPages(PPRTR0MEMOB
|
||||
static int rtR0MemObjFreeBSDAllocPhysPages(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJTYPE enmType, size_t cb, RTHCPHYS PhysHighest,
|
||||
size_t uAlignment, bool fContiguous, int rcNoMem, const char *pszTag)
|
||||
{
|
||||
|
@ -102,7 +125,7 @@
|
|||
/* create the object. */
|
||||
PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD), enmType, NULL, cb, pszTag);
|
||||
if (pMemFreeBSD)
|
||||
@@ -439,7 +451,8 @@
|
||||
@@ -439,7 +460,8 @@ static int rtR0MemObjFreeBSDAllocPhysPages(PPRTR0MEMOB
|
||||
vm_paddr_t const VmPhysAddrHigh = PhysHighest != NIL_RTHCPHYS ? PhysHighest : ~(vm_paddr_t)0;
|
||||
u_long const cPages = atop(cb);
|
||||
|
||||
|
@ -112,7 +135,7 @@
|
|||
|
||||
int rc = rtR0MemObjFreeBSDPhysAllocHelper(pMemFreeBSD->pObject, cPages, VmPhysAddrHigh,
|
||||
uAlignment, fContiguous, true, rcNoMem);
|
||||
@@ -462,8 +475,10 @@
|
||||
@@ -462,8 +484,10 @@ static int rtR0MemObjFreeBSDAllocPhysPages(PPRTR0MEMOB
|
||||
vm_object_deallocate(pMemFreeBSD->pObject);
|
||||
rtR0MemObjDelete(&pMemFreeBSD->Core);
|
||||
}
|
||||
|
@ -123,7 +146,7 @@
|
|||
return VERR_NO_MEMORY;
|
||||
}
|
||||
|
||||
@@ -486,6 +501,7 @@
|
||||
@@ -486,6 +510,7 @@ DECLHIDDEN(int) rtR0MemObjNativeEnterPhys(PPRTR0MEMOBJ
|
||||
const char *pszTag)
|
||||
{
|
||||
AssertReturn(uCachePolicy == RTMEM_CACHE_POLICY_DONT_CARE, VERR_NOT_SUPPORTED);
|
||||
|
@ -131,7 +154,7 @@
|
|||
|
||||
/* create the object. */
|
||||
PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD), RTR0MEMOBJTYPE_PHYS,
|
||||
@@ -497,8 +513,10 @@
|
||||
@@ -497,8 +522,10 @@ DECLHIDDEN(int) rtR0MemObjNativeEnterPhys(PPRTR0MEMOBJ
|
||||
pMemFreeBSD->Core.u.Phys.PhysBase = Phys;
|
||||
pMemFreeBSD->Core.u.Phys.uCachePolicy = uCachePolicy;
|
||||
*ppMem = &pMemFreeBSD->Core;
|
||||
|
@ -142,7 +165,7 @@
|
|||
return VERR_NO_MEMORY;
|
||||
}
|
||||
|
||||
@@ -510,6 +528,7 @@
|
||||
@@ -510,6 +537,7 @@ static int rtR0MemObjNativeLockInMap(PPRTR0MEMOBJINTER
|
||||
vm_offset_t AddrStart, size_t cb, uint32_t fAccess,
|
||||
RTR0PROCESS R0Process, int fFlags, const char *pszTag)
|
||||
{
|
||||
|
@ -150,7 +173,7 @@
|
|||
int rc;
|
||||
NOREF(fAccess);
|
||||
|
||||
@@ -519,21 +538,28 @@
|
||||
@@ -519,21 +547,28 @@ static int rtR0MemObjNativeLockInMap(PPRTR0MEMOBJINTER
|
||||
if (!pMemFreeBSD)
|
||||
return VERR_NO_MEMORY;
|
||||
|
||||
|
@ -187,7 +210,7 @@
|
|||
return VERR_NO_MEMORY;/** @todo fix mach -> vbox error conversion for freebsd. */
|
||||
}
|
||||
|
||||
@@ -573,6 +599,7 @@
|
||||
@@ -573,6 +608,7 @@ static int rtR0MemObjNativeReserveInMap(PPRTR0MEMOBJIN
|
||||
static int rtR0MemObjNativeReserveInMap(PPRTR0MEMOBJINTERNAL ppMem, void *pvFixed, size_t cb, size_t uAlignment,
|
||||
RTR0PROCESS R0Process, vm_map_t pMap, const char *pszTag)
|
||||
{
|
||||
|
@ -195,7 +218,7 @@
|
|||
int rc;
|
||||
|
||||
/*
|
||||
@@ -631,11 +658,13 @@
|
||||
@@ -631,11 +667,13 @@ static int rtR0MemObjNativeReserveInMap(PPRTR0MEMOBJIN
|
||||
pMemFreeBSD->Core.pv = (void *)MapAddress;
|
||||
pMemFreeBSD->Core.u.ResVirt.R0Process = R0Process;
|
||||
*ppMem = &pMemFreeBSD->Core;
|
||||
|
@ -209,7 +232,7 @@
|
|||
return rc;
|
||||
|
||||
}
|
||||
@@ -659,6 +688,8 @@
|
||||
@@ -659,6 +697,8 @@ DECLHIDDEN(int) rtR0MemObjNativeMapKernel(PPRTR0MEMOBJ
|
||||
DECLHIDDEN(int) rtR0MemObjNativeMapKernel(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, void *pvFixed, size_t uAlignment,
|
||||
unsigned fProt, size_t offSub, size_t cbSub, const char *pszTag)
|
||||
{
|
||||
|
@ -218,7 +241,7 @@
|
|||
// AssertMsgReturn(!offSub && !cbSub, ("%#x %#x\n", offSub, cbSub), VERR_NOT_SUPPORTED);
|
||||
AssertMsgReturn(pvFixed == (void *)-1, ("%p\n", pvFixed), VERR_NOT_SUPPORTED);
|
||||
|
||||
@@ -713,6 +744,7 @@
|
||||
@@ -713,6 +753,7 @@ DECLHIDDEN(int) rtR0MemObjNativeMapKernel(PPRTR0MEMOBJ
|
||||
Assert((vm_offset_t)pMemFreeBSD->Core.pv == Addr);
|
||||
pMemFreeBSD->Core.u.Mapping.R0Process = NIL_RTR0PROCESS;
|
||||
*ppMem = &pMemFreeBSD->Core;
|
||||
|
@ -226,7 +249,7 @@
|
|||
return VINF_SUCCESS;
|
||||
}
|
||||
rc = vm_map_remove(kernel_map, Addr, Addr + cbSub);
|
||||
@@ -721,6 +753,7 @@
|
||||
@@ -721,6 +762,7 @@ DECLHIDDEN(int) rtR0MemObjNativeMapKernel(PPRTR0MEMOBJ
|
||||
else
|
||||
vm_object_deallocate(pMemToMapFreeBSD->pObject);
|
||||
|
||||
|
@ -234,7 +257,7 @@
|
|||
return VERR_NO_MEMORY;
|
||||
}
|
||||
|
||||
@@ -728,6 +761,8 @@
|
||||
@@ -728,6 +770,8 @@ DECLHIDDEN(int) rtR0MemObjNativeMapUser(PPRTR0MEMOBJIN
|
||||
DECLHIDDEN(int) rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, RTR3PTR R3PtrFixed, size_t uAlignment,
|
||||
unsigned fProt, RTR0PROCESS R0Process, size_t offSub, size_t cbSub, const char *pszTag)
|
||||
{
|
||||
|
@ -243,7 +266,7 @@
|
|||
/*
|
||||
* Check for unsupported stuff.
|
||||
*/
|
||||
@@ -785,44 +820,50 @@
|
||||
@@ -785,44 +829,50 @@ DECLHIDDEN(int) rtR0MemObjNativeMapUser(PPRTR0MEMOBJIN
|
||||
|
||||
if (rc == KERN_SUCCESS)
|
||||
{
|
||||
|
@ -298,7 +321,7 @@
|
|||
|
||||
if ((fProt & RTMEM_PROT_NONE) == RTMEM_PROT_NONE)
|
||||
ProtectionFlags = VM_PROT_NONE;
|
||||
@@ -833,7 +874,12 @@
|
||||
@@ -833,7 +883,12 @@ DECLHIDDEN(int) rtR0MemObjNativeProtect(PRTR0MEMOBJINT
|
||||
if ((fProt & RTMEM_PROT_EXEC) == RTMEM_PROT_EXEC)
|
||||
ProtectionFlags |= VM_PROT_EXECUTE;
|
||||
|
||||
|
@ -311,7 +334,7 @@
|
|||
if (krc == KERN_SUCCESS)
|
||||
return VINF_SUCCESS;
|
||||
|
||||
@@ -858,11 +904,19 @@
|
||||
@@ -858,11 +913,19 @@ DECLHIDDEN(RTHCPHYS) rtR0MemObjNativeGetPagePhysAddr(P
|
||||
|
||||
vm_offset_t pb = (vm_offset_t)pMemFreeBSD->Core.pv + ptoa(iPage);
|
||||
|
||||
|
@ -335,7 +358,7 @@
|
|||
}
|
||||
|
||||
case RTR0MEMOBJTYPE_MAPPING:
|
||||
@@ -871,11 +925,15 @@
|
||||
@@ -871,11 +934,15 @@ DECLHIDDEN(RTHCPHYS) rtR0MemObjNativeGetPagePhysAddr(P
|
||||
|
||||
if (pMemFreeBSD->Core.u.Mapping.R0Process != NIL_RTR0PROCESS)
|
||||
{
|
||||
|
@ -352,7 +375,7 @@
|
|||
}
|
||||
return vtophys(pb);
|
||||
}
|
||||
@@ -886,9 +944,11 @@
|
||||
@@ -886,9 +953,11 @@ DECLHIDDEN(RTHCPHYS) rtR0MemObjNativeGetPagePhysAddr(P
|
||||
{
|
||||
RTHCPHYS addr;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- src/VBox/Runtime/r0drv/freebsd/the-freebsd-kernel.h.orig 2021-01-07 15:42:09 UTC
|
||||
--- src/VBox/Runtime/r0drv/freebsd/the-freebsd-kernel.h.orig 2025-01-21 14:07:01 UTC
|
||||
+++ src/VBox/Runtime/r0drv/freebsd/the-freebsd-kernel.h
|
||||
@@ -87,6 +87,7 @@
|
||||
@@ -97,6 +97,7 @@
|
||||
#include <sys/smp.h>
|
||||
#include <sys/sleepqueue.h>
|
||||
#include <sys/sx.h>
|
||||
|
@ -8,7 +8,7 @@
|
|||
#include <vm/vm.h>
|
||||
#include <vm/pmap.h> /* for vtophys */
|
||||
#include <vm/vm_map.h>
|
||||
@@ -94,10 +95,10 @@
|
||||
@@ -104,10 +105,11 @@
|
||||
#include <vm/vm_kern.h>
|
||||
#include <vm/vm_param.h> /* KERN_SUCCESS ++ */
|
||||
#include <vm/vm_page.h>
|
||||
|
@ -17,10 +17,11 @@
|
|||
#include <vm/vm_extern.h> /* kmem_alloc_attr */
|
||||
#include <vm/vm_pageout.h> /* vm_contig_grow_cache */
|
||||
-#include <sys/vmmeter.h> /* cnt */
|
||||
+#include <vm/vm_radix.h>
|
||||
#include <sys/resourcevar.h>
|
||||
#include <machine/cpu.h>
|
||||
|
||||
@@ -155,6 +156,24 @@
|
||||
@@ -165,6 +167,24 @@
|
||||
*/
|
||||
#if 0 /** @todo Not available yet. */
|
||||
# define USE_KMEM_ALLOC_PROT
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c.orig 2020-07-09 16:57:38 UTC
|
||||
+++ src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c
|
||||
@@ -105,6 +105,7 @@ static vm_map_t rtR0MemObjFreeBSDGetMap(PRTR0MEMOBJINT
|
||||
@@ -105,6 +105,7 @@ DECLHIDDEN(int) rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
|
||||
|
||||
DECLHIDDEN(int) rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
|
||||
{
|
||||
|
@ -30,7 +30,30 @@
|
|||
break;
|
||||
}
|
||||
|
||||
@@ -194,6 +194,7 @@ DECLHIDDEN(int) rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
|
||||
@@ -167,6 +167,7 @@ DECLHIDDEN(int) rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
|
||||
#else
|
||||
VM_OBJECT_LOCK(pMemFreeBSD->pObject);
|
||||
#endif
|
||||
+#if __FreeBSD_version < 1500038
|
||||
vm_page_t pPage = vm_page_find_least(pMemFreeBSD->pObject, 0);
|
||||
#if __FreeBSD_version < 1000000
|
||||
vm_page_lock_queues();
|
||||
@@ -180,6 +181,14 @@ DECLHIDDEN(int) rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
|
||||
#if __FreeBSD_version < 1000000
|
||||
vm_page_unlock_queues();
|
||||
#endif
|
||||
+#else /* __FreeBSD_version >= 1500038 */
|
||||
+ struct pctrie_iter pages;
|
||||
+ vm_page_t page;
|
||||
+
|
||||
+ pctrie_iter_init(&pages, pMemFreeBSD->pObject);
|
||||
+ VM_RADIX_FORALL(page, &pages)
|
||||
+ vm_page_unwire(page, PQ_INACTIVE);
|
||||
+#endif
|
||||
#if __FreeBSD_version >= 1000030
|
||||
VM_OBJECT_WUNLOCK(pMemFreeBSD->pObject);
|
||||
#else
|
||||
@@ -194,6 +203,7 @@ DECLHIDDEN(int) rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
|
||||
return VERR_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
|
@ -38,7 +61,7 @@
|
|||
return VINF_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -224,18 +225,23 @@ static vm_page_t rtR0MemObjFreeBSDContigPhysAllocHelpe
|
||||
@@ -224,18 +234,23 @@ static vm_page_t rtR0MemObjFreeBSDContigPhysAllocHelpe
|
||||
#else
|
||||
VM_OBJECT_UNLOCK(pObject);
|
||||
#endif
|
||||
|
@ -67,7 +90,7 @@
|
|||
break;
|
||||
vm_contig_grow_cache(cTries, 0, VmPhysAddrHigh);
|
||||
cTries++;
|
||||
@@ -243,11 +249,8 @@ static vm_page_t rtR0MemObjFreeBSDContigPhysAllocHelpe
|
||||
@@ -243,11 +258,8 @@ static vm_page_t rtR0MemObjFreeBSDContigPhysAllocHelpe
|
||||
|
||||
if (!pPages)
|
||||
return pPages;
|
||||
|
@ -80,7 +103,7 @@
|
|||
for (vm_pindex_t iPage = 0; iPage < cPages; iPage++)
|
||||
{
|
||||
vm_page_t pPage = pPages + iPage;
|
||||
@@ -259,13 +262,9 @@ static vm_page_t rtR0MemObjFreeBSDContigPhysAllocHelpe
|
||||
@@ -259,13 +271,9 @@ static vm_page_t rtR0MemObjFreeBSDContigPhysAllocHelpe
|
||||
atomic_add_int(&cnt.v_wire_count, 1);
|
||||
}
|
||||
}
|
||||
|
@ -94,7 +117,7 @@
|
|||
}
|
||||
|
||||
static int rtR0MemObjFreeBSDPhysAllocHelper(vm_object_t pObject, u_long cPages,
|
||||
@@ -292,16 +291,17 @@ static int rtR0MemObjFreeBSDPhysAllocHelper(vm_object_
|
||||
@@ -292,16 +300,17 @@ static int rtR0MemObjFreeBSDPhysAllocHelper(vm_object_
|
||||
#else
|
||||
VM_OBJECT_LOCK(pObject);
|
||||
#endif
|
||||
|
@ -114,7 +137,7 @@
|
|||
vm_page_unlock_queues();
|
||||
#endif
|
||||
}
|
||||
@@ -323,7 +323,8 @@ static int rtR0MemObjFreeBSDAllocHelper(PRTR0MEMOBJFRE
|
||||
@@ -323,7 +332,8 @@ static int rtR0MemObjFreeBSDAllocHelper(PRTR0MEMOBJFRE
|
||||
size_t cPages = atop(pMemFreeBSD->Core.cb);
|
||||
int rc;
|
||||
|
||||
|
@ -124,7 +147,7 @@
|
|||
|
||||
/* No additional object reference for auto-deallocation upon unmapping. */
|
||||
#if __FreeBSD_version >= 1000055
|
||||
@@ -364,58 +365,77 @@ static int rtR0MemObjFreeBSDAllocHelper(PRTR0MEMOBJFRE
|
||||
@@ -364,58 +374,77 @@ DECLHIDDEN(int) rtR0MemObjNativeAllocPage(PPRTR0MEMOBJ
|
||||
}
|
||||
DECLHIDDEN(int) rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
|
||||
{
|
||||
|
@ -202,7 +225,7 @@
|
|||
return rc;
|
||||
}
|
||||
|
||||
@@ -425,6 +445,7 @@ static int rtR0MemObjFreeBSDAllocPhysPages(PPRTR0MEMOB
|
||||
@@ -425,6 +454,7 @@ static int rtR0MemObjFreeBSDAllocPhysPages(PPRTR0MEMOB
|
||||
RTHCPHYS PhysHighest, size_t uAlignment,
|
||||
bool fContiguous, int rcNoMem)
|
||||
{
|
||||
|
@ -210,7 +233,7 @@
|
|||
uint32_t cPages = atop(cb);
|
||||
vm_paddr_t VmPhysAddrHigh;
|
||||
|
||||
@@ -432,9 +453,13 @@ static int rtR0MemObjFreeBSDAllocPhysPages(PPRTR0MEMOB
|
||||
@@ -432,9 +462,13 @@ static int rtR0MemObjFreeBSDAllocPhysPages(PPRTR0MEMOB
|
||||
PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD),
|
||||
enmType, NULL, cb);
|
||||
if (!pMemFreeBSD)
|
||||
|
@ -225,7 +248,7 @@
|
|||
|
||||
if (PhysHighest != NIL_RTHCPHYS)
|
||||
VmPhysAddrHigh = PhysHighest;
|
||||
@@ -470,6 +495,7 @@ static int rtR0MemObjFreeBSDAllocPhysPages(PPRTR0MEMOB
|
||||
@@ -470,6 +504,7 @@ static int rtR0MemObjFreeBSDAllocPhysPages(PPRTR0MEMOB
|
||||
rtR0MemObjDelete(&pMemFreeBSD->Core);
|
||||
}
|
||||
|
||||
|
@ -233,7 +256,7 @@
|
|||
return rc;
|
||||
}
|
||||
|
||||
@@ -489,17 +515,22 @@ DECLHIDDEN(int) rtR0MemObjNativeAllocPhysNC(PPRTR0MEMO
|
||||
@@ -489,17 +524,22 @@ DECLHIDDEN(int) rtR0MemObjNativeEnterPhys(PPRTR0MEMOBJ
|
||||
DECLHIDDEN(int) rtR0MemObjNativeEnterPhys(PPRTR0MEMOBJINTERNAL ppMem, RTHCPHYS Phys, size_t cb, uint32_t uCachePolicy)
|
||||
{
|
||||
AssertReturn(uCachePolicy == RTMEM_CACHE_POLICY_DONT_CARE, VERR_NOT_SUPPORTED);
|
||||
|
@ -256,7 +279,7 @@
|
|||
return VINF_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -511,6 +542,7 @@ static int rtR0MemObjNativeLockInMap(PPRTR0MEMOBJINTER
|
||||
@@ -511,6 +551,7 @@ static int rtR0MemObjNativeLockInMap(PPRTR0MEMOBJINTER
|
||||
vm_offset_t AddrStart, size_t cb, uint32_t fAccess,
|
||||
RTR0PROCESS R0Process, int fFlags)
|
||||
{
|
||||
|
@ -264,7 +287,7 @@
|
|||
int rc;
|
||||
NOREF(fAccess);
|
||||
|
||||
@@ -519,21 +551,28 @@ static int rtR0MemObjNativeLockInMap(PPRTR0MEMOBJINTER
|
||||
@@ -519,21 +560,28 @@ static int rtR0MemObjNativeLockInMap(PPRTR0MEMOBJINTER
|
||||
if (!pMemFreeBSD)
|
||||
return VERR_NO_MEMORY;
|
||||
|
||||
|
@ -301,7 +324,7 @@
|
|||
return VERR_NO_MEMORY;/** @todo fix mach -> vbox error conversion for freebsd. */
|
||||
}
|
||||
|
||||
@@ -569,6 +608,7 @@ DECLHIDDEN(int) rtR0MemObjNativeLockKernel(PPRTR0MEMOB
|
||||
@@ -569,6 +617,7 @@ static int rtR0MemObjNativeReserveInMap(PPRTR0MEMOBJIN
|
||||
*/
|
||||
static int rtR0MemObjNativeReserveInMap(PPRTR0MEMOBJINTERNAL ppMem, void *pvFixed, size_t cb, size_t uAlignment, RTR0PROCESS R0Process, vm_map_t pMap)
|
||||
{
|
||||
|
@ -309,7 +332,7 @@
|
|||
int rc;
|
||||
|
||||
/*
|
||||
@@ -626,11 +666,13 @@ static int rtR0MemObjNativeReserveInMap(PPRTR0MEMOBJIN
|
||||
@@ -626,11 +675,13 @@ static int rtR0MemObjNativeReserveInMap(PPRTR0MEMOBJIN
|
||||
pMemFreeBSD->Core.pv = (void *)MapAddress;
|
||||
pMemFreeBSD->Core.u.ResVirt.R0Process = R0Process;
|
||||
*ppMem = &pMemFreeBSD->Core;
|
||||
|
@ -323,7 +346,7 @@
|
|||
return rc;
|
||||
|
||||
}
|
||||
@@ -652,6 +694,8 @@ DECLHIDDEN(int) rtR0MemObjNativeReserveUser(PPRTR0MEMO
|
||||
@@ -652,6 +703,8 @@ DECLHIDDEN(int) rtR0MemObjNativeMapKernel(PPRTR0MEMOBJ
|
||||
DECLHIDDEN(int) rtR0MemObjNativeMapKernel(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, void *pvFixed, size_t uAlignment,
|
||||
unsigned fProt, size_t offSub, size_t cbSub)
|
||||
{
|
||||
|
@ -332,7 +355,7 @@
|
|||
// AssertMsgReturn(!offSub && !cbSub, ("%#x %#x\n", offSub, cbSub), VERR_NOT_SUPPORTED);
|
||||
AssertMsgReturn(pvFixed == (void *)-1, ("%p\n", pvFixed), VERR_NOT_SUPPORTED);
|
||||
|
||||
@@ -707,6 +751,7 @@ DECLHIDDEN(int) rtR0MemObjNativeMapKernel(PPRTR0MEMOBJ
|
||||
@@ -707,6 +760,7 @@ DECLHIDDEN(int) rtR0MemObjNativeMapKernel(PPRTR0MEMOBJ
|
||||
Assert((vm_offset_t)pMemFreeBSD->Core.pv == Addr);
|
||||
pMemFreeBSD->Core.u.Mapping.R0Process = NIL_RTR0PROCESS;
|
||||
*ppMem = &pMemFreeBSD->Core;
|
||||
|
@ -340,7 +363,7 @@
|
|||
return VINF_SUCCESS;
|
||||
}
|
||||
rc = vm_map_remove(kernel_map, Addr, Addr + cbSub);
|
||||
@@ -715,6 +760,7 @@ DECLHIDDEN(int) rtR0MemObjNativeMapKernel(PPRTR0MEMOBJ
|
||||
@@ -715,6 +769,7 @@ DECLHIDDEN(int) rtR0MemObjNativeMapKernel(PPRTR0MEMOBJ
|
||||
else
|
||||
vm_object_deallocate(pMemToMapFreeBSD->pObject);
|
||||
|
||||
|
@ -348,7 +371,7 @@
|
|||
return VERR_NO_MEMORY;
|
||||
}
|
||||
|
||||
@@ -722,6 +768,8 @@ DECLHIDDEN(int) rtR0MemObjNativeMapKernel(PPRTR0MEMOBJ
|
||||
@@ -722,6 +777,8 @@ DECLHIDDEN(int) rtR0MemObjNativeMapUser(PPRTR0MEMOBJIN
|
||||
DECLHIDDEN(int) rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, RTR3PTR R3PtrFixed, size_t uAlignment,
|
||||
unsigned fProt, RTR0PROCESS R0Process)
|
||||
{
|
||||
|
@ -357,7 +380,7 @@
|
|||
/*
|
||||
* Check for unsupported stuff.
|
||||
*/
|
||||
@@ -751,7 +799,12 @@ DECLHIDDEN(int) rtR0MemObjNativeMapUser(PPRTR0MEMOBJIN
|
||||
@@ -751,7 +808,12 @@ DECLHIDDEN(int) rtR0MemObjNativeMapUser(PPRTR0MEMOBJIN
|
||||
{
|
||||
/** @todo is this needed?. */
|
||||
PROC_LOCK(pProc);
|
||||
|
@ -371,7 +394,7 @@
|
|||
PROC_UNLOCK(pProc);
|
||||
}
|
||||
else
|
||||
@@ -774,10 +827,9 @@ DECLHIDDEN(int) rtR0MemObjNativeMapUser(PPRTR0MEMOBJIN
|
||||
@@ -774,10 +836,9 @@ DECLHIDDEN(int) rtR0MemObjNativeMapUser(PPRTR0MEMOBJIN
|
||||
0); /* copy-on-write and similar flags */
|
||||
|
||||
if (rc == KERN_SUCCESS)
|
||||
|
@ -384,7 +407,7 @@
|
|||
rc = vm_map_inherit(pProcMap, AddrR3, AddrR3 + pMemToMap->cb, VM_INHERIT_SHARE);
|
||||
AssertMsg(rc == KERN_SUCCESS, ("%#x\n", rc));
|
||||
|
||||
@@ -793,6 +845,7 @@ DECLHIDDEN(int) rtR0MemObjNativeMapUser(PPRTR0MEMOBJIN
|
||||
@@ -793,6 +854,7 @@ DECLHIDDEN(int) rtR0MemObjNativeMapUser(PPRTR0MEMOBJIN
|
||||
Assert((vm_offset_t)pMemFreeBSD->Core.pv == AddrR3);
|
||||
pMemFreeBSD->Core.u.Mapping.R0Process = R0Process;
|
||||
*ppMem = &pMemFreeBSD->Core;
|
||||
|
@ -392,7 +415,7 @@
|
|||
return VINF_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -802,19 +855,25 @@ DECLHIDDEN(int) rtR0MemObjNativeMapUser(PPRTR0MEMOBJIN
|
||||
@@ -802,19 +864,25 @@ DECLHIDDEN(int) rtR0MemObjNativeMapUser(PPRTR0MEMOBJIN
|
||||
else
|
||||
vm_object_deallocate(pMemToMapFreeBSD->pObject);
|
||||
|
||||
|
@ -418,7 +441,7 @@
|
|||
|
||||
if ((fProt & RTMEM_PROT_NONE) == RTMEM_PROT_NONE)
|
||||
ProtectionFlags = VM_PROT_NONE;
|
||||
@@ -825,7 +884,12 @@ DECLHIDDEN(int) rtR0MemObjNativeProtect(PRTR0MEMOBJINT
|
||||
@@ -825,7 +893,12 @@ DECLHIDDEN(int) rtR0MemObjNativeProtect(PRTR0MEMOBJINT
|
||||
if ((fProt & RTMEM_PROT_EXEC) == RTMEM_PROT_EXEC)
|
||||
ProtectionFlags |= VM_PROT_EXECUTE;
|
||||
|
||||
|
@ -431,7 +454,7 @@
|
|||
if (krc == KERN_SUCCESS)
|
||||
return VINF_SUCCESS;
|
||||
|
||||
@@ -850,11 +914,19 @@ DECLHIDDEN(RTHCPHYS) rtR0MemObjNativeGetPagePhysAddr(P
|
||||
@@ -850,11 +923,19 @@ DECLHIDDEN(RTHCPHYS) rtR0MemObjNativeGetPagePhysAddr(P
|
||||
|
||||
vm_offset_t pb = (vm_offset_t)pMemFreeBSD->Core.pv + ptoa(iPage);
|
||||
|
||||
|
@ -455,7 +478,7 @@
|
|||
}
|
||||
|
||||
case RTR0MEMOBJTYPE_MAPPING:
|
||||
@@ -863,11 +935,15 @@ DECLHIDDEN(RTHCPHYS) rtR0MemObjNativeGetPagePhysAddr(P
|
||||
@@ -863,11 +944,15 @@ DECLHIDDEN(RTHCPHYS) rtR0MemObjNativeGetPagePhysAddr(P
|
||||
|
||||
if (pMemFreeBSD->Core.u.Mapping.R0Process != NIL_RTR0PROCESS)
|
||||
{
|
||||
|
@ -472,7 +495,7 @@
|
|||
}
|
||||
return vtophys(pb);
|
||||
}
|
||||
@@ -877,6 +953,7 @@ DECLHIDDEN(RTHCPHYS) rtR0MemObjNativeGetPagePhysAddr(P
|
||||
@@ -877,6 +962,7 @@ DECLHIDDEN(RTHCPHYS) rtR0MemObjNativeGetPagePhysAddr(P
|
||||
case RTR0MEMOBJTYPE_PHYS_NC:
|
||||
{
|
||||
RTHCPHYS addr;
|
||||
|
@ -480,7 +503,7 @@
|
|||
#if __FreeBSD_version >= 1000030
|
||||
VM_OBJECT_WLOCK(pMemFreeBSD->pObject);
|
||||
#else
|
||||
@@ -888,6 +965,7 @@ DECLHIDDEN(RTHCPHYS) rtR0MemObjNativeGetPagePhysAddr(P
|
||||
@@ -888,6 +974,7 @@ DECLHIDDEN(RTHCPHYS) rtR0MemObjNativeGetPagePhysAddr(P
|
||||
#else
|
||||
VM_OBJECT_UNLOCK(pMemFreeBSD->pObject);
|
||||
#endif
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include <vm/vm.h>
|
||||
#include <vm/pmap.h> /* for vtophys */
|
||||
#include <vm/vm_map.h>
|
||||
@@ -67,10 +68,10 @@
|
||||
@@ -67,10 +68,11 @@
|
||||
#include <vm/vm_kern.h>
|
||||
#include <vm/vm_param.h> /* KERN_SUCCESS ++ */
|
||||
#include <vm/vm_page.h>
|
||||
|
@ -17,10 +17,11 @@
|
|||
#include <vm/vm_extern.h> /* kmem_alloc_attr */
|
||||
#include <vm/vm_pageout.h> /* vm_contig_grow_cache */
|
||||
-#include <sys/vmmeter.h> /* cnt */
|
||||
+#include <vm/vm_radix.h>
|
||||
#include <sys/resourcevar.h>
|
||||
#include <machine/cpu.h>
|
||||
|
||||
@@ -114,6 +115,24 @@
|
||||
@@ -114,6 +116,24 @@
|
||||
*/
|
||||
#if 0 /** @todo Not available yet. */
|
||||
# define USE_KMEM_ALLOC_PROT
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c.orig 2021-10-18 17:58:41 UTC
|
||||
--- src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c.orig 2024-01-11 12:25:56 UTC
|
||||
+++ src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c
|
||||
@@ -129,6 +129,7 @@ static vm_map_t rtR0MemObjFreeBSDGetMap(PRTR0MEMOBJINT
|
||||
@@ -129,6 +129,7 @@ DECLHIDDEN(int) rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
|
||||
|
||||
DECLHIDDEN(int) rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
|
||||
{
|
||||
|
@ -30,7 +30,30 @@
|
|||
break;
|
||||
}
|
||||
|
||||
@@ -210,6 +210,7 @@ DECLHIDDEN(int) rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
|
||||
@@ -187,6 +187,7 @@ DECLHIDDEN(int) rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
|
||||
case RTR0MEMOBJTYPE_PHYS_NC:
|
||||
{
|
||||
VM_OBJECT_WLOCK(pMemFreeBSD->pObject);
|
||||
+#if __FreeBSD_version < 1500038
|
||||
vm_page_t pPage = vm_page_find_least(pMemFreeBSD->pObject, 0);
|
||||
#if __FreeBSD_version < 1000000
|
||||
vm_page_lock_queues();
|
||||
@@ -200,6 +201,14 @@ DECLHIDDEN(int) rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
|
||||
#if __FreeBSD_version < 1000000
|
||||
vm_page_unlock_queues();
|
||||
#endif
|
||||
+#else /* __FreeBSD_version >= 1500038 */
|
||||
+ struct pctrie_iter pages;
|
||||
+ vm_page_t page;
|
||||
+
|
||||
+ pctrie_iter_init(&pages, pMemFreeBSD->pObject);
|
||||
+ VM_RADIX_FORALL(page, &pages)
|
||||
+ vm_page_unwire(page, PQ_INACTIVE);
|
||||
+#endif
|
||||
VM_OBJECT_WUNLOCK(pMemFreeBSD->pObject);
|
||||
vm_object_deallocate(pMemFreeBSD->pObject);
|
||||
break;
|
||||
@@ -210,6 +219,7 @@ DECLHIDDEN(int) rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
|
||||
return VERR_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
|
@ -38,7 +61,7 @@
|
|||
return VINF_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -320,8 +321,10 @@ static int rtR0MemObjFreeBSDAllocHelper(PRTR0MEMOBJFRE
|
||||
@@ -320,8 +330,10 @@ static int rtR0MemObjFreeBSDAllocHelper(PRTR0MEMOBJFRE
|
||||
size_t cPages = atop(pMemFreeBSD->Core.cb);
|
||||
int rc;
|
||||
|
||||
|
@ -50,7 +73,7 @@
|
|||
/* No additional object reference for auto-deallocation upon unmapping. */
|
||||
#if __FreeBSD_version >= 1000055
|
||||
rc = vm_map_find(kernel_map, pMemFreeBSD->pObject, 0,
|
||||
@@ -361,19 +364,25 @@ static int rtR0MemObjFreeBSDAllocHelper(PRTR0MEMOBJFRE
|
||||
@@ -361,19 +373,25 @@ DECLHIDDEN(int) rtR0MemObjNativeAllocPage(PPRTR0MEMOBJ
|
||||
}
|
||||
DECLHIDDEN(int) rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
|
||||
{
|
||||
|
@ -76,7 +99,7 @@
|
|||
return rc;
|
||||
}
|
||||
|
||||
@@ -387,39 +396,51 @@ DECLHIDDEN(int) rtR0MemObjNativeAllocLarge(PPRTR0MEMOB
|
||||
@@ -387,39 +405,51 @@ DECLHIDDEN(int) rtR0MemObjNativeAllocLow(PPRTR0MEMOBJI
|
||||
|
||||
DECLHIDDEN(int) rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
|
||||
{
|
||||
|
@ -128,7 +151,7 @@
|
|||
return rc;
|
||||
}
|
||||
|
||||
@@ -429,6 +450,7 @@ static int rtR0MemObjFreeBSDAllocPhysPages(PPRTR0MEMOB
|
||||
@@ -429,6 +459,7 @@ static int rtR0MemObjFreeBSDAllocPhysPages(PPRTR0MEMOB
|
||||
RTHCPHYS PhysHighest, size_t uAlignment,
|
||||
bool fContiguous, int rcNoMem)
|
||||
{
|
||||
|
@ -136,7 +159,7 @@
|
|||
uint32_t cPages = atop(cb);
|
||||
vm_paddr_t VmPhysAddrHigh;
|
||||
|
||||
@@ -436,9 +458,13 @@ static int rtR0MemObjFreeBSDAllocPhysPages(PPRTR0MEMOB
|
||||
@@ -436,9 +467,13 @@ static int rtR0MemObjFreeBSDAllocPhysPages(PPRTR0MEMOB
|
||||
PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD),
|
||||
enmType, NULL, cb);
|
||||
if (!pMemFreeBSD)
|
||||
|
@ -151,7 +174,7 @@
|
|||
|
||||
if (PhysHighest != NIL_RTHCPHYS)
|
||||
VmPhysAddrHigh = PhysHighest;
|
||||
@@ -466,6 +492,7 @@ static int rtR0MemObjFreeBSDAllocPhysPages(PPRTR0MEMOB
|
||||
@@ -466,6 +501,7 @@ static int rtR0MemObjFreeBSDAllocPhysPages(PPRTR0MEMOB
|
||||
rtR0MemObjDelete(&pMemFreeBSD->Core);
|
||||
}
|
||||
|
||||
|
@ -159,7 +182,7 @@
|
|||
return rc;
|
||||
}
|
||||
|
||||
@@ -485,17 +512,22 @@ DECLHIDDEN(int) rtR0MemObjNativeAllocPhysNC(PPRTR0MEMO
|
||||
@@ -485,17 +521,22 @@ DECLHIDDEN(int) rtR0MemObjNativeEnterPhys(PPRTR0MEMOBJ
|
||||
DECLHIDDEN(int) rtR0MemObjNativeEnterPhys(PPRTR0MEMOBJINTERNAL ppMem, RTHCPHYS Phys, size_t cb, uint32_t uCachePolicy)
|
||||
{
|
||||
AssertReturn(uCachePolicy == RTMEM_CACHE_POLICY_DONT_CARE, VERR_NOT_SUPPORTED);
|
||||
|
@ -182,7 +205,7 @@
|
|||
return VINF_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -507,6 +539,7 @@ static int rtR0MemObjNativeLockInMap(PPRTR0MEMOBJINTER
|
||||
@@ -507,6 +548,7 @@ static int rtR0MemObjNativeLockInMap(PPRTR0MEMOBJINTER
|
||||
vm_offset_t AddrStart, size_t cb, uint32_t fAccess,
|
||||
RTR0PROCESS R0Process, int fFlags)
|
||||
{
|
||||
|
@ -190,7 +213,7 @@
|
|||
int rc;
|
||||
NOREF(fAccess);
|
||||
|
||||
@@ -515,21 +548,28 @@ static int rtR0MemObjNativeLockInMap(PPRTR0MEMOBJINTER
|
||||
@@ -515,21 +557,28 @@ static int rtR0MemObjNativeLockInMap(PPRTR0MEMOBJINTER
|
||||
if (!pMemFreeBSD)
|
||||
return VERR_NO_MEMORY;
|
||||
|
||||
|
@ -227,7 +250,7 @@
|
|||
return VERR_NO_MEMORY;/** @todo fix mach -> vbox error conversion for freebsd. */
|
||||
}
|
||||
|
||||
@@ -565,6 +605,7 @@ DECLHIDDEN(int) rtR0MemObjNativeLockKernel(PPRTR0MEMOB
|
||||
@@ -565,6 +614,7 @@ static int rtR0MemObjNativeReserveInMap(PPRTR0MEMOBJIN
|
||||
*/
|
||||
static int rtR0MemObjNativeReserveInMap(PPRTR0MEMOBJINTERNAL ppMem, void *pvFixed, size_t cb, size_t uAlignment, RTR0PROCESS R0Process, vm_map_t pMap)
|
||||
{
|
||||
|
@ -235,7 +258,7 @@
|
|||
int rc;
|
||||
|
||||
/*
|
||||
@@ -622,11 +663,13 @@ static int rtR0MemObjNativeReserveInMap(PPRTR0MEMOBJIN
|
||||
@@ -622,11 +672,13 @@ static int rtR0MemObjNativeReserveInMap(PPRTR0MEMOBJIN
|
||||
pMemFreeBSD->Core.pv = (void *)MapAddress;
|
||||
pMemFreeBSD->Core.u.ResVirt.R0Process = R0Process;
|
||||
*ppMem = &pMemFreeBSD->Core;
|
||||
|
@ -249,7 +272,7 @@
|
|||
return rc;
|
||||
|
||||
}
|
||||
@@ -648,6 +691,8 @@ DECLHIDDEN(int) rtR0MemObjNativeReserveUser(PPRTR0MEMO
|
||||
@@ -648,6 +700,8 @@ DECLHIDDEN(int) rtR0MemObjNativeMapKernel(PPRTR0MEMOBJ
|
||||
DECLHIDDEN(int) rtR0MemObjNativeMapKernel(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, void *pvFixed, size_t uAlignment,
|
||||
unsigned fProt, size_t offSub, size_t cbSub)
|
||||
{
|
||||
|
@ -258,7 +281,7 @@
|
|||
// AssertMsgReturn(!offSub && !cbSub, ("%#x %#x\n", offSub, cbSub), VERR_NOT_SUPPORTED);
|
||||
AssertMsgReturn(pvFixed == (void *)-1, ("%p\n", pvFixed), VERR_NOT_SUPPORTED);
|
||||
|
||||
@@ -704,6 +749,7 @@ DECLHIDDEN(int) rtR0MemObjNativeMapKernel(PPRTR0MEMOBJ
|
||||
@@ -704,6 +758,7 @@ DECLHIDDEN(int) rtR0MemObjNativeMapKernel(PPRTR0MEMOBJ
|
||||
Assert((vm_offset_t)pMemFreeBSD->Core.pv == Addr);
|
||||
pMemFreeBSD->Core.u.Mapping.R0Process = NIL_RTR0PROCESS;
|
||||
*ppMem = &pMemFreeBSD->Core;
|
||||
|
@ -266,7 +289,7 @@
|
|||
return VINF_SUCCESS;
|
||||
}
|
||||
rc = vm_map_remove(kernel_map, Addr, Addr + cbSub);
|
||||
@@ -712,6 +758,7 @@ DECLHIDDEN(int) rtR0MemObjNativeMapKernel(PPRTR0MEMOBJ
|
||||
@@ -712,6 +767,7 @@ DECLHIDDEN(int) rtR0MemObjNativeMapKernel(PPRTR0MEMOBJ
|
||||
else
|
||||
vm_object_deallocate(pMemToMapFreeBSD->pObject);
|
||||
|
||||
|
@ -274,7 +297,7 @@
|
|||
return VERR_NO_MEMORY;
|
||||
}
|
||||
|
||||
@@ -719,6 +766,8 @@ DECLHIDDEN(int) rtR0MemObjNativeMapKernel(PPRTR0MEMOBJ
|
||||
@@ -719,6 +775,8 @@ DECLHIDDEN(int) rtR0MemObjNativeMapUser(PPRTR0MEMOBJIN
|
||||
DECLHIDDEN(int) rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, RTR3PTR R3PtrFixed, size_t uAlignment,
|
||||
unsigned fProt, RTR0PROCESS R0Process, size_t offSub, size_t cbSub)
|
||||
{
|
||||
|
@ -283,7 +306,7 @@
|
|||
/*
|
||||
* Check for unsupported stuff.
|
||||
*/
|
||||
@@ -775,47 +824,53 @@ DECLHIDDEN(int) rtR0MemObjNativeMapUser(PPRTR0MEMOBJIN
|
||||
@@ -775,47 +833,53 @@ DECLHIDDEN(int) rtR0MemObjNativeMapUser(PPRTR0MEMOBJIN
|
||||
0); /* copy-on-write and similar flags */
|
||||
|
||||
if (rc == KERN_SUCCESS)
|
||||
|
@ -343,7 +366,7 @@
|
|||
|
||||
if ((fProt & RTMEM_PROT_NONE) == RTMEM_PROT_NONE)
|
||||
ProtectionFlags = VM_PROT_NONE;
|
||||
@@ -826,7 +881,12 @@ DECLHIDDEN(int) rtR0MemObjNativeProtect(PRTR0MEMOBJINT
|
||||
@@ -826,7 +890,12 @@ DECLHIDDEN(int) rtR0MemObjNativeProtect(PRTR0MEMOBJINT
|
||||
if ((fProt & RTMEM_PROT_EXEC) == RTMEM_PROT_EXEC)
|
||||
ProtectionFlags |= VM_PROT_EXECUTE;
|
||||
|
||||
|
@ -356,7 +379,7 @@
|
|||
if (krc == KERN_SUCCESS)
|
||||
return VINF_SUCCESS;
|
||||
|
||||
@@ -851,11 +911,19 @@ DECLHIDDEN(RTHCPHYS) rtR0MemObjNativeGetPagePhysAddr(P
|
||||
@@ -851,11 +920,19 @@ DECLHIDDEN(RTHCPHYS) rtR0MemObjNativeGetPagePhysAddr(P
|
||||
|
||||
vm_offset_t pb = (vm_offset_t)pMemFreeBSD->Core.pv + ptoa(iPage);
|
||||
|
||||
|
@ -380,7 +403,7 @@
|
|||
}
|
||||
|
||||
case RTR0MEMOBJTYPE_MAPPING:
|
||||
@@ -864,11 +932,16 @@ DECLHIDDEN(RTHCPHYS) rtR0MemObjNativeGetPagePhysAddr(P
|
||||
@@ -864,11 +941,16 @@ DECLHIDDEN(RTHCPHYS) rtR0MemObjNativeGetPagePhysAddr(P
|
||||
|
||||
if (pMemFreeBSD->Core.u.Mapping.R0Process != NIL_RTR0PROCESS)
|
||||
{
|
||||
|
@ -398,7 +421,7 @@
|
|||
}
|
||||
return vtophys(pb);
|
||||
}
|
||||
@@ -879,9 +952,11 @@ DECLHIDDEN(RTHCPHYS) rtR0MemObjNativeGetPagePhysAddr(P
|
||||
@@ -879,9 +961,11 @@ DECLHIDDEN(RTHCPHYS) rtR0MemObjNativeGetPagePhysAddr(P
|
||||
{
|
||||
RTHCPHYS addr;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
--- src/VBox/Runtime/r0drv/freebsd/the-freebsd-kernel.h.orig 2021-01-07 15:42:09 UTC
|
||||
--- src/VBox/Runtime/r0drv/freebsd/the-freebsd-kernel.h.orig 2024-01-11 12:25:57 UTC
|
||||
+++ src/VBox/Runtime/r0drv/freebsd/the-freebsd-kernel.h
|
||||
@@ -87,6 +87,7 @@
|
||||
#include <sys/smp.h>
|
||||
|
@ -8,7 +8,7 @@
|
|||
#include <vm/vm.h>
|
||||
#include <vm/pmap.h> /* for vtophys */
|
||||
#include <vm/vm_map.h>
|
||||
@@ -94,10 +95,10 @@
|
||||
@@ -94,10 +95,11 @@
|
||||
#include <vm/vm_kern.h>
|
||||
#include <vm/vm_param.h> /* KERN_SUCCESS ++ */
|
||||
#include <vm/vm_page.h>
|
||||
|
@ -17,10 +17,11 @@
|
|||
#include <vm/vm_extern.h> /* kmem_alloc_attr */
|
||||
#include <vm/vm_pageout.h> /* vm_contig_grow_cache */
|
||||
-#include <sys/vmmeter.h> /* cnt */
|
||||
+#include <vm/vm_radix.h>
|
||||
#include <sys/resourcevar.h>
|
||||
#include <machine/cpu.h>
|
||||
|
||||
@@ -155,6 +156,24 @@
|
||||
@@ -155,6 +157,24 @@
|
||||
*/
|
||||
#if 0 /** @todo Not available yet. */
|
||||
# define USE_KMEM_ALLOC_PROT
|
||||
|
|
Loading…
Add table
Reference in a new issue