Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 24 Feb 2010 21:50:29 +0000 (GMT)
From:      Alexander Eichner <alexeichi@yahoo.de>
To:        freebsd-emulation@freebsd.org
Subject:   Patch to fix VirtualBox with recent kernel versions
Message-ID:  <663605.67178.qm@web27601.mail.ukl.yahoo.com>

next in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
Hi,

as promised to decke here is the final patch to fix VirtualBox with recent FreeBSD kernel versions. As it is quite different to the one posted to freebsd-current please test it first before including it in the port. The problem seems to be 32bit specific and I don't have a 32bit FreeBSD system here to test unfortunately.

Regards,
Alexander Eichner

PS: the OSE repository is working again. :)

__________________________________________________
Do You Yahoo!?
Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen Massenmails. 
http://mail.yahoo.com 
[-- Attachment #2 --]
Index: src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c
===================================================================
--- src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c	(revision 57646)
+++ src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c	(working copy)
@@ -739,12 +739,26 @@
             }
             /* fall thru*/
         case RTR0MEMOBJTYPE_PAGE:
-        case RTR0MEMOBJTYPE_MAPPING:
         {
-            uint8_t *pb = (uint8_t *)pMemFreeBSD->Core.pv + (iPage << PAGE_SHIFT);
+            vm_offset_t pb = (vm_offset_t)pMemFreeBSD->Core.pv + (iPage << PAGE_SHIFT);
             return vtophys(pb);
         }
+        case RTR0MEMOBJTYPE_MAPPING:
+        {
+            vm_offset_t pb = (vm_offset_t)pMemFreeBSD->Core.pv + (iPage << PAGE_SHIFT);
 
+            if (pMemFreeBSD->Core.u.Mapping.R0Process != NIL_RTR0PROCESS)
+            {
+                struct proc    *pProc     = (struct proc *)pMemFreeBSD->Core.u.Mapping.R0Process;
+                struct vm_map  *pProcMap  = &pProc->p_vmspace->vm_map;
+                pmap_t pPhysicalMap       = pProcMap->pmap;
+
+                return pmap_extract(pPhysicalMap, pb);
+            }
+            else
+                return vtophys(pb);
+        }
+
         case RTR0MEMOBJTYPE_CONT:
             return pMemFreeBSD->Core.u.Cont.Phys + (iPage << PAGE_SHIFT);
 

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?663605.67178.qm>