VirtualBox

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

Last change on this file since 3393 was 3393, checked in by vboxsync, 17 years ago

Removed PCSUPGLOBALINFOPAGE and PCSUPGIPCPU to avoid const/volatile confusion.

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