VirtualBox

source: vbox/trunk/src/VBox/HostDrivers/Support/SUPDRV.h@ 3968

Last change on this file since 3968 was 3888, checked in by vboxsync, 18 years ago

Solaris.

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