1 | /* $Revision: 21339 $ */
|
---|
2 | /** @file
|
---|
3 | * VBoxGuestLibR0 - System dependent helpers 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_SysHlp_h
|
---|
23 | #define __VBoxGuestLib_SysHlp_h
|
---|
24 |
|
---|
25 | #ifdef RT_OS_WINDOWS
|
---|
26 | # if (_MSC_VER >= 1400) && !defined(VBOX_WITH_PATCHED_DDK)
|
---|
27 | # include <iprt/asm.h>
|
---|
28 | # define _InterlockedExchange _InterlockedExchange_StupidDDKVsCompilerCrap
|
---|
29 | # define _InterlockedExchangeAdd _InterlockedExchangeAdd_StupidDDKVsCompilerCrap
|
---|
30 | # define _InterlockedCompareExchange _InterlockedCompareExchange_StupidDDKVsCompilerCrap
|
---|
31 | # define _InterlockedAddLargeStatistic _InterlockedAddLargeStatistic_StupidDDKVsCompilerCrap
|
---|
32 | # pragma warning(disable : 4163)
|
---|
33 | RT_C_DECLS_BEGIN
|
---|
34 | # include <ntddk.h>
|
---|
35 | RT_C_DECLS_END
|
---|
36 | # pragma warning(default : 4163)
|
---|
37 | # undef _InterlockedExchange
|
---|
38 | # undef _InterlockedExchangeAdd
|
---|
39 | # undef _InterlockedCompareExchange
|
---|
40 | # undef _InterlockedAddLargeStatistic
|
---|
41 | # else
|
---|
42 | RT_C_DECLS_BEGIN
|
---|
43 | # include <ntddk.h>
|
---|
44 | RT_C_DECLS_END
|
---|
45 | # endif
|
---|
46 | /* XP DDK #defines ExFreePool to ExFreePoolWithTag. The latter does not exist on NT4, so...
|
---|
47 | * The same for ExAllocatePool.
|
---|
48 | */
|
---|
49 | #undef ExAllocatePool
|
---|
50 | #undef ExFreePool
|
---|
51 | #endif
|
---|
52 |
|
---|
53 | typedef struct _VBGLDRIVER
|
---|
54 | {
|
---|
55 | #ifdef RT_OS_WINDOWS
|
---|
56 | PDEVICE_OBJECT pDeviceObject;
|
---|
57 | PFILE_OBJECT pFileObject;
|
---|
58 | #elif defined (RT_OS_LINUX) && !defined(VBOX_WITH_COMMON_VBOXGUEST_ON_LINUX)
|
---|
59 | void *opaque;
|
---|
60 | #elif defined (RT_OS_OS2)
|
---|
61 | uint32_t u32Session; /**< just for sanity checking. */
|
---|
62 | #else /* PORTME */
|
---|
63 | void *pvOpaque;
|
---|
64 | #endif
|
---|
65 | } VBGLDRIVER;
|
---|
66 |
|
---|
67 | int vbglLockLinear (void **ppvCtx, void *pv, uint32_t u32Size, bool fWriteAccess, uint32_t fFlags);
|
---|
68 | void vbglUnlockLinear (void *pvCtx, void *pv, uint32_t u32Size);
|
---|
69 |
|
---|
70 |
|
---|
71 | #ifndef VBGL_VBOXGUEST
|
---|
72 |
|
---|
73 | /**
|
---|
74 | * Open VBoxGuest driver.
|
---|
75 | *
|
---|
76 | * @param pDriver Pointer to the driver structure.
|
---|
77 | *
|
---|
78 | * @return VBox error code
|
---|
79 | */
|
---|
80 | int vbglDriverOpen (VBGLDRIVER *pDriver);
|
---|
81 |
|
---|
82 | /**
|
---|
83 | * Call VBoxGuest driver.
|
---|
84 | *
|
---|
85 | * @param pDriver Pointer to the driver structure.
|
---|
86 | * @param u32Function Function code.
|
---|
87 | * @param pvData Pointer to supplied in/out data buffer.
|
---|
88 | * @param cbData Size of data buffer.
|
---|
89 | *
|
---|
90 | * @return VBox error code
|
---|
91 | */
|
---|
92 | int vbglDriverIOCtl (VBGLDRIVER *pDriver, uint32_t u32Function, void *pvData, uint32_t cbData);
|
---|
93 |
|
---|
94 | /**
|
---|
95 | * Close VBoxGuest driver.
|
---|
96 | *
|
---|
97 | * @param pDriver Pointer to the driver structure.
|
---|
98 | *
|
---|
99 | * @return VBox error code
|
---|
100 | */
|
---|
101 | void vbglDriverClose (VBGLDRIVER *pDriver);
|
---|
102 |
|
---|
103 | #endif
|
---|
104 |
|
---|
105 | #endif /* !__VBoxGuestLib_SysHlp_h */
|
---|
106 |
|
---|