Logo Search packages:      
Sourcecode: virtualbox-ose version File versions

SUPDRV.h

Go to the documentation of this file.
/* $Revision: 4161 $ */
/** @file
 * VirtualBox Support Driver - Internal header.
 */

/*
 * Copyright (C) 2006-2007 innotek GmbH
 *
 * This file is part of VirtualBox Open Source Edition (OSE), as
 * available from http://www.virtualbox.org. This file is free software;
 * you can redistribute it and/or modify it under the terms of the GNU
 * General Public License as published by the Free Software Foundation,
 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
 * distribution. VirtualBox OSE is distributed in the hope that it will
 * be useful, but WITHOUT ANY WARRANTY of any kind.
 */

#ifndef __SUPDRV_h__
#define __SUPDRV_h__


/*******************************************************************************
*   Header Files                                                               *
*******************************************************************************/
#include <VBox/cdefs.h>
#include <VBox/types.h>
#include <iprt/assert.h>
#include <iprt/asm.h>
#include <VBox/sup.h>
#ifdef USE_NEW_OS_INTERFACE
# define USE_NEW_OS_INTERFACE_FOR_MM
# define USE_NEW_OS_INTERFACE_FOR_GIP
# undef  USE_NEW_OS_INTERFACE_FOR_LOW
#endif
#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)
# include <iprt/memobj.h>
# include <iprt/time.h>
# include <iprt/timer.h>
# include <iprt/string.h>
# include <iprt/err.h>
#endif


#if defined(RT_OS_WINDOWS)
    __BEGIN_DECLS
#   if (_MSC_VER >= 1400) && !defined(VBOX_WITH_PATCHED_DDK)
#       define _InterlockedExchange           _InterlockedExchange_StupidDDKVsCompilerCrap
#       define _InterlockedExchangeAdd        _InterlockedExchangeAdd_StupidDDKVsCompilerCrap
#       define _InterlockedCompareExchange    _InterlockedCompareExchange_StupidDDKVsCompilerCrap
#       define _InterlockedAddLargeStatistic  _InterlockedAddLargeStatistic_StupidDDKVsCompilerCrap
#       include <ntddk.h>
#       undef  _InterlockedExchange
#       undef  _InterlockedExchangeAdd
#       undef  _InterlockedCompareExchange
#       undef  _InterlockedAddLargeStatistic
#   else
#       include <ntddk.h>
#   endif
#   include <memory.h>
#   define memcmp(a,b,c) mymemcmp(a,b,c)
    int VBOXCALL mymemcmp(const void *, const void *, size_t);
    __END_DECLS

#elif defined(RT_OS_LINUX)
#   include <linux/autoconf.h>
#   include <linux/version.h>
#   if defined(CONFIG_MODVERSIONS) && !defined(MODVERSIONS)
#       define MODVERSIONS
#       if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 71)
#           include <linux/modversions.h>
#       endif
#   endif
#   if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 0)
#       undef ALIGN
#   endif
#   ifndef KBUILD_STR
#       if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 16)
#            define KBUILD_STR(s) s
#       else
#            define KBUILD_STR(s) #s
#       endif
#   endif
#   include <linux/string.h>
#   include <linux/spinlock.h>
#   include <linux/slab.h>
#   include <asm/semaphore.h>
#   include <linux/timer.h>

#elif defined(RT_OS_DARWIN)
#   include <libkern/libkern.h>
#   include <iprt/string.h>

#elif defined(RT_OS_OS2)

#elif defined(RT_OS_FREEBSD)
#   include <sys/libkern.h>
#   include <iprt/string.h>

#elif defined(RT_OS_SOLARIS)
#   include <iprt/string.h>

#else
#   error "unsupported OS."
#endif

#include "SUPDRVIOC.h"



/*******************************************************************************
*   Defined Constants And Macros                                               *
*******************************************************************************/
/*
 * Hardcoded cookies.
 */
#define BIRD        0x64726962 /* 'bird' */
#define BIRD_INV    0x62697264 /* 'drib' */


/*
 * Win32
 */
#if defined(RT_OS_WINDOWS)

/* debug printf */
# define OSDBGPRINT(a) DbgPrint a

/** Maximum number of bytes we try to lock down in one go.
 * This is supposed to have a limit right below 256MB, but this appears
 * to actually be much lower. The values here have been determined experimentally.
 */
#ifdef RT_ARCH_X86
# define MAX_LOCK_MEM_SIZE   (32*1024*1024) /* 32mb */
#endif
#ifdef RT_ARCH_AMD64
# define MAX_LOCK_MEM_SIZE   (24*1024*1024) /* 24mb */
#endif


/*
 * Linux
 */
#elif defined(RT_OS_LINUX)

/* check kernel version */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 0)
# error Unsupported kernel version!
#endif

__BEGIN_DECLS
int  linux_dprintf(const char *format, ...);
__END_DECLS

/* debug printf */
# define OSDBGPRINT(a) printk a


/*
 * Darwin
 */
#elif defined(RT_OS_DARWIN)

/* debug printf */
# define OSDBGPRINT(a) printf a


/*
 * OS/2
 */
#elif defined(RT_OS_OS2)

/* No log API in OS/2 only COM port. */
# define OSDBGPRINT(a) SUPR0Printf a


/*
 * FreeBSD
 */
#elif defined(RT_OS_FREEBSD)

/* No log API in OS/2 only COM port. */
# define OSDBGPRINT(a) printf a


/*
 * Solaris
 */
#elif defined(RT_OS_SOLARIS)
# define OSDBGPRINT(a) printf a


#else
/** @todo other os'es */
# error "OS interface defines is not done for this OS!"
#endif


/* dprintf */
#if (defined(DEBUG) && !defined(NO_LOGGING)) || defined(RT_OS_FREEBSD)
# ifdef LOG_TO_COM
#  include <VBox/log.h>
#  define dprintf(a) RTLogComPrintf a
# else
#  define dprintf(a) OSDBGPRINT(a)
# endif
#else
00207 # define dprintf(a) do {} while (0)
#endif

/* dprintf2 - extended logging. */
#if defined(RT_OS_DARWIN) || defined(RT_OS_OS2) || defined(RT_OS_FREEBSD)
# define dprintf2 dprintf
#else
# define dprintf2(a) do { } while (0)
#endif


/*
 * Error codes.
 */
/** Invalid parameter. */
00222 #define SUPDRV_ERR_GENERAL_FAILURE  (-1)
/** Invalid parameter. */
00224 #define SUPDRV_ERR_INVALID_PARAM    (-2)
/** Invalid magic or cookie. */
00226 #define SUPDRV_ERR_INVALID_MAGIC    (-3)
/** Invalid loader handle. */
00228 #define SUPDRV_ERR_INVALID_HANDLE   (-4)
/** Failed to lock the address range. */
00230 #define SUPDRV_ERR_LOCK_FAILED      (-5)
/** Invalid memory pointer. */
00232 #define SUPDRV_ERR_INVALID_POINTER  (-6)
/** Failed to patch the IDT. */
00234 #define SUPDRV_ERR_IDT_FAILED       (-7)
/** Memory allocation failed. */
00236 #define SUPDRV_ERR_NO_MEMORY        (-8)
/** Already loaded. */
00238 #define SUPDRV_ERR_ALREADY_LOADED   (-9)
/** Permission denied. */
00240 #define SUPDRV_ERR_PERMISSION_DENIED (-10)
/** Version mismatch. */
00242 #define SUPDRV_ERR_VERSION_MISMATCH (-11)



/*******************************************************************************
*   Structures and Typedefs                                                    *
*******************************************************************************/
/** Pointer to the device extension. */
00250 typedef struct SUPDRVDEVEXT *PSUPDRVDEVEXT;

#ifndef VBOX_WITHOUT_IDT_PATCHING

/**
 * An IDT Entry.
 */
00257 typedef struct SUPDRVIDTE
{
    /** Low offset word. */
00260     uint32_t    u16OffsetLow : 16;
    /** Segment Selector. */
00262     uint32_t    u16SegSel : 16;
#ifdef RT_ARCH_AMD64
    /** Interrupt Stack Table index. */
    uint32_t    u3IST : 3;
    /** Reserved, ignored. */
    uint32_t    u5Reserved : 5;
#else
    /** Reserved. */
00270     uint32_t    u5Reserved : 5;
    /** IDT Type part one (not used for task gate). */
00272     uint32_t    u3Type1 : 3;
#endif
    /** IDT Type part two. */
00275     uint32_t    u5Type2 : 5;
    /** Descriptor Privilege level. */
00277     uint32_t    u2DPL : 2;
    /** Present flag. */
00279     uint32_t    u1Present : 1;
    /** High offset word. */
00281     uint32_t    u16OffsetHigh : 16;
#ifdef RT_ARCH_AMD64
    /** The upper top part of the address. */
    uint32_t    u32OffsetTop;
    /** Reserved dword for qword (aligning the struct), ignored. */
    uint32_t    u32Reserved;
#endif
} SUPDRVIDTE, *PSUPDRVIDTE;

/** The u5Type2 value for an interrupt gate. */
00291 #define SUPDRV_IDTE_TYPE2_INTERRUPT_GATE    0x0e


/**
 * Patch code.
 */
00297 typedef struct SUPDRVPATCH
{
#define SUPDRV_PATCH_CODE_SIZE  0x50
    /** Patch code. */
00301     uint8_t                 auCode[SUPDRV_PATCH_CODE_SIZE];
    /** Changed IDT entry (for parnoid UnpatchIdt()). */
00303     SUPDRVIDTE              ChangedIdt;
    /** Saved IDT entry. */
00305     SUPDRVIDTE              SavedIdt;
    /** Pointer to the IDT.
     * We ASSUME the IDT is not re(al)located after bootup and use this as key
     * for the patches rather than processor number. This prevents some
     * stupid nesting stuff from happening in case of processors sharing the
     * IDT.
     * We're fucked if the processors have different physical mapping for
     * the(se) page(s), but we'll find that out soon enough in VBOX_STRICT mode.
     */
00314     void                   *pvIdt;
    /** Pointer to the IDT entry. */
00316     SUPDRVIDTE volatile    *pIdtEntry;
    /** Usage counter. */
00318     uint32_t volatile       cUsage;
    /** The offset into auCode of the VMMR0Entry fixup. */
00320     uint16_t                offVMMR0EntryFixup;
    /** The offset into auCode of the stub function. */
00322     uint16_t                offStub;
    /** Pointer to the next patch. */
00324     struct SUPDRVPATCH * volatile pNext;
} SUPDRVPATCH, *PSUPDRVPATCH;

/**
 * Usage record for a patch.
 */
00330 typedef struct SUPDRVPATCHUSAGE
{
    /** Next in the chain. */
00333     struct SUPDRVPATCHUSAGE * volatile pNext;
    /** The patch this usage applies to. */
00335     PSUPDRVPATCH        pPatch;
    /** Usage count. */
00337     uint32_t volatile   cUsage;
} SUPDRVPATCHUSAGE, *PSUPDRVPATCHUSAGE;

#endif /* !VBOX_WITHOUT_IDT_PATCHING */


/**
 * Memory reference types.
 */
00346 typedef enum
{
    /** Unused entry */
00349     MEMREF_TYPE_UNUSED = 0,
    /** Locked memory (r3 mapping only). */
00351     MEMREF_TYPE_LOCKED,
    /** Continous memory block (r3 and r0 mapping). */
00353     MEMREF_TYPE_CONT,
    /** Low memory block (r3 and r0 mapping). */
00355     MEMREF_TYPE_LOW,
    /** Memory block (r3 and r0 mapping). */
00357     MEMREF_TYPE_MEM,
    /** Blow the type up to 32-bit and mark the end. */
00359     MEMREG_TYPE_32BIT_HACK = 0x7fffffff
} SUPDRVMEMREFTYPE, *PSUPDRVMEMREFTYPE;


/**
 * Structure used for tracking memory a session
 * references in one way or another.
 */
00367 typedef struct SUPDRVMEMREF
{
#ifdef USE_NEW_OS_INTERFACE_FOR_MM
    /** The memory object handle. */
    RTR0MEMOBJ          MemObj;
    /** The ring-3 mapping memory object handle. */
    RTR0MEMOBJ          MapObjR3;
    /** Type of memory. */
    SUPDRVMEMREFTYPE    eType;

#else /* !USE_NEW_OS_INTERFACE_FOR_MM */
    /** Pointer to the R0 mapping of the memory.
     * Set to NULL if N/A. */
00380     void               *pvR0;
    /** Pointer to the R3 mapping of the memory.
     * Set to NULL if N/A. */
00383     RTR3PTR             pvR3;
    /** Size of the locked memory. */
00385     unsigned            cb;
    /** Type of memory. */
00387     SUPDRVMEMREFTYPE    eType;

    /** memory type specific information. */
    union
    {
        struct
        {
#if defined(RT_OS_WINDOWS)
            /** Pointer to memory descriptor list (MDL). */
            PMDL               *papMdl;
            unsigned            cMdls;
#elif defined(RT_OS_LINUX)
            struct page       **papPages;
          unsigned            cPages;
#else
# error "Either no target was defined or we haven't ported the driver to the target yet."
#endif
        } locked;
        struct
        {
#if defined(RT_OS_WINDOWS)
            /** Pointer to memory descriptor list (MDL). */
            PMDL                pMdl;
#elif defined(RT_OS_LINUX)
            struct page        *paPages;
          unsigned            cPages;
#else
# error "Either no target was defined or we haven't ported the driver to the target yet."
#endif
        } cont;
        struct
        {
#if defined(RT_OS_WINDOWS)
            /** Pointer to memory descriptor list (MDL). */
            PMDL                pMdl;
#elif defined(RT_OS_LINUX)
            /** Pointer to the array of page pointers. */
            struct page       **papPages;
            /** Number of pages in papPages. */
          unsigned            cPages;
#else
# error "Either no target was defined or we haven't ported the driver to the target yet."
#endif
        } mem;
#if defined(USE_NEW_OS_INTERFACE_FOR_LOW)
        struct
        {
            /** The memory object handle. */
            RTR0MEMOBJ          MemObj;
            /** The ring-3 mapping memory object handle. */
            RTR0MEMOBJ          MapObjR3;
        } iprt;
#endif
    } u;
#endif /* !USE_NEW_OS_INTERFACE_FOR_MM */
} SUPDRVMEMREF, *PSUPDRVMEMREF;


/**
 * Bundle of locked memory ranges.
 */
00448 typedef struct SUPDRVBUNDLE
{
    /** Pointer to the next bundle. */
00451     struct SUPDRVBUNDLE * volatile pNext;
    /** Referenced memory. */
00453     SUPDRVMEMREF        aMem[64];
    /** Number of entries used. */
00455     uint32_t volatile   cUsed;
} SUPDRVBUNDLE, *PSUPDRVBUNDLE;


/**
 * Loaded image.
 */
00462 typedef struct SUPDRVLDRIMAGE
{
    /** Next in chain. */
00465     struct SUPDRVLDRIMAGE * volatile pNext;
    /** Pointer to the image. */
00467     void               *pvImage;
    /** Pointer to the optional module initialization callback. */
00469     PFNR0MODULEINIT     pfnModuleInit;
    /** Pointer to the optional module termination callback. */
00471     PFNR0MODULETERM     pfnModuleTerm;
    /** Size of the image. */
00473     uint32_t            cbImage;
    /** The offset of the symbol table. */
00475     uint32_t            offSymbols;
    /** The number of entries in the symbol table. */
00477     uint32_t            cSymbols;
    /** The offset of the string table. */
00479     uint32_t            offStrTab;
    /** Size of the string table. */
00481     uint32_t            cbStrTab;
    /** The ldr image state. (IOCtl code of last opration.) */
00483     uint32_t            uState;
    /** Usage count. */
00485     uint32_t volatile   cUsage;
    /** Image name. */
00487     char                szName[32];
} SUPDRVLDRIMAGE, *PSUPDRVLDRIMAGE;


/** Image usage record. */
00492 typedef struct SUPDRVLDRUSAGE
{
    /** Next in chain. */
00495     struct SUPDRVLDRUSAGE * volatile pNext;
    /** The image. */
00497     PSUPDRVLDRIMAGE     pImage;
    /** Load count. */
00499     uint32_t volatile   cUsage;
} SUPDRVLDRUSAGE, *PSUPDRVLDRUSAGE;


/**
 * Registered object.
 * This takes care of reference counting and tracking data for access checks.
 */
00507 typedef struct SUPDRVOBJ
{
    /** Magic value (SUPDRVOBJ_MAGIC). */
00510     uint32_t                        u32Magic;
    /** The object type. */
00512     SUPDRVOBJTYPE                   enmType;
    /** Pointer to the next in the global list. */
00514     struct SUPDRVOBJ * volatile     pNext;
    /** Pointer to the object destructor. */
00516     PFNSUPDRVDESTRUCTOR             pfnDestructor;
    /** User argument 1. */
00518     void                           *pvUser1;
    /** User argument 2. */
00520     void                           *pvUser2;
    /** The total sum of all per-session usage. */
00522     uint32_t volatile               cUsage;
    /** The creator user id. */
00524     RTUID                           CreatorUid;
    /** The creator group id. */
00526     RTGID                           CreatorGid;
    /** The creator process id. */
00528     RTPROCESS                       CreatorProcess;
} SUPDRVOBJ, *PSUPDRVOBJ;

/** Magic number for SUPDRVOBJ::u32Magic. (Dame Agatha Mary Clarissa Christie). */
00532 #define SUPDRVOBJ_MAGIC             0x18900915

/**
 * The per-session object usage record.
 */
00537 typedef struct SUPDRVUSAGE
{
    /** Pointer to the next in the list. */
00540     struct SUPDRVUSAGE * volatile   pNext;
    /** Pointer to the object we're recording usage for. */
00542     PSUPDRVOBJ                      pObj;
    /** The usage count. */
00544     uint32_t volatile               cUsage;
} SUPDRVUSAGE, *PSUPDRVUSAGE;


/**
 * Per session data.
 * This is mainly for memory tracking.
 */
00552 typedef struct SUPDRVSESSION
{
    /** Pointer to the device extension. */
00555     PSUPDRVDEVEXT               pDevExt;
    /** Session Cookie. */
00557     uint32_t                    u32Cookie;

    /** Load usage records. (protected by SUPDRVDEVEXT::mtxLdr) */
00560     PSUPDRVLDRUSAGE volatile    pLdrUsage;
#ifndef VBOX_WITHOUT_IDT_PATCHING
    /** Patch usage records. (protected by SUPDRVDEVEXT::SpinLock) */
00563     PSUPDRVPATCHUSAGE volatile  pPatchUsage;
#else
    /** The VM associated with the session. */
    PVM                         pVM;
#endif
    /** List of generic usage records. (protected by SUPDRVDEVEXT::SpinLock) */
00569     PSUPDRVUSAGE volatile       pUsage;

    /** Spinlock protecting the bundles and the GIP members. */
00572     RTSPINLOCK                  Spinlock;
#ifdef USE_NEW_OS_INTERFACE_FOR_GIP
    /** The ring-3 mapping of the GIP (readonly). */
    RTR0MEMOBJ                  GipMapObjR3;
#else
    /** The read-only usermode mapping address of the GID.
     * This is NULL if the GIP hasn't been mapped. */
00579     PSUPGLOBALINFOPAGE          pGip;
#endif
    /** Set if the session is using the GIP. */
00582     uint32_t                    fGipReferenced;
    /** Bundle of locked memory objects. */
00584     SUPDRVBUNDLE                Bundle;

    /** The user id of the session. (Set by the OS part.) */
00587     RTUID                       Uid;
    /** The group id of the session. (Set by the OS part.) */
00589     RTGID                       Gid;
    /** The process (id) of the session. (Set by the OS part.) */
00591     RTPROCESS                   Process;
    /** Which process this session is associated with. */
00593     RTR0PROCESS                 R0Process;
#if defined(RT_OS_OS2)
    /** The system file number of this session. */
    uint16_t                    sfn;
    uint16_t                    Alignment; /**< Alignment */
#endif
#if defined(RT_OS_DARWIN) || defined(RT_OS_OS2) || defined(RT_OS_SOLARIS)
    /** Pointer to the next session with the same hash. */
    PSUPDRVSESSION              pNextHash;
#endif
} SUPDRVSESSION;


/**
 * Device extension.
 */
00609 typedef struct SUPDRVDEVEXT
{
    /** Spinlock to serialize the initialization,
     * usage counting and destruction of the IDT entry override. */
00613     RTSPINLOCK              Spinlock;

#ifndef VBOX_WITHOUT_IDT_PATCHING
    /** List of patches. */
00617     PSUPDRVPATCH volatile   pIdtPatches;
    /** List of patches Free. */
00619     PSUPDRVPATCH volatile   pIdtPatchesFree;
#endif

    /** List of registered objects. */
00623     PSUPDRVOBJ volatile     pObjs;
    /** List of free object usage records. */
00625     PSUPDRVUSAGE volatile   pUsageFree;

    /** Global cookie. */
00628     uint32_t                u32Cookie;

    /** The IDT entry number.
     * Only valid if pIdtPatches is set. */
00632     uint8_t volatile        u8Idt;

    /** Loader mutex.
     * This protects pvVMMR0, pvVMMR0Entry, pImages and SUPDRVSESSION::pLdrUsage. */
00636     RTSEMFASTMUTEX          mtxLdr;

    /** VMM Module 'handle'.
     * 0 if the code VMM isn't loaded and Idt are nops. */
00640     void * volatile         pvVMMR0;
    /** VMMR0Entry() pointer. */
    DECLCALLBACKMEMBER(int, pfnVMMR0Entry)(PVM pVM, unsigned uOperation, void *pvArg);

    /** Linked list of loaded code. */
00645     PSUPDRVLDRIMAGE volatile pLdrImages;

    /** GIP mutex.
     * Any changes to any of the GIP members requires ownership of this mutex,
     * except on driver init and termination. */
00650     RTSEMFASTMUTEX          mtxGip;
    /** Pointer to the Global Info Page (GIP). */
00652     PSUPGLOBALINFOPAGE      pGip;
    /** The physical address of the GIP. */
00654     RTHCPHYS                HCPhysGip;
    /** Number of processes using the GIP.
     * (The updates are suspend while cGipUsers is 0.)*/
00657     uint32_t volatile       cGipUsers;
#ifdef USE_NEW_OS_INTERFACE_FOR_GIP
    /** The ring-0 memory object handle for the GIP page. */
    RTR0MEMOBJ              GipMemObj;
    /** The GIP timer handle. */
    PRTTIMER                pGipTimer;
    /** If non-zero we've successfully called RTTimerRequestSystemGranularity(). */
    uint32_t                u32SystemTimerGranularityGrant;
#endif
#ifdef RT_OS_WINDOWS
    /** The GIP timer object. */
    KTIMER                  GipTimer;
    /** The GIP DPC object associated with GipTimer. */
    KDPC                    GipDpc;
    /** The GIP DPC objects for updating per-cpu data. */
    KDPC                    aGipCpuDpcs[32];
    /** Pointer to the MDL for the pGip page. */
    PMDL                    pGipMdl;
    /** GIP timer interval (ms). */
    ULONG                   ulGipTimerInterval;
#endif
#ifdef RT_OS_LINUX
    /** The last jiffies. */
    unsigned long           ulLastJiffies;
    /** The last mono time stamp. */
    uint64_t volatile       u64LastMonotime;
    /** Set when GIP is suspended to prevent the timers from re-registering themselves). */
    uint8_t volatile        fGIPSuspended;
# ifdef CONFIG_SMP
    /** Array of per CPU data for SUPGIPMODE_ASYNC_TSC. */
    struct LINUXCPU
    {
        /** The last mono time stamp. */
        uint64_t volatile   u64LastMonotime;
        /** The last jiffies. */
        unsigned long       ulLastJiffies;
        /** The Linux Process ID. */
        unsigned            iSmpProcessorId;
        /** The per cpu timer. */
        struct timer_list   Timer;
    }                       aCPUs[256];
# endif
#endif
} SUPDRVDEVEXT;


__BEGIN_DECLS

/*******************************************************************************
*   OS Specific Functions                                                      *
*******************************************************************************/
void VBOXCALL   supdrvOSObjInitCreator(PSUPDRVOBJ pObj, PSUPDRVSESSION pSession);
bool VBOXCALL   supdrvOSObjCanAccess(PSUPDRVOBJ pObj, PSUPDRVSESSION pSession, const char *pszObjName, int *prc);
#ifndef USE_NEW_OS_INTERFACE_FOR_MM
int  VBOXCALL   supdrvOSLockMemOne(PSUPDRVMEMREF pMem, PSUPPAGE paPages);
void VBOXCALL   supdrvOSUnlockMemOne(PSUPDRVMEMREF pMem);
int  VBOXCALL   supdrvOSContAllocOne(PSUPDRVMEMREF pMem, PRTR0PTR ppvR0, PRTR3PTR ppvR3, PRTHCPHYS pHCPhys);
void VBOXCALL   supdrvOSContFreeOne(PSUPDRVMEMREF pMem);
int  VBOXCALL   supdrvOSLowAllocOne(PSUPDRVMEMREF pMem, PRTR0PTR ppvR0, PRTR3PTR ppvR3, PSUPPAGE paPages);
void VBOXCALL   supdrvOSLowFreeOne(PSUPDRVMEMREF pMem);
int  VBOXCALL   supdrvOSMemAllocOne(PSUPDRVMEMREF pMem, PRTR0PTR ppvR0, PRTR3PTR ppvR3);
void VBOXCALL   supdrvOSMemGetPages(PSUPDRVMEMREF pMem, PSUPPAGE paPages);
void VBOXCALL   supdrvOSMemFreeOne(PSUPDRVMEMREF pMem);
#endif
#ifndef USE_NEW_OS_INTERFACE_FOR_GIP
int  VBOXCALL   supdrvOSGipMap(PSUPDRVDEVEXT pDevExt, PSUPGLOBALINFOPAGE *ppGip);
int  VBOXCALL   supdrvOSGipUnmap(PSUPDRVDEVEXT pDevExt, PSUPGLOBALINFOPAGE pGip);
void  VBOXCALL  supdrvOSGipResume(PSUPDRVDEVEXT pDevExt);
void  VBOXCALL  supdrvOSGipSuspend(PSUPDRVDEVEXT pDevExt);
unsigned VBOXCALL supdrvOSGetCPUCount(void);
bool VBOXCALL   supdrvOSGetForcedAsyncTscMode(void);
#endif


/*******************************************************************************
*   Shared Functions                                                           *
*******************************************************************************/
int  VBOXCALL   supdrvIOCtl(unsigned uIOCtl, PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession,
                            void *pvIn, unsigned cbIn, void *pvOut, unsigned cbOut, unsigned *pcbReturned);
#ifdef VBOX_WITHOUT_IDT_PATCHING
int  VBOXCALL   supdrvIOCtlFast(unsigned uIOCtl, PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession);
#endif
int  VBOXCALL   supdrvInitDevExt(PSUPDRVDEVEXT pDevExt);
int  VBOXCALL   supdrvDeleteDevExt(PSUPDRVDEVEXT pDevExt);
int  VBOXCALL   supdrvCreateSession(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION *ppSession);
void VBOXCALL   supdrvCloseSession(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession);
void VBOXCALL   supdrvCleanupSession(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession);
int  VBOXCALL   supdrvGipInit(PSUPDRVDEVEXT pDevExt, PSUPGLOBALINFOPAGE pGip, RTHCPHYS HCPhys, uint64_t u64NanoTS, unsigned uUpdateHz);
void VBOXCALL   supdrvGipTerm(PSUPGLOBALINFOPAGE pGip);
void VBOXCALL   supdrvGipUpdate(PSUPGLOBALINFOPAGE pGip, uint64_t u64NanoTS);
void VBOXCALL   supdrvGipUpdatePerCpu(PSUPGLOBALINFOPAGE pGip, uint64_t u64NanoTS, unsigned iCpu);

__END_DECLS

#endif


Generated by  Doxygen 1.6.0   Back to index