1 | /* $Revision: 21461 $ */
|
---|
2 | /** @file
|
---|
3 | * VBoxGuestLibR0 - Internal header.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2007 Sun Microsystems, Inc.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | *
|
---|
17 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
18 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
19 | * additional information or have any questions.
|
---|
20 | */
|
---|
21 |
|
---|
22 | #ifndef ___VBoxGuestLib_VBGLInternal_h
|
---|
23 | #define ___VBoxGuestLib_VBGLInternal_h
|
---|
24 |
|
---|
25 | #include <VBox/VMMDev.h>
|
---|
26 | #include <VBox/VBoxGuest.h>
|
---|
27 | #include <VBox/VBoxGuestLib.h>
|
---|
28 |
|
---|
29 | #include <VBox/log.h>
|
---|
30 |
|
---|
31 |
|
---|
32 | #ifdef RT_OS_WINDOWS /** @todo dprintf() -> Log() */
|
---|
33 | #if (defined(DEBUG) && !defined(NO_LOGGING)) || defined(LOG_ENABLED)
|
---|
34 | # define dprintf(a) RTLogBackdoorPrintf a
|
---|
35 | #else
|
---|
36 | # define dprintf(a) do {} while (0)
|
---|
37 | #endif
|
---|
38 | #else
|
---|
39 | # define dprintf(a) Log(a)
|
---|
40 | #endif
|
---|
41 |
|
---|
42 | #include "SysHlp.h"
|
---|
43 |
|
---|
44 | #pragma pack(4) /** @todo r=bird: What do we need packing for here? None of these structures are shared between drivers AFAIK. */
|
---|
45 |
|
---|
46 | struct _VBGLPHYSHEAPBLOCK;
|
---|
47 | typedef struct _VBGLPHYSHEAPBLOCK VBGLPHYSHEAPBLOCK;
|
---|
48 | struct _VBGLPHYSHEAPCHUNK;
|
---|
49 | typedef struct _VBGLPHYSHEAPCHUNK VBGLPHYSHEAPCHUNK;
|
---|
50 |
|
---|
51 | #ifndef VBGL_VBOXGUEST
|
---|
52 | struct VBGLHGCMHANDLEDATA
|
---|
53 | {
|
---|
54 | uint32_t fAllocated;
|
---|
55 | VBGLDRIVER driver;
|
---|
56 | };
|
---|
57 | #endif
|
---|
58 |
|
---|
59 | enum VbglLibStatus
|
---|
60 | {
|
---|
61 | VbglStatusNotInitialized = 0,
|
---|
62 | VbglStatusInitializing,
|
---|
63 | VbglStatusReady
|
---|
64 | };
|
---|
65 |
|
---|
66 | /**
|
---|
67 | * Global VBGL ring-0 data.
|
---|
68 | * Lives in VbglR0Init.cpp.
|
---|
69 | */
|
---|
70 | typedef struct _VBGLDATA
|
---|
71 | {
|
---|
72 | enum VbglLibStatus status;
|
---|
73 |
|
---|
74 | VBGLIOPORT portVMMDev;
|
---|
75 |
|
---|
76 | VMMDevMemory *pVMMDevMemory;
|
---|
77 |
|
---|
78 | /**
|
---|
79 | * Physical memory heap data.
|
---|
80 | * @{
|
---|
81 | */
|
---|
82 |
|
---|
83 | VBGLPHYSHEAPBLOCK *pFreeBlocksHead;
|
---|
84 | VBGLPHYSHEAPBLOCK *pAllocBlocksHead;
|
---|
85 | VBGLPHYSHEAPCHUNK *pChunkHead;
|
---|
86 |
|
---|
87 | RTSEMFASTMUTEX mutexHeap;
|
---|
88 | /** @} */
|
---|
89 |
|
---|
90 | /**
|
---|
91 | * The host version data.
|
---|
92 | */
|
---|
93 | VMMDevReqHostVersion hostVersion;
|
---|
94 |
|
---|
95 |
|
---|
96 | #ifndef VBGL_VBOXGUEST
|
---|
97 | /**
|
---|
98 | * Fast heap for HGCM handles data.
|
---|
99 | * @{
|
---|
100 | */
|
---|
101 |
|
---|
102 | RTSEMFASTMUTEX mutexHGCMHandle;
|
---|
103 |
|
---|
104 | struct VBGLHGCMHANDLEDATA aHGCMHandleData[64];
|
---|
105 |
|
---|
106 | /** @} */
|
---|
107 | #endif
|
---|
108 | } VBGLDATA;
|
---|
109 |
|
---|
110 |
|
---|
111 | #pragma pack()
|
---|
112 |
|
---|
113 | #ifndef VBGL_DECL_DATA
|
---|
114 | extern VBGLDATA g_vbgldata;
|
---|
115 | #endif
|
---|
116 |
|
---|
117 | /**
|
---|
118 | * Internal macro for checking whether we can pass phyical page lists to the
|
---|
119 | * host.
|
---|
120 | *
|
---|
121 | * ASSUMES that vbglR0Enter has been called already.
|
---|
122 | */
|
---|
123 | #define VBGLR0_CAN_USE_PHYS_PAGE_LIST() \
|
---|
124 | ( !!(g_vbgldata.hostVersion.features & VMMDEV_HVF_HGCM_PHYS_PAGE_LIST) )
|
---|
125 |
|
---|
126 | int vbglR0Enter (void);
|
---|
127 |
|
---|
128 | #ifdef VBOX_WITH_HGCM
|
---|
129 | # ifndef VBGL_VBOXGUEST
|
---|
130 | int vbglR0HGCMInit (void);
|
---|
131 | int vbglR0HGCMTerminate (void);
|
---|
132 | # endif
|
---|
133 | #endif /* VBOX_WITH_HGCM */
|
---|
134 |
|
---|
135 | #endif /* !___VBoxGuestLib_VBGLInternal_h */
|
---|
136 |
|
---|