VirtualBox

source: vbox/trunk/src/VBox/Additions/common/VBoxGuestLib/VBGLR3Internal.h@ 28501

Last change on this file since 28501 was 27687, checked in by vboxsync, 15 years ago

Additons/common/VBoxGuestLibR3: make saving and restoring video modes work with XFree86 and clean up the code

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.5 KB
Line 
1/* $Id: VBGLR3Internal.h 27687 2010-03-24 22:14:20Z vboxsync $ */
2/** @file
3 * VBoxGuestR3Lib - Ring-3 support library for the guest additions, 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 * 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 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
27 * Clara, CA 95054 USA or visit http://www.sun.com if you need
28 * additional information or have any questions.
29 */
30
31#ifndef ___VBGLR3Internal_h
32#define ___VBGLR3Internal_h
33
34#if defined(RT_OS_WINDOWS) /** @todo explain why this is here. */
35# include <Windows.h>
36#endif
37#include <VBox/VMMDev.h>
38#include <VBox/VBoxGuest.h>
39#include <VBox/VBoxGuestLib.h>
40
41#ifdef VBOX_VBGLR3_XFREE86
42/* Rather than try to resolve all the header file conflicts, I will just
43 prototype what we need here. */
44typedef unsigned long xf86size_t;
45extern "C" xf86size_t xf86strlen(const char*);
46# undef strlen
47# define strlen xf86strlen
48#endif /* VBOX_VBGLR3_XFREE86 */
49
50RT_C_DECLS_BEGIN
51
52int vbglR3DoIOCtl(unsigned iFunction, void *pvData, size_t cbData);
53int vbglR3GRAlloc(VMMDevRequestHeader **ppReq, uint32_t cb, VMMDevRequestType enmReqType);
54int vbglR3GRPerform(VMMDevRequestHeader *pReq);
55void vbglR3GRFree(VMMDevRequestHeader *pReq);
56
57
58
59DECLINLINE(void) VbglHGCMParmUInt32Set(HGCMFunctionParameter *pParm, uint32_t u32)
60{
61 pParm->type = VMMDevHGCMParmType_32bit;
62 pParm->u.value64 = 0; /* init unused bits to 0 */
63 pParm->u.value32 = u32;
64}
65
66
67DECLINLINE(int) VbglHGCMParmUInt32Get(HGCMFunctionParameter *pParm, uint32_t *pu32)
68{
69 if (pParm->type == VMMDevHGCMParmType_32bit)
70 {
71 *pu32 = pParm->u.value32;
72 return VINF_SUCCESS;
73 }
74 return VERR_INVALID_PARAMETER;
75}
76
77
78DECLINLINE(void) VbglHGCMParmUInt64Set(HGCMFunctionParameter *pParm, uint64_t u64)
79{
80 pParm->type = VMMDevHGCMParmType_64bit;
81 pParm->u.value64 = u64;
82}
83
84
85DECLINLINE(int) VbglHGCMParmUInt64Get(HGCMFunctionParameter *pParm, uint64_t *pu64)
86{
87 if (pParm->type == VMMDevHGCMParmType_64bit)
88 {
89 *pu64 = pParm->u.value64;
90 return VINF_SUCCESS;
91 }
92 return VERR_INVALID_PARAMETER;
93}
94
95
96DECLINLINE(void) VbglHGCMParmPtrSet(HGCMFunctionParameter *pParm, void *pv, uint32_t cb)
97{
98 pParm->type = VMMDevHGCMParmType_LinAddr;
99 pParm->u.Pointer.size = cb;
100 pParm->u.Pointer.u.linearAddr = (uintptr_t)pv;
101}
102
103
104#ifdef ___iprt_string_h
105
106DECLINLINE(void) VbglHGCMParmPtrSetString(HGCMFunctionParameter *pParm, const char *psz)
107{
108 pParm->type = VMMDevHGCMParmType_LinAddr_In;
109 pParm->u.Pointer.size = (uint32_t)strlen(psz) + 1;
110 pParm->u.Pointer.u.linearAddr = (uintptr_t)psz;
111}
112
113#endif /* ___iprt_string_h */
114
115RT_C_DECLS_END
116
117#endif
118
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