VirtualBox

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

Last change on this file since 83563 was 82968, checked in by vboxsync, 5 years ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 11.8 KB
Line 
1/* $Id: VBoxGuest-haiku.h 82968 2020-02-04 10:35:17Z vboxsync $ */
2/** @file
3 * VBoxGuest kernel module, Haiku Guest Additions, header.
4 */
5
6/*
7 * Copyright (C) 2012-2020 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#ifndef GA_INCLUDED_SRC_common_VBoxGuest_VBoxGuest_haiku_h
57#define GA_INCLUDED_SRC_common_VBoxGuest_VBoxGuest_haiku_h
58#ifndef RT_WITHOUT_PRAGMA_ONCE
59# pragma once
60#endif
61
62#include <OS.h>
63#include <Drivers.h>
64#include <drivers/module.h>
65
66#include "VBoxGuestInternal.h"
67#include <VBox/log.h>
68#include <iprt/assert.h>
69#include <iprt/initterm.h>
70#include <iprt/process.h>
71#include <iprt/mem.h>
72#include <iprt/asm.h>
73#include <iprt/mp.h>
74#include <iprt/power.h>
75#include <iprt/thread.h>
76
77/** The module name. */
78#define VBOXGUEST_MODULE_NAME "generic/vboxguest"
79
80struct VBoxGuestDeviceState
81{
82 /** Resource ID of the I/O port */
83 int iIOPortResId;
84 /** Pointer to the I/O port resource. */
85// struct resource *pIOPortRes;
86 /** Start address of the IO Port. */
87 uint16_t uIOPortBase;
88 /** Resource ID of the MMIO area */
89 area_id iVMMDevMemAreaId;
90 /** Pointer to the MMIO resource. */
91// struct resource *pVMMDevMemRes;
92 /** Handle of the MMIO resource. */
93// bus_space_handle_t VMMDevMemHandle;
94 /** Size of the memory area. */
95 size_t VMMDevMemSize;
96 /** Mapping of the register space */
97 void *pMMIOBase;
98 /** IRQ number */
99 int iIrqResId;
100 /** IRQ resource handle. */
101// struct resource *pIrqRes;
102 /** Pointer to the IRQ handler. */
103// void *pfnIrqHandler;
104 /** VMMDev version */
105 uint32_t u32Version;
106
107 /** The (only) select data we wait on. */
108 //XXX: should leave in pSession ?
109 uint8_t selectEvent;
110 uint32_t selectRef;
111 void *selectSync;
112};
113
114struct vboxguest_module_info
115{
116 module_info module;
117
118 VBOXGUESTDEVEXT devExt;
119 struct VBoxGuestDeviceState _sState;
120 volatile uint32_t _cUsers;
121
122 size_t(*_RTLogBackdoorPrintf)(const char *pszFormat, ...);
123 size_t(*_RTLogBackdoorPrintfV)(const char *pszFormat, va_list args);
124 int (*_RTLogSetDefaultInstanceThread)(PRTLOGGER pLogger, uintptr_t uKey);
125 int (*_RTMemAllocExTag)(size_t cb, size_t cbAlignment, uint32_t fFlags, const char *pszTag, void **ppv);
126 void* (*_RTMemContAlloc)(PRTCCPHYS pPhys, size_t cb);
127 void (*_RTMemContFree)(void *pv, size_t cb);
128 void (*_RTMemFreeEx)(void *pv, size_t cb);
129 bool (*_RTMpIsCpuPossible)(RTCPUID idCpu);
130 int (*_RTMpNotificationDeregister)(PFNRTMPNOTIFICATION pfnCallback, void *pvUser);
131 int (*_RTMpNotificationRegister)(PFNRTMPNOTIFICATION pfnCallback, void *pvUser);
132 int (*_RTMpOnAll)(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2);
133 int (*_RTMpOnOthers)(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2);
134 int (*_RTMpOnSpecific)(RTCPUID idCpu, PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2);
135 int (*_RTPowerNotificationDeregister)(PFNRTPOWERNOTIFICATION pfnCallback, void *pvUser);
136 int (*_RTPowerNotificationRegister)(PFNRTPOWERNOTIFICATION pfnCallback, void *pvUser);
137 int (*_RTPowerSignalEvent)(RTPOWEREVENT enmEvent);
138 void (*_RTR0AssertPanicSystem)(void);
139 int (*_RTR0Init)(unsigned fReserved);
140 void* (*_RTR0MemObjAddress)(RTR0MEMOBJ MemObj);
141 RTR3PTR(*_RTR0MemObjAddressR3)(RTR0MEMOBJ MemObj);
142 int (*_RTR0MemObjAllocContTag)(PRTR0MEMOBJ pMemObj, size_t cb, bool fExecutable, const char *pszTag);
143 int (*_RTR0MemObjAllocLowTag)(PRTR0MEMOBJ pMemObj, size_t cb, bool fExecutable, const char *pszTag);
144 int (*_RTR0MemObjAllocPageTag)(PRTR0MEMOBJ pMemObj, size_t cb, bool fExecutable, const char *pszTag);
145 int (*_RTR0MemObjAllocPhysExTag)(PRTR0MEMOBJ pMemObj, size_t cb, RTHCPHYS PhysHighest, size_t uAlignment, const char *pszTag);
146 int (*_RTR0MemObjAllocPhysNCTag)(PRTR0MEMOBJ pMemObj, size_t cb, RTHCPHYS PhysHighest, const char *pszTag);
147 int (*_RTR0MemObjAllocPhysTag)(PRTR0MEMOBJ pMemObj, size_t cb, RTHCPHYS PhysHighest, const char *pszTag);
148 int (*_RTR0MemObjEnterPhysTag)(PRTR0MEMOBJ pMemObj, RTHCPHYS Phys, size_t cb, uint32_t uCachePolicy, const char *pszTag);
149 int (*_RTR0MemObjFree)(RTR0MEMOBJ MemObj, bool fFreeMappings);
150 RTHCPHYS(*_RTR0MemObjGetPagePhysAddr)(RTR0MEMOBJ MemObj, size_t iPage);
151 bool (*_RTR0MemObjIsMapping)(RTR0MEMOBJ MemObj);
152 int (*_RTR0MemObjLockKernelTag)(PRTR0MEMOBJ pMemObj, void *pv, size_t cb, uint32_t fAccess, const char *pszTag);
153 int (*_RTR0MemObjLockUserTag)(PRTR0MEMOBJ pMemObj, RTR3PTR R3Ptr, size_t cb, uint32_t fAccess,
154 RTR0PROCESS R0Process, const char *pszTag);
155 int (*_RTR0MemObjMapKernelExTag)(PRTR0MEMOBJ pMemObj, RTR0MEMOBJ MemObjToMap, void *pvFixed, size_t uAlignment,
156 unsigned fProt, size_t offSub, size_t cbSub, const char *pszTag);
157 int (*_RTR0MemObjMapKernelTag)(PRTR0MEMOBJ pMemObj, RTR0MEMOBJ MemObjToMap, void *pvFixed,
158 size_t uAlignment, unsigned fProt, const char *pszTag);
159 int (*_RTR0MemObjMapUserTag)(PRTR0MEMOBJ pMemObj, RTR0MEMOBJ MemObjToMap, RTR3PTR R3PtrFixed,
160 size_t uAlignment, unsigned fProt, RTR0PROCESS R0Process, const char *pszTag);
161 int (*_RTR0MemObjProtect)(RTR0MEMOBJ hMemObj, size_t offSub, size_t cbSub, uint32_t fProt);
162 int (*_RTR0MemObjReserveKernelTag)(PRTR0MEMOBJ pMemObj, void *pvFixed, size_t cb, size_t uAlignment, const char *pszTag);
163 int (*_RTR0MemObjReserveUserTag)(PRTR0MEMOBJ pMemObj, RTR3PTR R3PtrFixed, size_t cb, size_t uAlignment,
164 RTR0PROCESS R0Process, const char *pszTag);
165 size_t(*_RTR0MemObjSize)(RTR0MEMOBJ MemObj);
166 RTR0PROCESS(*_RTR0ProcHandleSelf)(void);
167 void (*_RTR0Term)(void);
168 void (*_RTR0TermForced)(void);
169 RTPROCESS(*_RTProcSelf)(void);
170 uint32_t(*_RTSemEventGetResolution)(void);
171 uint32_t(*_RTSemEventMultiGetResolution)(void);
172 int (*_RTSemEventMultiWaitEx)(RTSEMEVENTMULTI hEventMultiSem, uint32_t fFlags, uint64_t uTimeout);
173 int (*_RTSemEventMultiWaitExDebug)(RTSEMEVENTMULTI hEventMultiSem, uint32_t fFlags, uint64_t uTimeout,
174 RTHCUINTPTR uId, RT_SRC_POS_DECL);
175 int (*_RTSemEventWaitEx)(RTSEMEVENT hEventSem, uint32_t fFlags, uint64_t uTimeout);
176 int (*_RTSemEventWaitExDebug)(RTSEMEVENT hEventSem, uint32_t fFlags, uint64_t uTimeout,
177 RTHCUINTPTR uId, RT_SRC_POS_DECL);
178 bool (*_RTThreadIsInInterrupt)(RTTHREAD hThread);
179 void (*_RTThreadPreemptDisable)(PRTTHREADPREEMPTSTATE pState);
180 bool (*_RTThreadPreemptIsEnabled)(RTTHREAD hThread);
181 bool (*_RTThreadPreemptIsPending)(RTTHREAD hThread);
182 bool (*_RTThreadPreemptIsPendingTrusty)(void);
183 bool (*_RTThreadPreemptIsPossible)(void);
184 void (*_RTThreadPreemptRestore)(PRTTHREADPREEMPTSTATE pState);
185 uint32_t(*_RTTimerGetSystemGranularity)(void);
186 int (*_RTTimerReleaseSystemGranularity)(uint32_t u32Granted);
187 int (*_RTTimerRequestSystemGranularity)(uint32_t u32Request, uint32_t *pu32Granted);
188 void (*_RTSpinlockAcquire)(RTSPINLOCK Spinlock);
189 void (*_RTSpinlockRelease)(RTSPINLOCK Spinlock);
190 void* (*_RTMemTmpAllocTag)(size_t cb, const char *pszTag);
191 void (*_RTMemTmpFree)(void *pv);
192 PRTLOGGER(*_RTLogDefaultInstance)(void);
193 PRTLOGGER(*_RTLogDefaultInstanceEx)(uint32_t fFlagsAndGroup);
194 PRTLOGGER(*_RTLogRelGetDefaultInstance)(void);
195 PRTLOGGER(*_RTLogRelGetDefaultInstanceEx)(uint32_t fFlagsAndGroup);
196 int (*_RTErrConvertToErrno)(int iErr);
197 int (*_VGDrvCommonIoCtl)(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
198 void *pvData, size_t cbData, size_t *pcbDataReturned);
199 int (*_VGDrvCommonCreateUserSession)(PVBOXGUESTDEVEXT pDevExt, uint32_t fRequestor, PVBOXGUESTSESSION *ppSession);
200 void (*_VGDrvCommonCloseSession)(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession);
201 void* (*_VBoxGuestIDCOpen)(uint32_t *pu32Version);
202 int (*_VBoxGuestIDCClose)(void *pvSession);
203 int (*_VBoxGuestIDCCall)(void *pvSession, unsigned iCmd, void *pvData, size_t cbData, size_t *pcbDataReturned);
204 void (*_RTAssertMsg1Weak)(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction);
205 void (*_RTAssertMsg2Weak)(const char *pszFormat, ...);
206 void (*_RTAssertMsg2WeakV)(const char *pszFormat, va_list va);
207 bool (*_RTAssertShouldPanic)(void);
208 int (*_RTSemFastMutexCreate)(PRTSEMFASTMUTEX phFastMtx);
209 int (*_RTSemFastMutexDestroy)(RTSEMFASTMUTEX hFastMtx);
210 int (*_RTSemFastMutexRelease)(RTSEMFASTMUTEX hFastMtx);
211 int (*_RTSemFastMutexRequest)(RTSEMFASTMUTEX hFastMtx);
212 int (*_RTSemMutexCreate)(PRTSEMMUTEX phFastMtx);
213 int (*_RTSemMutexDestroy)(RTSEMMUTEX hFastMtx);
214 int (*_RTSemMutexRelease)(RTSEMMUTEX hFastMtx);
215 int (*_RTSemMutexRequest)(RTSEMMUTEX hFastMtx, RTMSINTERVAL cMillies);
216 int (*_RTHeapSimpleRelocate)(RTHEAPSIMPLE hHeap, uintptr_t offDelta);
217 int (*_RTHeapOffsetInit)(PRTHEAPOFFSET phHeap, void *pvMemory, size_t cbMemory);
218 int (*_RTHeapSimpleInit)(PRTHEAPSIMPLE pHeap, void *pvMemory, size_t cbMemory);
219 void* (*_RTHeapOffsetAlloc)(RTHEAPOFFSET hHeap, size_t cb, size_t cbAlignment);
220 void* (*_RTHeapSimpleAlloc)(RTHEAPSIMPLE Heap, size_t cb, size_t cbAlignment);
221 void (*_RTHeapOffsetFree)(RTHEAPOFFSET hHeap, void *pv);
222 void (*_RTHeapSimpleFree)(RTHEAPSIMPLE Heap, void *pv);
223};
224
225
226#ifdef IN_VBOXGUEST
227#define g_DevExt (g_VBoxGuest.devExt)
228#define cUsers (g_VBoxGuest._cUsers)
229#define sState (g_VBoxGuest._sState)
230#else
231#define g_DevExt (g_VBoxGuest->devExt)
232#define cUsers (g_VBoxGuest->_cUsers)
233#define sState (g_VBoxGuest->_sState)
234extern struct vboxguest_module_info *g_VBoxGuest;
235#endif
236
237#endif /* !GA_INCLUDED_SRC_common_VBoxGuest_VBoxGuest_haiku_h */
238
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