1 | /* $Id: VBoxGuestR3LibInternal.h 69308 2017-10-25 13:51:16Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBoxGuestR3Lib - Ring-3 support library for the guest additions, Internal header.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2016 Oracle Corporation
|
---|
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 | * The contents of this file may alternatively be used under the terms
|
---|
18 | * of the Common Development and Distribution License Version 1.0
|
---|
19 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
20 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
21 | * CDDL are applicable instead of those of the GPL.
|
---|
22 | *
|
---|
23 | * You may elect to license modified versions of this file under the
|
---|
24 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
25 | */
|
---|
26 |
|
---|
27 | #ifndef ___VBoxGuestR3LibInternal_h
|
---|
28 | #define ___VBoxGuestR3LibInternal_h
|
---|
29 |
|
---|
30 | #include <VBox/VMMDev.h>
|
---|
31 | #include <VBox/VBoxGuest.h>
|
---|
32 | #include <VBox/VBoxGuestLib.h>
|
---|
33 |
|
---|
34 | #ifdef VBOX_VBGLR3_XFREE86
|
---|
35 | /* Rather than try to resolve all the header file conflicts, I will just
|
---|
36 | prototype what we need here. */
|
---|
37 | typedef unsigned long xf86size_t;
|
---|
38 | extern "C" xf86size_t xf86strlen(const char*);
|
---|
39 | # undef strlen
|
---|
40 | # define strlen xf86strlen
|
---|
41 | #endif /* VBOX_VBGLR3_XFREE86 */
|
---|
42 |
|
---|
43 | RT_C_DECLS_BEGIN
|
---|
44 |
|
---|
45 | int vbglR3DoIOCtl(uintptr_t uFunction, PVBGLREQHDR pReq, size_t cbReq);
|
---|
46 | int vbglR3DoIOCtlRaw(uintptr_t uFunction, PVBGLREQHDR pReq, size_t cbReq);
|
---|
47 | int vbglR3GRAlloc(VMMDevRequestHeader **ppReq, size_t cb, VMMDevRequestType enmReqType);
|
---|
48 | int vbglR3GRPerform(VMMDevRequestHeader *pReq);
|
---|
49 | void vbglR3GRFree(VMMDevRequestHeader *pReq);
|
---|
50 |
|
---|
51 |
|
---|
52 |
|
---|
53 | DECLINLINE(void) VbglHGCMParmUInt32Set(HGCMFunctionParameter *pParm, uint32_t u32)
|
---|
54 | {
|
---|
55 | pParm->type = VMMDevHGCMParmType_32bit;
|
---|
56 | pParm->u.value64 = 0; /* init unused bits to 0 */
|
---|
57 | pParm->u.value32 = u32;
|
---|
58 | }
|
---|
59 |
|
---|
60 |
|
---|
61 | DECLINLINE(int) VbglHGCMParmUInt32Get(HGCMFunctionParameter *pParm, uint32_t *pu32)
|
---|
62 | {
|
---|
63 | if (pParm->type == VMMDevHGCMParmType_32bit)
|
---|
64 | {
|
---|
65 | *pu32 = pParm->u.value32;
|
---|
66 | return VINF_SUCCESS;
|
---|
67 | }
|
---|
68 | return VERR_INVALID_PARAMETER;
|
---|
69 | }
|
---|
70 |
|
---|
71 |
|
---|
72 | DECLINLINE(void) VbglHGCMParmUInt64Set(HGCMFunctionParameter *pParm, uint64_t u64)
|
---|
73 | {
|
---|
74 | pParm->type = VMMDevHGCMParmType_64bit;
|
---|
75 | pParm->u.value64 = u64;
|
---|
76 | }
|
---|
77 |
|
---|
78 |
|
---|
79 | DECLINLINE(int) VbglHGCMParmUInt64Get(HGCMFunctionParameter *pParm, uint64_t *pu64)
|
---|
80 | {
|
---|
81 | if (pParm->type == VMMDevHGCMParmType_64bit)
|
---|
82 | {
|
---|
83 | *pu64 = pParm->u.value64;
|
---|
84 | return VINF_SUCCESS;
|
---|
85 | }
|
---|
86 | return VERR_INVALID_PARAMETER;
|
---|
87 | }
|
---|
88 |
|
---|
89 |
|
---|
90 | DECLINLINE(void) VbglHGCMParmPtrSet(HGCMFunctionParameter *pParm, void *pv, uint32_t cb)
|
---|
91 | {
|
---|
92 | pParm->type = VMMDevHGCMParmType_LinAddr;
|
---|
93 | pParm->u.Pointer.size = cb;
|
---|
94 | pParm->u.Pointer.u.linearAddr = (uintptr_t)pv;
|
---|
95 | }
|
---|
96 |
|
---|
97 |
|
---|
98 | #ifdef ___iprt_string_h
|
---|
99 |
|
---|
100 | DECLINLINE(void) VbglHGCMParmPtrSetString(HGCMFunctionParameter *pParm, const char *psz)
|
---|
101 | {
|
---|
102 | pParm->type = VMMDevHGCMParmType_LinAddr_In;
|
---|
103 | pParm->u.Pointer.size = (uint32_t)strlen(psz) + 1;
|
---|
104 | pParm->u.Pointer.u.linearAddr = (uintptr_t)psz;
|
---|
105 | }
|
---|
106 |
|
---|
107 | #endif /* ___iprt_string_h */
|
---|
108 |
|
---|
109 | #ifdef VBOX_VBGLR3_XFREE86
|
---|
110 | # undef strlen
|
---|
111 | #endif /* VBOX_VBGLR3_XFREE86 */
|
---|
112 |
|
---|
113 | RT_C_DECLS_END
|
---|
114 |
|
---|
115 | #endif
|
---|
116 |
|
---|