VirtualBox

source: vbox/trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-haiku-stubs.c@ 45221

Last change on this file since 45221 was 43411, checked in by vboxsync, 12 years ago

Additions/haiku: cleanup.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 15.4 KB
Line 
1/* $Id: VBoxGuest-haiku-stubs.c 43411 2012-09-22 18:42:16Z vboxsync $ */
2/** @file
3 * VBoxGuest kernel module, Haiku Guest Additions, stubs.
4 */
5
6/*
7 * Copyright (C) 2012 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 <[email protected]>
23 * François Revol <[email protected]>
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/*
49 * This file provides stubs for calling VBox runtime functions through the vboxguest module.
50 * It should be linked into any driver or module that uses the VBox runtime, except vboxguest
51 * itself (which contains the actual library and therefore doesn't need stubs to call it).
52 */
53
54#include "VBoxGuest-haiku.h"
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// >>> file('/tmp/stubs.c', 'w').writelines([re.sub(r'^(?P<returntype>[^(]+) \(\*_(?P<functionname>[A-Za-z0-9_]+)\)\((?P<params>[^)]+)\);', lambda m: '%s %s(%s)\n{\n %sg_VBoxGuest->_%s(%s);\n}\n' % (m.group(1), m.group(2), m.group(3), ('return ' if m.group(1) != 'void' else ''), m.group(2), (', '.join(a.split(' ')[-1].replace('*', '') for a in m.group(3).split(',')) if m.group(3) != 'void' else '')), f) for f in functions])
67
68struct vboxguest_module_info *g_VBoxGuest;
69
70size_t RTLogBackdoorPrintf(const char *pszFormat, ...)
71{
72 va_list args;
73 size_t cb;
74
75 va_start(args, pszFormat);
76 cb = g_VBoxGuest->_RTLogBackdoorPrintf(pszFormat, args);
77 va_end(args);
78
79 return cb;
80}
81size_t RTLogBackdoorPrintfV(const char *pszFormat, va_list args)
82{
83 return g_VBoxGuest->_RTLogBackdoorPrintfV(pszFormat, args);
84}
85int RTLogSetDefaultInstanceThread(PRTLOGGER pLogger, uintptr_t uKey)
86{
87 return g_VBoxGuest->_RTLogSetDefaultInstanceThread(pLogger, uKey);
88}
89int RTMemAllocExTag(size_t cb, size_t cbAlignment, uint32_t fFlags, const char *pszTag, void **ppv)
90{
91 return g_VBoxGuest->_RTMemAllocExTag(cb, cbAlignment, fFlags, pszTag, ppv);
92}
93void* RTMemContAlloc(PRTCCPHYS pPhys, size_t cb)
94{
95 return g_VBoxGuest->_RTMemContAlloc(pPhys, cb);
96}
97void RTMemContFree(void *pv, size_t cb)
98{
99 g_VBoxGuest->_RTMemContFree(pv, cb);
100}
101void RTMemFreeEx(void *pv, size_t cb)
102{
103 g_VBoxGuest->_RTMemFreeEx(pv, cb);
104}
105bool RTMpIsCpuPossible(RTCPUID idCpu)
106{
107 return g_VBoxGuest->_RTMpIsCpuPossible(idCpu);
108}
109int RTMpNotificationDeregister(PFNRTMPNOTIFICATION pfnCallback, void *pvUser)
110{
111 return g_VBoxGuest->_RTMpNotificationDeregister(pfnCallback, pvUser);
112}
113int RTMpNotificationRegister(PFNRTMPNOTIFICATION pfnCallback, void *pvUser)
114{
115 return g_VBoxGuest->_RTMpNotificationRegister(pfnCallback, pvUser);
116}
117int RTMpOnAll(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
118{
119 return g_VBoxGuest->_RTMpOnAll(pfnWorker, pvUser1, pvUser2);
120}
121int RTMpOnOthers(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
122{
123 return g_VBoxGuest->_RTMpOnOthers(pfnWorker, pvUser1, pvUser2);
124}
125int RTMpOnSpecific(RTCPUID idCpu, PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
126{
127 return g_VBoxGuest->_RTMpOnSpecific(idCpu, pfnWorker, pvUser1, pvUser2);
128}
129int RTPowerNotificationDeregister(PFNRTPOWERNOTIFICATION pfnCallback, void *pvUser)
130{
131 return g_VBoxGuest->_RTPowerNotificationDeregister(pfnCallback, pvUser);
132}
133int RTPowerNotificationRegister(PFNRTPOWERNOTIFICATION pfnCallback, void *pvUser)
134{
135 return g_VBoxGuest->_RTPowerNotificationRegister(pfnCallback, pvUser);
136}
137int RTPowerSignalEvent(RTPOWEREVENT enmEvent)
138{
139 return g_VBoxGuest->_RTPowerSignalEvent(enmEvent);
140}
141void RTR0AssertPanicSystem(void)
142{
143 g_VBoxGuest->_RTR0AssertPanicSystem();
144}
145int RTR0Init(unsigned fReserved)
146{
147 return g_VBoxGuest->_RTR0Init(fReserved);
148}
149void* RTR0MemObjAddress(RTR0MEMOBJ MemObj)
150{
151 return g_VBoxGuest->_RTR0MemObjAddress(MemObj);
152}
153RTR3PTR RTR0MemObjAddressR3(RTR0MEMOBJ MemObj)
154{
155 return g_VBoxGuest->_RTR0MemObjAddressR3(MemObj);
156}
157int RTR0MemObjAllocContTag(PRTR0MEMOBJ pMemObj, size_t cb, bool fExecutable, const char *pszTag)
158{
159 return g_VBoxGuest->_RTR0MemObjAllocContTag(pMemObj, cb, fExecutable, pszTag);
160}
161int RTR0MemObjAllocLowTag(PRTR0MEMOBJ pMemObj, size_t cb, bool fExecutable, const char *pszTag)
162{
163 return g_VBoxGuest->_RTR0MemObjAllocLowTag(pMemObj, cb, fExecutable, pszTag);
164}
165int RTR0MemObjAllocPageTag(PRTR0MEMOBJ pMemObj, size_t cb, bool fExecutable, const char *pszTag)
166{
167 return g_VBoxGuest->_RTR0MemObjAllocPageTag(pMemObj, cb, fExecutable, pszTag);
168}
169int RTR0MemObjAllocPhysExTag(PRTR0MEMOBJ pMemObj, size_t cb, RTHCPHYS PhysHighest, size_t uAlignment, const char *pszTag)
170{
171 return g_VBoxGuest->_RTR0MemObjAllocPhysExTag(pMemObj, cb, PhysHighest, uAlignment, pszTag);
172}
173int RTR0MemObjAllocPhysNCTag(PRTR0MEMOBJ pMemObj, size_t cb, RTHCPHYS PhysHighest, const char *pszTag)
174{
175 return g_VBoxGuest->_RTR0MemObjAllocPhysNCTag(pMemObj, cb, PhysHighest, pszTag);
176}
177int RTR0MemObjAllocPhysTag(PRTR0MEMOBJ pMemObj, size_t cb, RTHCPHYS PhysHighest, const char *pszTag)
178{
179 return g_VBoxGuest->_RTR0MemObjAllocPhysTag(pMemObj, cb, PhysHighest, pszTag);
180}
181int RTR0MemObjEnterPhysTag(PRTR0MEMOBJ pMemObj, RTHCPHYS Phys, size_t cb, uint32_t uCachePolicy, const char *pszTag)
182{
183 return g_VBoxGuest->_RTR0MemObjEnterPhysTag(pMemObj, Phys, cb, uCachePolicy, pszTag);
184}
185int RTR0MemObjFree(RTR0MEMOBJ MemObj, bool fFreeMappings)
186{
187 return g_VBoxGuest->_RTR0MemObjFree(MemObj, fFreeMappings);
188}
189RTHCPHYS RTR0MemObjGetPagePhysAddr(RTR0MEMOBJ MemObj, size_t iPage)
190{
191 return g_VBoxGuest->_RTR0MemObjGetPagePhysAddr(MemObj, iPage);
192}
193bool RTR0MemObjIsMapping(RTR0MEMOBJ MemObj)
194{
195 return g_VBoxGuest->_RTR0MemObjIsMapping(MemObj);
196}
197int RTR0MemObjLockKernelTag(PRTR0MEMOBJ pMemObj, void *pv, size_t cb, uint32_t fAccess, const char *pszTag)
198{
199 return g_VBoxGuest->_RTR0MemObjLockKernelTag(pMemObj, pv, cb, fAccess, pszTag);
200}
201int RTR0MemObjLockUserTag(PRTR0MEMOBJ pMemObj, RTR3PTR R3Ptr, size_t cb, uint32_t fAccess, RTR0PROCESS R0Process, const char *pszTag)
202{
203 return g_VBoxGuest->_RTR0MemObjLockUserTag(pMemObj, R3Ptr, cb, fAccess, R0Process, pszTag);
204}
205int RTR0MemObjMapKernelExTag(PRTR0MEMOBJ pMemObj, RTR0MEMOBJ MemObjToMap, void *pvFixed, size_t uAlignment, unsigned fProt, size_t offSub, size_t cbSub, const char *pszTag)
206{
207 return g_VBoxGuest->_RTR0MemObjMapKernelExTag(pMemObj, MemObjToMap, pvFixed, uAlignment, fProt, offSub, cbSub, pszTag);
208}
209int RTR0MemObjMapKernelTag(PRTR0MEMOBJ pMemObj, RTR0MEMOBJ MemObjToMap, void *pvFixed, size_t uAlignment, unsigned fProt, const char *pszTag)
210{
211 return g_VBoxGuest->_RTR0MemObjMapKernelTag(pMemObj, MemObjToMap, pvFixed, uAlignment, fProt, pszTag);
212}
213int RTR0MemObjMapUserTag(PRTR0MEMOBJ pMemObj, RTR0MEMOBJ MemObjToMap, RTR3PTR R3PtrFixed, size_t uAlignment, unsigned fProt, RTR0PROCESS R0Process, const char *pszTag)
214{
215 return g_VBoxGuest->_RTR0MemObjMapUserTag(pMemObj, MemObjToMap, R3PtrFixed, uAlignment, fProt, R0Process, pszTag);
216}
217int RTR0MemObjProtect(RTR0MEMOBJ hMemObj, size_t offSub, size_t cbSub, uint32_t fProt)
218{
219 return g_VBoxGuest->_RTR0MemObjProtect(hMemObj, offSub, cbSub, fProt);
220}
221int RTR0MemObjReserveKernelTag(PRTR0MEMOBJ pMemObj, void *pvFixed, size_t cb, size_t uAlignment, const char *pszTag)
222{
223 return g_VBoxGuest->_RTR0MemObjReserveKernelTag(pMemObj, pvFixed, cb, uAlignment, pszTag);
224}
225int RTR0MemObjReserveUserTag(PRTR0MEMOBJ pMemObj, RTR3PTR R3PtrFixed, size_t cb, size_t uAlignment, RTR0PROCESS R0Process, const char *pszTag)
226{
227 return g_VBoxGuest->_RTR0MemObjReserveUserTag(pMemObj, R3PtrFixed, cb, uAlignment, R0Process, pszTag);
228}
229size_t RTR0MemObjSize(RTR0MEMOBJ MemObj)
230{
231 return g_VBoxGuest->_RTR0MemObjSize(MemObj);
232}
233RTR0PROCESS RTR0ProcHandleSelf(void)
234{
235 return g_VBoxGuest->_RTR0ProcHandleSelf();
236}
237void RTR0Term(void)
238{
239 g_VBoxGuest->_RTR0Term();
240}
241void RTR0TermForced(void)
242{
243 g_VBoxGuest->_RTR0TermForced();
244}
245RTPROCESS RTProcSelf(void)
246{
247 return g_VBoxGuest->_RTProcSelf();
248}
249uint32_t RTSemEventGetResolution(void)
250{
251 return g_VBoxGuest->_RTSemEventGetResolution();
252}
253uint32_t RTSemEventMultiGetResolution(void)
254{
255 return g_VBoxGuest->_RTSemEventMultiGetResolution();
256}
257int RTSemEventMultiWaitEx(RTSEMEVENTMULTI hEventMultiSem, uint32_t fFlags, uint64_t uTimeout)
258{
259 return g_VBoxGuest->_RTSemEventMultiWaitEx(hEventMultiSem, fFlags, uTimeout);
260}
261int RTSemEventMultiWaitExDebug(RTSEMEVENTMULTI hEventMultiSem, uint32_t fFlags, uint64_t uTimeout, RTHCUINTPTR uId, RT_SRC_POS_DECL)
262{
263 return g_VBoxGuest->_RTSemEventMultiWaitExDebug(hEventMultiSem, fFlags, uTimeout, uId, pszFile, iLine, pszFunction);
264}
265int RTSemEventWaitEx(RTSEMEVENT hEventSem, uint32_t fFlags, uint64_t uTimeout)
266{
267 return g_VBoxGuest->_RTSemEventWaitEx(hEventSem, fFlags, uTimeout);
268}
269int RTSemEventWaitExDebug(RTSEMEVENT hEventSem, uint32_t fFlags, uint64_t uTimeout, RTHCUINTPTR uId, RT_SRC_POS_DECL)
270{
271 return g_VBoxGuest->_RTSemEventWaitExDebug(hEventSem, fFlags, uTimeout, uId, pszFile, iLine, pszFunction);
272}
273bool RTThreadIsInInterrupt(RTTHREAD hThread)
274{
275 return g_VBoxGuest->_RTThreadIsInInterrupt(hThread);
276}
277void RTThreadPreemptDisable(PRTTHREADPREEMPTSTATE pState)
278{
279 g_VBoxGuest->_RTThreadPreemptDisable(pState);
280}
281bool RTThreadPreemptIsEnabled(RTTHREAD hThread)
282{
283 return g_VBoxGuest->_RTThreadPreemptIsEnabled(hThread);
284}
285bool RTThreadPreemptIsPending(RTTHREAD hThread)
286{
287 return g_VBoxGuest->_RTThreadPreemptIsPending(hThread);
288}
289bool RTThreadPreemptIsPendingTrusty(void)
290{
291 return g_VBoxGuest->_RTThreadPreemptIsPendingTrusty();
292}
293bool RTThreadPreemptIsPossible(void)
294{
295 return g_VBoxGuest->_RTThreadPreemptIsPossible();
296}
297void RTThreadPreemptRestore(PRTTHREADPREEMPTSTATE pState)
298{
299 g_VBoxGuest->_RTThreadPreemptRestore(pState);
300}
301uint32_t RTTimerGetSystemGranularity(void)
302{
303 return g_VBoxGuest->_RTTimerGetSystemGranularity();
304}
305int RTTimerReleaseSystemGranularity(uint32_t u32Granted)
306{
307 return g_VBoxGuest->_RTTimerReleaseSystemGranularity(u32Granted);
308}
309int RTTimerRequestSystemGranularity(uint32_t u32Request, uint32_t *pu32Granted)
310{
311 return g_VBoxGuest->_RTTimerRequestSystemGranularity(u32Request, pu32Granted);
312}
313void RTSpinlockAcquire(RTSPINLOCK Spinlock)
314{
315 g_VBoxGuest->_RTSpinlockAcquire(Spinlock);
316}
317void RTSpinlockRelease(RTSPINLOCK Spinlock)
318{
319 g_VBoxGuest->_RTSpinlockRelease(Spinlock);
320}
321void RTSpinlockReleaseNoInts(RTSPINLOCK Spinlock)
322{
323 g_VBoxGuest->_RTSpinlockReleaseNoInts(Spinlock);
324}
325void* RTMemTmpAllocTag(size_t cb, const char *pszTag)
326{
327 return g_VBoxGuest->_RTMemTmpAllocTag(cb, pszTag);
328}
329void RTMemTmpFree(void *pv)
330{
331 g_VBoxGuest->_RTMemTmpFree(pv);
332}
333PRTLOGGER RTLogDefaultInstance(void)
334{
335 return g_VBoxGuest->_RTLogDefaultInstance();
336}
337PRTLOGGER RTLogRelDefaultInstance(void)
338{
339 return g_VBoxGuest->_RTLogRelDefaultInstance();
340}
341int RTErrConvertToErrno(int iErr)
342{
343 return g_VBoxGuest->_RTErrConvertToErrno(iErr);
344}
345int VBoxGuestCommonIOCtl(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, void *pvData, size_t cbData, size_t *pcbDataReturned)
346{
347 return g_VBoxGuest->_VBoxGuestCommonIOCtl(iFunction, pDevExt, pSession, pvData, cbData, pcbDataReturned);
348}
349int VBoxGuestCreateUserSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *ppSession)
350{
351 return g_VBoxGuest->_VBoxGuestCreateUserSession(pDevExt, ppSession);
352}
353void VBoxGuestCloseSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession)
354{
355 g_VBoxGuest->_VBoxGuestCloseSession(pDevExt, pSession);
356}
357void* VBoxGuestIDCOpen(uint32_t *pu32Version)
358{
359 return g_VBoxGuest->_VBoxGuestIDCOpen(pu32Version);
360}
361int VBoxGuestIDCClose(void *pvSession)
362{
363 return g_VBoxGuest->_VBoxGuestIDCClose(pvSession);
364}
365int VBoxGuestIDCCall(void *pvSession, unsigned iCmd, void *pvData, size_t cbData, size_t *pcbDataReturned)
366{
367 return g_VBoxGuest->_VBoxGuestIDCCall(pvSession, iCmd, pvData, cbData, pcbDataReturned);
368}
369void RTAssertMsg1Weak(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction)
370{
371 g_VBoxGuest->_RTAssertMsg1Weak(pszExpr, uLine, pszFile, pszFunction);
372}
373void RTAssertMsg2Weak(const char *pszFormat, ...)
374{
375 va_list va;
376 va_start(va, pszFormat);
377 RTAssertMsg2WeakV(pszFormat, va);
378 va_end(va);
379}
380void RTAssertMsg2WeakV(const char *pszFormat, va_list va)
381{
382 g_VBoxGuest->_RTAssertMsg2WeakV(pszFormat, va);
383}
384bool RTAssertShouldPanic(void)
385{
386 return g_VBoxGuest->_RTAssertShouldPanic();
387}
388int RTSemFastMutexCreate(PRTSEMFASTMUTEX phFastMtx)
389{
390 return g_VBoxGuest->_RTSemFastMutexCreate(phFastMtx);
391}
392int RTSemFastMutexDestroy(RTSEMFASTMUTEX hFastMtx)
393{
394 return g_VBoxGuest->_RTSemFastMutexDestroy(hFastMtx);
395}
396int RTSemFastMutexRelease(RTSEMFASTMUTEX hFastMtx)
397{
398 return g_VBoxGuest->_RTSemFastMutexRelease(hFastMtx);
399}
400int RTSemFastMutexRequest(RTSEMFASTMUTEX hFastMtx)
401{
402 return g_VBoxGuest->_RTSemFastMutexRequest(hFastMtx);
403}
404int RTSemMutexCreate(PRTSEMMUTEX phFastMtx)
405{
406 return g_VBoxGuest->_RTSemMutexCreate(phFastMtx);
407}
408int RTSemMutexDestroy(RTSEMMUTEX hFastMtx)
409{
410 return g_VBoxGuest->_RTSemMutexDestroy(hFastMtx);
411}
412int RTSemMutexRelease(RTSEMMUTEX hFastMtx)
413{
414 return g_VBoxGuest->_RTSemMutexRelease(hFastMtx);
415}
416int RTSemMutexRequest(RTSEMMUTEX hFastMtx, RTMSINTERVAL cMillies)
417{
418 return g_VBoxGuest->_RTSemMutexRequest(hFastMtx, cMillies);
419}
420int RTHeapSimpleRelocate(RTHEAPSIMPLE hHeap, uintptr_t offDelta)
421{
422 return g_VBoxGuest->_RTHeapSimpleRelocate(hHeap, offDelta);
423}
424int RTHeapOffsetInit(PRTHEAPOFFSET phHeap, void *pvMemory, size_t cbMemory)
425{
426 return g_VBoxGuest->_RTHeapOffsetInit(phHeap, pvMemory, cbMemory);
427}
428int RTHeapSimpleInit(PRTHEAPSIMPLE pHeap, void *pvMemory, size_t cbMemory)
429{
430 return g_VBoxGuest->_RTHeapSimpleInit(pHeap, pvMemory, cbMemory);
431}
432void* RTHeapOffsetAlloc(RTHEAPOFFSET hHeap, size_t cb, size_t cbAlignment)
433{
434 return g_VBoxGuest->_RTHeapOffsetAlloc(hHeap, cb, cbAlignment);
435}
436void* RTHeapSimpleAlloc(RTHEAPSIMPLE Heap, size_t cb, size_t cbAlignment)
437{
438 return g_VBoxGuest->_RTHeapSimpleAlloc(Heap, cb, cbAlignment);
439}
440void RTHeapOffsetFree(RTHEAPOFFSET hHeap, void *pv)
441{
442 g_VBoxGuest->_RTHeapOffsetFree(hHeap, pv);
443}
444void RTHeapSimpleFree(RTHEAPSIMPLE Heap, void *pv)
445{
446 g_VBoxGuest->_RTHeapSimpleFree(Heap, pv);
447}
448
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