VirtualBox

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

Last change on this file was 100357, checked in by vboxsync, 10 months ago

Runtime/RTR0MemObj*: Add PhysHighest parameter to RTR0MemObjAllocCont to indicate the maximum allowed physical address for an allocation, bugref:10457 [second attempt]

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

© 2023 Oracle
ContactPrivacy policyTerms of Use