VirtualBox

source: vbox/trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-haiku.h@ 72352

Last change on this file since 72352 was 70873, checked in by vboxsync, 7 years ago

VMMDev,VBoxGuest: Classify who is calling the host (part 1). bugref:9105

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 11.6 KB
Line 
1/* $Id: VBoxGuest-haiku.h 70873 2018-02-05 18:13:55Z vboxsync $ */
2/** @file
3 * VBoxGuest kernel module, Haiku Guest Additions, header.
4 */
5
6/*
7 * Copyright (C) 2012-2017 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/*
28 * This code is based on:
29 *
30 * VirtualBox Guest Additions for Haiku.
31 * Copyright (c) 2011 Mike Smith <mike@scgtrp.net>
32 * François Revol <revol@free.fr>
33 *
34 * Permission is hereby granted, free of charge, to any person
35 * obtaining a copy of this software and associated documentation
36 * files (the "Software"), to deal in the Software without
37 * restriction, including without limitation the rights to use,
38 * copy, modify, merge, publish, distribute, sublicense, and/or sell
39 * copies of the Software, and to permit persons to whom the
40 * Software is furnished to do so, subject to the following
41 * conditions:
42 *
43 * The above copyright notice and this permission notice shall be
44 * included in all copies or substantial portions of the Software.
45 *
46 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
47 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
48 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
49 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
50 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
51 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
52 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
53 * OTHER DEALINGS IN THE SOFTWARE.
54 */
55
56
57#ifndef ___VBoxGuest_haiku_h
58#define ___VBoxGuest_haiku_h
59
60#include <OS.h>
61#include <Drivers.h>
62#include <drivers/module.h>
63
64#include "VBoxGuestInternal.h"
65#include <VBox/log.h>
66#include <iprt/assert.h>
67#include <iprt/initterm.h>
68#include <iprt/process.h>
69#include <iprt/mem.h>
70#include <iprt/asm.h>
71#include <iprt/mp.h>
72#include <iprt/power.h>
73#include <iprt/thread.h>
74
75/** The module name. */
76#define VBOXGUEST_MODULE_NAME "generic/vboxguest"
77
78struct VBoxGuestDeviceState
79{
80 /** Resource ID of the I/O port */
81 int iIOPortResId;
82 /** Pointer to the I/O port resource. */
83// struct resource *pIOPortRes;
84 /** Start address of the IO Port. */
85 uint16_t uIOPortBase;
86 /** Resource ID of the MMIO area */
87 area_id iVMMDevMemAreaId;
88 /** Pointer to the MMIO resource. */
89// struct resource *pVMMDevMemRes;
90 /** Handle of the MMIO resource. */
91// bus_space_handle_t VMMDevMemHandle;
92 /** Size of the memory area. */
93 size_t VMMDevMemSize;
94 /** Mapping of the register space */
95 void *pMMIOBase;
96 /** IRQ number */
97 int iIrqResId;
98 /** IRQ resource handle. */
99// struct resource *pIrqRes;
100 /** Pointer to the IRQ handler. */
101// void *pfnIrqHandler;
102 /** VMMDev version */
103 uint32_t u32Version;
104
105 /** The (only) select data we wait on. */
106 //XXX: should leave in pSession ?
107 uint8_t selectEvent;
108 uint32_t selectRef;
109 void *selectSync;
110};
111
112struct vboxguest_module_info
113{
114 module_info module;
115
116 VBOXGUESTDEVEXT devExt;
117 struct VBoxGuestDeviceState _sState;
118 volatile uint32_t _cUsers;
119
120 size_t(*_RTLogBackdoorPrintf)(const char *pszFormat, ...);
121 size_t(*_RTLogBackdoorPrintfV)(const char *pszFormat, va_list args);
122 int (*_RTLogSetDefaultInstanceThread)(PRTLOGGER pLogger, uintptr_t uKey);
123 int (*_RTMemAllocExTag)(size_t cb, size_t cbAlignment, uint32_t fFlags, const char *pszTag, void **ppv);
124 void* (*_RTMemContAlloc)(PRTCCPHYS pPhys, size_t cb);
125 void (*_RTMemContFree)(void *pv, size_t cb);
126 void (*_RTMemFreeEx)(void *pv, size_t cb);
127 bool (*_RTMpIsCpuPossible)(RTCPUID idCpu);
128 int (*_RTMpNotificationDeregister)(PFNRTMPNOTIFICATION pfnCallback, void *pvUser);
129 int (*_RTMpNotificationRegister)(PFNRTMPNOTIFICATION pfnCallback, void *pvUser);
130 int (*_RTMpOnAll)(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2);
131 int (*_RTMpOnOthers)(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2);
132 int (*_RTMpOnSpecific)(RTCPUID idCpu, PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2);
133 int (*_RTPowerNotificationDeregister)(PFNRTPOWERNOTIFICATION pfnCallback, void *pvUser);
134 int (*_RTPowerNotificationRegister)(PFNRTPOWERNOTIFICATION pfnCallback, void *pvUser);
135 int (*_RTPowerSignalEvent)(RTPOWEREVENT enmEvent);
136 void (*_RTR0AssertPanicSystem)(void);
137 int (*_RTR0Init)(unsigned fReserved);
138 void* (*_RTR0MemObjAddress)(RTR0MEMOBJ MemObj);
139 RTR3PTR(*_RTR0MemObjAddressR3)(RTR0MEMOBJ MemObj);
140 int (*_RTR0MemObjAllocContTag)(PRTR0MEMOBJ pMemObj, size_t cb, bool fExecutable, const char *pszTag);
141 int (*_RTR0MemObjAllocLowTag)(PRTR0MEMOBJ pMemObj, size_t cb, bool fExecutable, const char *pszTag);
142 int (*_RTR0MemObjAllocPageTag)(PRTR0MEMOBJ pMemObj, size_t cb, bool fExecutable, const char *pszTag);
143 int (*_RTR0MemObjAllocPhysExTag)(PRTR0MEMOBJ pMemObj, size_t cb, RTHCPHYS PhysHighest, size_t uAlignment, const char *pszTag);
144 int (*_RTR0MemObjAllocPhysNCTag)(PRTR0MEMOBJ pMemObj, size_t cb, RTHCPHYS PhysHighest, const char *pszTag);
145 int (*_RTR0MemObjAllocPhysTag)(PRTR0MEMOBJ pMemObj, size_t cb, RTHCPHYS PhysHighest, const char *pszTag);
146 int (*_RTR0MemObjEnterPhysTag)(PRTR0MEMOBJ pMemObj, RTHCPHYS Phys, size_t cb, uint32_t uCachePolicy, const char *pszTag);
147 int (*_RTR0MemObjFree)(RTR0MEMOBJ MemObj, bool fFreeMappings);
148 RTHCPHYS(*_RTR0MemObjGetPagePhysAddr)(RTR0MEMOBJ MemObj, size_t iPage);
149 bool (*_RTR0MemObjIsMapping)(RTR0MEMOBJ MemObj);
150 int (*_RTR0MemObjLockKernelTag)(PRTR0MEMOBJ pMemObj, void *pv, size_t cb, uint32_t fAccess, const char *pszTag);
151 int (*_RTR0MemObjLockUserTag)(PRTR0MEMOBJ pMemObj, RTR3PTR R3Ptr, size_t cb, uint32_t fAccess,
152 RTR0PROCESS R0Process, const char *pszTag);
153 int (*_RTR0MemObjMapKernelExTag)(PRTR0MEMOBJ pMemObj, RTR0MEMOBJ MemObjToMap, void *pvFixed, size_t uAlignment,
154 unsigned fProt, size_t offSub, size_t cbSub, const char *pszTag);
155 int (*_RTR0MemObjMapKernelTag)(PRTR0MEMOBJ pMemObj, RTR0MEMOBJ MemObjToMap, void *pvFixed,
156 size_t uAlignment, unsigned fProt, const char *pszTag);
157 int (*_RTR0MemObjMapUserTag)(PRTR0MEMOBJ pMemObj, RTR0MEMOBJ MemObjToMap, RTR3PTR R3PtrFixed,
158 size_t uAlignment, unsigned fProt, RTR0PROCESS R0Process, const char *pszTag);
159 int (*_RTR0MemObjProtect)(RTR0MEMOBJ hMemObj, size_t offSub, size_t cbSub, uint32_t fProt);
160 int (*_RTR0MemObjReserveKernelTag)(PRTR0MEMOBJ pMemObj, void *pvFixed, size_t cb, size_t uAlignment, const char *pszTag);
161 int (*_RTR0MemObjReserveUserTag)(PRTR0MEMOBJ pMemObj, RTR3PTR R3PtrFixed, size_t cb, size_t uAlignment,
162 RTR0PROCESS R0Process, const char *pszTag);
163 size_t(*_RTR0MemObjSize)(RTR0MEMOBJ MemObj);
164 RTR0PROCESS(*_RTR0ProcHandleSelf)(void);
165 void (*_RTR0Term)(void);
166 void (*_RTR0TermForced)(void);
167 RTPROCESS(*_RTProcSelf)(void);
168 uint32_t(*_RTSemEventGetResolution)(void);
169 uint32_t(*_RTSemEventMultiGetResolution)(void);
170 int (*_RTSemEventMultiWaitEx)(RTSEMEVENTMULTI hEventMultiSem, uint32_t fFlags, uint64_t uTimeout);
171 int (*_RTSemEventMultiWaitExDebug)(RTSEMEVENTMULTI hEventMultiSem, uint32_t fFlags, uint64_t uTimeout,
172 RTHCUINTPTR uId, RT_SRC_POS_DECL);
173 int (*_RTSemEventWaitEx)(RTSEMEVENT hEventSem, uint32_t fFlags, uint64_t uTimeout);
174 int (*_RTSemEventWaitExDebug)(RTSEMEVENT hEventSem, uint32_t fFlags, uint64_t uTimeout,
175 RTHCUINTPTR uId, RT_SRC_POS_DECL);
176 bool (*_RTThreadIsInInterrupt)(RTTHREAD hThread);
177 void (*_RTThreadPreemptDisable)(PRTTHREADPREEMPTSTATE pState);
178 bool (*_RTThreadPreemptIsEnabled)(RTTHREAD hThread);
179 bool (*_RTThreadPreemptIsPending)(RTTHREAD hThread);
180 bool (*_RTThreadPreemptIsPendingTrusty)(void);
181 bool (*_RTThreadPreemptIsPossible)(void);
182 void (*_RTThreadPreemptRestore)(PRTTHREADPREEMPTSTATE pState);
183 uint32_t(*_RTTimerGetSystemGranularity)(void);
184 int (*_RTTimerReleaseSystemGranularity)(uint32_t u32Granted);
185 int (*_RTTimerRequestSystemGranularity)(uint32_t u32Request, uint32_t *pu32Granted);
186 void (*_RTSpinlockAcquire)(RTSPINLOCK Spinlock);
187 void (*_RTSpinlockRelease)(RTSPINLOCK Spinlock);
188 void* (*_RTMemTmpAllocTag)(size_t cb, const char *pszTag);
189 void (*_RTMemTmpFree)(void *pv);
190 PRTLOGGER(*_RTLogDefaultInstance)(void);
191 PRTLOGGER(*_RTLogDefaultInstanceEx)(uint32_t fFlagsAndGroup);
192 PRTLOGGER(*_RTLogRelGetDefaultInstance)(void);
193 PRTLOGGER(*_RTLogRelGetDefaultInstanceEx)(uint32_t fFlagsAndGroup);
194 int (*_RTErrConvertToErrno)(int iErr);
195 int (*_VGDrvCommonIoCtl)(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
196 void *pvData, size_t cbData, size_t *pcbDataReturned);
197 int (*_VGDrvCommonCreateUserSession)(PVBOXGUESTDEVEXT pDevExt, uint32_t fRequestor, PVBOXGUESTSESSION *ppSession);
198 void (*_VGDrvCommonCloseSession)(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession);
199 void* (*_VBoxGuestIDCOpen)(uint32_t *pu32Version);
200 int (*_VBoxGuestIDCClose)(void *pvSession);
201 int (*_VBoxGuestIDCCall)(void *pvSession, unsigned iCmd, void *pvData, size_t cbData, size_t *pcbDataReturned);
202 void (*_RTAssertMsg1Weak)(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction);
203 void (*_RTAssertMsg2Weak)(const char *pszFormat, ...);
204 void (*_RTAssertMsg2WeakV)(const char *pszFormat, va_list va);
205 bool (*_RTAssertShouldPanic)(void);
206 int (*_RTSemFastMutexCreate)(PRTSEMFASTMUTEX phFastMtx);
207 int (*_RTSemFastMutexDestroy)(RTSEMFASTMUTEX hFastMtx);
208 int (*_RTSemFastMutexRelease)(RTSEMFASTMUTEX hFastMtx);
209 int (*_RTSemFastMutexRequest)(RTSEMFASTMUTEX hFastMtx);
210 int (*_RTSemMutexCreate)(PRTSEMMUTEX phFastMtx);
211 int (*_RTSemMutexDestroy)(RTSEMMUTEX hFastMtx);
212 int (*_RTSemMutexRelease)(RTSEMMUTEX hFastMtx);
213 int (*_RTSemMutexRequest)(RTSEMMUTEX hFastMtx, RTMSINTERVAL cMillies);
214 int (*_RTHeapSimpleRelocate)(RTHEAPSIMPLE hHeap, uintptr_t offDelta);
215 int (*_RTHeapOffsetInit)(PRTHEAPOFFSET phHeap, void *pvMemory, size_t cbMemory);
216 int (*_RTHeapSimpleInit)(PRTHEAPSIMPLE pHeap, void *pvMemory, size_t cbMemory);
217 void* (*_RTHeapOffsetAlloc)(RTHEAPOFFSET hHeap, size_t cb, size_t cbAlignment);
218 void* (*_RTHeapSimpleAlloc)(RTHEAPSIMPLE Heap, size_t cb, size_t cbAlignment);
219 void (*_RTHeapOffsetFree)(RTHEAPOFFSET hHeap, void *pv);
220 void (*_RTHeapSimpleFree)(RTHEAPSIMPLE Heap, void *pv);
221};
222
223
224#ifdef IN_VBOXGUEST
225#define g_DevExt (g_VBoxGuest.devExt)
226#define cUsers (g_VBoxGuest._cUsers)
227#define sState (g_VBoxGuest._sState)
228#else
229#define g_DevExt (g_VBoxGuest->devExt)
230#define cUsers (g_VBoxGuest->_cUsers)
231#define sState (g_VBoxGuest->_sState)
232extern struct vboxguest_module_info *g_VBoxGuest;
233#endif
234
235#endif /* !___VBoxGuest_haiku_h */
236
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