SUPDrv.c revision 4343fdcc4add2ac76ddbd30a7ae7666699e9ccc0
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync/* $Revision$ */
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync * VBoxDrv - The VirtualBox Support Driver - Common code.
e64031e20c39650a7bc902a3e1aba613b9415deevboxsync * Copyright (C) 2006-2007 Sun Microsystems, Inc.
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync * available from http://www.virtualbox.org. This file is free software;
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync * you can redistribute it and/or modify it under the terms of the GNU
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync * General Public License (GPL) as published by the Free Software
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync * The contents of this file may alternatively be used under the terms
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync * of the Common Development and Distribution License Version 1.0
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync * VirtualBox OSE distribution, in which case the provisions of the
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync * CDDL are applicable instead of those of the GPL.
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync * You may elect to license modified versions of this file under the
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync * terms and conditions of either the GPL or the CDDL or both.
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync * additional information or have any questions.
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync/*******************************************************************************
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync* Header Files *
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync*******************************************************************************/
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync/* VBox/x86.h not compatible with the Linux kernel sources */
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync * Logging assignments:
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync * Log - useful stuff, like failures.
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync * LogFlow - program flow, except the really noisy bits.
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync * Log2 - Cleanup.
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync * Log3 - Loader flow noise.
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync * Log4 - Call VMMR0 flow noise.
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync * Log5 - Native yet-to-be-defined noise.
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync * Log6 - Native ioctl flow noise.
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync * Logging requires BUILD_TYPE=debug and possibly changes to the logger
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync * instanciation in log-vbox.c(pp).
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync/*******************************************************************************
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync* Defined Constants And Macros *
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync*******************************************************************************/
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync/* from x86.h - clashes with linux thus this duplication */
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync#define X86_CPUID_AMD_FEATURE_EDX_LONG_MODE RT_BIT(29)
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync/** The frequency by which we recalculate the u32UpdateHz and
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync * u32UpdateIntervalNS GIP members. The value must be a power of 2. */
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync * Validates a session pointer.
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync * @returns true/false accordingly.
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync * @param pSession The session.
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync/** @def VBOX_SVN_REV
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync * The makefile should define this if it can. */
be196d173cf52fa33016912e4745dbe1170ac53avboxsync/*******************************************************************************
be196d173cf52fa33016912e4745dbe1170ac53avboxsync* Internal Functions *
be196d173cf52fa33016912e4745dbe1170ac53avboxsync*******************************************************************************/
be196d173cf52fa33016912e4745dbe1170ac53avboxsyncstatic int supdrvMemAdd(PSUPDRVMEMREF pMem, PSUPDRVSESSION pSession);
be196d173cf52fa33016912e4745dbe1170ac53avboxsyncstatic int supdrvMemRelease(PSUPDRVSESSION pSession, RTHCUINTPTR uPtr, SUPDRVMEMREFTYPE eType);
be196d173cf52fa33016912e4745dbe1170ac53avboxsyncstatic int supdrvIOCtl_LdrOpen(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPLDROPEN pReq);
be196d173cf52fa33016912e4745dbe1170ac53avboxsyncstatic int supdrvIOCtl_LdrLoad(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPLDRLOAD pReq);
be196d173cf52fa33016912e4745dbe1170ac53avboxsyncstatic int supdrvIOCtl_LdrFree(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPLDRFREE pReq);
be196d173cf52fa33016912e4745dbe1170ac53avboxsyncstatic int supdrvIOCtl_LdrGetSymbol(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPLDRGETSYMBOL pReq);
be196d173cf52fa33016912e4745dbe1170ac53avboxsyncstatic int supdrvIDC_LdrGetSymbol(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPDRVIDCREQGETSYM pReq);
be196d173cf52fa33016912e4745dbe1170ac53avboxsyncstatic int supdrvLdrSetVMMR0EPs(PSUPDRVDEVEXT pDevExt, void *pvVMMR0, void *pvVMMR0EntryInt, void *pvVMMR0EntryFast, void *pvVMMR0EntryEx);
be196d173cf52fa33016912e4745dbe1170ac53avboxsyncstatic void supdrvLdrUnsetVMMR0EPs(PSUPDRVDEVEXT pDevExt);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncstatic int supdrvLdrAddUsage(PSUPDRVSESSION pSession, PSUPDRVLDRIMAGE pImage);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncstatic void supdrvLdrFree(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncstatic int supdrvIOCtl_CallServiceModule(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPCALLSERVICE pReq);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncstatic SUPGIPMODE supdrvGipDeterminTscMode(PSUPDRVDEVEXT pDevExt);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncstatic int supdrvPageGetPhys(PSUPDRVSESSION pSession, RTR3PTR pvR3, uint32_t cPages, PRTHCPHYS paPages);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncstatic bool supdrvPageWasLockedByPageAlloc(PSUPDRVSESSION pSession, RTR3PTR pvR3);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync#endif /* RT_OS_WINDOWS */
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncstatic void supdrvGipDestroy(PSUPDRVDEVEXT pDevExt);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncstatic DECLCALLBACK(void) supdrvGipSyncTimer(PRTTIMER pTimer, void *pvUser, uint64_t iTick);
be196d173cf52fa33016912e4745dbe1170ac53avboxsyncstatic DECLCALLBACK(void) supdrvGipAsyncTimer(PRTTIMER pTimer, void *pvUser, uint64_t iTick);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncstatic DECLCALLBACK(void) supdrvGipMpEvent(RTMPEVENT enmEvent, RTCPUID idCpu, void *pvUser);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(int) supdrvNtWrapVMMR0EntryEx(PFNRT pfnVMMR0EntryEx, PVM pVM, unsigned uOperation, PSUPVMMR0REQHDR pReq, uint64_t u64Arg, PSUPDRVSESSION pSession);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(int) supdrvNtWrapVMMR0EntryFast(PFNRT pfnVMMR0EntryFast, PVM pVM, unsigned idCpu, unsigned uOperation);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(void) supdrvNtWrapObjDestructor(PFNRT pfnDestruction, void *pvObj, void *pvUser1, void *pvUser2);
be196d173cf52fa33016912e4745dbe1170ac53avboxsyncDECLASM(void *) supdrvNtWrapQueryFactoryInterface(PFNRT pfnQueryFactoryInterface, struct SUPDRVFACTORY const *pSupDrvFactory, PSUPDRVSESSION pSession, const char *pszInterfaceUuid);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(int) supdrvNtWrapModuleInit(PFNRT pfnModuleInit);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(void) supdrvNtWrapModuleTerm(PFNRT pfnModuleTerm);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(int) supdrvNtWrapServiceReqHandler(PFNRT pfnServiceReqHandler, PSUPDRVSESSION pSession, uint32_t uOperation, uint64_t u64Arg, PSUPR0SERVICEREQHDR pReqHdr);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(int) UNWIND_WRAP(SUPR0ComponentRegisterFactory)(PSUPDRVSESSION pSession, PCSUPDRVFACTORY pFactory);
be196d173cf52fa33016912e4745dbe1170ac53avboxsyncDECLASM(int) UNWIND_WRAP(SUPR0ComponentDeregisterFactory)(PSUPDRVSESSION pSession, PCSUPDRVFACTORY pFactory);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(int) UNWIND_WRAP(SUPR0ComponentQueryFactory)(PSUPDRVSESSION pSession, const char *pszName, const char *pszInterfaceUuid, void **ppvFactoryIf);
be196d173cf52fa33016912e4745dbe1170ac53avboxsyncDECLASM(void *) UNWIND_WRAP(SUPR0ObjRegister)(PSUPDRVSESSION pSession, SUPDRVOBJTYPE enmType, PFNSUPDRVDESTRUCTOR pfnDestructor, void *pvUser1, void *pvUser2);
be196d173cf52fa33016912e4745dbe1170ac53avboxsyncDECLASM(int) UNWIND_WRAP(SUPR0ObjAddRef)(void *pvObj, PSUPDRVSESSION pSession);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(int) UNWIND_WRAP(SUPR0ObjRelease)(void *pvObj, PSUPDRVSESSION pSession);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(int) UNWIND_WRAP(SUPR0ObjVerifyAccess)(void *pvObj, PSUPDRVSESSION pSession, const char *pszObjName);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(int) UNWIND_WRAP(SUPR0LockMem)(PSUPDRVSESSION pSession, RTR3PTR pvR3, uint32_t cPages, PRTHCPHYS paPages);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(int) UNWIND_WRAP(SUPR0UnlockMem)(PSUPDRVSESSION pSession, RTR3PTR pvR3);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(int) UNWIND_WRAP(SUPR0ContAlloc)(PSUPDRVSESSION pSession, uint32_t cPages, PRTR0PTR ppvR0, PRTR3PTR ppvR3, PRTHCPHYS pHCPhys);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(int) UNWIND_WRAP(SUPR0ContFree)(PSUPDRVSESSION pSession, RTHCUINTPTR uPtr);
be196d173cf52fa33016912e4745dbe1170ac53avboxsyncDECLASM(int) UNWIND_WRAP(SUPR0LowAlloc)(PSUPDRVSESSION pSession, uint32_t cPages, PRTR0PTR ppvR0, PRTR3PTR ppvR3, PRTHCPHYS paPages);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(int) UNWIND_WRAP(SUPR0LowFree)(PSUPDRVSESSION pSession, RTHCUINTPTR uPtr);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(int) UNWIND_WRAP(SUPR0MemAlloc)(PSUPDRVSESSION pSession, uint32_t cb, PRTR0PTR ppvR0, PRTR3PTR ppvR3);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(int) UNWIND_WRAP(SUPR0MemGetPhys)(PSUPDRVSESSION pSession, RTHCUINTPTR uPtr, PSUPPAGE paPages);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(int) UNWIND_WRAP(SUPR0MemFree)(PSUPDRVSESSION pSession, RTHCUINTPTR uPtr);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(int) UNWIND_WRAP(SUPR0PageAlloc)(PSUPDRVSESSION pSession, uint32_t cPages, PRTR3PTR ppvR3, PRTHCPHYS paPages);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(int) UNWIND_WRAP(SUPR0PageFree)(PSUPDRVSESSION pSession, RTR3PTR pvR3);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync//DECLASM(int) UNWIND_WRAP(SUPR0Printf)(const char *pszFormat, ...);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(SUPPAGINGMODE) UNWIND_WRAP(SUPR0GetPagingMode)(void);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(void *) UNWIND_WRAP(RTMemAlloc)(size_t cb) RT_NO_THROW;
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(void *) UNWIND_WRAP(RTMemAllocZ)(size_t cb) RT_NO_THROW;
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(void) UNWIND_WRAP(RTMemFree)(void *pv) RT_NO_THROW;
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(void *) UNWIND_WRAP(RTMemDup)(const void *pvSrc, size_t cb) RT_NO_THROW;
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(void *) UNWIND_WRAP(RTMemDupEx)(const void *pvSrc, size_t cbSrc, size_t cbExtra) RT_NO_THROW;
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(void *) UNWIND_WRAP(RTMemRealloc)(void *pvOld, size_t cbNew) RT_NO_THROW;
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(int) UNWIND_WRAP(RTR0MemObjAllocLow)(PRTR0MEMOBJ pMemObj, size_t cb, bool fExecutable);
be196d173cf52fa33016912e4745dbe1170ac53avboxsyncDECLASM(int) UNWIND_WRAP(RTR0MemObjAllocPage)(PRTR0MEMOBJ pMemObj, size_t cb, bool fExecutable);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(int) UNWIND_WRAP(RTR0MemObjAllocPhys)(PRTR0MEMOBJ pMemObj, size_t cb, RTHCPHYS PhysHighest);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(int) UNWIND_WRAP(RTR0MemObjAllocPhysNC)(PRTR0MEMOBJ pMemObj, size_t cb, RTHCPHYS PhysHighest);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(int) UNWIND_WRAP(RTR0MemObjAllocCont)(PRTR0MEMOBJ pMemObj, size_t cb, bool fExecutable);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(int) UNWIND_WRAP(RTR0MemObjEnterPhys)(PRTR0MEMOBJ pMemObj, RTHCPHYS Phys, size_t cb);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(int) UNWIND_WRAP(RTR0MemObjLockUser)(PRTR0MEMOBJ pMemObj, RTR3PTR R3Ptr, size_t cb, RTR0PROCESS R0Process);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(int) UNWIND_WRAP(RTR0MemObjMapKernel)(PRTR0MEMOBJ pMemObj, RTR0MEMOBJ MemObjToMap, void *pvFixed, size_t uAlignment, unsigned fProt);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(int) UNWIND_WRAP(RTR0MemObjMapUser)(PRTR0MEMOBJ pMemObj, RTR0MEMOBJ MemObjToMap, RTR3PTR R3PtrFixed, size_t uAlignment, unsigned fProt, RTR0PROCESS R0Process);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync/*DECLASM(void *) UNWIND_WRAP(RTR0MemObjAddress)(RTR0MEMOBJ MemObj); - not necessary */
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync/*DECLASM(RTR3PTR) UNWIND_WRAP(RTR0MemObjAddressR3)(RTR0MEMOBJ MemObj); - not necessary */
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync/*DECLASM(size_t) UNWIND_WRAP(RTR0MemObjSize)(RTR0MEMOBJ MemObj); - not necessary */
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync/*DECLASM(bool) UNWIND_WRAP(RTR0MemObjIsMapping)(RTR0MEMOBJ MemObj); - not necessary */
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync/*DECLASM(RTHCPHYS) UNWIND_WRAP(RTR0MemObjGetPagePhysAddr)(RTR0MEMOBJ MemObj, size_t iPage); - not necessary */
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(int) UNWIND_WRAP(RTR0MemObjFree)(RTR0MEMOBJ MemObj, bool fFreeMappings);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync/* RTProcSelf - not necessary */
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync/* RTR0ProcHandleSelf - not necessary */
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(int) UNWIND_WRAP(RTSemFastMutexCreate)(PRTSEMFASTMUTEX pMutexSem);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(int) UNWIND_WRAP(RTSemFastMutexDestroy)(RTSEMFASTMUTEX MutexSem);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(int) UNWIND_WRAP(RTSemFastMutexRequest)(RTSEMFASTMUTEX MutexSem);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(int) UNWIND_WRAP(RTSemFastMutexRelease)(RTSEMFASTMUTEX MutexSem);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(int) UNWIND_WRAP(RTSemEventCreate)(PRTSEMEVENT pEventSem);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(int) UNWIND_WRAP(RTSemEventSignal)(RTSEMEVENT EventSem);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(int) UNWIND_WRAP(RTSemEventWait)(RTSEMEVENT EventSem, unsigned cMillies);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(int) UNWIND_WRAP(RTSemEventWaitNoResume)(RTSEMEVENT EventSem, unsigned cMillies);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(int) UNWIND_WRAP(RTSemEventDestroy)(RTSEMEVENT EventSem);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(int) UNWIND_WRAP(RTSemEventMultiCreate)(PRTSEMEVENTMULTI pEventMultiSem);
88acfa6629a7976c0583c1712d2b5b22a87a5121vboxsyncDECLASM(int) UNWIND_WRAP(RTSemEventMultiSignal)(RTSEMEVENTMULTI EventMultiSem);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(int) UNWIND_WRAP(RTSemEventMultiReset)(RTSEMEVENTMULTI EventMultiSem);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(int) UNWIND_WRAP(RTSemEventMultiWait)(RTSEMEVENTMULTI EventMultiSem, unsigned cMillies);
88acfa6629a7976c0583c1712d2b5b22a87a5121vboxsyncDECLASM(int) UNWIND_WRAP(RTSemEventMultiWaitNoResume)(RTSEMEVENTMULTI EventMultiSem, unsigned cMillies);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(int) UNWIND_WRAP(RTSemEventMultiDestroy)(RTSEMEVENTMULTI EventMultiSem);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(int) UNWIND_WRAP(RTSpinlockCreate)(PRTSPINLOCK pSpinlock);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(int) UNWIND_WRAP(RTSpinlockDestroy)(RTSPINLOCK Spinlock);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(void) UNWIND_WRAP(RTSpinlockAcquire)(RTSPINLOCK Spinlock, PRTSPINLOCKTMP pTmp);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(void) UNWIND_WRAP(RTSpinlockRelease)(RTSPINLOCK Spinlock, PRTSPINLOCKTMP pTmp);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(void) UNWIND_WRAP(RTSpinlockAcquireNoInts)(RTSPINLOCK Spinlock, PRTSPINLOCKTMP pTmp);
be196d173cf52fa33016912e4745dbe1170ac53avboxsyncDECLASM(void) UNWIND_WRAP(RTSpinlockReleaseNoInts)(RTSPINLOCK Spinlock, PRTSPINLOCKTMP pTmp);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync/* RTTimeNanoTS - not necessary */
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync/* RTTimeMilliTS - not necessary */
eab872ee272cc9e799e0b68735b660deb84b8629vboxsync/* RTTimeSystemNanoTS - not necessary */
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync/* RTTimeSystemMilliTS - not necessary */
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync/* RTThreadNativeSelf - not necessary */
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(int) UNWIND_WRAP(RTThreadSleep)(unsigned cMillies);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync/* RTThreadSelf - not necessary */
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(int) UNWIND_WRAP(RTThreadCreate)(PRTTHREAD pThread, PFNRTTHREAD pfnThread, void *pvUser, size_t cbStack,
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync RTTHREADTYPE enmType, unsigned fFlags, const char *pszName);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(RTNATIVETHREAD) UNWIND_WRAP(RTThreadGetNative)(RTTHREAD Thread);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(int) UNWIND_WRAP(RTThreadWait)(RTTHREAD Thread, unsigned cMillies, int *prc);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(int) UNWIND_WRAP(RTThreadWaitNoResume)(RTTHREAD Thread, unsigned cMillies, int *prc);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(const char *) UNWIND_WRAP(RTThreadGetName)(RTTHREAD Thread);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(const char *) UNWIND_WRAP(RTThreadSelfName)(void);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(RTTHREADTYPE) UNWIND_WRAP(RTThreadGetType)(RTTHREAD Thread);
be196d173cf52fa33016912e4745dbe1170ac53avboxsyncDECLASM(int) UNWIND_WRAP(RTThreadUserSignal)(RTTHREAD Thread);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(int) UNWIND_WRAP(RTThreadUserReset)(RTTHREAD Thread);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(int) UNWIND_WRAP(RTThreadUserWait)(RTTHREAD Thread, unsigned cMillies);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(int) UNWIND_WRAP(RTThreadUserWaitNoResume)(RTTHREAD Thread, unsigned cMillies);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync/* RTLogDefaultInstance - a bit of a gamble, but we do not want the overhead! */
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync/* RTMpCpuId - not necessary */
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync/* RTMpCpuIdFromSetIndex - not necessary */
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync/* RTMpCpuIdToSetIndex - not necessary */
be196d173cf52fa33016912e4745dbe1170ac53avboxsync/* RTMpIsCpuPossible - not necessary */
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync/* RTMpGetCount - not necessary */
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync/* RTMpGetMaxCpuId - not necessary */
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync/* RTMpGetOnlineCount - not necessary */
be196d173cf52fa33016912e4745dbe1170ac53avboxsync/* RTMpGetOnlineSet - not necessary */
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync/* RTMpGetSet - not necessary */
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync/* RTMpIsCpuOnline - not necessary */
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(int) UNWIND_WRAP(RTMpOnAll)(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(int) UNWIND_WRAP(RTMpOnOthers)(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(int) UNWIND_WRAP(RTMpOnSpecific)(RTCPUID idCpu, PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync/* RTLogRelDefaultInstance - not necessary. */
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(int) UNWIND_WRAP(RTLogSetDefaultInstanceThread)(PRTLOGGER pLogger, uintptr_t uKey);
be196d173cf52fa33016912e4745dbe1170ac53avboxsync/* RTLogLogger - can't wrap this buster. */
be196d173cf52fa33016912e4745dbe1170ac53avboxsync/* RTLogLoggerEx - can't wrap this buster. */
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncDECLASM(void) UNWIND_WRAP(RTLogLoggerExV)(PRTLOGGER pLogger, unsigned fFlags, unsigned iGroup, const char *pszFormat, va_list args);
be196d173cf52fa33016912e4745dbe1170ac53avboxsync/* RTLogPrintf - can't wrap this buster. */ /** @todo provide va_list log wrappers in RuntimeR0. */
be196d173cf52fa33016912e4745dbe1170ac53avboxsyncDECLASM(void) UNWIND_WRAP(RTLogPrintfV)(const char *pszFormat, va_list args);
be196d173cf52fa33016912e4745dbe1170ac53avboxsyncDECLASM(void) UNWIND_WRAP(AssertMsg1)(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync/* AssertMsg2 - can't wrap this buster. */
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync#endif /* RT_WITH_W64_UNWIND_HACK */
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync/*******************************************************************************
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync* Global Variables *
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync*******************************************************************************/
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync * Array of the R0 SUP API.
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync /* name function */
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "SUPR0ComponentRegisterFactory", (void *)UNWIND_WRAP(SUPR0ComponentRegisterFactory) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "SUPR0ComponentDeregisterFactory", (void *)UNWIND_WRAP(SUPR0ComponentDeregisterFactory) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "SUPR0ComponentQueryFactory", (void *)UNWIND_WRAP(SUPR0ComponentQueryFactory) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "SUPR0ObjRegister", (void *)UNWIND_WRAP(SUPR0ObjRegister) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "SUPR0ObjAddRef", (void *)UNWIND_WRAP(SUPR0ObjAddRef) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "SUPR0ObjRelease", (void *)UNWIND_WRAP(SUPR0ObjRelease) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "SUPR0ObjVerifyAccess", (void *)UNWIND_WRAP(SUPR0ObjVerifyAccess) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "SUPR0LockMem", (void *)UNWIND_WRAP(SUPR0LockMem) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "SUPR0UnlockMem", (void *)UNWIND_WRAP(SUPR0UnlockMem) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "SUPR0ContAlloc", (void *)UNWIND_WRAP(SUPR0ContAlloc) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "SUPR0ContFree", (void *)UNWIND_WRAP(SUPR0ContFree) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "SUPR0LowAlloc", (void *)UNWIND_WRAP(SUPR0LowAlloc) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "SUPR0LowFree", (void *)UNWIND_WRAP(SUPR0LowFree) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "SUPR0MemAlloc", (void *)UNWIND_WRAP(SUPR0MemAlloc) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "SUPR0MemGetPhys", (void *)UNWIND_WRAP(SUPR0MemGetPhys) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "SUPR0MemFree", (void *)UNWIND_WRAP(SUPR0MemFree) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "SUPR0PageAlloc", (void *)UNWIND_WRAP(SUPR0PageAlloc) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "SUPR0PageFree", (void *)UNWIND_WRAP(SUPR0PageFree) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "SUPR0Printf", (void *)SUPR0Printf }, /** @todo needs wrapping? */
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "SUPR0GetPagingMode", (void *)UNWIND_WRAP(SUPR0GetPagingMode) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTMemAllocZ", (void *)UNWIND_WRAP(RTMemAllocZ) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync /*{ "RTMemDup", (void *)UNWIND_WRAP(RTMemDup) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTMemDupEx", (void *)UNWIND_WRAP(RTMemDupEx) },*/
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTMemRealloc", (void *)UNWIND_WRAP(RTMemRealloc) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTR0MemObjAllocLow", (void *)UNWIND_WRAP(RTR0MemObjAllocLow) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTR0MemObjAllocPage", (void *)UNWIND_WRAP(RTR0MemObjAllocPage) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTR0MemObjAllocPhys", (void *)UNWIND_WRAP(RTR0MemObjAllocPhys) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTR0MemObjAllocPhysNC", (void *)UNWIND_WRAP(RTR0MemObjAllocPhysNC) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTR0MemObjAllocCont", (void *)UNWIND_WRAP(RTR0MemObjAllocCont) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTR0MemObjEnterPhys", (void *)UNWIND_WRAP(RTR0MemObjEnterPhys) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTR0MemObjLockUser", (void *)UNWIND_WRAP(RTR0MemObjLockUser) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTR0MemObjMapKernel", (void *)UNWIND_WRAP(RTR0MemObjMapKernel) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTR0MemObjMapUser", (void *)UNWIND_WRAP(RTR0MemObjMapUser) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTR0MemObjAddress", (void *)RTR0MemObjAddress },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTR0MemObjAddressR3", (void *)RTR0MemObjAddressR3 },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTR0MemObjIsMapping", (void *)RTR0MemObjIsMapping },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTR0MemObjGetPagePhysAddr", (void *)RTR0MemObjGetPagePhysAddr },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTR0MemObjFree", (void *)UNWIND_WRAP(RTR0MemObjFree) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync/* These don't work yet on linux - use fast mutexes!
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTSemMutexCreate", (void *)RTSemMutexCreate },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTSemMutexRequest", (void *)RTSemMutexRequest },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTSemMutexRelease", (void *)RTSemMutexRelease },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTSemMutexDestroy", (void *)RTSemMutexDestroy },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTR0ProcHandleSelf", (void *)RTR0ProcHandleSelf },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTSemFastMutexCreate", (void *)UNWIND_WRAP(RTSemFastMutexCreate) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTSemFastMutexDestroy", (void *)UNWIND_WRAP(RTSemFastMutexDestroy) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTSemFastMutexRequest", (void *)UNWIND_WRAP(RTSemFastMutexRequest) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTSemFastMutexRelease", (void *)UNWIND_WRAP(RTSemFastMutexRelease) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTSemEventCreate", (void *)UNWIND_WRAP(RTSemEventCreate) },
be196d173cf52fa33016912e4745dbe1170ac53avboxsync { "RTSemEventSignal", (void *)UNWIND_WRAP(RTSemEventSignal) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTSemEventWait", (void *)UNWIND_WRAP(RTSemEventWait) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTSemEventWaitNoResume", (void *)UNWIND_WRAP(RTSemEventWaitNoResume) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTSemEventDestroy", (void *)UNWIND_WRAP(RTSemEventDestroy) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTSemEventMultiCreate", (void *)UNWIND_WRAP(RTSemEventMultiCreate) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTSemEventMultiSignal", (void *)UNWIND_WRAP(RTSemEventMultiSignal) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTSemEventMultiReset", (void *)UNWIND_WRAP(RTSemEventMultiReset) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTSemEventMultiWait", (void *)UNWIND_WRAP(RTSemEventMultiWait) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTSemEventMultiWaitNoResume", (void *)UNWIND_WRAP(RTSemEventMultiWaitNoResume) },
27de6b7fcf72c0add242c8dbefff24fbdc7869ebvboxsync { "RTSemEventMultiDestroy", (void *)UNWIND_WRAP(RTSemEventMultiDestroy) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTSpinlockCreate", (void *)UNWIND_WRAP(RTSpinlockCreate) },
78817f40cd3fec6cba19ad8a2df2a690970c5895vboxsync { "RTSpinlockDestroy", (void *)UNWIND_WRAP(RTSpinlockDestroy) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTSpinlockAcquire", (void *)UNWIND_WRAP(RTSpinlockAcquire) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTSpinlockRelease", (void *)UNWIND_WRAP(RTSpinlockRelease) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTSpinlockAcquireNoInts", (void *)UNWIND_WRAP(RTSpinlockAcquireNoInts) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTSpinlockReleaseNoInts", (void *)UNWIND_WRAP(RTSpinlockReleaseNoInts) },
0aa150e34ed49f14aaa37368c2e6999ec89e5f43vboxsync { "RTTimeSystemNanoTS", (void *)RTTimeSystemNanoTS },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTTimeSystemMillieTS", (void *)RTTimeSystemMilliTS },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTThreadNativeSelf", (void *)RTThreadNativeSelf },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTThreadSleep", (void *)UNWIND_WRAP(RTThreadSleep) },
0aa150e34ed49f14aaa37368c2e6999ec89e5f43vboxsync { "RTThreadYield", (void *)UNWIND_WRAP(RTThreadYield) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync#if 0 /* Thread APIs, Part 2. */
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTThreadSelf", (void *)UNWIND_WRAP(RTThreadSelf) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTThreadCreate", (void *)UNWIND_WRAP(RTThreadCreate) }, /** @todo need to wrap the callback */
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTThreadGetNative", (void *)UNWIND_WRAP(RTThreadGetNative) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTThreadWait", (void *)UNWIND_WRAP(RTThreadWait) },
0aa150e34ed49f14aaa37368c2e6999ec89e5f43vboxsync { "RTThreadWaitNoResume", (void *)UNWIND_WRAP(RTThreadWaitNoResume) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTThreadGetName", (void *)UNWIND_WRAP(RTThreadGetName) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTThreadSelfName", (void *)UNWIND_WRAP(RTThreadSelfName) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTThreadGetType", (void *)UNWIND_WRAP(RTThreadGetType) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTThreadUserSignal", (void *)UNWIND_WRAP(RTThreadUserSignal) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTThreadUserReset", (void *)UNWIND_WRAP(RTThreadUserReset) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTThreadUserWait", (void *)UNWIND_WRAP(RTThreadUserWait) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTThreadUserWaitNoResume", (void *)UNWIND_WRAP(RTThreadUserWaitNoResume) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTLogDefaultInstance", (void *)RTLogDefaultInstance },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTMpCpuIdFromSetIndex", (void *)RTMpCpuIdFromSetIndex },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTMpCpuIdToSetIndex", (void *)RTMpCpuIdToSetIndex },
be196d173cf52fa33016912e4745dbe1170ac53avboxsync { "RTMpIsCpuPossible", (void *)RTMpIsCpuPossible },
27de6b7fcf72c0add242c8dbefff24fbdc7869ebvboxsync { "RTMpGetOnlineCount", (void *)RTMpGetOnlineCount },
b79e4344bf4eb8033fd06d560cd864192728bd0bvboxsync { "RTMpOnOthers", (void *)UNWIND_WRAP(RTMpOnOthers) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTMpOnSpecific", (void *)UNWIND_WRAP(RTMpOnSpecific) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTPowerNotificationRegister", (void *)RTPowerNotificationRegister },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTPowerNotificationDeregister", (void *)RTPowerNotificationDeregister },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTLogRelDefaultInstance", (void *)RTLogRelDefaultInstance },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTLogSetDefaultInstanceThread", (void *)UNWIND_WRAP(RTLogSetDefaultInstanceThread) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTLogLogger", (void *)RTLogLogger }, /** @todo remove this */
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTLogLoggerEx", (void *)RTLogLoggerEx }, /** @todo remove this */
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTLogLoggerExV", (void *)UNWIND_WRAP(RTLogLoggerExV) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTLogPrintf", (void *)RTLogPrintf }, /** @todo remove this */
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTLogPrintfV", (void *)UNWIND_WRAP(RTLogPrintfV) },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "AssertMsg2", (void *)AssertMsg2 }, /** @todo replace this by RTAssertMsg2V */
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync { "RTR0AssertPanicSystem", (void *)RTR0AssertPanicSystem },
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync * Drag in the rest of IRPT since we share it with the
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync * rest of the kernel modules on darwin.
b79e4344bf4eb8033fd06d560cd864192728bd0bvboxsync#endif /* RT_OS_DARWIN || RT_OS_SOLARIS */
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync * Initializes the device extentsion structure.
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync * @returns IPRT status code.
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync * @param pDevExt The device extension to initialize.
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncint VBOXCALL supdrvInitDevExt(PSUPDRVDEVEXT pDevExt)
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync * Create the release log.
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync static const char * const s_apszGroups[] = VBOX_LOGGROUP_NAMES;
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync rc = RTLogCreate(&pRelLogger, 0 /* fFlags */, "all",
f2ffcc39cf4469a87fea28faf36a3918493bf7c1vboxsync "VBOX_RELEASE_LOG", RT_ELEMENTS(s_apszGroups), s_apszGroups,
b79e4344bf4eb8033fd06d560cd864192728bd0bvboxsync * Initialize it.
f2ffcc39cf4469a87fea28faf36a3918493bf7c1vboxsync rc = RTSemFastMutexCreate(&pDevExt->mtxComponentFactory);
b79e4344bf4eb8033fd06d560cd864192728bd0bvboxsync pDevExt->u32Cookie = BIRD; /** @todo make this random? */
b79e4344bf4eb8033fd06d560cd864192728bd0bvboxsync RTSemFastMutexDestroy(pDevExt->mtxComponentFactory);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync * Delete the device extension (e.g. cleanup members).
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync * @param pDevExt The device extension to delete.
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsyncvoid VBOXCALL supdrvDeleteDevExt(PSUPDRVDEVEXT pDevExt)
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync * Kill mutexes and spinlocks.
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync RTSemFastMutexDestroy(pDevExt->mtxComponentFactory);
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync * Free lists.
922f46b2f42ccb05e3c9cba34bbd1d2c19e04120vboxsync /* objects. */
while (pObj)
while (pUsage)
#ifdef SUPDRV_WITH_RELEASE_LOGGER
if (pSession)
if (!rc)
pSession->Bundle.cUsed = 0; */
if (fUser)
return VINF_SUCCESS;
return rc;
AssertMsg(pUsage->cUsage >= 1 && pObj->cUsage >= pUsage->cUsage, ("glob %d; sess %d\n", pObj->cUsage, pUsage->cUsage));
pObj, pObj->enmType, pObj->pvUser1, pObj->pvUser2, pObj->CreatorProcess, RTProcSelf(), pObj->pfnDestructor));
#ifdef RT_WITH_W64_UNWIND_HACK
while (pBundle)
int rc;
Log2(("eType=%d pvR0=%p pvR3=%p cb=%ld\n", pBundle->aMem[i].eType, RTR0MemObjAddress(pBundle->aMem[i].MemObj),
(void *)RTR0MemObjAddressR3(pBundle->aMem[i].MapObjR3), (long)RTR0MemObjSize(pBundle->aMem[i].MemObj)));
while (pCur)
if (pPrev)
while (pUsage)
int VBOXCALL supdrvIOCtlFast(uintptr_t uIOCtl, unsigned idCpu, PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession)
switch (uIOCtl)
#ifdef RT_WITH_W64_UNWIND_HACK
supdrvNtWrapVMMR0EntryFast((PFNRT)pDevExt->pfnVMMR0EntryFast, pSession->pVM, idCpu, SUP_VMMR0_DO_RAW_RUN);
#ifdef RT_WITH_W64_UNWIND_HACK
supdrvNtWrapVMMR0EntryFast((PFNRT)pDevExt->pfnVMMR0EntryFast, pSession->pVM, idCpu, SUP_VMMR0_DO_HWACC_RUN);
case SUP_IOCTL_FAST_DO_NOP:
#ifdef RT_WITH_W64_UNWIND_HACK
supdrvNtWrapVMMR0EntryFast((PFNRT)pDevExt->pfnVMMR0EntryFast, pSession->pVM, idCpu, SUP_VMMR0_DO_NOP);
return VERR_INTERNAL_ERROR;
return VINF_SUCCESS;
return VERR_INTERNAL_ERROR;
* list, see http://www.kerneldrivers.org/RHEL5.
int chCur;
int ch;
int VBOXCALL supdrvIOCtl(uintptr_t uIOCtl, PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPREQHDR pReqHdr)
return VERR_INVALID_PARAMETER;
return VERR_INVALID_PARAMETER;
OSDBGPRINT(("vboxdrv: bad cookie %#lx / %#lx.\n", (long)pReqHdr->u32Cookie, (long)pReqHdr->u32SessionCookie));
return VERR_INVALID_PARAMETER;
OSDBGPRINT(( #Name ": Invalid input/output sizes. cbIn=%ld expected %ld. cbOut=%ld expected %ld.\n", \
REQ_CHECK_SIZES_EX(SUP_IOCTL_QUERY_FUNCS, SUP_IOCTL_QUERY_FUNCS_SIZE_IN, SUP_IOCTL_QUERY_FUNCS_SIZE_OUT(RT_ELEMENTS(g_aFunctions)));
pReq->Hdr.rc = SUPR0ContAlloc(pSession, pReq->u.In.cPages, &pReq->u.Out.pvR0, &pReq->u.Out.pvR3, &pReq->u.Out.HCPhys);
REQ_CHECK_EXPR(SUP_IOCTL_LDR_OPEN, !supdrvCheckInvalidChar(pReq->u.In.szName, ";:()[]{}/\\|&*%#@!~`\"'"));
REQ_CHECK_SIZES_EX(SUP_IOCTL_LDR_LOAD, SUP_IOCTL_LDR_LOAD_SIZE_IN(pReq->u.In.cbImage), SUP_IOCTL_LDR_LOAD_SIZE_OUT);
uint32_t i;
("SUP_IOCTL_LDR_LOAD: sym #%ld: symb off %#lx (max=%#lx)\n", (long)i, (long)paSyms[i].offSymbol, (long)pReq->u.In.cbImage));
("SUP_IOCTL_LDR_LOAD: sym #%ld: name off %#lx (max=%#lx)\n", (long)i, (long)paSyms[i].offName, (long)pReq->u.In.cbImage));
REQ_CHECK_EXPR_FMT(memchr(&pReq->u.In.achImage[pReq->u.In.offStrTab + paSyms[i].offName], '\0', pReq->u.In.cbStrTab - paSyms[i].offName),
("SUP_IOCTL_LDR_LOAD: sym #%ld: unterminated name! (%#lx / %#lx)\n", (long)i, (long)paSyms[i].offName, (long)pReq->u.In.cbImage));
REQ_CHECK_EXPR(SUP_IOCTL_LDR_GET_SYMBOL, memchr(pReq->u.In.szSymbol, '\0', sizeof(pReq->u.In.szSymbol)));
REQ_CHECK_SIZES_EX(SUP_IOCTL_CALL_VMMR0, SUP_IOCTL_CALL_VMMR0_SIZE_IN(0), SUP_IOCTL_CALL_VMMR0_SIZE_OUT(0));
#ifdef RT_WITH_W64_UNWIND_HACK
pReq->Hdr.rc = supdrvNtWrapVMMR0EntryEx((PFNRT)pDevExt->pfnVMMR0EntryEx, pReq->u.In.pVMR0, pReq->u.In.uOperation, NULL, pReq->u.In.u64Arg, pSession);
pReq->Hdr.rc = pDevExt->pfnVMMR0EntryEx(pReq->u.In.pVMR0, pReq->u.In.uOperation, NULL, pReq->u.In.u64Arg, pSession);
("SUP_IOCTL_CALL_VMMR0: cbIn=%#x < %#lx\n", pReq->Hdr.cbIn, SUP_IOCTL_CALL_VMMR0_SIZE(sizeof(SUPVMMR0REQHDR))));
REQ_CHECK_SIZES_EX(SUP_IOCTL_CALL_VMMR0, SUP_IOCTL_CALL_VMMR0_SIZE_IN(pVMMReq->cbReq), SUP_IOCTL_CALL_VMMR0_SIZE_OUT(pVMMReq->cbReq));
#ifdef RT_WITH_W64_UNWIND_HACK
pReq->Hdr.rc = supdrvNtWrapVMMR0EntryEx((PFNRT)pDevExt->pfnVMMR0EntryEx, pReq->u.In.pVMR0, pReq->u.In.uOperation, pVMMReq, pReq->u.In.u64Arg, pSession);
pReq->Hdr.rc = pDevExt->pfnVMMR0EntryEx(pReq->u.In.pVMR0, pReq->u.In.uOperation, pVMMReq, pReq->u.In.u64Arg, pSession);
pReq->Hdr.rc, pReq->u.In.uOperation, pReq->Hdr.cbOut, pReq->u.In.u64Arg, RTProcSelf(), RTThreadNativeSelf()));
pReq->Hdr.rc, pReq->u.In.uOperation, pReq->Hdr.cbOut, pReq->u.In.u64Arg, RTProcSelf(), RTThreadNativeSelf()));
REQ_CHECK_SIZES_EX(SUP_IOCTL_LOW_ALLOC, SUP_IOCTL_LOW_ALLOC_SIZE_IN, SUP_IOCTL_LOW_ALLOC_SIZE_OUT(pReq->u.In.cPages));
pReq->Hdr.rc = SUPR0LowAlloc(pSession, pReq->u.In.cPages, &pReq->u.Out.pvR0, &pReq->u.Out.pvR3, &pReq->u.Out.aPages[0]);
REQ_CHECK_SIZES_EX(SUP_IOCTL_PAGE_ALLOC, SUP_IOCTL_PAGE_ALLOC_SIZE_IN, SUP_IOCTL_PAGE_ALLOC_SIZE_OUT(pReq->u.In.cPages));
pReq->Hdr.rc = SUPR0PageAlloc(pSession, pReq->u.In.cPages, &pReq->u.Out.pvR3, &pReq->u.Out.aPages[0]);
REQ_CHECK_SIZES_EX(SUP_IOCTL_PAGE_ALLOC_EX, SUP_IOCTL_PAGE_ALLOC_EX_SIZE_IN, SUP_IOCTL_PAGE_ALLOC_EX_SIZE_OUT(pReq->u.In.cPages));
("SUP_IOCTL_PAGE_ALLOC_EX: fReserved0=%d fReserved1=%d\n", pReq->u.In.fReserved0, pReq->u.In.fReserved1));
REQ_CHECK_SIZES_EX(SUP_IOCTL_CALL_SERVICE, SUP_IOCTL_CALL_SERVICE_SIZE_IN(0), SUP_IOCTL_CALL_SERVICE_SIZE_OUT(0));
("SUP_IOCTL_CALL_SERVICE: cbIn=%#x < %#lx\n", pReq->Hdr.cbIn, SUP_IOCTL_CALL_SERVICE_SIZE(sizeof(SUPR0SERVICEREQHDR))));
REQ_CHECK_SIZES_EX(SUP_IOCTL_CALL_SERVICE, SUP_IOCTL_CALL_SERVICE_SIZE_IN(pSrvReq->cbReq), SUP_IOCTL_CALL_SERVICE_SIZE_OUT(pSrvReq->cbReq));
return SUPDRV_ERR_GENERAL_FAILURE;
int VBOXCALL supdrvIDC(uintptr_t uReq, PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPDRVIDCREQHDR pReqHdr)
return VERR_INVALID_PARAMETER;
switch (uReq)
case SUPDRV_IDC_REQ_CONNECT:
|| (pReq->u.In.uMinVersion & UINT32_C(0xffff0000)) != (pReq->u.In.uReqVersion & UINT32_C(0xffff0000)))
return VINF_SUCCESS;
#ifdef RT_OS_WINDOWS
return VINF_SUCCESS;
return VINF_SUCCESS;
#ifdef RT_OS_WINDOWS
return VINF_SUCCESS;
return VINF_SUCCESS;
return VINF_SUCCESS;
return VERR_NOT_SUPPORTED;
* @param pfnDestructor The destructore function which will be called when the reference count reaches 0.
SUPR0DECL(void *) SUPR0ObjRegister(PSUPDRVSESSION pSession, SUPDRVOBJTYPE enmType, PFNSUPDRVDESTRUCTOR pfnDestructor, void *pvUser1, void *pvUser2)
if (!pObj)
return NULL;
if (pUsage)
if (!pUsage)
return NULL;
/* Log2(("SUPR0ObjRegister: pUsage=%p:{.pObj=%p, .pNext=%p}\n", pUsage, pUsage->pObj, pUsage->pNext)); */
return pObj;
("Invalid pvObj=%p magic=%#x (expected %#x or %#x)\n", pvObj, pObj->u32Magic, SUPDRVOBJ_MAGIC, SUPDRVOBJ_MAGIC + 1),
return VERR_WRONG_ORDER;
if (pUsagePre)
if (!pUsagePre)
return VERR_NO_MEMORY;
if (pUsage)
/*Log(("SUPR0AddRef: pUsagePre=%p:{.pObj=%p, .pNext=%p}\n", pUsagePre, pUsagePre->pObj, pUsagePre->pNext));*/
if (pUsagePre)
return VINF_SUCCESS;
bool fDestroy = false;
/*Log2(("SUPR0ObjRelease: pUsage=%p:{.pObj=%p, .pNext=%p}\n", pUsage, pUsage->pObj, pUsage->pNext));*/
AssertMsg(pUsage->cUsage >= 1 && pObj->cUsage >= pUsage->cUsage, ("glob %d; sess %d\n", pObj->cUsage, pUsage->cUsage));
if (pUsagePrev)
fDestroy = true;
if (fDestroy)
pObj, pObj->enmType, pObj->pvUser1, pObj->pvUser2, pObj->CreatorProcess, RTProcSelf(), pObj->pfnDestructor));
#ifdef RT_WITH_W64_UNWIND_HACK
int rc;
return rc;
return VINF_SUCCESS;
return VERR_PERMISSION_DENIED;
SUPR0DECL(int) SUPR0LockMem(PSUPDRVSESSION pSession, RTR3PTR pvR3, uint32_t cPages, PRTHCPHYS paPages)
int rc;
LogFlow(("SUPR0LockMem: pSession=%p pvR3=%p cPages=%d paPages=%p\n", pSession, (void *)pvR3, cPages, paPages));
|| !pvR3)
return VERR_INVALID_PARAMETER;
#ifdef RT_OS_WINDOWS /* A temporary hack for windows, will be removed once all ring-3 code has been cleaned up. */
return rc;
AssertMsg(RTR0MemObjAddressR3(Mem.MemObj) == pvR3, ("%p == %p\n", RTR0MemObjAddressR3(Mem.MemObj), pvR3));
while (iPage-- > 0)
return rc;
#ifdef RT_OS_WINDOWS
return VINF_SUCCESS;
SUPR0DECL(int) SUPR0ContAlloc(PSUPDRVSESSION pSession, uint32_t cPages, PRTR0PTR ppvR0, PRTR3PTR ppvR3, PRTHCPHYS pHCPhys)
int rc;
LogFlow(("SUPR0ContAlloc: pSession=%p cPages=%d ppvR0=%p ppvR3=%p pHCPhys=%p\n", pSession, cPages, ppvR0, ppvR3, pHCPhys));
return VERR_INVALID_PARAMETER;
return VERR_INVALID_PARAMETER;
int rc2;
if (!rc)
return rc;
SUPR0DECL(int) SUPR0LowAlloc(PSUPDRVSESSION pSession, uint32_t cPages, PRTR0PTR ppvR0, PRTR3PTR ppvR3, PRTHCPHYS paPages)
unsigned iPage;
int rc;
LogFlow(("SUPR0LowAlloc: pSession=%p cPages=%d ppvR3=%p ppvR0=%p paPages=%p\n", pSession, cPages, ppvR3, ppvR0, paPages));
return VERR_INVALID_PARAMETER;
return VERR_INVALID_PARAMETER;
int rc2;
if (!rc)
return rc;
int rc;
return VERR_INVALID_PARAMETER;
int rc2;
if (!rc)
return VINF_SUCCESS;
return rc;
SUPR0DECL(int) SUPR0MemGetPhys(PSUPDRVSESSION pSession, RTHCUINTPTR uPtr, PSUPPAGE paPages) /** @todo switch this bugger to RTHCPHYS */
return VINF_SUCCESS;
return VERR_INVALID_PARAMETER;
SUPR0DECL(int) SUPR0PageAlloc(PSUPDRVSESSION pSession, uint32_t cPages, PRTR3PTR ppvR3, PRTHCPHYS paPages)
SUPR0DECL(int) SUPR0PageAllocEx(PSUPDRVSESSION pSession, uint32_t cPages, uint32_t fFlags, PRTR3PTR ppvR3, PRTR0PTR ppvR0, PRTHCPHYS paPages)
int rc;
* Validate input. The allowed allocation size must be at least equal to the maximum guest VRAM size.
Log(("SUPR0PageAlloc: Illegal request cb=%u; must be greater than 0 and smaller than 128MB.\n", cPages));
return VERR_INVALID_PARAMETER;
if (ppvR0)
int rc2;
if (ppvR3)
if (!rc)
if (ppvR3)
if (ppvR0)
if (paPages)
while (iPage-- > 0)
return VINF_SUCCESS;
return rc;
#ifdef RT_OS_WINDOWS
static int supdrvPageGetPhys(PSUPDRVSESSION pSession, RTR3PTR pvR3, uint32_t cPages, PRTHCPHYS paPages)
LogFlow(("supdrvPageGetPhys: pSession=%p pvR3=%p cPages=%#lx paPages=%p\n", pSession, (void *)pvR3, (long)cPages, paPages));
return VINF_SUCCESS;
return VERR_INVALID_PARAMETER;
int rc = 0;
if (ppGipR3)
ASMAtomicXchgU32(&pGip->aCPUs[i].u32TransactionId, pGip->aCPUs[i].u32TransactionId & ~(GIP_UPDATEHZ_RECALC_FREQ * 2 - 1));
if (pHCPhysGip)
if (ppGipR3)
#ifdef DEBUG_DARWIN_GIP
OSDBGPRINT(("SUPR0GipMap: returns %d *pHCPhysGip=%lx *ppGip=%p GipMapObjR3\n", rc, (unsigned long)HCPhys, pGip, pSession->GipMapObjR3));
LogFlow(("SUPR0GipMap: returns %d *pHCPhysGip=%lx *ppGipR3=%p\n", rc, (unsigned long)HCPhys, (void *)(uintptr_t)pGip));
return rc;
#ifdef DEBUG_DARWIN_GIP
return rc;
const char *psz;
int rc;
if (pNewReg)
if (!pCur)
if (pPrev)
return rc;
int rc;
if (pCur)
if (!pPrev)
return rc;
SUPR0DECL(int) SUPR0ComponentQueryFactory(PSUPDRVSESSION pSession, const char *pszName, const char *pszInterfaceUuid, void **ppvFactoryIf)
const char *pszEnd;
int rc;
while (pCur)
#ifdef RT_WITH_W64_UNWIND_HACK
void *pvFactory = supdrvNtWrapQueryFactoryInterface((PFNRT)pCur->pFactory->pfnQueryFactoryInterface, pCur->pFactory, pSession, pszInterfaceUuid);
void *pvFactory = pCur->pFactory->pfnQueryFactoryInterface(pCur->pFactory, pSession, pszInterfaceUuid);
if (pvFactory)
return rc;
return VINF_SUCCESS;
if (!pBundle)
return VERR_NO_MEMORY;
return VINF_SUCCESS;
if (!uPtr)
return VERR_INVALID_PARAMETER;
return VINF_SUCCESS;
return VERR_INVALID_PARAMETER;
unsigned cb;
void *pv;
return VINF_SUCCESS;
if (!pv)
return VERR_NO_MEMORY;
return VINF_SUCCESS;
int rc;
LogFlow(("supdrvIOCtl_LdrLoad: pvImageBase=%p cbImage=%d\n", pReq->u.In.pvImageBase, pReq->u.In.cbImage));
if (!pUsage)
return VERR_INVALID_HANDLE;
Log(("SUP_IOCTL_LDR_LOAD: image size mismatch!! %d(prep) != %d(load)\n", pImage->cbImage, pReq->u.In.cbImage));
return VERR_INVALID_HANDLE;
return SUPDRV_ERR_ALREADY_LOADED;
case SUPLDRLOADEP_NOTHING:
case SUPLDRLOADEP_VMMR0:
return VERR_INVALID_PARAMETER;
if ( (uintptr_t)pReq->u.In.EP.VMMR0.pvVMMR0EntryInt - (uintptr_t)pImage->pvImage >= pReq->u.In.cbImage
|| (uintptr_t)pReq->u.In.EP.VMMR0.pvVMMR0EntryFast - (uintptr_t)pImage->pvImage >= pReq->u.In.cbImage
|| (uintptr_t)pReq->u.In.EP.VMMR0.pvVMMR0EntryEx - (uintptr_t)pImage->pvImage >= pReq->u.In.cbImage)
Log(("Out of range (%p LB %#x): pvVMMR0EntryInt=%p, pvVMMR0EntryFast=%p or pvVMMR0EntryEx=%p is NULL!\n",
return VERR_INVALID_PARAMETER;
case SUPLDRLOADEP_SERVICE:
return VERR_INVALID_PARAMETER;
if ((uintptr_t)pReq->u.In.EP.Service.pfnServiceReq - (uintptr_t)pImage->pvImage >= pReq->u.In.cbImage)
Log(("Out of range (%p LB %#x): pfnServiceReq=%p, pvVMMR0EntryFast=%p or pvVMMR0EntryEx=%p is NULL!\n",
return VERR_INVALID_PARAMETER;
return VERR_INVALID_PARAMETER;
return VERR_INVALID_PARAMETER;
return VERR_INVALID_PARAMETER;
return VERR_INVALID_PARAMETER;
case SUPLDRLOADEP_NOTHING:
case SUPLDRLOADEP_VMMR0:
rc = supdrvLdrSetVMMR0EPs(pDevExt, pReq->u.In.EP.VMMR0.pvVMMR0, pReq->u.In.EP.VMMR0.pvVMMR0EntryInt,
case SUPLDRLOADEP_SERVICE:
#ifdef RT_WITH_W64_UNWIND_HACK
if (rc)
return rc;
int rc;
if (!pUsage)
return VERR_INVALID_HANDLE;
if (RT_UNLIKELY((uintptr_t)pGenUsage->pObj->pfnDestructor - (uintptr_t)pImage->pvImage < pImage->cbImage))
if (pUsagePrev)
return VINF_SUCCESS;
static int supdrvIOCtl_LdrGetSymbol(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPLDRGETSYMBOL pReq)
uint32_t i;
const char *pchStrings;
Log3(("supdrvIOCtl_LdrGetSymbol: pvImageBase=%p szSymbol=\"%s\"\n", pReq->u.In.pvImageBase, pReq->u.In.szSymbol));
if (!pUsage)
return VERR_INVALID_HANDLE;
return VERR_ALREADY_LOADED;
return rc;
static int supdrvIDC_LdrGetSymbol(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPDRVIDCREQGETSYM pReq)
char const *pszEnd;
uint32_t i;
if (pszModule)
Log3(("supdrvIDC_LdrGetSymbol: pszModule=%p:{%s} pszSymbol=%p:{%s}\n", pszModule, pszModule, pszSymbol, pszSymbol));
if ( !pszModule
return rc;
static int supdrvLdrSetVMMR0EPs(PSUPDRVDEVEXT pDevExt, void *pvVMMR0, void *pvVMMR0EntryInt, void *pvVMMR0EntryFast, void *pvVMMR0EntryEx)
return rc;
while (pUsage)
return VINF_SUCCESS;
return VINF_SUCCESS;
if (pImagePrev)
unsigned cObjs = 0;
cObjs++;
if (cObjs)
#ifdef RT_WITH_W64_UNWIND_HACK
static int supdrvIOCtl_CallServiceModule(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPCALLSERVICE pReq)
int rc;
if (pfnServiceReqHandler)
#ifdef RT_WITH_W64_UNWIND_HACK
rc = supdrvNtWrapServiceReqHandler((PFNRT)pfnServiceReqHandler, pSession, pReq->u.In.uOperation, pReq->u.In.u64Arg, NULL);
#ifdef RT_WITH_W64_UNWIND_HACK
rc = pfnServiceReqHandler(pSession, pReq->u.In.uOperation, pReq->u.In.u64Arg, (PSUPR0SERVICEREQHDR)&pReq->abReqPkt[0]);
rc, pReq->u.In.uOperation, pReq->Hdr.cbOut, pReq->u.In.u64Arg, RTProcSelf(), RTThreadNativeSelf()));
rc, pReq->u.In.uOperation, pReq->Hdr.cbOut, pReq->u.In.u64Arg, RTProcSelf(), RTThreadNativeSelf()));
return rc;
return VERR_NOT_IMPLEMENTED;
case X86_CR4_PGE:
case X86_CR4_PAE:
return enmMode;
int rc;
return rc;
#if 0 /** @todo Disabled this as we didn't used to do it before and causes unnecessary stress on laptops.
rc = RTTimerCreateEx(&pDevExt->pGipTimer, u32Interval, RTTIMER_FLAGS_CPU_ALL, supdrvGipAsyncTimer, pDevExt);
return VINF_SUCCESS;
OSDBGPRINT(("supdrvGipCreate: failed create GIP timer at %ld ns interval. rc=%d\n", (long)u32Interval, rc));
return rc;
int rc;
#ifdef DEBUG_DARWIN_GIP
bool fIgnored;
for (i = 0; i < RTCPUSET_MAX_CPUS; i++)
int VBOXCALL supdrvGipInit(PSUPDRVDEVEXT pDevExt, PSUPGLOBALINFOPAGE pGip, RTHCPHYS HCPhys, uint64_t u64NanoTS, unsigned uUpdateHz)
#ifdef DEBUG_DARWIN_GIP
OSDBGPRINT(("supdrvGipInit: pGip=%p HCPhys=%lx u64NanoTS=%llu uUpdateHz=%d\n", pGip, (long)HCPhys, u64NanoTS, uUpdateHz));
LogFlow(("supdrvGipInit: pGip=%p HCPhys=%lx u64NanoTS=%llu uUpdateHz=%d\n", pGip, (long)HCPhys, u64NanoTS, uUpdateHz));
return VINF_SUCCESS;
static DECLCALLBACK(void) supdrvDetermineAsyncTscWorker(RTCPUID idCpu, void *pvUser1, void *pvUser2)
int iCpu;
bool fAsync = false;
while (cLoops-- > 0)
fAsync = true;
return fAsync;
return SUPGIPMODE_ASYNC_TSC;
return SUPGIPMODE_ASYNC_TSC;
return SUPGIPMODE_ASYNC_TSC;
return SUPGIPMODE_SYNC_TSC;
unsigned iTSCHistoryHead;