VBGLInternal.h revision d6aa6429f99fb7648883eb612f8a52b9aaf3bff4
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore/* $Revision$ */
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore/** @file
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore * VBoxGuestLibR0 - Internal header.
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore */
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore/*
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore * Copyright (C) 2006-2007 Sun Microsystems, Inc.
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore *
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore * This file is part of VirtualBox Open Source Edition (OSE), as
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore * available from http://www.virtualbox.org. This file is free software;
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore * you can redistribute it and/or modify it under the terms of the GNU
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore * General Public License (GPL) as published by the Free Software
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore * Foundation, in version 2 as it comes in the "COPYING" file of the
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore *
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore * Clara, CA 95054 USA or visit http://www.sun.com if you need
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore * additional information or have any questions.
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore */
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore#ifndef __VBoxGuestLib_VBGLInternal_h
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore#define __VBoxGuestLib_VBGLInternal_h
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore/* I have added this include here as
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore a) This file is always included before VBGLInternal and
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore b) It contains a definition for VBGLHGCMHANDLE, so we definitely do not
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore need to redefine that here. The C (without ++) compiler was complaining
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore that it was defined twice.
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore*/
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore#include <VBox/VBoxGuestLib.h>
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore#include <VBox/log.h>
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore/** @todo dprintf() -> Log() */
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore#if (defined(DEBUG) && !defined(NO_LOGGING)) || defined(LOG_ENABLED)
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore# define dprintf(a) RTLogBackdoorPrintf a
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore#else
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore# define dprintf(a) do {} while (0)
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore#endif
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore#include "SysHlp.h"
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore#pragma pack(4)
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amorestruct _VBGLPHYSHEAPBLOCK;
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amoretypedef struct _VBGLPHYSHEAPBLOCK VBGLPHYSHEAPBLOCK;
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amorestruct _VBGLPHYSHEAPCHUNK;
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amoretypedef struct _VBGLPHYSHEAPCHUNK VBGLPHYSHEAPCHUNK;
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore#ifndef VBGL_VBOXGUEST
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amorestruct VBGLHGCMHANDLEDATA
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore{
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore uint32_t fAllocated;
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore VBGLDRIVER driver;
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore};
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore#endif
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amoreenum VbglLibStatus
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore{
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore VbglStatusNotInitialized = 0,
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore VbglStatusInitializing,
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore VbglStatusReady
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore};
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amoretypedef struct _VBGLDATA
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore{
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore enum VbglLibStatus status;
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore VBGLIOPORT portVMMDev;
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore VMMDevMemory *pVMMDevMemory;
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore /**
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore * Physical memory heap data.
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore * @{
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore */
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore VBGLPHYSHEAPBLOCK *pFreeBlocksHead;
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore VBGLPHYSHEAPBLOCK *pAllocBlocksHead;
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore VBGLPHYSHEAPCHUNK *pChunkHead;
RTSEMFASTMUTEX mutexHeap;
/** @} */
#ifndef VBGL_VBOXGUEST
/**
* Fast heap for HGCM handles data.
* @{
*/
RTSEMFASTMUTEX mutexHGCMHandle;
struct VBGLHGCMHANDLEDATA aHGCMHandleData[64];
/** @} */
#endif
} VBGLDATA;
#pragma pack()
#ifndef VBGL_DECL_DATA
extern VBGLDATA g_vbgldata;
#endif
/* Check if library has been initialized before entering
* a public library function.
*/
int VbglEnter (void);
#ifdef VBOX_WITH_HGCM
#ifndef VBGL_VBOXGUEST
/* Initialize HGCM subsystem. */
int vbglHGCMInit (void);
/* Terminate HGCM subsystem. */
int vbglHGCMTerminate (void);
#endif
#endif
#endif /* !__VBoxGuestLib_VBGLInternal_h */