VirtualBox

source: vbox/trunk/src/VBox/HostDrivers/Support/SUPDrvInternal.h@ 10836

最後變更 在這個檔案從10836是 10836,由 vboxsync 提交於 17 年 前

supdrv: Fixed missing session clean on the mac when more than one client was active.

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 21.7 KB
 
1/* $Revision: 10836 $ */
2/** @file
3 * VirtualBox Support Driver - Internal header.
4 */
5
6/*
7 * Copyright (C) 2006-2007 Sun Microsystems, Inc.
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.alldomusa.eu.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 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
27 * Clara, CA 95054 USA or visit http://www.sun.com if you need
28 * additional information or have any questions.
29 */
30
31#ifndef ___SUPDrvInternal_h
32#define ___SUPDrvInternal_h
33
34
35/*******************************************************************************
36* Header Files *
37*******************************************************************************/
38#include <VBox/cdefs.h>
39#include <VBox/types.h>
40#include <iprt/assert.h>
41#include <iprt/asm.h>
42#include <VBox/sup.h>
43#include <iprt/memobj.h>
44#include <iprt/time.h>
45#include <iprt/timer.h>
46#include <iprt/string.h>
47#include <iprt/err.h>
48
49
50#if defined(RT_OS_WINDOWS)
51 __BEGIN_DECLS
52# if (_MSC_VER >= 1400) && !defined(VBOX_WITH_PATCHED_DDK)
53# define _InterlockedExchange _InterlockedExchange_StupidDDKVsCompilerCrap
54# define _InterlockedExchangeAdd _InterlockedExchangeAdd_StupidDDKVsCompilerCrap
55# define _InterlockedCompareExchange _InterlockedCompareExchange_StupidDDKVsCompilerCrap
56# define _InterlockedAddLargeStatistic _InterlockedAddLargeStatistic_StupidDDKVsCompilerCrap
57# define _interlockedbittestandset _interlockedbittestandset_StupidDDKVsCompilerCrap
58# define _interlockedbittestandreset _interlockedbittestandreset_StupidDDKVsCompilerCrap
59# define _interlockedbittestandset64 _interlockedbittestandset64_StupidDDKVsCompilerCrap
60# define _interlockedbittestandreset64 _interlockedbittestandreset64_StupidDDKVsCompilerCrap
61# include <ntddk.h>
62# undef _InterlockedExchange
63# undef _InterlockedExchangeAdd
64# undef _InterlockedCompareExchange
65# undef _InterlockedAddLargeStatistic
66# undef _interlockedbittestandset
67# undef _interlockedbittestandreset
68# undef _interlockedbittestandset64
69# undef _interlockedbittestandreset64
70# else
71# include <ntddk.h>
72# endif
73# include <memory.h>
74# define memcmp(a,b,c) mymemcmp(a,b,c)
75 int VBOXCALL mymemcmp(const void *, const void *, size_t);
76 __END_DECLS
77
78#elif defined(RT_OS_LINUX)
79# include <linux/autoconf.h>
80# include <linux/version.h>
81# if defined(CONFIG_MODVERSIONS) && !defined(MODVERSIONS)
82# define MODVERSIONS
83# if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 71)
84# include <linux/modversions.h>
85# endif
86# endif
87# if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 0)
88# undef ALIGN
89# endif
90# ifndef KBUILD_STR
91# if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 16)
92# define KBUILD_STR(s) s
93# else
94# define KBUILD_STR(s) #s
95# endif
96# endif
97# include <linux/string.h>
98# include <linux/spinlock.h>
99# include <linux/slab.h>
100# include <asm/semaphore.h>
101# include <linux/timer.h>
102
103# if 0
104# include <linux/hrtimer.h>
105# define VBOX_HRTIMER
106# endif
107
108#elif defined(RT_OS_DARWIN)
109# include <libkern/libkern.h>
110# include <iprt/string.h>
111
112#elif defined(RT_OS_OS2)
113
114#elif defined(RT_OS_FREEBSD)
115# include <sys/libkern.h>
116# include <iprt/string.h>
117
118#elif defined(RT_OS_SOLARIS)
119# include <sys/cmn_err.h>
120# include <iprt/string.h>
121
122#else
123# error "unsupported OS."
124#endif
125
126#include "SUPDrvIOC.h"
127#include "SUPDrvIDC.h"
128
129
130
131/*******************************************************************************
132* Defined Constants And Macros *
133*******************************************************************************/
134/*
135 * Hardcoded cookies.
136 */
137#define BIRD 0x64726962 /* 'bird' */
138#define BIRD_INV 0x62697264 /* 'drib' */
139
140
141/*
142 * Win32
143 */
144#if defined(RT_OS_WINDOWS)
145
146/* debug printf */
147# define OSDBGPRINT(a) DbgPrint a
148
149/** Maximum number of bytes we try to lock down in one go.
150 * This is supposed to have a limit right below 256MB, but this appears
151 * to actually be much lower. The values here have been determined experimentally.
152 */
153#ifdef RT_ARCH_X86
154# define MAX_LOCK_MEM_SIZE (32*1024*1024) /* 32mb */
155#endif
156#ifdef RT_ARCH_AMD64
157# define MAX_LOCK_MEM_SIZE (24*1024*1024) /* 24mb */
158#endif
159
160
161/*
162 * Linux
163 */
164#elif defined(RT_OS_LINUX)
165
166/* check kernel version */
167#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 0)
168# error Unsupported kernel version!
169#endif
170
171__BEGIN_DECLS
172int linux_dprintf(const char *format, ...);
173__END_DECLS
174
175/* debug printf */
176# define OSDBGPRINT(a) printk a
177
178
179/*
180 * Darwin
181 */
182#elif defined(RT_OS_DARWIN)
183
184/* debug printf */
185# define OSDBGPRINT(a) printf a
186
187
188/*
189 * OS/2
190 */
191#elif defined(RT_OS_OS2)
192
193/* No log API in OS/2 only COM port. */
194# define OSDBGPRINT(a) SUPR0Printf a
195
196
197/*
198 * FreeBSD
199 */
200#elif defined(RT_OS_FREEBSD)
201
202/* debug printf */
203# define OSDBGPRINT(a) printf a
204
205
206/*
207 * Solaris
208 */
209#elif defined(RT_OS_SOLARIS)
210# define OSDBGPRINT(a) SUPR0Printf a
211
212
213#else
214/** @todo other os'es */
215# error "OS interface defines is not done for this OS!"
216#endif
217
218
219/* dprintf */
220#if (defined(DEBUG) && !defined(NO_LOGGING)) || defined(RT_OS_FREEBSD)
221# ifdef LOG_TO_COM
222# include <VBox/log.h>
223# define dprintf(a) RTLogComPrintf a
224# else
225# define dprintf(a) OSDBGPRINT(a)
226# endif
227#else
228# define dprintf(a) do {} while (0)
229#endif
230
231/* dprintf2 - extended logging. */
232#if defined(RT_OS_DARWIN) || defined(RT_OS_OS2) || defined(RT_OS_FREEBSD)
233# define dprintf2 dprintf
234#else
235# define dprintf2(a) do { } while (0)
236#endif
237
238
239/*
240 * Error codes.
241 */
242/** @todo retire the SUPDRV_ERR_* stuff, we ship err.h now. */
243/** Invalid parameter. */
244#define SUPDRV_ERR_GENERAL_FAILURE (-1)
245/** Invalid parameter. */
246#define SUPDRV_ERR_INVALID_PARAM (-2)
247/** Invalid magic or cookie. */
248#define SUPDRV_ERR_INVALID_MAGIC (-3)
249/** Invalid loader handle. */
250#define SUPDRV_ERR_INVALID_HANDLE (-4)
251/** Failed to lock the address range. */
252#define SUPDRV_ERR_LOCK_FAILED (-5)
253/** Invalid memory pointer. */
254#define SUPDRV_ERR_INVALID_POINTER (-6)
255/** Failed to patch the IDT. */
256#define SUPDRV_ERR_IDT_FAILED (-7)
257/** Memory allocation failed. */
258#define SUPDRV_ERR_NO_MEMORY (-8)
259/** Already loaded. */
260#define SUPDRV_ERR_ALREADY_LOADED (-9)
261/** Permission denied. */
262#define SUPDRV_ERR_PERMISSION_DENIED (-10)
263/** Version mismatch. */
264#define SUPDRV_ERR_VERSION_MISMATCH (-11)
265
266
267
268/*******************************************************************************
269* Structures and Typedefs *
270*******************************************************************************/
271/** Pointer to the device extension. */
272typedef struct SUPDRVDEVEXT *PSUPDRVDEVEXT;
273
274#ifdef VBOX_WITH_IDT_PATCHING
275
276/**
277 * An IDT Entry.
278 */
279typedef struct SUPDRVIDTE
280{
281 /** Low offset word. */
282 uint32_t u16OffsetLow : 16;
283 /** Segment Selector. */
284 uint32_t u16SegSel : 16;
285#ifdef RT_ARCH_AMD64
286 /** Interrupt Stack Table index. */
287 uint32_t u3IST : 3;
288 /** Reserved, ignored. */
289 uint32_t u5Reserved : 5;
290#else
291 /** Reserved. */
292 uint32_t u5Reserved : 5;
293 /** IDT Type part one (not used for task gate). */
294 uint32_t u3Type1 : 3;
295#endif
296 /** IDT Type part two. */
297 uint32_t u5Type2 : 5;
298 /** Descriptor Privilege level. */
299 uint32_t u2DPL : 2;
300 /** Present flag. */
301 uint32_t u1Present : 1;
302 /** High offset word. */
303 uint32_t u16OffsetHigh : 16;
304#ifdef RT_ARCH_AMD64
305 /** The upper top part of the address. */
306 uint32_t u32OffsetTop;
307 /** Reserved dword for qword (aligning the struct), ignored. */
308 uint32_t u32Reserved;
309#endif
310} SUPDRVIDTE, *PSUPDRVIDTE;
311
312/** The u5Type2 value for an interrupt gate. */
313#define SUPDRV_IDTE_TYPE2_INTERRUPT_GATE 0x0e
314
315
316/**
317 * Patch code.
318 */
319typedef struct SUPDRVPATCH
320{
321#define SUPDRV_PATCH_CODE_SIZE 0x50
322 /** Patch code. */
323 uint8_t auCode[SUPDRV_PATCH_CODE_SIZE];
324 /** Changed IDT entry (for parnoid UnpatchIdt()). */
325 SUPDRVIDTE ChangedIdt;
326 /** Saved IDT entry. */
327 SUPDRVIDTE SavedIdt;
328 /** Pointer to the IDT.
329 * We ASSUME the IDT is not re(al)located after bootup and use this as key
330 * for the patches rather than processor number. This prevents some
331 * stupid nesting stuff from happening in case of processors sharing the
332 * IDT.
333 * We're fucked if the processors have different physical mapping for
334 * the(se) page(s), but we'll find that out soon enough in VBOX_STRICT mode.
335 */
336 void *pvIdt;
337 /** Pointer to the IDT entry. */
338 SUPDRVIDTE volatile *pIdtEntry;
339 /** Usage counter. */
340 uint32_t volatile cUsage;
341 /** The offset into auCode of the VMMR0Entry fixup. */
342 uint16_t offVMMR0EntryFixup;
343 /** The offset into auCode of the stub function. */
344 uint16_t offStub;
345 /** Pointer to the next patch. */
346 struct SUPDRVPATCH * volatile pNext;
347} SUPDRVPATCH, *PSUPDRVPATCH;
348
349/**
350 * Usage record for a patch.
351 */
352typedef struct SUPDRVPATCHUSAGE
353{
354 /** Next in the chain. */
355 struct SUPDRVPATCHUSAGE * volatile pNext;
356 /** The patch this usage applies to. */
357 PSUPDRVPATCH pPatch;
358 /** Usage count. */
359 uint32_t volatile cUsage;
360} SUPDRVPATCHUSAGE, *PSUPDRVPATCHUSAGE;
361
362#endif /* VBOX_WITH_IDT_PATCHING */
363
364
365/**
366 * Memory reference types.
367 */
368typedef enum
369{
370 /** Unused entry */
371 MEMREF_TYPE_UNUSED = 0,
372 /** Locked memory (r3 mapping only). */
373 MEMREF_TYPE_LOCKED,
374 /** Continous memory block (r3 and r0 mapping). */
375 MEMREF_TYPE_CONT,
376 /** Low memory block (r3 and r0 mapping). */
377 MEMREF_TYPE_LOW,
378 /** Memory block (r3 and r0 mapping). */
379 MEMREF_TYPE_MEM,
380 /** Locked memory (r3 mapping only) allocated by the support driver. */
381 MEMREF_TYPE_LOCKED_SUP,
382 /** Blow the type up to 32-bit and mark the end. */
383 MEMREG_TYPE_32BIT_HACK = 0x7fffffff
384} SUPDRVMEMREFTYPE, *PSUPDRVMEMREFTYPE;
385
386
387/**
388 * Structure used for tracking memory a session
389 * references in one way or another.
390 */
391typedef struct SUPDRVMEMREF
392{
393 /** The memory object handle. */
394 RTR0MEMOBJ MemObj;
395 /** The ring-3 mapping memory object handle. */
396 RTR0MEMOBJ MapObjR3;
397 /** Type of memory. */
398 SUPDRVMEMREFTYPE eType;
399} SUPDRVMEMREF, *PSUPDRVMEMREF;
400
401
402/**
403 * Bundle of locked memory ranges.
404 */
405typedef struct SUPDRVBUNDLE
406{
407 /** Pointer to the next bundle. */
408 struct SUPDRVBUNDLE * volatile pNext;
409 /** Referenced memory. */
410 SUPDRVMEMREF aMem[64];
411 /** Number of entries used. */
412 uint32_t volatile cUsed;
413} SUPDRVBUNDLE, *PSUPDRVBUNDLE;
414
415
416/**
417 * Loaded image.
418 */
419typedef struct SUPDRVLDRIMAGE
420{
421 /** Next in chain. */
422 struct SUPDRVLDRIMAGE * volatile pNext;
423 /** Pointer to the image. */
424 void *pvImage;
425 /** Pointer to the optional module initialization callback. */
426 PFNR0MODULEINIT pfnModuleInit;
427 /** Pointer to the optional module termination callback. */
428 PFNR0MODULETERM pfnModuleTerm;
429 /** Size of the image. */
430 uint32_t cbImage;
431 /** The offset of the symbol table. */
432 uint32_t offSymbols;
433 /** The number of entries in the symbol table. */
434 uint32_t cSymbols;
435 /** The offset of the string table. */
436 uint32_t offStrTab;
437 /** Size of the string table. */
438 uint32_t cbStrTab;
439 /** The ldr image state. (IOCtl code of last opration.) */
440 uint32_t uState;
441 /** Usage count. */
442 uint32_t volatile cUsage;
443 /** Image name. */
444 char szName[32];
445} SUPDRVLDRIMAGE, *PSUPDRVLDRIMAGE;
446
447
448/** Image usage record. */
449typedef struct SUPDRVLDRUSAGE
450{
451 /** Next in chain. */
452 struct SUPDRVLDRUSAGE * volatile pNext;
453 /** The image. */
454 PSUPDRVLDRIMAGE pImage;
455 /** Load count. */
456 uint32_t volatile cUsage;
457} SUPDRVLDRUSAGE, *PSUPDRVLDRUSAGE;
458
459
460/**
461 * Component factory registration record.
462 */
463typedef struct SUPDRVFACTORYREG
464{
465 /** Pointer to the next registration. */
466 struct SUPDRVFACTORYREG *pNext;
467 /** Pointer to the registered factory. */
468 PCSUPDRVFACTORY pFactory;
469 /** The session owning the factory.
470 * Used for deregistration and session cleanup. */
471 PSUPDRVSESSION pSession;
472 /** Length of the name. */
473 size_t cchName;
474} SUPDRVFACTORYREG;
475/** Pointer to a component factory registration record. */
476typedef SUPDRVFACTORYREG *PSUPDRVFACTORYREG;
477/** Pointer to a const component factory registration record. */
478typedef SUPDRVFACTORYREG const *PCSUPDRVFACTORYREG;
479
480
481/**
482 * Registered object.
483 * This takes care of reference counting and tracking data for access checks.
484 */
485typedef struct SUPDRVOBJ
486{
487 /** Magic value (SUPDRVOBJ_MAGIC). */
488 uint32_t u32Magic;
489 /** The object type. */
490 SUPDRVOBJTYPE enmType;
491 /** Pointer to the next in the global list. */
492 struct SUPDRVOBJ * volatile pNext;
493 /** Pointer to the object destructor.
494 * This may be set to NULL if the image containing the destructor get unloaded. */
495 PFNSUPDRVDESTRUCTOR pfnDestructor;
496 /** User argument 1. */
497 void *pvUser1;
498 /** User argument 2. */
499 void *pvUser2;
500 /** The total sum of all per-session usage. */
501 uint32_t volatile cUsage;
502 /** The creator user id. */
503 RTUID CreatorUid;
504 /** The creator group id. */
505 RTGID CreatorGid;
506 /** The creator process id. */
507 RTPROCESS CreatorProcess;
508} SUPDRVOBJ, *PSUPDRVOBJ;
509
510/** Magic number for SUPDRVOBJ::u32Magic. (Dame Agatha Mary Clarissa Christie). */
511#define SUPDRVOBJ_MAGIC 0x18900915
512
513/**
514 * The per-session object usage record.
515 */
516typedef struct SUPDRVUSAGE
517{
518 /** Pointer to the next in the list. */
519 struct SUPDRVUSAGE * volatile pNext;
520 /** Pointer to the object we're recording usage for. */
521 PSUPDRVOBJ pObj;
522 /** The usage count. */
523 uint32_t volatile cUsage;
524} SUPDRVUSAGE, *PSUPDRVUSAGE;
525
526
527/**
528 * Per session data.
529 * This is mainly for memory tracking.
530 */
531typedef struct SUPDRVSESSION
532{
533 /** Pointer to the device extension. */
534 PSUPDRVDEVEXT pDevExt;
535 /** Session Cookie. */
536 uint32_t u32Cookie;
537
538 /** Load usage records. (protected by SUPDRVDEVEXT::mtxLdr) */
539 PSUPDRVLDRUSAGE volatile pLdrUsage;
540#ifdef VBOX_WITH_IDT_PATCHING
541 /** Patch usage records. (protected by SUPDRVDEVEXT::SpinLock) */
542 PSUPDRVPATCHUSAGE volatile pPatchUsage;
543#endif
544 /** The VM associated with the session. */
545 PVM pVM;
546 /** List of generic usage records. (protected by SUPDRVDEVEXT::SpinLock) */
547 PSUPDRVUSAGE volatile pUsage;
548
549 /** Spinlock protecting the bundles and the GIP members. */
550 RTSPINLOCK Spinlock;
551 /** The ring-3 mapping of the GIP (readonly). */
552 RTR0MEMOBJ GipMapObjR3;
553 /** Set if the session is using the GIP. */
554 uint32_t fGipReferenced;
555 /** Bundle of locked memory objects. */
556 SUPDRVBUNDLE Bundle;
557
558 /** The user id of the session. (Set by the OS part.) */
559 RTUID Uid;
560 /** The group id of the session. (Set by the OS part.) */
561 RTGID Gid;
562 /** The process (id) of the session. */
563 RTPROCESS Process;
564 /** Which process this session is associated with.
565 * This is NIL_RTR0PROCESS for kernel sessions and valid for user ones. */
566 RTR0PROCESS R0Process;
567#if defined(RT_OS_DARWIN)
568 /** Pointer to the associated org_virtualbox_SupDrvClient object. */
569 void *pvSupDrvClient;
570 /** Whether this session has been opened or not. */
571 bool fOpened;
572#endif
573#if defined(RT_OS_OS2)
574 /** The system file number of this session. */
575 uint16_t sfn;
576 uint16_t Alignment; /**< Alignment */
577#endif
578#if defined(RT_OS_DARWIN) || defined(RT_OS_OS2) || defined(RT_OS_SOLARIS)
579 /** Pointer to the next session with the same hash. */
580 PSUPDRVSESSION pNextHash;
581#endif
582} SUPDRVSESSION;
583
584
585/**
586 * Device extension.
587 */
588typedef struct SUPDRVDEVEXT
589{
590 /** Spinlock to serialize the initialization,
591 * usage counting and destruction of the IDT entry override and objects. */
592 RTSPINLOCK Spinlock;
593
594#ifdef VBOX_WITH_IDT_PATCHING
595 /** List of patches. */
596 PSUPDRVPATCH volatile pIdtPatches;
597 /** List of patches Free. */
598 PSUPDRVPATCH volatile pIdtPatchesFree;
599#endif
600
601 /** List of registered objects. Protected by the spinlock. */
602 PSUPDRVOBJ volatile pObjs;
603 /** List of free object usage records. */
604 PSUPDRVUSAGE volatile pUsageFree;
605
606 /** Global cookie. */
607 uint32_t u32Cookie;
608
609 /** The IDT entry number.
610 * Only valid if pIdtPatches is set. */
611 uint8_t volatile u8Idt;
612
613 /** Loader mutex.
614 * This protects pvVMMR0, pvVMMR0Entry, pImages and SUPDRVSESSION::pLdrUsage. */
615 RTSEMFASTMUTEX mtxLdr;
616
617 /** VMM Module 'handle'.
618 * 0 if the code VMM isn't loaded and Idt are nops. */
619 void * volatile pvVMMR0;
620 /** VMMR0EntryInt() pointer. */
621 DECLR0CALLBACKMEMBER(int, pfnVMMR0EntryInt, (PVM pVM, unsigned uOperation, void *pvArg));
622 /** VMMR0EntryFast() pointer. */
623 DECLR0CALLBACKMEMBER(void, pfnVMMR0EntryFast, (PVM pVM, unsigned uOperation));
624 /** VMMR0EntryEx() pointer. */
625 DECLR0CALLBACKMEMBER(int, pfnVMMR0EntryEx, (PVM pVM, unsigned uOperation, PSUPVMMR0REQHDR pReq, uint64_t u64Arg, PSUPDRVSESSION pSession));
626
627 /** Linked list of loaded code. */
628 PSUPDRVLDRIMAGE volatile pLdrImages;
629
630 /** GIP mutex.
631 * Any changes to any of the GIP members requires ownership of this mutex,
632 * except on driver init and termination. */
633 RTSEMFASTMUTEX mtxGip;
634 /** Pointer to the Global Info Page (GIP). */
635 PSUPGLOBALINFOPAGE pGip;
636 /** The physical address of the GIP. */
637 RTHCPHYS HCPhysGip;
638 /** Number of processes using the GIP.
639 * (The updates are suspend while cGipUsers is 0.)*/
640 uint32_t volatile cGipUsers;
641 /** The ring-0 memory object handle for the GIP page. */
642 RTR0MEMOBJ GipMemObj;
643 /** The GIP timer handle. */
644 PRTTIMER pGipTimer;
645 /** If non-zero we've successfully called RTTimerRequestSystemGranularity(). */
646 uint32_t u32SystemTimerGranularityGrant;
647 /** The CPU id of the GIP master.
648 * This CPU is responsible for the updating the common GIP data. */
649 RTCPUID volatile idGipMaster;
650
651 /** Component factory mutex.
652 * This protects pComponentFactoryHead and component factory querying. */
653 RTSEMFASTMUTEX mtxComponentFactory;
654 /** The head of the list of registered component factories. */
655 PSUPDRVFACTORYREG pComponentFactoryHead;
656} SUPDRVDEVEXT;
657
658
659__BEGIN_DECLS
660
661/*******************************************************************************
662* OS Specific Functions *
663*******************************************************************************/
664void VBOXCALL supdrvOSObjInitCreator(PSUPDRVOBJ pObj, PSUPDRVSESSION pSession);
665bool VBOXCALL supdrvOSObjCanAccess(PSUPDRVOBJ pObj, PSUPDRVSESSION pSession, const char *pszObjName, int *prc);
666bool VBOXCALL supdrvOSGetForcedAsyncTscMode(PSUPDRVDEVEXT pDevExt);
667
668
669/*******************************************************************************
670* Shared Functions *
671*******************************************************************************/
672int VBOXCALL supdrvIOCtl(uintptr_t uIOCtl, PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPREQHDR pReqHdr);
673int VBOXCALL supdrvIOCtlFast(uintptr_t uIOCtl, PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession);
674int VBOXCALL supdrvIDC(uintptr_t uIOCtl, PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPDRVIDCREQHDR pReqHdr);
675int VBOXCALL supdrvInitDevExt(PSUPDRVDEVEXT pDevExt);
676void VBOXCALL supdrvDeleteDevExt(PSUPDRVDEVEXT pDevExt);
677int VBOXCALL supdrvCreateSession(PSUPDRVDEVEXT pDevExt, bool fUser, PSUPDRVSESSION *ppSession);
678void VBOXCALL supdrvCloseSession(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession);
679void VBOXCALL supdrvCleanupSession(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession);
680int VBOXCALL supdrvGipInit(PSUPDRVDEVEXT pDevExt, PSUPGLOBALINFOPAGE pGip, RTHCPHYS HCPhys, uint64_t u64NanoTS, unsigned uUpdateHz);
681void VBOXCALL supdrvGipTerm(PSUPGLOBALINFOPAGE pGip);
682void VBOXCALL supdrvGipUpdate(PSUPGLOBALINFOPAGE pGip, uint64_t u64NanoTS);
683void VBOXCALL supdrvGipUpdatePerCpu(PSUPGLOBALINFOPAGE pGip, uint64_t u64NanoTS, unsigned iCpu);
684bool VBOXCALL supdrvDetermineAsyncTsc(uint64_t *pu64DiffCores);
685
686__END_DECLS
687
688#endif
689
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette