VirtualBox

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

Last change on this file since 62521 was 62521, checked in by vboxsync, 8 years ago

(C) 2016

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