Re: (286206) fix for virtualbox-70 after current commit a3a88ed

From: Michael Butler <imb_at_protected-networks.net>
Date: Sun, 27 Apr 2025 13:18:16 UTC
On 4/27/25 08:54, Michael Butler wrote:
> On 4/23/25 01:22, Graham Perrin wrote:
>> On 20/04/2025 16:21, Michael Butler wrote:
>>> In case anyone else is stuck on this ..
>>>
>>> Recent changes in -current to remove vm_page_prev and vm_page_next 
>>> break compilation and loading of the virtualbox kernel modules.
>>>
>>> This patch moves the troublesome call to the new KPI. I only tested 
>>> on virtualbox-70
>>
>>
>> Report 286193 was followed by <https://bugs.freebsd.org/bugzilla/ 
>> show_bug.cgi?id=286206>
>>
>> I'm testing the patch at attachment 259804.
> 
> Commit a114891 now breaks vbox kmods similarly :-(

To resolve this, it seems the following patch fragment works ..

*** src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c~      Sun Apr 
27 09:08:34 2025
--- src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c       Sun Apr 
27 09:14:10 2025
***************
*** 471,477 ****
--- 471,481 ----
               {
                   Assert(enmType == RTR0MEMOBJTYPE_PHYS);
                   VM_OBJECT_WLOCK(pMemFreeBSD->pObject);
+ #if __FreeBSD_version < 1500038
                   pMemFreeBSD->Core.u.Phys.PhysBase = 
VM_PAGE_TO_PHYS(vm_page_find_least(pMemFreeBSD->pObject, 0));
+ #else
+                 pMemFreeBSD->Core.u.Phys.PhysBase = 
VM_PAGE_TO_PHYS(vm_radix_lookup_ge(&pMemFreeBSD->pObject->rtree, 0));
+ #endif
                   VM_OBJECT_WUNLOCK(pMemFreeBSD->pObject);
                   pMemFreeBSD->Core.u.Phys.fAllocated = true;
               }