1 | /** @file
|
---|
2 | *
|
---|
3 | * VBoxGuestLib - A support library for VirtualBox guest additions:
|
---|
4 | * Internal header
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2006-2007 innotek GmbH
|
---|
9 | *
|
---|
10 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
11 | * available from http://www.virtualbox.org. This file is free software;
|
---|
12 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
13 | * General Public License as published by the Free Software Foundation,
|
---|
14 | * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
|
---|
15 | * distribution. VirtualBox OSE is distributed in the hope that it will
|
---|
16 | * be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 | */
|
---|
18 |
|
---|
19 | #ifndef __VBGLINTERNAL__H
|
---|
20 | #define __VBGLINTERNAL__H
|
---|
21 |
|
---|
22 | /* I have added this include here as
|
---|
23 | a) This file is always included before VBGLInternal and
|
---|
24 | b) It contains a definition for VBGLHGCMHANDLE, so we definitely do not
|
---|
25 | need to redefine that here. The C (without ++) compiler was complaining
|
---|
26 | that it was defined twice.
|
---|
27 | */
|
---|
28 | #include <VBox/VBoxGuestLib.h>
|
---|
29 |
|
---|
30 | #if (defined(DEBUG) && !defined(NO_LOGGING)) || defined(LOG_ENABLED)
|
---|
31 | #include <VBox/log.h>
|
---|
32 | # define dprintf(a) RTLogBackdoorPrintf a
|
---|
33 | #else
|
---|
34 | # define dprintf(a) do {} while (0)
|
---|
35 | #endif
|
---|
36 |
|
---|
37 | #include "SysHlp.h"
|
---|
38 |
|
---|
39 | #pragma pack(4)
|
---|
40 |
|
---|
41 | struct _VBGLPHYSHEAPBLOCK;
|
---|
42 | typedef struct _VBGLPHYSHEAPBLOCK VBGLPHYSHEAPBLOCK;
|
---|
43 | struct _VBGLPHYSHEAPCHUNK;
|
---|
44 | typedef struct _VBGLPHYSHEAPCHUNK VBGLPHYSHEAPCHUNK;
|
---|
45 |
|
---|
46 | #ifndef VBGL_VBOXGUEST
|
---|
47 | struct VBGLHGCMHANDLEDATA
|
---|
48 | {
|
---|
49 | uint32_t fAllocated;
|
---|
50 | VBGLDRIVER driver;
|
---|
51 | };
|
---|
52 | #endif
|
---|
53 |
|
---|
54 | enum VbglLibStatus
|
---|
55 | {
|
---|
56 | VbglStatusNotInitialized = 0,
|
---|
57 | VbglStatusInitializing,
|
---|
58 | VbglStatusReady
|
---|
59 | };
|
---|
60 |
|
---|
61 | typedef struct _VBGLDATA
|
---|
62 | {
|
---|
63 | enum VbglLibStatus status;
|
---|
64 |
|
---|
65 | VBGLIOPORT portVMMDev;
|
---|
66 |
|
---|
67 | VMMDevMemory *pVMMDevMemory;
|
---|
68 |
|
---|
69 | /**
|
---|
70 | * Physical memory heap data.
|
---|
71 | * @{
|
---|
72 | */
|
---|
73 |
|
---|
74 | VBGLPHYSHEAPBLOCK *pFreeBlocksHead;
|
---|
75 | VBGLPHYSHEAPBLOCK *pAllocBlocksHead;
|
---|
76 | VBGLPHYSHEAPCHUNK *pChunkHead;
|
---|
77 |
|
---|
78 | RTSEMFASTMUTEX mutexHeap;
|
---|
79 | /** @} */
|
---|
80 |
|
---|
81 | #ifndef VBGL_VBOXGUEST
|
---|
82 | /**
|
---|
83 | * Fast heap for HGCM handles data.
|
---|
84 | * @{
|
---|
85 | */
|
---|
86 |
|
---|
87 | RTSEMFASTMUTEX mutexHGCMHandle;
|
---|
88 |
|
---|
89 | struct VBGLHGCMHANDLEDATA aHGCMHandleData[64];
|
---|
90 |
|
---|
91 | /** @} */
|
---|
92 | #endif
|
---|
93 | } VBGLDATA;
|
---|
94 |
|
---|
95 | #pragma pack()
|
---|
96 |
|
---|
97 | #ifndef VBGL_DECL_DATA
|
---|
98 | extern VBGLDATA g_vbgldata;
|
---|
99 | #endif
|
---|
100 |
|
---|
101 | /* Check if library has been initialized before entering
|
---|
102 | * a public library function.
|
---|
103 | */
|
---|
104 | int VbglEnter (void);
|
---|
105 |
|
---|
106 | #ifdef VBOX_HGCM
|
---|
107 | #ifndef VBGL_VBOXGUEST
|
---|
108 | /* Initialize HGCM subsystem. */
|
---|
109 | int vbglHGCMInit (void);
|
---|
110 | /* Terminate HGCM subsystem. */
|
---|
111 | int vbglHGCMTerminate (void);
|
---|
112 | #endif
|
---|
113 | #endif
|
---|
114 |
|
---|
115 | #endif /* __VBGLINTERNAL__H */
|
---|