SUPDrvInternal.h revision b3325f50334bd566860a0a324a137961966f9b33
57775f39a19dc392e5882d5217d5a9148688aa4aMatt Sweeney/* $Revision$ */
69ce664b1e66d48ae3ae5be08488f38b4855fc8bSatyen Desai * VirtualBox Support Driver - Internal header.
69ce664b1e66d48ae3ae5be08488f38b4855fc8bSatyen Desai * Copyright (C) 2006-2007 Sun Microsystems, Inc.
69ce664b1e66d48ae3ae5be08488f38b4855fc8bSatyen Desai * This file is part of VirtualBox Open Source Edition (OSE), as
69ce664b1e66d48ae3ae5be08488f38b4855fc8bSatyen Desai * available from http://www.virtualbox.org. This file is free software;
69ce664b1e66d48ae3ae5be08488f38b4855fc8bSatyen Desai * you can redistribute it and/or modify it under the terms of the GNU
69ce664b1e66d48ae3ae5be08488f38b4855fc8bSatyen Desai * General Public License (GPL) as published by the Free Software
69ce664b1e66d48ae3ae5be08488f38b4855fc8bSatyen Desai * Foundation, in version 2 as it comes in the "COPYING" file of the
eaa9719567e2ec55d96f9298077f5fc0effe1ed3Satyen Desai * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
69ce664b1e66d48ae3ae5be08488f38b4855fc8bSatyen Desai * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
86fa3fa071113dfe732100d1a15cb149f67ffc83Jenny Donnelly * The contents of this file may alternatively be used under the terms
86fa3fa071113dfe732100d1a15cb149f67ffc83Jenny Donnelly * of the Common Development and Distribution License Version 1.0
86fa3fa071113dfe732100d1a15cb149f67ffc83Jenny Donnelly * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
86fa3fa071113dfe732100d1a15cb149f67ffc83Jenny Donnelly * VirtualBox OSE distribution, in which case the provisions of the
86fa3fa071113dfe732100d1a15cb149f67ffc83Jenny Donnelly * CDDL are applicable instead of those of the GPL.
69ce664b1e66d48ae3ae5be08488f38b4855fc8bSatyen Desai * You may elect to license modified versions of this file under the
69ce664b1e66d48ae3ae5be08488f38b4855fc8bSatyen Desai * terms and conditions of either the GPL or the CDDL or both.
69ce664b1e66d48ae3ae5be08488f38b4855fc8bSatyen Desai * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
69ce664b1e66d48ae3ae5be08488f38b4855fc8bSatyen Desai * Clara, CA 95054 USA or visit http://www.sun.com if you need
69ce664b1e66d48ae3ae5be08488f38b4855fc8bSatyen Desai * additional information or have any questions.
feaab31990f7893c59257f33cd9f708a6c0e7ddbSatyen Desai/*******************************************************************************
69ce664b1e66d48ae3ae5be08488f38b4855fc8bSatyen Desai* Header Files *
69ce664b1e66d48ae3ae5be08488f38b4855fc8bSatyen Desai*******************************************************************************/
69ce664b1e66d48ae3ae5be08488f38b4855fc8bSatyen Desai# if (_MSC_VER >= 1400) && !defined(VBOX_WITH_PATCHED_DDK)
69ce664b1e66d48ae3ae5be08488f38b4855fc8bSatyen Desai# define _InterlockedExchange _InterlockedExchange_StupidDDKVsCompilerCrap
69ce664b1e66d48ae3ae5be08488f38b4855fc8bSatyen Desai# define _InterlockedExchangeAdd _InterlockedExchangeAdd_StupidDDKVsCompilerCrap
69ce664b1e66d48ae3ae5be08488f38b4855fc8bSatyen Desai# define _InterlockedCompareExchange _InterlockedCompareExchange_StupidDDKVsCompilerCrap
69ce664b1e66d48ae3ae5be08488f38b4855fc8bSatyen Desai# define _InterlockedAddLargeStatistic _InterlockedAddLargeStatistic_StupidDDKVsCompilerCrap
69ce664b1e66d48ae3ae5be08488f38b4855fc8bSatyen Desai# define _interlockedbittestandset _interlockedbittestandset_StupidDDKVsCompilerCrap
69ce664b1e66d48ae3ae5be08488f38b4855fc8bSatyen Desai# define _interlockedbittestandreset _interlockedbittestandreset_StupidDDKVsCompilerCrap
69ce664b1e66d48ae3ae5be08488f38b4855fc8bSatyen Desai# define _interlockedbittestandset64 _interlockedbittestandset64_StupidDDKVsCompilerCrap
69ce664b1e66d48ae3ae5be08488f38b4855fc8bSatyen Desai# define _interlockedbittestandreset64 _interlockedbittestandreset64_StupidDDKVsCompilerCrap
69ce664b1e66d48ae3ae5be08488f38b4855fc8bSatyen Desai int VBOXCALL mymemcmp(const void *, const void *, size_t);
eaa9719567e2ec55d96f9298077f5fc0effe1ed3Satyen Desai# if defined(CONFIG_MODVERSIONS) && !defined(MODVERSIONS)
69ce664b1e66d48ae3ae5be08488f38b4855fc8bSatyen Desai# if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 71)
69ce664b1e66d48ae3ae5be08488f38b4855fc8bSatyen Desai# if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 0)
69ce664b1e66d48ae3ae5be08488f38b4855fc8bSatyen Desai# if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 16)
69ce664b1e66d48ae3ae5be08488f38b4855fc8bSatyen Desai# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
69ce664b1e66d48ae3ae5be08488f38b4855fc8bSatyen Desai# else /* older kernels */
57775f39a19dc392e5882d5217d5a9148688aa4aMatt Sweeney# endif /* older kernels */
75013e52e14f366e77d0a078bc1bfedfa421fe70Satyen Desai# define memset libkern_memset /** @todo these are just hacks to get it compiling, check out later. */
75013e52e14f366e77d0a078bc1bfedfa421fe70Satyen Desai/*******************************************************************************
75013e52e14f366e77d0a078bc1bfedfa421fe70Satyen Desai* Defined Constants And Macros *
75013e52e14f366e77d0a078bc1bfedfa421fe70Satyen Desai*******************************************************************************/
75013e52e14f366e77d0a078bc1bfedfa421fe70Satyen Desai * Hardcoded cookies.
75013e52e14f366e77d0a078bc1bfedfa421fe70Satyen Desai/* debug printf */
75013e52e14f366e77d0a078bc1bfedfa421fe70Satyen Desai/** Maximum number of bytes we try to lock down in one go.
75013e52e14f366e77d0a078bc1bfedfa421fe70Satyen Desai * This is supposed to have a limit right below 256MB, but this appears
75013e52e14f366e77d0a078bc1bfedfa421fe70Satyen Desai * to actually be much lower. The values here have been determined experimentally.
75013e52e14f366e77d0a078bc1bfedfa421fe70Satyen Desai# define MAX_LOCK_MEM_SIZE (32*1024*1024) /* 32mb */
75013e52e14f366e77d0a078bc1bfedfa421fe70Satyen Desai# define MAX_LOCK_MEM_SIZE (24*1024*1024) /* 24mb */
75013e52e14f366e77d0a078bc1bfedfa421fe70Satyen Desai/* check kernel version */
75013e52e14f366e77d0a078bc1bfedfa421fe70Satyen Desai#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
75013e52e14f366e77d0a078bc1bfedfa421fe70Satyen Desai/* debug printf */
75013e52e14f366e77d0a078bc1bfedfa421fe70Satyen Desai/* debug printf */
75013e52e14f366e77d0a078bc1bfedfa421fe70Satyen Desai/* No log API in OS/2 only COM port. */
69ce664b1e66d48ae3ae5be08488f38b4855fc8bSatyen Desai/* debug printf */
# ifdef LOG_TO_COM
# define dprintf(a) do {} while (0)
# define dprintf2(a) do { } while (0)
#ifdef DOXYGEN_RUNNING
# define RT_WITH_W64_UNWIND_HACK
#ifdef RT_WITH_W64_UNWIND_HACK
/** @todo retire the SUPDRV_ERR_* stuff, we ship err.h now. */
MEMREF_TYPE_UNUSED = 0,
typedef struct SUPDRVMEMREF
typedef struct SUPDRVBUNDLE
typedef struct SUPDRVLDRIMAGE
void *pvImage;
typedef struct SUPDRVLDRUSAGE
typedef struct SUPDRVFACTORYREG
typedef struct SUPDRVOBJ
void *pvUser1;
void *pvUser2;
typedef struct SUPDRVUSAGE
typedef struct SUPDRVSESSION
#if defined(RT_OS_DARWIN)
void *pvSupDrvClient;
bool fOpened;
#if defined(RT_OS_OS2)
typedef struct SUPDRVDEVEXT
void * volatile pvVMMR0;
DECLR0CALLBACKMEMBER(int, pfnVMMR0EntryEx, (PVM pVM, unsigned idCpu, unsigned uOperation, PSUPVMMR0REQHDR pReq, uint64_t u64Arg, PSUPDRVSESSION pSession));
#ifdef RT_OS_WINDOWS
} SUPDRVDEVEXT;
bool VBOXCALL supdrvOSObjCanAccess(PSUPDRVOBJ pObj, PSUPDRVSESSION pSession, const char *pszObjName, int *prc);
int VBOXCALL supdrvIOCtl(uintptr_t uIOCtl, PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPREQHDR pReqHdr);
int VBOXCALL supdrvIOCtlFast(uintptr_t uIOCtl, unsigned idCpu, PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession);
int VBOXCALL supdrvIDC(uintptr_t uIOCtl, PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPDRVIDCREQHDR pReqHdr);
int VBOXCALL supdrvGipInit(PSUPDRVDEVEXT pDevExt, PSUPGLOBALINFOPAGE pGip, RTHCPHYS HCPhys, uint64_t u64NanoTS, unsigned uUpdateHz);