VirtualBox

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

Last change on this file since 93115 was 93115, checked in by vboxsync, 3 years ago

scm --update-copyright-year

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.6 KB
Line 
1/* $Id: VBoxGuestR3LibInternal.h 93115 2022-01-01 11:31:46Z vboxsync $ */
2/** @file
3 * VBoxGuestR3Lib - Ring-3 support library for the guest additions, Internal header.
4 */
5
6/*
7 * Copyright (C) 2006-2022 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 GA_INCLUDED_SRC_common_VBoxGuest_lib_VBoxGuestR3LibInternal_h
28#define GA_INCLUDED_SRC_common_VBoxGuest_lib_VBoxGuestR3LibInternal_h
29#ifndef RT_WITHOUT_PRAGMA_ONCE
30# pragma once
31#endif
32
33#include <VBox/VMMDev.h>
34#include <VBox/VBoxGuest.h>
35#include <VBox/VBoxGuestLib.h>
36
37#ifdef VBOX_VBGLR3_XFREE86
38/* Rather than try to resolve all the header file conflicts, I will just
39 prototype what we need here. */
40typedef unsigned long xf86size_t;
41extern "C" xf86size_t xf86strlen(const char*);
42# undef strlen
43# define strlen xf86strlen
44#endif /* VBOX_VBGLR3_XFREE86 */
45
46RT_C_DECLS_BEGIN
47
48int vbglR3DoIOCtl(uintptr_t uFunction, PVBGLREQHDR pReq, size_t cbReq);
49int vbglR3DoIOCtlRaw(uintptr_t uFunction, PVBGLREQHDR pReq, size_t cbReq);
50int vbglR3GRAlloc(VMMDevRequestHeader **ppReq, size_t cb, VMMDevRequestType enmReqType);
51int vbglR3GRPerform(VMMDevRequestHeader *pReq);
52void vbglR3GRFree(VMMDevRequestHeader *pReq);
53
54
55
56DECLINLINE(void) VbglHGCMParmUInt32Set(HGCMFunctionParameter *pParm, uint32_t u32)
57{
58 pParm->type = VMMDevHGCMParmType_32bit;
59 pParm->u.value64 = 0; /* init unused bits to 0 */
60 pParm->u.value32 = u32;
61}
62
63
64DECLINLINE(int) VbglHGCMParmUInt32Get(HGCMFunctionParameter *pParm, uint32_t *pu32)
65{
66 if (pParm->type == VMMDevHGCMParmType_32bit)
67 {
68 *pu32 = pParm->u.value32;
69 return VINF_SUCCESS;
70 }
71 return VERR_INVALID_PARAMETER;
72}
73
74
75DECLINLINE(void) VbglHGCMParmUInt64Set(HGCMFunctionParameter *pParm, uint64_t u64)
76{
77 pParm->type = VMMDevHGCMParmType_64bit;
78 pParm->u.value64 = u64;
79}
80
81
82DECLINLINE(int) VbglHGCMParmUInt64Get(HGCMFunctionParameter *pParm, uint64_t *pu64)
83{
84 if (pParm->type == VMMDevHGCMParmType_64bit)
85 {
86 *pu64 = pParm->u.value64;
87 return VINF_SUCCESS;
88 }
89 return VERR_INVALID_PARAMETER;
90}
91
92
93DECLINLINE(void) VbglHGCMParmPtrSet(HGCMFunctionParameter *pParm, void *pv, uint32_t cb)
94{
95 pParm->type = VMMDevHGCMParmType_LinAddr;
96 pParm->u.Pointer.size = cb;
97 pParm->u.Pointer.u.linearAddr = (uintptr_t)pv;
98}
99
100
101#ifdef IPRT_INCLUDED_string_h
102
103DECLINLINE(void) VbglHGCMParmPtrSetString(HGCMFunctionParameter *pParm, const char *psz)
104{
105 pParm->type = VMMDevHGCMParmType_LinAddr_In;
106 pParm->u.Pointer.size = (uint32_t)strlen(psz) + 1;
107 pParm->u.Pointer.u.linearAddr = (uintptr_t)psz;
108}
109
110#endif /* IPRT_INCLUDED_string_h */
111
112#ifdef VBOX_VBGLR3_XFREE86
113# undef strlen
114#endif /* VBOX_VBGLR3_XFREE86 */
115
116RT_C_DECLS_END
117
118#endif /* !GA_INCLUDED_SRC_common_VBoxGuest_lib_VBoxGuestR3LibInternal_h */
119
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