VirtualBox

Changeset 4755

Show
Ignore:
Timestamp:
09/13/07 10:05:08 (1 year ago)
Author:
vboxsync
Message:

Reverse allocation for Windows hosts: physical pages are allocated in the support driver and mapped into user space
VMM: Use locked memory for the MM pagepool structures.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/include/VBox/sup.h

    r4071 r4755  
    560560SUPR0DECL(int) SUPR0MemGetPhys(PSUPDRVSESSION pSession, RTHCUINTPTR uPtr, PSUPPAGE paPages); 
    561561SUPR0DECL(int) SUPR0MemFree(PSUPDRVSESSION pSession, RTHCUINTPTR uPtr); 
     562SUPR0DECL(int) SUPR0PageAlloc(PSUPDRVSESSION pSession, uint32_t cb, PRTR3PTR ppvR3); 
     563SUPR0DECL(int) SUPR0PageGetPhys(PSUPDRVSESSION pSession, RTHCUINTPTR uPtr, uint32_t cPages, PSUPPAGE paPages); 
     564SUPR0DECL(int) SUPR0PageFree(PSUPDRVSESSION pSession, RTHCUINTPTR uPtr); 
     565SUPR0DECL(bool) SUPR0PageWasLockedByPageAlloc(PSUPDRVSESSION pSession, RTHCUINTPTR uPtr); 
    562566SUPR0DECL(int) SUPR0GipMap(PSUPDRVSESSION pSession, PRTR3PTR ppGipR3, PRTHCPHYS pHCPhysGid); 
    563567SUPR0DECL(int) SUPR0GipUnmap(PSUPDRVSESSION pSession); 
  • trunk/include/iprt/cdefs.h

    r4697 r4755  
    227227#endif 
    228228 
     229/** @def CTXTYPE 
     230 * Declare a type differently in GC vs R3 and R0. 
     231 * 
     232 * @param   GCType  The GC type. 
     233 * @param   R3Type  The R3 type. 
     234 * @param   R0Type  The R0 type. 
     235 * @remark  For pointers used only in one context use GCPTRTYPE(), HCPTRTYPE(), R3PTRTYPE() or R0PTRTYPE(). 
     236 */ 
     237#ifdef IN_GC 
     238# define CTR3R0TYPE(GCType, R3Type, R0Type)  GCType 
     239#else 
     240# define CTR3R0TYPE(GCType, R3Type, R0Type)  R3Type 
     241#endif 
     242 
    229243/** @def GCTYPE 
    230244 * Declare a type differently in GC and HC. 
     
    253267 */ 
    254268#define HCPTRTYPE(HCType)       CTXTYPE(RTHCPTR, HCType, HCType) 
     269 
     270/** @def R3R0PTRTYPE 
     271 * Declare a pointer which is used in HC, is explicitely valid in ring 3 and 0,  
     272 * but appears in structure(s) used by both HC and GC. The main purpose is to  
     273 * make sure structures have the same size when built for different architectures. 
     274 * 
     275 * @param   R3R0Type  The R3R0 type. 
     276 */ 
     277#define R3R0PTRTYPE(R3R0Type)       CTR3R0TYPE(RTHCPTR, R3R0Type, R3R0Type) 
    255278 
    256279/** @def R3PTRTYPE 
  • trunk/src/VBox/HostDrivers/Support/SUPDRV.h

    r4704 r4755  
    357357    /** Memory block (r3 and r0 mapping). */ 
    358358    MEMREF_TYPE_MEM, 
     359    /** Locked memory (r3 mapping only) allocated by the support driver. */ 
     360    MEMREF_TYPE_LOCKED_SUP, 
    359361    /** Blow the type up to 32-bit and mark the end. */ 
    360362    MEMREG_TYPE_32BIT_HACK = 0x7fffffff 
  • trunk/src/VBox/HostDrivers/Support/SUPDRVIOC.h

    r4249 r4755  
    134134/** Set the VM handle for doing fast call ioctl calls. */ 
    135135#define SUP_IOCTL_SET_VM_FOR_FAST   SUP_CTL_CODE(20) 
     136/** Allocate memory and map into the user process. */ 
     137#define SUP_IOCTL_PAGE_ALLOC        SUP_CTL_CODE(21) 
     138/** Free memory allocated with SUP_IOCTL_PAGE_ALLOC. */ 
     139#define SUP_IOCTL_PAGE_FREE         SUP_CTL_CODE(22) 
    136140 
    137141/** Fast path IOCtl: VMMR0_DO_RAW_RUN */ 
     
    598602} SUPSETVMFORFAST_IN, *PSUPSETVMFORFAST_IN; 
    599603 
     604typedef struct SUPALLOCPAGE_IN 
     605{ 
     606    /** Cookie. */ 
     607    uint32_t        u32Cookie; 
     608    /** Session cookie. */ 
     609    uint32_t        u32SessionCookie; 
     610    /** Number of pages to allocate */ 
     611    uint32_t        cPages; 
     612} SUPALLOCPAGE_IN, *PSUPALLOCPAGE_IN; 
     613 
     614typedef struct SUPALLOCPAGE_OUT 
     615{ 
     616    /** Cookie. */ 
     617    uint32_t            u32Cookie; 
     618    /** Returned ring-3 address */ 
     619    R3PTRTYPE(void *)   pvR3; 
     620} SUPALLOCPAGE_OUT, *PSUPALLOCPAGE_OUT; 
     621 
     622typedef struct SUPFREEPAGE_IN 
     623{ 
     624    /** Cookie. */ 
     625    uint32_t            u32Cookie; 
     626    /** Session cookie. */ 
     627    uint32_t        u32SessionCookie; 
     628    /** Address of memory range to free */ 
     629    R3PTRTYPE(void *)   pvR3; 
     630} SUPFREEPAGE_IN, *PSUPFREEPAGE_IN; 
     631 
    600632#pragma pack()                          /* paranoia */ 
    601633 
  • trunk/src/VBox/HostDrivers/Support/SUPDRVShared.c

    r4705 r4755  
    8585    { "SUPR0MemGetPhys",                        (void *)SUPR0MemGetPhys }, 
    8686    { "SUPR0MemFree",                           (void *)SUPR0MemFree }, 
     87#ifdef USE_NEW_OS_INTERFACE_FOR_MM 
     88    { "SUPR0PageAlloc",                         (void *)SUPR0PageAlloc }, 
     89    { "SUPR0PageGetPhys",                       (void *)SUPR0PageGetPhys }, 
     90    { "SUPR0PageFree",                          (void *)SUPR0PageFree }, 
     91#endif 
    8792    { "SUPR0Printf",                            (void *)SUPR0Printf }, 
    8893    { "RTMemAlloc",                             (void *)RTMemAlloc }, 
     
    462467            { 
    463468                int rc; 
     469                dprintf2(("eType=%d pvR0=%p pvR3=%p cb=%d\n", pBundle->aMem[i].eType, 
     470                          RTR0MemObjAddress(pBundle->aMem[i].MapObj), RTR0MemObjAddressR3(pBundle->aMem[i].MapObjR3), RTR0MemObjSize(pBundle->aMem[i].MemObj))); 
    464471                if (pBundle->aMem[i].MapObjR3 != NIL_RTR0MEMOBJ) 
    465472                { 
     
    13811388        } 
    13821389 
     1390#ifdef USE_NEW_OS_INTERFACE_FOR_MM 
     1391        case SUP_IOCTL_PAGE_ALLOC: 
     1392        { 
     1393            int               rc; 
     1394            PSUPALLOCPAGE_IN  pIn  = (PSUPALLOCPAGE_IN)pvIn; 
     1395            PSUPALLOCPAGE_OUT pOut = (PSUPALLOCPAGE_OUT)pvOut; 
     1396 
     1397            /* 
     1398             * Validate. 
     1399             */ 
     1400            if (    cbIn != sizeof(*pIn) 
     1401                ||  cbOut < sizeof(*pOut)) 
     1402            { 
     1403                dprintf(("SUP_IOCTL_PAGE_ALLOC: Invalid input/output sizes. cbIn=%ld expected %ld. cbOut=%ld expected %ld.\n", 
     1404                         (long)cbIn, (long)sizeof(*pIn), (long)cbOut, (long)sizeof(*pOut))); 
     1405                return SUPDRV_ERR_INVALID_PARAM; 
     1406            } 
     1407            if (    pIn->u32Cookie != pDevExt->u32Cookie 
     1408                ||  pIn->u32SessionCookie != pSession->u32Cookie  
     1409                ||  pOut->u32Cookie != pDevExt->u32Cookie) 
     1410            { 
     1411                dprintf(("SUP_IOCTL_PAGE_ALLOC: Cookie mismatch {%#x,%#x} != {%#x,%#x}!\n", 
     1412                         pIn->u32Cookie,  pDevExt->u32Cookie, pIn->u32SessionCookie, pSession->u32Cookie)); 
     1413                return SUPDRV_ERR_INVALID_MAGIC; 
     1414            } 
     1415            /* 
     1416             * Execute. 
     1417             */ 
     1418            *pcbReturned = sizeof(*pOut); 
     1419            rc = SUPR0PageAlloc(pSession, pIn->cPages, &pOut->pvR3); 
     1420            if (rc) 
     1421                *pcbReturned = 0; 
     1422            return rc; 
     1423        } 
     1424 
     1425        case SUP_IOCTL_PAGE_FREE: 
     1426        { 
     1427            PSUPFREEPAGE_IN pIn = (PSUPFREEPAGE_IN)pvIn; 
     1428 
     1429            /* 
     1430             * Validate. 
     1431             */ 
     1432            if (    cbIn != sizeof(*pIn) 
     1433                ||  cbOut != 0) 
     1434            { 
     1435                dprintf(("SUP_IOCTL_PAGE_FREE: Invalid input/output sizes. cbIn=%ld expected %ld. cbOut=%ld expected %ld.\n", 
     1436                         (long)cbIn, (long)sizeof(*pIn), (long)cbOut, (long)0)); 
     1437                return SUPDRV_ERR_INVALID_PARAM; 
     1438            } 
     1439            if (    pIn->u32Cookie != pDevExt->u32Cookie 
     1440                ||  pIn->u32SessionCookie != pSession->u32Cookie) 
     1441            { 
     1442                dprintf(("SUP_IOCTL_PAGE_FREE: Cookie mismatch {%#x,%#x} != {%#x,%#x}!\n", 
     1443                         pIn->u32Cookie, pDevExt->u32Cookie, pIn->u32SessionCookie, pSession->u32Cookie)); 
     1444                return SUPDRV_ERR_INVALID_MAGIC; 
     1445            } 
     1446            /* 
     1447             * Execute. 
     1448             */ 
     1449            return SUPR0PageFree(pSession, (RTHCUINTPTR)pIn->pvR3); 
     1450        } 
     1451#endif /* USE_NEW_OS_INTERFACE_FOR_MM */ 
    13831452 
    13841453        default: 
     
    17701839 
    17711840#ifdef USE_NEW_OS_INTERFACE_FOR_MM 
     1841    /* First check if we allocated it using SUPPageAlloc; if so then we don't need to lock it again */ 
     1842    rc = SUPR0PageGetPhys(pSession, pvR3, cPages, paPages); 
     1843    if (RT_SUCCESS(rc)) 
     1844        return rc; 
     1845 
    17721846    /* 
    17731847     * Let IPRT do the job. 
     
    18361910{ 
    18371911    dprintf(("SUPR0UnlockMem: pSession=%p pvR3=%p\n", pSession, (void *)pvR3)); 
     1912 
     1913    /* SUPR0PageFree will unlock SUPR0PageAlloc allocations; ignore this call */ 
     1914    if (SUPR0PageWasLockedByPageAlloc(pSession, pvR3)) 
     1915    { 
     1916        dprintf(("Page will be unlocked in SUPR0PageFree -> ignore\n")); 
     1917        return 0; 
     1918    } 
     1919 
    18381920    return supdrvMemRelease(pSession, (RTHCUINTPTR)pvR3, MEMREF_TYPE_LOCKED); 
    18391921} 
     
    20552137    return supdrvMemRelease(pSession, uPtr, MEMREF_TYPE_LOW); 
    20562138} 
     2139 
    20572140 
    20582141 
     
    22372320 
    22382321 
     2322#ifdef USE_NEW_OS_INTERFACE_FOR_MM 
     2323/** 
     2324 * Allocates a chunk of memory with only a R3 mappings. 
     2325 * The memory is fixed and it's possible to query the physical addresses using SUPR0MemGetPhys(). 
     2326 * 
     2327 * @returns 0 on success. 
     2328 * @returns SUPDRV_ERR_* on failure. 
     2329 * @param   pSession    The session to associated the allocation with. 
     2330 * @param   cb          Number of bytes to allocate. 
     2331 * @param   ppvR3       Where to store the address of the Ring-3 mapping. 
     2332 */ 
     2333SUPR0DECL(int) SUPR0PageAlloc(PSUPDRVSESSION pSession, uint32_t cb, PRTR3PTR ppvR3) 
     2334{ 
     2335    int             rc; 
     2336    SUPDRVMEMREF    Mem = {0}; 
     2337    dprintf(("SUPR0PageAlloc: pSession=%p cb=%d ppvR3=%p\n", pSession, cb, ppvR3)); 
     2338 
     2339    /* 
     2340     * Validate input. 
     2341     */ 
     2342    if (!pSession || !ppvR3) 
     2343    { 
     2344        dprintf(("Null pointer. All of these should be set: pSession=%p ppvR3=%p\n", 
     2345                 pSession, ppvR3)); 
     2346        return SUPDRV_ERR_INVALID_PARAM; 
     2347 
     2348    } 
     2349    if (cb < 1 || cb >= 4096) 
     2350    { 
     2351        dprintf(("Illegal request cb=%u; must be greater than 0 and smaller than 16MB.\n", cb)); 
     2352        return SUPDRV_ERR_INVALID_PARAM; 
     2353    } 
     2354 
     2355    /* 
     2356     * Let IPRT do the work. 
     2357     */ 
     2358    rc = RTR0MemObjAllocPhysNC(&Mem.MemObj, cb * PAGE_SIZE, NIL_RTHCPHYS); 
     2359    if (RT_SUCCESS(rc)) 
     2360    { 
     2361        int rc2; 
     2362        rc = RTR0MemObjMapUser(&Mem.MapObjR3, Mem.MemObj, (RTR3PTR)-1, 0, 
     2363                               RTMEM_PROT_EXEC | RTMEM_PROT_WRITE | RTMEM_PROT_READ, RTR0ProcHandleSelf()); 
     2364        if (RT_SUCCESS(rc)) 
     2365        { 
     2366            Mem.eType = MEMREF_TYPE_LOCKED_SUP; 
     2367            rc = supdrvMemAdd(&Mem, pSession); 
     2368            if (!rc) 
     2369            { 
     2370                *ppvR3 = RTR0MemObjAddressR3(Mem.MapObjR3); 
     2371                return 0; 
     2372            } 
     2373            rc2 = RTR0MemObjFree(Mem.MapObjR3, false); 
     2374            AssertRC(rc2); 
     2375        } 
     2376 
     2377        rc2 = RTR0MemObjFree(Mem.MemObj, false); 
     2378        AssertRC(rc2); 
     2379    } 
     2380    return rc; 
     2381} 
     2382 
     2383/** 
     2384 * Check if the pages were locked by SUPR0PageAlloc 
     2385 * 
     2386 * @returns boolean 
     2387 * @param   pSession        The session to which the memory was allocated. 
     2388 * @param   uPtr            The Ring-3 address returned by SUPR0PageAlloc(). 
     2389 */ 
     2390SUPR0DECL(bool) SUPR0PageWasLockedByPageAlloc(PSUPDRVSESSION pSession, RTHCUINTPTR uPtr) 
     2391{ 
     2392    PSUPDRVBUNDLE pBundle; 
     2393    RTSPINLOCKTMP SpinlockTmp = RTSPINLOCKTMP_INITIALIZER; 
     2394    dprintf(("SUPR0PageIsLockedByPageAlloc: pSession=%p uPtr=%p\n", pSession, (void *)uPtr)); 
     2395 
     2396    /* 
     2397     * Validate input. 
     2398     */ 
     2399    if (!pSession) 
     2400    { 
     2401        dprintf(("pSession must not be NULL!")); 
     2402        return false; 
     2403    } 
     2404    if (!uPtr) 
     2405    { 
     2406        dprintf(("Illegal address uPtr=%p\n", (void *)uPtr)); 
     2407        return false; 
     2408    } 
     2409 
     2410    /* 
     2411     * Search for the address. 
     2412     */ 
     2413    RTSpinlockAcquire(pSession->Spinlock, &SpinlockTmp); 
     2414    for (pBundle = &pSession->Bundle; pBundle; pBundle = pBundle->pNext) 
     2415    { 
     2416        if (pBundle->cUsed > 0) 
     2417        { 
     2418            unsigned i; 
     2419            for (i = 0; i < sizeof(pBundle->aMem) / sizeof(pBundle->aMem[0]); i++) 
     2420            { 
     2421                if (    pBundle->aMem[i].eType == MEMREF_TYPE_LOCKED_SUP 
     2422                    &&  pBundle->aMem[i].MemObj != NIL_RTR0MEMOBJ 
     2423                    &&  (   (RTHCUINTPTR)RTR0MemObjAddress(pBundle->aMem[i].MemObj) == uPtr 
     2424                         || (   pBundle->aMem[i].MapObjR3 != NIL_RTR0MEMOBJ 
     2425                             && RTR0MemObjAddressR3(pBundle->aMem[i].MapObjR3) == uPtr) 
     2426                        ) 
     2427                   ) 
     2428                { 
     2429                    RTSpinlockRelease(pSession->Spinlock, &SpinlockTmp); 
     2430                    return true; 
     2431                } 
     2432            } 
     2433        } 
     2434    } 
     2435    RTSpinlockRelease(pSession->Spinlock, &SpinlockTmp); 
     2436    return false; 
     2437} 
     2438 
     2439/** 
     2440 * Get the physical addresses of memory allocated using SUPR0PageAlloc(). 
     2441 * 
     2442 * @returns 0 on success. 
     2443 * @returns SUPDRV_ERR_* on failure. 
     2444 * @param   pSession        The session to which the memory was allocated. 
     2445 * @param   uPtr            The Ring-3 address returned by SUPR0PageAlloc(). 
     2446 * @param   cPages          Number of pages in paPages 
     2447 * @param   paPages         Where to store the physical addresses. 
     2448 */ 
     2449SUPR0DECL(int) SUPR0PageGetPhys(PSUPDRVSESSION pSession, RTHCUINTPTR uPtr, uint32_t cPages, PSUPPAGE paPages) 
     2450{ 
     2451    PSUPDRVBUNDLE pBundle; 
     2452    RTSPINLOCKTMP SpinlockTmp = RTSPINLOCKTMP_INITIALIZER; 
     2453    dprintf(("SUPR0PageGetPhys: pSession=%p uPtr=%p paPages=%p\n", pSession, (void *)uPtr, paPages)); 
     2454 
     2455    /* 
     2456     * Validate input. 
     2457     */ 
     2458    if (!pSession) 
     2459    { 
     2460        dprintf(("pSession must not be NULL!")); 
     2461        return SUPDRV_ERR_INVALID_PARAM; 
     2462    } 
     2463    if (!uPtr || !paPages) 
     2464    { 
     2465        dprintf(("Illegal address uPtr=%p or/and paPages=%p\n", (void *)uPtr, paPages)); 
     2466        return SUPDRV_ERR_INVALID_PARAM; 
     2467    } 
     2468 
     2469    /* 
     2470     * Search for the address. 
     2471     */ 
     2472    RTSpinlockAcquire(pSession->Spinlock, &SpinlockTmp); 
     2473    for (pBundle = &pSession->Bundle; pBundle; pBundle = pBundle->pNext) 
     2474    { 
     2475        if (pBundle->cUsed > 0) 
     2476        { 
     2477            unsigned i; 
     2478            for (i = 0; i < sizeof(pBundle->aMem) / sizeof(pBundle->aMem[0]); i++) 
     2479            { 
     2480                if (    pBundle->aMem[i].eType == MEMREF_TYPE_LOCKED_SUP 
     2481                    &&  pBundle->aMem[i].MemObj != NIL_RTR0MEMOBJ 
     2482                    &&  (   (RTHCUINTPTR)RTR0MemObjAddress(pBundle->aMem[i].MemObj) == uPtr 
     2483                         || (   pBundle->aMem[i].MapObjR3 != NIL_RTR0MEMOBJ 
     2484                             && RTR0MemObjAddressR3(pBundle->aMem[i].MapObjR3) == uPtr) 
     2485                        ) 
     2486                   ) 
     2487                { 
     2488                    unsigned iPage; 
     2489                    cPages = RT_MIN(RTR0MemObjSize(pBundle->aMem[i].MemObj) >> PAGE_SHIFT, cPages); 
     2490                    for (iPage = 0; iPage < cPages; iPage++) 
     2491                    { 
     2492                        paPages[iPage].Phys = RTR0MemObjGetPagePhysAddr(pBundle->aMem[i].MemObj, iPage); 
     2493                        paPages[iPage].uReserved = 0; 
     2494                    } 
     2495                    RTSpinlockRelease(pSession->Spinlock, &SpinlockTmp); 
     2496                    return 0; 
     2497                } 
     2498            } 
     2499        } 
     2500    } 
     2501    RTSpinlockRelease(pSession->Spinlock, &SpinlockTmp); 
     2502    dprintf(("Failed to find %p!!!\n", (void *)uPtr)); 
     2503    return SUPDRV_ERR_INVALID_PARAM; 
     2504} 
     2505 
     2506 
     2507/** 
     2508 * Free memory allocated by SUPR0PageAlloc(). 
     2509 * 
     2510 * @returns 0 on success. 
     2511 * @returns SUPDRV_ERR_* on failure. 
     2512 * @param   pSession        The session owning the allocation. 
     2513 * @param   uPtr            The Ring-3 address returned by SUPR0PageAlloc(). 
     2514 */ 
     2515SUPR0DECL(int) SUPR0PageFree(PSUPDRVSESSION pSession, RTHCUINTPTR uPtr) 
     2516{ 
     2517    dprintf(("SUPR0PageFree: pSession=%p uPtr=%p\n", pSession, (void *)uPtr)); 
     2518    return supdrvMemRelease(pSession, uPtr, MEMREF_TYPE_LOCKED_SUP); 
     2519} 
     2520#endif /* USE_NEW_OS_INTERFACE_FOR_MM */ 
     2521 
     2522 
    22392523/** 
    22402524 * Maps the GIP into userspace and/or get the physical address of the GIP. 
  • trunk/src/VBox/HostDrivers/Support/SUPLib.cpp

    r4614 r4755  
    725725} 
    726726 
    727  
    728727SUPR3DECL(int) SUPPageAlloc(size_t cPages, void **ppvPages) 
    729728{ 
     
    741740    *ppvPages = NULL; 
    742741 
     742#ifdef RT_OS_WINDOWS 
     743    SUPALLOCPAGE_IN  In; 
     744    SUPALLOCPAGE_OUT Out; 
     745 
     746    In.u32Cookie        = g_u32Cookie; 
     747    In.u32SessionCookie = g_u32SessionCookie; 
     748    In.cPages           = cPages; 
     749    Out.u32Cookie       = g_u32Cookie; 
     750    int rc = suplibOsIOCtl(SUP_IOCTL_PAGE_ALLOC, &In, sizeof(In), &Out, sizeof(Out)); 
     751    if (VBOX_SUCCESS(rc)) 
     752        *ppvPages = Out.pvR3; 
     753 
     754    return rc; 
     755#else 
    743756    /* 
    744757     * Call OS specific worker. 
    745758     */ 
    746759    return suplibOsPageAlloc(cPages, ppvPages); 
     760#endif 
    747761} 
    748762 
     
    757771        return VINF_SUCCESS; 
    758772 
     773#ifdef RT_OS_WINDOWS 
     774    SUPFREEPAGE_IN  In; 
     775 
     776    In.u32Cookie        = g_u32Cookie; 
     777    In.u32SessionCookie = g_u32SessionCookie; 
     778    In.pvR3             = pvPages; 
     779    return suplibOsIOCtl(SUP_IOCTL_PAGE_FREE, &In, sizeof(In), NULL, 0); 
     780#else 
    759781    /* 
    760782     * Call OS specific worker. 
    761783     */ 
    762784    return suplibOsPageFree(pvPages, cPages); 
     785#endif 
    763786} 
    764787 
  • trunk/src/VBox/HostDrivers/Support/win/SUPDrv-win.cpp

    r4226 r4755  
    320320    int         rc = 0; 
    321321    dprintf2(("VBoxSupDrvDeviceControlSlow(%p,%p): ioctl=%#x pBuf=%p cbIn=%#x cbOut=%#x pSession=%p\n", 
    322              pDevObj, pIrp, pStack->Parameters.DeviceIoControl.IoControlCode, 
    323              pBuf, pStack->Parameters.DeviceIoControl.InputBufferLength, 
     322             pDevExt, pIrp, pStack->Parameters.DeviceIoControl.IoControlCode, 
     323             pIrp->AssociatedIrp.SystemBuffer, pStack->Parameters.DeviceIoControl.InputBufferLength, 
    324324             pStack->Parameters.DeviceIoControl.OutputBufferLength, pSession)); 
    325325 
  • trunk/src/VBox/Runtime/r0drv/memobj-r0drv.cpp

    r4233 r4755  
    187187                         && pMem->u.Mapping.R0Process != NIL_RTR0PROCESS) 
    188188                    ||  (   pMem->enmType == RTR0MEMOBJTYPE_LOCK 
     189                         && pMem->u.Lock.R0Process != NIL_RTR0PROCESS) 
     190                    ||  (   pMem->enmType == RTR0MEMOBJTYPE_PHYS_NC 
    189191                         && pMem->u.Lock.R0Process != NIL_RTR0PROCESS) 
    190192                    ||  (   pMem->enmType == RTR0MEMOBJTYPE_RES_VIRT 
     
    467469        R0Process = RTR0ProcHandleSelf(); 
    468470 
    469     /* do the allocation. */ 
     471    /* do the locking. */ 
    470472    return rtR0MemObjNativeLockUser(pMemObj, R3PtrAligned, cbAligned, R0Process); 
    471473} 
  • trunk/src/VBox/VMM/MMInternal.h

    r4388 r4755  
    648648 
    649649    /** Page pool. (HC only) */ 
    650     HCPTRTYPE(PMMPAGEPOOL)      pPagePool; 
     650    R3R0PTRTYPE(PMMPAGEPOOL)    pPagePool; 
    651651    /** Page pool pages in low memory. (HC only) */ 
    652     HCPTRTYPE(PMMPAGEPOOL)      pPagePoolLow; 
     652    R3R0PTRTYPE(PMMPAGEPOOL)    pPagePoolLow; 
    653653 
    654654    /** Pointer to the dummy page. 
  • trunk/src/VBox/VMM/MMPagePool.cpp

    r4071 r4755  
    6161     * Allocate the pool structures. 
    6262     */ 
    63     pVM->mm.s.pPagePool = (PMMPAGEPOOL)MMR3HeapAllocZ(pVM, MM_TAG_MM_PAGE, sizeof(MMPAGEPOOL)); 
    64     if (!pVM->mm.s.pPagePool
    65         return VERR_NO_MEMORY
     63    int rc = SUPPageAlloc(RT_ALIGN_32(sizeof(*pVM->mm.s.pPagePool), PAGE_SIZE), (void **)pVM->mm.s.pPagePool); 
     64    if (VBOX_FAILURE(rc)
     65        return rc
    6666    pVM->mm.s.pPagePool->pVM = pVM; 
    6767    STAM_REG(pVM, &pVM->mm.s.pPagePool->cPages,         STAMTYPE_U32,     "/MM/Page/Def/cPages",        STAMUNIT_PAGES, "Number of pages in the default pool."); 
     
    7474    STAM_REG(pVM, &pVM->mm.s.pPagePool->cErrors,        STAMTYPE_COUNTER, "/MM/Page/Def/cErrors",       STAMUNIT_ERRORS,"Number of errors for the default pool."); 
    7575 
    76     pVM->mm.s.pPagePoolLow = (PMMPAGEPOOL)MMR3HeapAllocZ(pVM, MM_TAG_MM_PAGE, sizeof(MMPAGEPOOL)); 
    77     if (!pVM->mm.s.pPagePoolLow
    78         return VERR_NO_MEMORY
     76    rc = SUPPageAlloc(RT_ALIGN_32(sizeof(*pVM->mm.s.pPagePoolLow), PAGE_SIZE), (void **)pVM->mm.s.pPagePoolLow); 
     77    if (VBOX_FAILURE(rc)
     78        return rc
    7979    pVM->mm.s.pPagePoolLow->pVM = pVM; 
    8080    pVM->mm.s.pPagePoolLow->fLow = true; 
     
    121121        } 
    122122 
     123        SUPPageFree(pVM->mm.s.pPagePool, RT_ALIGN_32(sizeof(*pVM->mm.s.pPagePool), PAGE_SIZE)); 
    123124        pVM->mm.s.pPagePool = NULL; 
    124125    } 
     
    141142        } 
    142143 
    143         pVM->mm.s.pPagePool = NULL; 
     144        SUPPageFree(pVM->mm.s.pPagePoolLow, RT_ALIGN_32(sizeof(*pVM->mm.s.pPagePoolLow), PAGE_SIZE)); 
     145        pVM->mm.s.pPagePoolLow = NULL; 
    144146    } 
    145147} 
  • trunk/src/VBox/VMM/VMMR0/VMMR0.cpp

    r4738 r4755  
    509509        { 
    510510            int rc; 
     511            RTCCUINTREG fFlags; 
    511512 
    512513            STAM_COUNTER_INC(&pVM->vmm.s.StatRunGC); 
     514            fFlags = ASMIntDisableFlags(); 
    513515            rc = HWACCMR0Enable(pVM); 
    514516            if (VBOX_SUCCESS(rc)) 
     
    525527            } 
    526528            pVM->vmm.s.iLastGCRc = rc; 
     529            ASMSetFlags(fFlags); 
    527530 
    528531#ifdef VBOX_WITH_STATISTICS 

© 2008 Sun Microsystems, Inc.
ContactPrivacy policy