VirtualBox

Changeset 10805

Show
Ignore:
Timestamp:
07/22/08 11:44:31 (3 months ago)
Author:
vboxsync
Message:

VMM+SUPDrv: Changed the VMMR0EntryEx interface to also take the session as an argument, this means breaking the current IOC interface and thus a major driver version change.

Files:

Legend:

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

    r10724 r10805  
    483483 * @param   enmOperation    Which operation to execute. 
    484484 * @param   pvArg           Argument to the operation. 
    485  * @remarks Assume called with interrupts disabled. 
     485 * @remarks Assume called with interrupts or preemption disabled. 
    486486 */ 
    487487VMMR0DECL(int) VMMR0EntryInt(PVM pVM, VMMR0OPERATION enmOperation, void *pvArg); 
     
    505505 * @param   pReq            This points to a SUPVMMR0REQHDR packet. Optional. 
    506506 * @param   u64Arg          Some simple constant argument. 
     507 * @param   pSession        The session of the caller. 
    507508 * @remarks Assume called with interrupts _enabled_. 
    508509 */ 
    509 VMMR0DECL(int) VMMR0EntryEx(PVM pVM, VMMR0OPERATION enmOperation, PSUPVMMR0REQHDR pReq, uint64_t u64Arg); 
     510VMMR0DECL(int) VMMR0EntryEx(PVM pVM, VMMR0OPERATION enmOperation, PSUPVMMR0REQHDR pReq, uint64_t u64Arg, PSUPDRVSESSION); 
    510511 
    511512/** 
  • trunk/src/VBox/HostDrivers/Support/SUPDrv.c

    r10724 r10805  
    11161116                /* execute */ 
    11171117                if (RT_LIKELY(pDevExt->pfnVMMR0EntryEx)) 
    1118                     pReq->Hdr.rc = pDevExt->pfnVMMR0EntryEx(pReq->u.In.pVMR0, pReq->u.In.uOperation, NULL, pReq->u.In.u64Arg); 
     1118                    pReq->Hdr.rc = pDevExt->pfnVMMR0EntryEx(pReq->u.In.pVMR0, pReq->u.In.uOperation, NULL, pReq->u.In.u64Arg, pSession); 
    11191119                else 
    11201120                    pReq->Hdr.rc = VERR_WRONG_ORDER; 
     
    11301130                /* execute */ 
    11311131                if (RT_LIKELY(pDevExt->pfnVMMR0EntryEx)) 
    1132                     pReq->Hdr.rc = pDevExt->pfnVMMR0EntryEx(pReq->u.In.pVMR0, pReq->u.In.uOperation, pVMMReq, pReq->u.In.u64Arg); 
     1132                    pReq->Hdr.rc = pDevExt->pfnVMMR0EntryEx(pReq->u.In.pVMR0, pReq->u.In.uOperation, pVMMReq, pReq->u.In.u64Arg, pSession); 
    11331133                else 
    11341134                    pReq->Hdr.rc = VERR_WRONG_ORDER; 
  • trunk/src/VBox/HostDrivers/Support/SUPDrvIOC.h

    r10732 r10805  
    182182 * The upper 16-bit is the major version, the the lower the minor version. 
    183183 * When incompatible changes are made, the upper major number has to be changed. */ 
    184 #define SUPDRV_IOC_VERSION                              0x00080001 
     184#define SUPDRV_IOC_VERSION                              0x00090000 
    185185 
    186186/** SUP_IOCTL_COOKIE. */ 
  • trunk/src/VBox/HostDrivers/Support/SUPDrvInternal.h

    r10724 r10805  
    617617    DECLR0CALLBACKMEMBER(void, pfnVMMR0EntryFast, (PVM pVM, unsigned uOperation)); 
    618618    /** VMMR0EntryEx() pointer. */ 
    619     DECLR0CALLBACKMEMBER(int, pfnVMMR0EntryEx, (PVM pVM, unsigned uOperation, PSUPVMMR0REQHDR pReq, uint64_t u64Arg)); 
     619    DECLR0CALLBACKMEMBER(int, pfnVMMR0EntryEx, (PVM pVM, unsigned uOperation, PSUPVMMR0REQHDR pReq, uint64_t u64Arg, PSUPDRVSESSION pSession)); 
    620620 
    621621    /** Linked list of loaded code. */ 
  • trunk/src/VBox/HostDrivers/Support/SUPLib.cpp

    r10732 r10805  
    212212        strcpy(CookieReq.u.In.szMagic, SUPCOOKIE_MAGIC); 
    213213        CookieReq.u.In.u32ReqVersion = SUPDRV_IOC_VERSION; 
    214         const uint32_t MinVersion = (SUPDRV_IOC_VERSION & 0xffff0000) == 0x00080000 
     214        const uint32_t MinVersion = /*(SUPDRV_IOC_VERSION & 0xffff0000) == 0x00080000 
    215215                                  ? 0x00080001 
    216                                   : SUPDRV_IOC_VERSION & 0xffff0000; 
     216                                  : */ SUPDRV_IOC_VERSION & 0xffff0000; 
    217217        CookieReq.u.In.u32MinVersion = MinVersion; 
    218218        rc = suplibOsIOCtl(SUP_IOCTL_COOKIE, &CookieReq, SUP_IOCTL_COOKIE_SIZE); 
  • trunk/src/VBox/VMM/VMMR0/VMMR0.cpp

    r10746 r10805  
    668668 * @param   pSession    The session argument. 
    669669 */ 
    670 DECLINLINE(bool) vmmR0IsValidSession(PVM pVM, PSUPDRVSESSION pSession) 
     670DECLINLINE(bool) vmmR0IsValidSession(PVM pVM, PSUPDRVSESSION pClaimedSession, PSUPDRVSESSION pSession) 
    671671{ 
    672672    /* Only one out of the two */ 
     
    674674        return false; 
    675675    if (pVM) 
    676         pSession = pVM->pSession; 
    677  
    678     /** @todo supdrv should validate it. */ 
    679     return VALID_PTR(pSession); 
     676        pClaimedSession = pVM->pSession; 
     677    return pClaimedSession == pSession; 
    680678} 
    681679 
     
    691689 *                          The support driver validates this if it's present. 
    692690 * @param   u64Arg          Some simple constant argument. 
     691 * @param   pSession        The session of the caller. 
    693692 * @remarks Assume called with interrupts _enabled_. 
    694693 */ 
    695 static int vmmR0EntryExWorker(PVM pVM, VMMR0OPERATION enmOperation, PSUPVMMR0REQHDR pReqHdr, uint64_t u64Arg
     694static int vmmR0EntryExWorker(PVM pVM, VMMR0OPERATION enmOperation, PSUPVMMR0REQHDR pReqHdr, uint64_t u64Arg, PSUPDRVSESSION pSession
    696695{ 
    697696    /* 
     
    883882        { 
    884883            PINTNETOPENREQ pReq = (PINTNETOPENREQ)pReqHdr; 
    885             if (u64Arg || !pReq || !vmmR0IsValidSession(pVM, pReq->pSession)) 
     884            if (u64Arg || !pReq || !vmmR0IsValidSession(pVM, pReq->pSession, pSession)) 
    886885                return VERR_INVALID_PARAMETER; 
    887886            if (!g_pIntNet) 
    888887                return VERR_NOT_SUPPORTED; 
    889             return INTNETR0OpenReq(g_pIntNet, pVM ? pVM->pSession : pReq->pSession, pReq); 
     888            return INTNETR0OpenReq(g_pIntNet, pSession, pReq); 
    890889        } 
    891890 
    892891        case VMMR0_DO_INTNET_IF_CLOSE: 
    893             if (u64Arg || !pReqHdr || !vmmR0IsValidSession(pVM, ((PINTNETIFCLOSEREQ)pReqHdr)->pSession)) 
     892            if (u64Arg || !pReqHdr || !vmmR0IsValidSession(pVM, ((PINTNETIFCLOSEREQ)pReqHdr)->pSession, pSession)) 
    894893                return VERR_INVALID_PARAMETER; 
    895894            if (!g_pIntNet) 
     
    898897 
    899898        case VMMR0_DO_INTNET_IF_GET_RING3_BUFFER: 
    900             if (u64Arg || !pReqHdr || !vmmR0IsValidSession(pVM, ((PINTNETIFGETRING3BUFFERREQ)pReqHdr)->pSession)) 
     899            if (u64Arg || !pReqHdr || !vmmR0IsValidSession(pVM, ((PINTNETIFGETRING3BUFFERREQ)pReqHdr)->pSession, pSession)) 
    901900                return VERR_INVALID_PARAMETER; 
    902901            if (!g_pIntNet) 
     
    905904 
    906905        case VMMR0_DO_INTNET_IF_SET_PROMISCUOUS_MODE: 
    907             if (u64Arg || !pReqHdr || !vmmR0IsValidSession(pVM, ((PINTNETIFSETPROMISCUOUSMODEREQ)pReqHdr)->pSession)) 
     906            if (u64Arg || !pReqHdr || !vmmR0IsValidSession(pVM, ((PINTNETIFSETPROMISCUOUSMODEREQ)pReqHdr)->pSession, pSession)) 
    908907                return VERR_INVALID_PARAMETER; 
    909908            if (!g_pIntNet) 
     
    912911 
    913912        case VMMR0_DO_INTNET_IF_SEND: 
    914             if (u64Arg || !pReqHdr || !vmmR0IsValidSession(pVM, ((PINTNETIFSENDREQ)pReqHdr)->pSession)) 
     913            if (u64Arg || !pReqHdr || !vmmR0IsValidSession(pVM, ((PINTNETIFSENDREQ)pReqHdr)->pSession, pSession)) 
    915914                return VERR_INVALID_PARAMETER; 
    916915            if (!g_pIntNet) 
     
    919918 
    920919        case VMMR0_DO_INTNET_IF_WAIT: 
    921             if (u64Arg || !pReqHdr || !vmmR0IsValidSession(pVM, ((PINTNETIFWAITREQ)pReqHdr)->pSession)) 
     920            if (u64Arg || !pReqHdr || !vmmR0IsValidSession(pVM, ((PINTNETIFWAITREQ)pReqHdr)->pSession, pSession)) 
    922921                return VERR_INVALID_PARAMETER; 
    923922            if (!g_pIntNet) 
     
    961960    PSUPVMMR0REQHDR     pReq; 
    962961    uint64_t            u64Arg; 
     962    PSUPDRVSESSION      pSession; 
    963963} VMMR0ENTRYEXARGS; 
    964964/** Pointer to a vmmR0EntryExWrapper argument package. */ 
     
    976976                              ((PVMMR0ENTRYEXARGS)pvArgs)->enmOperation, 
    977977                              ((PVMMR0ENTRYEXARGS)pvArgs)->pReq, 
    978                               ((PVMMR0ENTRYEXARGS)pvArgs)->u64Arg); 
     978                              ((PVMMR0ENTRYEXARGS)pvArgs)->u64Arg, 
     979                              ((PVMMR0ENTRYEXARGS)pvArgs)->pSession); 
    979980} 
    980981 
     
    988989 * @param   pReq            This points to a SUPVMMR0REQHDR packet. Optional. 
    989990 * @param   u64Arg          Some simple constant argument. 
     991 * @param   pSession        The session of the caller. 
    990992 * @remarks Assume called with interrupts _enabled_. 
    991993 */ 
    992 VMMR0DECL(int) VMMR0EntryEx(PVM pVM, VMMR0OPERATION enmOperation, PSUPVMMR0REQHDR pReq, uint64_t u64Arg
     994VMMR0DECL(int) VMMR0EntryEx(PVM pVM, VMMR0OPERATION enmOperation, PSUPVMMR0REQHDR pReq, uint64_t u64Arg, PSUPDRVSESSION pSession
    993995{ 
    994996    /* 
     
    10251027        } 
    10261028    } 
    1027     return vmmR0EntryExWorker(pVM, enmOperation, pReq, u64Arg); 
     1029    return vmmR0EntryExWorker(pVM, enmOperation, pReq, u64Arg, pSession); 
    10281030} 
    10291031 

© 2008 Sun Microsystems, Inc.
ContactPrivacy policy