VirtualBox

Changeset 4161 in vbox


Ignore:
Timestamp:
Aug 15, 2007 9:24:10 PM (17 years ago)
Author:
vboxsync
Message:

USE_NEW_OS_INTERFACE_FOR_MM & USE_NEW_OS_INTERFACE_FOR_GIP.

Location:
trunk/src/VBox/HostDrivers/Support
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/SUPDRV.h

    r4156 r4161  
    2828#include <iprt/asm.h>
    2929#include <VBox/sup.h>
    30 #if defined(USE_NEW_OS_INTERFACE) || defined(USB_NEW_OS_INTERFACE_FOR_LOW)
     30#ifdef USE_NEW_OS_INTERFACE
     31# define USE_NEW_OS_INTERFACE_FOR_MM
     32# define USE_NEW_OS_INTERFACE_FOR_GIP
     33# undef  USE_NEW_OS_INTERFACE_FOR_LOW
     34#endif
     35#if defined(USE_NEW_OS_INTERFACE) || defined(USE_NEW_OS_INTERFACE_FOR_LOW) || defined(USE_NEW_OS_INTERFACE_FOR_MM) || defined(USE_NEW_OS_INTERFACE_FOR_GIP)
    3136# include <iprt/memobj.h>
    3237# include <iprt/time.h>
     
    362367typedef struct SUPDRVMEMREF
    363368{
    364 #ifdef USE_NEW_OS_INTERFACE
     369#ifdef USE_NEW_OS_INTERFACE_FOR_MM
    365370    /** The memory object handle. */
    366371    RTR0MEMOBJ          MemObj;
     
    370375    SUPDRVMEMREFTYPE    eType;
    371376
    372 #else /* !USE_NEW_OS_INTERFACE */
     377#else /* !USE_NEW_OS_INTERFACE_FOR_MM */
    373378    /** Pointer to the R0 mapping of the memory.
    374379     * Set to NULL if N/A. */
     
    424429#endif
    425430        } mem;
    426 #if defined(USB_NEW_OS_INTERFACE_FOR_LOW)
     431#if defined(USE_NEW_OS_INTERFACE_FOR_LOW)
    427432        struct
    428433        {
     
    434439#endif
    435440    } u;
    436 #endif /* !USE_NEW_OS_INTERFACE */
     441#endif /* !USE_NEW_OS_INTERFACE_FOR_MM */
    437442} SUPDRVMEMREF, *PSUPDRVMEMREF;
    438443
     
    566571    /** Spinlock protecting the bundles and the GIP members. */
    567572    RTSPINLOCK                  Spinlock;
    568 #ifdef USE_NEW_OS_INTERFACE
     573#ifdef USE_NEW_OS_INTERFACE_FOR_GIP
    569574    /** The ring-3 mapping of the GIP (readonly). */
    570575    RTR0MEMOBJ                  GipMapObjR3;
     
    651656     * (The updates are suspend while cGipUsers is 0.)*/
    652657    uint32_t volatile       cGipUsers;
    653 #ifdef USE_NEW_OS_INTERFACE
     658#ifdef USE_NEW_OS_INTERFACE_FOR_GIP
    654659    /** The ring-0 memory object handle for the GIP page. */
    655660    RTR0MEMOBJ              GipMemObj;
     
    703708void VBOXCALL   supdrvOSObjInitCreator(PSUPDRVOBJ pObj, PSUPDRVSESSION pSession);
    704709bool VBOXCALL   supdrvOSObjCanAccess(PSUPDRVOBJ pObj, PSUPDRVSESSION pSession, const char *pszObjName, int *prc);
    705 #ifndef USE_NEW_OS_INTERFACE
     710#ifndef USE_NEW_OS_INTERFACE_FOR_MM
    706711int  VBOXCALL   supdrvOSLockMemOne(PSUPDRVMEMREF pMem, PSUPPAGE paPages);
    707712void VBOXCALL   supdrvOSUnlockMemOne(PSUPDRVMEMREF pMem);
     
    713718void VBOXCALL   supdrvOSMemGetPages(PSUPDRVMEMREF pMem, PSUPPAGE paPages);
    714719void VBOXCALL   supdrvOSMemFreeOne(PSUPDRVMEMREF pMem);
     720#endif
     721#ifndef USE_NEW_OS_INTERFACE_FOR_GIP
    715722int  VBOXCALL   supdrvOSGipMap(PSUPDRVDEVEXT pDevExt, PSUPGLOBALINFOPAGE *ppGip);
    716723int  VBOXCALL   supdrvOSGipUnmap(PSUPDRVDEVEXT pDevExt, PSUPGLOBALINFOPAGE pGip);
  • trunk/src/VBox/HostDrivers/Support/SUPDRVShared.c

    r4138 r4161  
    160160static int      supdrvIOCtl_GetPagingMode(PSUPGETPAGINGMODE_OUT pOut);
    161161static SUPGIPMODE supdrvGipDeterminTscMode(void);
    162 #ifdef USE_NEW_OS_INTERFACE
     162#ifdef USE_NEW_OS_INTERFACE_FOR_GIP
    163163static int      supdrvGipCreate(PSUPDRVDEVEXT pDevExt);
    164164static int      supdrvGipDestroy(PSUPDRVDEVEXT pDevExt);
     
    192192            if (!rc)
    193193            {
    194 #ifdef USE_NEW_OS_INTERFACE
     194#ifdef USE_NEW_OS_INTERFACE_FOR_GIP
    195195                rc = supdrvGipCreate(pDevExt);
    196196                if (RT_SUCCESS(rc))
     
    277277    }
    278278
    279 #ifdef USE_NEW_OS_INTERFACE
     279#ifdef USE_NEW_OS_INTERFACE_FOR_GIP
    280280    /* kill the GIP */
    281281    supdrvGipDestroy(pDevExt);
     
    456456        for (i = 0; i < sizeof(pBundle->aMem) / sizeof(pBundle->aMem[0]); i++)
    457457        {
    458 #ifdef USE_NEW_OS_INTERFACE
     458#ifdef USE_NEW_OS_INTERFACE_FOR_MM
    459459            if (pBundle->aMem[i].MemObj != NIL_RTR0MEMOBJ)
    460460            {
     
    472472            }
    473473
    474 #else /* !USE_NEW_OS_INTERFACE */
     474#else /* !USE_NEW_OS_INTERFACE_FOR_MM */
    475475            if (    pBundle->aMem[i].pvR0
    476476                ||  pBundle->aMem[i].pvR3)
     
    497497                pBundle->aMem[i].eType = MEMREF_TYPE_UNUSED;
    498498            }
    499 #endif /* !USE_NEW_OS_INTERFACE */
     499#endif /* !USE_NEW_OS_INTERFACE_FOR_MM */
    500500        }
    501501
     
    542542     */
    543543    dprintf2(("umapping GIP:\n"));
    544 #ifdef USE_NEW_OS_INTERFACE
     544#ifdef USE_NEW_OS_INTERFACE_FOR_GIP
    545545    if (pSession->GipMapObjR3 != NIL_RTR0MEMOBJ)
    546546#else
     
    549549    {
    550550        SUPR0GipUnmap(pSession);
    551 #ifndef USE_NEW_OS_INTERFACE
     551#ifndef USE_NEW_OS_INTERFACE_FOR_GIP
    552552        pSession->pGip = NULL;
    553553#endif
     
    17671767    }
    17681768
    1769 #ifdef USE_NEW_OS_INTERFACE
     1769#ifdef USE_NEW_OS_INTERFACE_FOR_MM
    17701770    /*
    17711771     * Let IPRT do the job.
     
    17751775    if (RT_SUCCESS(rc))
    17761776    {
     1777        unsigned iPage = cPages;
    17771778        AssertMsg(RTR0MemObjAddressR3(Mem.MemObj) == pvR3, ("%p == %p\n", RTR0MemObjAddressR3(Mem.MemObj), pvR3));
    17781779        AssertMsg(RTR0MemObjSize(Mem.MemObj) == cb, ("%x == %x\n", RTR0MemObjSize(Mem.MemObj), cb));
    17791780
    1780         unsigned iPage = cPages;
    17811781        while (iPage-- > 0)
    17821782        {
     
    17991799    }
    18001800
    1801 #else /* !USE_NEW_OS_INTERFACE */
     1801#else /* !USE_NEW_OS_INTERFACE_FOR_MM */
    18021802
    18031803    /*
     
    18181818    if (rc)
    18191819        supdrvOSUnlockMemOne(&Mem);
    1820 #endif /* !USE_NEW_OS_INTERFACE */
     1820#endif /* !USE_NEW_OS_INTERFACE_FOR_MM */
    18211821    return rc;
    18221822}
     
    18721872    }
    18731873
    1874 #ifdef USE_NEW_OS_INTERFACE
     1874#ifdef USE_NEW_OS_INTERFACE_FOR_MM
    18751875    /*
    18761876     * Let IPRT do the job.
     
    19011901    }
    19021902
    1903 #else /* !USE_NEW_OS_INTERFACE */
     1903#else /* !USE_NEW_OS_INTERFACE_FOR_MM */
    19041904
    19051905    /*
     
    19221922    if (rc)
    19231923        supdrvOSContFreeOne(&Mem);
    1924 #endif /* !USE_NEW_OS_INTERFACE */
     1924#endif /* !USE_NEW_OS_INTERFACE_FOR_MM */
    19251925
    19261926    return rc;
     
    19771977    }
    19781978
    1979 #ifdef USE_NEW_OS_INTERFACE
     1979#ifdef USE_NEW_OS_INTERFACE_FOR_MM
    19801980    /*
    19811981     * Let IPRT do the work.
     
    20122012    }
    20132013
    2014 #else /* !USE_NEW_OS_INTERFACE */
     2014#else /* !USE_NEW_OS_INTERFACE_FOR_MM */
    20152015
    20162016    /*
     
    20352035    if (rc)
    20362036        supdrvOSLowFreeOne(&Mem);
    2037 #endif /* !USE_NEW_OS_INTERFACE */
     2037#endif /* !USE_NEW_OS_INTERFACE_FOR_MM */
    20382038    return rc;
    20392039}
     
    20882088    }
    20892089
    2090 #ifdef USE_NEW_OS_INTERFACE
     2090#ifdef USE_NEW_OS_INTERFACE_FOR_MM
    20912091    /*
    20922092     * Let IPRT do the work.
     
    21162116    }
    21172117
    2118 #else /* !USE_NEW_OS_INTERFACE */
     2118#else /* !USE_NEW_OS_INTERFACE_FOR_MM */
    21192119
    21202120    /*
     
    21372137    if (rc)
    21382138        supdrvOSMemFreeOne(&Mem);
    2139 #endif /* !USE_NEW_OS_INTERFACE */
     2139#endif /* !USE_NEW_OS_INTERFACE_FOR_MM */
    21402140    return rc;
    21412141}
     
    21822182            for (i = 0; i < sizeof(pBundle->aMem) / sizeof(pBundle->aMem[0]); i++)
    21832183            {
    2184 #ifdef USE_NEW_OS_INTERFACE
     2184#ifdef USE_NEW_OS_INTERFACE_FOR_MM
    21852185                if (    pBundle->aMem[i].eType == MEMREF_TYPE_MEM
    21862186                    &&  pBundle->aMem[i].MemObj != NIL_RTR0MEMOBJ
     
    22012201                    return 0;
    22022202                }
    2203 #else /* !USE_NEW_OS_INTERFACE */
     2203#else /* !USE_NEW_OS_INTERFACE_FOR_MM */
    22042204                if (    pBundle->aMem[i].eType == MEMREF_TYPE_MEM
    22052205                    &&  (   (RTHCUINTPTR)pBundle->aMem[i].pvR0 == uPtr
     
    22702270        if (ppGipR3)
    22712271        {
    2272 #ifdef USE_NEW_OS_INTERFACE
     2272#ifdef USE_NEW_OS_INTERFACE_FOR_GIP
    22732273            if (pSession->GipMapObjR3 == NIL_RTR0MEMOBJ)
    22742274                rc = RTR0MemObjMapUser(&pSession->GipMapObjR3, pDevExt->GipMemObj, (RTR3PTR)-1, 0,
     
    22792279                rc = VINF_SUCCESS; /** @todo remove this and replace the !rc below with RT_SUCCESS(rc). */
    22802280            }
    2281 #else /* !USE_NEW_OS_INTERFACE */
     2281#else /* !USE_NEW_OS_INTERFACE_FOR_GIP */
    22822282            if (!pSession->pGip)
    22832283                rc = supdrvOSGipMap(pSession->pDevExt, &pSession->pGip);
    22842284            if (!rc)
    22852285                pGip = (RTR3PTR)pSession->pGip;
    2286 #endif /* !USE_NEW_OS_INTERFACE */
     2286#endif /* !USE_NEW_OS_INTERFACE_FOR_GIP */
    22872287        }
    22882288
     
    23112311                ASMAtomicXchgU64(&pGip->u64NanoTSLastUpdateHz, 0);
    23122312
    2313 #ifdef USE_NEW_OS_INTERFACE
     2313#ifdef USE_NEW_OS_INTERFACE_FOR_GIP
    23142314                rc = RTTimerStart(pDevExt->pGipTimer, 0);
    23152315                AssertRC(rc); rc = 0;
     
    23702370     * Unmap anything?
    23712371     */
    2372 #ifdef USE_NEW_OS_INTERFACE
     2372#ifdef USE_NEW_OS_INTERFACE_FOR_GIP
    23732373    if (pSession->GipMapObjR3 != NIL_RTR0MEMOBJ)
    23742374    {
     
    23972397        {
    23982398            dprintf(("SUPR0GipUnmap: Suspends GIP updating\n"));
    2399 #ifdef USE_NEW_OS_INTERFACE
     2399#ifdef USE_NEW_OS_INTERFACE_FOR_GIP
    24002400            rc = RTTimerStop(pDevExt->pGipTimer); AssertRC(rc); rc = 0;
    24012401#else
     
    24362436            for (i = 0; i < sizeof(pBundle->aMem) / sizeof(pBundle->aMem[0]); i++)
    24372437            {
    2438 #ifdef USE_NEW_OS_INTERFACE
     2438#ifdef USE_NEW_OS_INTERFACE_FOR_MM
    24392439                if (pBundle->aMem[i].MemObj == NIL_RTR0MEMOBJ)
    2440 #else  /* !USE_NEW_OS_INTERFACE */
     2440#else  /* !USE_NEW_OS_INTERFACE_FOR_MM */
    24412441                if (    !pBundle->aMem[i].pvR0
    24422442                    &&  !pBundle->aMem[i].pvR3)
    2443 #endif /* !USE_NEW_OS_INTERFACE */
     2443#endif /* !USE_NEW_OS_INTERFACE_FOR_MM */
    24442444                {
    24452445                    pBundle->cUsed++;
     
    25152515            for (i = 0; i < sizeof(pBundle->aMem) / sizeof(pBundle->aMem[0]); i++)
    25162516            {
    2517 #ifdef USE_NEW_OS_INTERFACE
     2517#ifdef USE_NEW_OS_INTERFACE_FOR_MM
    25182518                if (    pBundle->aMem[i].eType == eType
    25192519                    &&  pBundle->aMem[i].MemObj != NIL_RTR0MEMOBJ
     
    25422542                    return 0;
    25432543                }
    2544 #else /* !USE_NEW_OS_INTERFACE */
     2544#else /* !USE_NEW_OS_INTERFACE_FOR_MM */
    25452545                if (    pBundle->aMem[i].eType == eType
    25462546                    &&  (   (RTHCUINTPTR)pBundle->aMem[i].pvR0 == uPtr
     
    25762576                    return 0;
    25772577               }
    2578 #endif /* !USE_NEW_OS_INTERFACE */
     2578#endif /* !USE_NEW_OS_INTERFACE_FOR_MM */
    25792579            }
    25802580        }
     
    38483848
    38493849
    3850 #if !defined(SUPDRV_OS_HAVE_LOW) && !defined(USE_NEW_OS_INTERFACE)  /* Use same backend as the contiguous stuff */
     3850#if !defined(SUPDRV_OS_HAVE_LOW) && !defined(USE_NEW_OS_INTERFACE_FOR_MM)  /* Use same backend as the contiguous stuff */
    38513851/**
    38523852 * OS Specific code for allocating page aligned memory with fixed
     
    38633863int VBOXCALL supdrvOSLowAllocOne(PSUPDRVMEMREF pMem, PRTR0PTR ppvR0, PRTR3PTR ppvR3, PSUPPAGE paPagesOut)
    38643864{
    3865 #if defined(USB_NEW_OS_INTERFACE_FOR_LOW)  /* a temp hack */
     3865#if defined(USE_NEW_OS_INTERFACE_FOR_LOW)  /* a temp hack */
    38663866    int rc = RTR0MemObjAllocLow(&pMem->u.iprt.MemObj, pMem->cb, true /* executable ring-0 mapping */);
    38673867    if (RT_SUCCESS(rc))
     
    39223922void VBOXCALL supdrvOSLowFreeOne(PSUPDRVMEMREF pMem)
    39233923{
    3924 # if defined(USB_NEW_OS_INTERFACE_FOR_LOW)
     3924# if defined(USE_NEW_OS_INTERFACE_FOR_LOW)
    39253925    if (pMem->u.iprt.MapObjR3)
    39263926    {
     
    39373937# endif
    39383938}
    3939 #endif /* !SUPDRV_OS_HAVE_LOW */
    3940 
    3941 
    3942 #ifdef USE_NEW_OS_INTERFACE
     3939#endif /* !SUPDRV_OS_HAVE_LOW && !USE_NEW_OS_INTERFACE_FOR_MM */
     3940
     3941
     3942#ifdef USE_NEW_OS_INTERFACE_FOR_GIP
    39433943/**
    39443944 * Creates the GIP.
     
    40794079    supdrvGipUpdate(pDevExt->pGip, RTTimeSystemNanoTS());
    40804080}
    4081 #endif /* USE_NEW_OS_INTERFACE */
     4081#endif /* USE_NEW_OS_INTERFACE_FOR_GIP */
    40824082
    40834083
     
    41524152static SUPGIPMODE supdrvGipDeterminTscMode(void)
    41534153{
    4154 #ifndef USE_NEW_OS_INTERFACE
     4154#ifndef USE_NEW_OS_INTERFACE_FOR_GIP
    41554155    /*
    41564156     * The problem here is that AMD processors with power management features
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette