VirtualBox

source: vbox/trunk/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR3LibInternal.h@ 97929

Last change on this file since 97929 was 96407, checked in by vboxsync, 2 years ago

scm copyright and license note update

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.9 KB
Line 
1/* $Id: VBoxGuestR3LibInternal.h 96407 2022-08-22 17:43:14Z vboxsync $ */
2/** @file
3 * VBoxGuestR3Lib - Ring-3 support library for the guest additions, Internal header.
4 */
5
6/*
7 * Copyright (C) 2006-2022 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * The contents of this file may alternatively be used under the terms
26 * of the Common Development and Distribution License Version 1.0
27 * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
28 * in the VirtualBox distribution, in which case the provisions of the
29 * CDDL are applicable instead of those of the GPL.
30 *
31 * You may elect to license modified versions of this file under the
32 * terms and conditions of either the GPL or the CDDL or both.
33 *
34 * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
35 */
36
37#ifndef GA_INCLUDED_SRC_common_VBoxGuest_lib_VBoxGuestR3LibInternal_h
38#define GA_INCLUDED_SRC_common_VBoxGuest_lib_VBoxGuestR3LibInternal_h
39#ifndef RT_WITHOUT_PRAGMA_ONCE
40# pragma once
41#endif
42
43#include <VBox/VMMDev.h>
44#include <VBox/VBoxGuest.h>
45#include <VBox/VBoxGuestLib.h>
46
47#ifdef VBOX_VBGLR3_XFREE86
48/* Rather than try to resolve all the header file conflicts, I will just
49 prototype what we need here. */
50typedef unsigned long xf86size_t;
51extern "C" xf86size_t xf86strlen(const char*);
52# undef strlen
53# define strlen xf86strlen
54#endif /* VBOX_VBGLR3_XFREE86 */
55
56RT_C_DECLS_BEGIN
57
58int vbglR3DoIOCtl(uintptr_t uFunction, PVBGLREQHDR pReq, size_t cbReq);
59int vbglR3DoIOCtlRaw(uintptr_t uFunction, PVBGLREQHDR pReq, size_t cbReq);
60int vbglR3GRAlloc(VMMDevRequestHeader **ppReq, size_t cb, VMMDevRequestType enmReqType);
61int vbglR3GRPerform(VMMDevRequestHeader *pReq);
62void vbglR3GRFree(VMMDevRequestHeader *pReq);
63
64
65
66DECLINLINE(void) VbglHGCMParmUInt32Set(HGCMFunctionParameter *pParm, uint32_t u32)
67{
68 pParm->type = VMMDevHGCMParmType_32bit;
69 pParm->u.value64 = 0; /* init unused bits to 0 */
70 pParm->u.value32 = u32;
71}
72
73
74DECLINLINE(int) VbglHGCMParmUInt32Get(HGCMFunctionParameter *pParm, uint32_t *pu32)
75{
76 if (pParm->type == VMMDevHGCMParmType_32bit)
77 {
78 *pu32 = pParm->u.value32;
79 return VINF_SUCCESS;
80 }
81 return VERR_INVALID_PARAMETER;
82}
83
84
85DECLINLINE(void) VbglHGCMParmUInt64Set(HGCMFunctionParameter *pParm, uint64_t u64)
86{
87 pParm->type = VMMDevHGCMParmType_64bit;
88 pParm->u.value64 = u64;
89}
90
91
92DECLINLINE(int) VbglHGCMParmUInt64Get(HGCMFunctionParameter *pParm, uint64_t *pu64)
93{
94 if (pParm->type == VMMDevHGCMParmType_64bit)
95 {
96 *pu64 = pParm->u.value64;
97 return VINF_SUCCESS;
98 }
99 return VERR_INVALID_PARAMETER;
100}
101
102
103DECLINLINE(void) VbglHGCMParmPtrSet(HGCMFunctionParameter *pParm, void *pv, uint32_t cb)
104{
105 pParm->type = VMMDevHGCMParmType_LinAddr;
106 pParm->u.Pointer.size = cb;
107 pParm->u.Pointer.u.linearAddr = (uintptr_t)pv;
108}
109
110
111#ifdef IPRT_INCLUDED_string_h
112
113DECLINLINE(void) VbglHGCMParmPtrSetString(HGCMFunctionParameter *pParm, const char *psz)
114{
115 pParm->type = VMMDevHGCMParmType_LinAddr_In;
116 pParm->u.Pointer.size = (uint32_t)strlen(psz) + 1;
117 pParm->u.Pointer.u.linearAddr = (uintptr_t)psz;
118}
119
120#endif /* IPRT_INCLUDED_string_h */
121
122#ifdef VBOX_VBGLR3_XFREE86
123# undef strlen
124#endif /* VBOX_VBGLR3_XFREE86 */
125
126RT_C_DECLS_END
127
128#endif /* !GA_INCLUDED_SRC_common_VBoxGuest_lib_VBoxGuestR3LibInternal_h */
129
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette