VirtualBox

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

Last change on this file since 3827 was 3672, checked in by vboxsync, 18 years ago

RT_OS_* and RT_ARCH_* for Runtime/ and Support/

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