VirtualBox

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

Last change on this file since 86719 was 86512, checked in by vboxsync, 4 years ago

SUP: Major support driver interface version bump. Trace VMMR0.r0 dependants. bugref:9841

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 44.3 KB
Line 
1/* $Id: SUPDrvInternal.h 86512 2020-10-10 11:20:58Z vboxsync $ */
2/** @file
3 * VirtualBox Support Driver - Internal header.
4 */
5
6/*
7 * Copyright (C) 2006-2020 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 * 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
27#ifndef VBOX_INCLUDED_SRC_Support_SUPDrvInternal_h
28#define VBOX_INCLUDED_SRC_Support_SUPDrvInternal_h
29#ifndef RT_WITHOUT_PRAGMA_ONCE
30# pragma once
31#endif
32
33
34/*********************************************************************************************************************************
35* Header Files *
36*********************************************************************************************************************************/
37#include <VBox/cdefs.h>
38#include <VBox/types.h>
39#include <VBox/sup.h>
40
41#include <iprt/assert.h>
42#include <iprt/list.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#ifdef SUPDRV_AGNOSTIC
50/* do nothing */
51
52#elif defined(RT_OS_WINDOWS)
53# include <iprt/nt/nt.h>
54# include <memory.h>
55
56#elif defined(RT_OS_LINUX)
57# include <iprt/linux/version.h>
58# if RTLNX_VER_MIN(2,6,33)
59# include <generated/autoconf.h>
60# else
61# ifndef AUTOCONF_INCLUDED
62# include <linux/autoconf.h>
63# endif
64# endif
65# if defined(CONFIG_MODVERSIONS) && !defined(MODVERSIONS)
66# define MODVERSIONS
67# if RTLNX_VER_MAX(2,5,71)
68# include <linux/modversions.h>
69# endif
70# endif
71# ifndef KBUILD_STR
72# if RTLNX_VER_MAX(2,6,16)
73# define KBUILD_STR(s) s
74# else
75# define KBUILD_STR(s) #s
76# endif
77# endif
78# include <linux/string.h>
79# include <linux/spinlock.h>
80# include <linux/slab.h>
81# if RTLNX_VER_MIN(2,6,27)
82# include <linux/semaphore.h>
83# else /* older kernels */
84# include <asm/semaphore.h>
85# endif /* older kernels */
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# define memset libkern_memset /** @todo these are just hacks to get it compiling, check out later. */
96# define memcmp libkern_memcmp
97# define strchr libkern_strchr
98# define strrchr libkern_strrchr
99# define ffsl libkern_ffsl
100# define fls libkern_fls
101# define flsl libkern_flsl
102# include <sys/libkern.h>
103# undef memset
104# undef memcmp
105# undef strchr
106# undef strrchr
107# undef ffs
108# undef ffsl
109# undef fls
110# undef flsl
111# include <iprt/string.h>
112
113#elif defined(RT_OS_SOLARIS)
114# include <sys/cmn_err.h>
115# include <iprt/string.h>
116
117#else
118# error "unsupported OS."
119#endif
120
121#include "SUPDrvIOC.h"
122#include "SUPDrvIDC.h"
123
124
125
126/*********************************************************************************************************************************
127* Defined Constants And Macros *
128*********************************************************************************************************************************/
129/*
130 * Hardcoded cookies.
131 */
132#define BIRD 0x64726962 /* 'bird' */
133#define BIRD_INV 0x62697264 /* 'drib' */
134
135
136#ifdef RT_OS_WINDOWS
137/** Use a normal mutex for the loader so we remain at the same IRQL after
138 * taking it.
139 * @todo fix the mutex implementation on linux and make this the default. */
140# define SUPDRV_USE_MUTEX_FOR_LDR
141
142/** Use a normal mutex for the GIP so we remain at the same IRQL after
143 * taking it.
144 * @todo fix the mutex implementation on linux and make this the default. */
145# define SUPDRV_USE_MUTEX_FOR_GIP
146#endif
147
148#if defined(RT_OS_LINUX) /** @todo make everyone do this */
149/** Use the RTR0MemObj API rather than the RTMemExecAlloc for the images.
150 * This is a good idea in general, but a necessity for @bugref{9801}. */
151# define SUPDRV_USE_MEMOBJ_FOR_LDR_IMAGE
152#endif
153
154
155/**
156 * OS debug print macro.
157 */
158#define OSDBGPRINT(a) SUPR0Printf a
159
160/** Debug printf macro shared with the ring-3 part. */
161#ifdef DEBUG_bird
162# define SUP_DPRINTF(a) SUPR0Printf a
163#else
164# define SUP_DPRINTF(a) do { } while (0)
165#endif
166
167
168/** @name Context values for the per-session handle tables.
169 * The context value is used to distinguish between the different kinds of
170 * handles, making the handle table API do all the work.
171 * @{ */
172/** Handle context value for single release event handles. */
173#define SUPDRV_HANDLE_CTX_EVENT ((void *)(uintptr_t)(SUPDRVOBJTYPE_SEM_EVENT))
174/** Handle context value for multiple release event handles. */
175#define SUPDRV_HANDLE_CTX_EVENT_MULTI ((void *)(uintptr_t)(SUPDRVOBJTYPE_SEM_EVENT_MULTI))
176/** @} */
177
178
179/**
180 * Validates a session pointer.
181 *
182 * @returns true/false accordingly.
183 * @param pSession The session.
184 */
185#define SUP_IS_SESSION_VALID(pSession) \
186 ( VALID_PTR(pSession) \
187 && pSession->u32Cookie == BIRD_INV)
188
189/**
190 * Validates a device extension pointer.
191 *
192 * @returns true/false accordingly.
193 * @param pDevExt The device extension.
194 */
195#define SUP_IS_DEVEXT_VALID(pDevExt) \
196 ( VALID_PTR(pDevExt)\
197 && pDevExt->u32Cookie == BIRD)
198
199
200/** @def SUPDRV_WITH_MSR_PROBER
201 * Enables the SUP_IOCTL_MSR_PROBER function.
202 * By default, only enabled in DEBUG builds as it's a sensitive feature.
203 */
204#if defined(DEBUG) && !defined(SUPDRV_WITH_MSR_PROBER) && !defined(SUPDRV_WITHOUT_MSR_PROBER)
205# define SUPDRV_WITH_MSR_PROBER
206#endif
207
208/** @def SUPDRV_WITHOUT_MSR_PROBER
209 * Executive overide for disabling the SUP_IOCTL_MSR_PROBER function.
210 */
211#ifdef SUPDRV_WITHOUT_MSR_PROBER
212# undef SUPDRV_WITH_MSR_PROBER
213#endif
214
215#ifdef DOXYGEN_RUNNING
216# define SUPDRV_WITH_MSR_PROBER
217# define SUPDRV_WITHOUT_MSR_PROBER
218#endif
219
220#if 1
221/** @def SUPDRV_USE_TSC_DELTA_THREAD
222 * Use a dedicated kernel thread to service TSC-delta measurement requests.
223 * @todo Test on servers with many CPUs and sockets. */
224# define SUPDRV_USE_TSC_DELTA_THREAD
225#endif
226
227
228/*********************************************************************************************************************************
229* Structures and Typedefs *
230*********************************************************************************************************************************/
231/** Pointer to the device extension. */
232typedef struct SUPDRVDEVEXT *PSUPDRVDEVEXT;
233
234#ifdef SUPDRV_USE_TSC_DELTA_THREAD
235/**
236 * TSC-delta measurement thread state machine.
237 */
238typedef enum SUPDRVTSCDELTATHREADSTATE
239{
240 /** Uninitialized/invalid value. */
241 kTscDeltaThreadState_Invalid = 0,
242 /** The thread is being created.
243 * Next state: Listening, Butchered, Terminating */
244 kTscDeltaThreadState_Creating,
245 /** The thread is listening for events.
246 * Previous state: Creating, Measuring
247 * Next state: WaitAndMeasure, Butchered, Terminated */
248 kTscDeltaThreadState_Listening,
249 /** The thread is sleeping before starting a measurement.
250 * Previous state: Listening, Measuring
251 * Next state: Measuring, Butchered, Terminating
252 * @remarks The thread won't enter this state on its own, it is put into this
253 * state by the GIP timer, the CPU online callback and by the
254 * SUP_IOCTL_TSC_DELTA_MEASURE code. */
255 kTscDeltaThreadState_WaitAndMeasure,
256 /** The thread is currently servicing a measurement request.
257 * Previous state: WaitAndMeasure
258 * Next state: Listening, WaitAndMeasure, Terminate */
259 kTscDeltaThreadState_Measuring,
260 /** The thread is terminating.
261 * @remarks The thread won't enter this state on its own, is put into this state
262 * by supdrvTscDeltaTerm. */
263 kTscDeltaThreadState_Terminating,
264 /** The thread is butchered due to an unexpected error.
265 * Previous State: Creating, Listening, WaitAndMeasure */
266 kTscDeltaThreadState_Butchered,
267 /** The thread is destroyed (final).
268 * Previous state: Terminating */
269 kTscDeltaThreadState_Destroyed,
270 /** The usual 32-bit blowup hack. */
271 kTscDeltaThreadState_32BitHack = 0x7fffffff
272} SUPDRVTSCDELTATHREADSTATE;
273#endif /* SUPDRV_USE_TSC_DELTA_THREAD */
274
275/**
276 * Memory reference types.
277 */
278typedef enum
279{
280 /** Unused entry */
281 MEMREF_TYPE_UNUSED = 0,
282 /** Locked memory (r3 mapping only). */
283 MEMREF_TYPE_LOCKED,
284 /** Continuous memory block (r3 and r0 mapping). */
285 MEMREF_TYPE_CONT,
286 /** Low memory block (r3 and r0 mapping). */
287 MEMREF_TYPE_LOW,
288 /** Memory block (r3 and r0 mapping). */
289 MEMREF_TYPE_MEM,
290 /** Locked memory (r3 mapping only) allocated by the support driver. */
291 MEMREF_TYPE_PAGE,
292 /** Blow the type up to 32-bit and mark the end. */
293 MEMREF_TYPE_32BIT_HACK = 0x7fffffff
294} SUPDRVMEMREFTYPE, *PSUPDRVMEMREFTYPE;
295
296
297/**
298 * Structure used for tracking memory a session
299 * references in one way or another.
300 */
301typedef struct SUPDRVMEMREF
302{
303 /** The memory object handle. */
304 RTR0MEMOBJ MemObj;
305 /** The ring-3 mapping memory object handle. */
306 RTR0MEMOBJ MapObjR3;
307 /** Type of memory. */
308 SUPDRVMEMREFTYPE eType;
309} SUPDRVMEMREF, *PSUPDRVMEMREF;
310
311
312/**
313 * Bundle of locked memory ranges.
314 */
315typedef struct SUPDRVBUNDLE
316{
317 /** Pointer to the next bundle. */
318 struct SUPDRVBUNDLE * volatile pNext;
319 /** Referenced memory. */
320 SUPDRVMEMREF aMem[64];
321 /** Number of entries used. */
322 uint32_t volatile cUsed;
323} SUPDRVBUNDLE, *PSUPDRVBUNDLE;
324
325
326/**
327 * Loaded image.
328 */
329typedef struct SUPDRVLDRIMAGE
330{
331 /** Next in chain. */
332 struct SUPDRVLDRIMAGE * volatile pNext;
333 /** Pointer to the image. */
334 void *pvImage;
335#ifdef SUPDRV_USE_MEMOBJ_FOR_LDR_IMAGE
336 /** The memory object for the module allocation. */
337 RTR0MEMOBJ hMemObjImage;
338#else
339 /** Pointer to the allocated image buffer.
340 * pvImage is 32-byte aligned or it may governed by the native loader (this
341 * member is NULL then). */
342 void *pvImageAlloc;
343#endif
344 /** Magic value (SUPDRVLDRIMAGE_MAGIC). */
345 uint32_t uMagic;
346 /** Size of the image including the tables. This is mainly for verification
347 * of the load request. */
348 uint32_t cbImageWithEverything;
349 /** Size of the image. */
350 uint32_t cbImageBits;
351 /** The number of entries in the symbol table. */
352 uint32_t cSymbols;
353 /** Pointer to the symbol table. */
354 PSUPLDRSYM paSymbols;
355 /** The offset of the string table. */
356 char *pachStrTab;
357 /** Size of the string table. */
358 uint32_t cbStrTab;
359 /** Number of segments. */
360 uint32_t cSegments;
361 /** Segments (for memory protection). */
362 PSUPLDRSEG paSegments;
363 /** Pointer to the optional module initialization callback. */
364 PFNR0MODULEINIT pfnModuleInit;
365 /** Pointer to the optional module termination callback. */
366 PFNR0MODULETERM pfnModuleTerm;
367 /** Service request handler. This is NULL for non-service modules. */
368 PFNSUPR0SERVICEREQHANDLER pfnServiceReqHandler;
369 /** The ldr image state. (IOCtl code of last operation.) */
370 uint32_t uState;
371 /** Usage count. */
372 uint32_t volatile cUsage;
373 /** Pointer to the device extension. */
374 struct SUPDRVDEVEXT *pDevExt;
375 /** Image (VMMR0.r0) containing functions/data that this one uses. */
376 struct SUPDRVLDRIMAGE *pImageImport;
377#ifdef RT_OS_WINDOWS
378 /** The section object for the loaded image (fNative=true). */
379 void *pvNtSectionObj;
380 /** Lock object. */
381 RTR0MEMOBJ hMemLock;
382#endif
383#if defined(RT_OS_SOLARIS) && defined(VBOX_WITH_NATIVE_SOLARIS_LOADING)
384 /** The Solaris module ID. */
385 int idSolMod;
386 /** Pointer to the module control structure. */
387 struct modctl *pSolModCtl;
388#endif
389#ifdef RT_OS_LINUX
390 /** Hack for seeing the module in perf, dtrace and other stack crawlers. */
391 struct module *pLnxModHack;
392#endif
393#if defined(RT_OS_DARWIN) && defined(VBOX_WITH_DARWIN_R0_DARWIN_IMAGE_VERIFICATION)
394 /** Load module handle. */
395 RTLDRMOD hLdrMod;
396 /** Allocate object. */
397 RTR0MEMOBJ hMemAlloc;
398#endif
399 /** Whether it's loaded by the native loader or not. */
400 bool fNative;
401 /** Image name. */
402 char szName[32];
403} SUPDRVLDRIMAGE, *PSUPDRVLDRIMAGE;
404
405/** Magic value for SUPDRVLDRIMAGE::uMagic (Charlotte Bronte). */
406#define SUPDRVLDRIMAGE_MAGIC UINT32_C(0x18160421)
407/** Magic value for SUPDRVLDRIMAGE::uMagic when freed. */
408#define SUPDRVLDRIMAGE_MAGIC_DEAD UINT32_C(0x18550331)
409
410
411/** Image usage record. */
412typedef struct SUPDRVLDRUSAGE
413{
414 /** Next in chain. */
415 struct SUPDRVLDRUSAGE * volatile pNext;
416 /** The image. */
417 PSUPDRVLDRIMAGE pImage;
418 /** Load count (ring-3). */
419 uint32_t volatile cRing3Usage;
420 /** Ring-0 usage counter. */
421 uint32_t volatile cRing0Usage;
422} SUPDRVLDRUSAGE, *PSUPDRVLDRUSAGE;
423
424
425/**
426 * Component factory registration record.
427 */
428typedef struct SUPDRVFACTORYREG
429{
430 /** Pointer to the next registration. */
431 struct SUPDRVFACTORYREG *pNext;
432 /** Pointer to the registered factory. */
433 PCSUPDRVFACTORY pFactory;
434 /** The session owning the factory.
435 * Used for deregistration and session cleanup. */
436 PSUPDRVSESSION pSession;
437 /** Length of the name. */
438 size_t cchName;
439} SUPDRVFACTORYREG;
440/** Pointer to a component factory registration record. */
441typedef SUPDRVFACTORYREG *PSUPDRVFACTORYREG;
442/** Pointer to a const component factory registration record. */
443typedef SUPDRVFACTORYREG const *PCSUPDRVFACTORYREG;
444
445
446/**
447 * Registered object.
448 * This takes care of reference counting and tracking data for access checks.
449 */
450typedef struct SUPDRVOBJ
451{
452 /** Magic value (SUPDRVOBJ_MAGIC). */
453 uint32_t u32Magic;
454 /** The object type. */
455 SUPDRVOBJTYPE enmType;
456 /** Pointer to the next in the global list. */
457 struct SUPDRVOBJ * volatile pNext;
458 /** Pointer to the object destructor.
459 * This may be set to NULL if the image containing the destructor get unloaded. */
460 PFNSUPDRVDESTRUCTOR pfnDestructor;
461 /** User argument 1. */
462 void *pvUser1;
463 /** User argument 2. */
464 void *pvUser2;
465 /** The total sum of all per-session usage. */
466 uint32_t volatile cUsage;
467 /** The creator user id. */
468 RTUID CreatorUid;
469 /** The creator group id. */
470 RTGID CreatorGid;
471 /** The creator process id. */
472 RTPROCESS CreatorProcess;
473} SUPDRVOBJ, *PSUPDRVOBJ;
474
475/** Magic number for SUPDRVOBJ::u32Magic. (Dame Agatha Mary Clarissa Christie). */
476#define SUPDRVOBJ_MAGIC UINT32_C(0x18900915)
477/** Dead number magic for SUPDRVOBJ::u32Magic. */
478#define SUPDRVOBJ_MAGIC_DEAD UINT32_C(0x19760112)
479
480/**
481 * The per-session object usage record.
482 */
483typedef struct SUPDRVUSAGE
484{
485 /** Pointer to the next in the list. */
486 struct SUPDRVUSAGE * volatile pNext;
487 /** Pointer to the object we're recording usage for. */
488 PSUPDRVOBJ pObj;
489 /** The usage count. */
490 uint32_t volatile cUsage;
491} SUPDRVUSAGE, *PSUPDRVUSAGE;
492
493
494/**
495 * I/O control context.
496 */
497typedef struct SUPR0IOCTLCTX
498{
499 /** Magic value (SUPR0IOCTLCTX_MAGIC). */
500 uint32_t u32Magic;
501 /** Reference counter. */
502 uint32_t volatile cRefs;
503#ifdef RT_OS_WINDOWS
504# ifndef SUPDRV_AGNOSTIC
505 /** The file object, referenced. */
506 PFILE_OBJECT pFileObject;
507 /** The device object, not referenced. */
508 PDEVICE_OBJECT pDeviceObject;
509 /** Pointer to fast I/O routine if available. */
510 FAST_IO_DEVICE_CONTROL *pfnFastIoDeviceControl;
511# else
512 void *apvPadding[3];
513# endif
514#endif
515} SUPR0IOCTLCTX;
516/** Magic value for SUPR0IOCTLCTX (Ahmad Jamal). */
517#define SUPR0IOCTLCTX_MAGIC UINT32_C(0x19300702)
518
519
520/**
521 * Per session data.
522 * This is mainly for memory tracking.
523 */
524typedef struct SUPDRVSESSION
525{
526 /** Pointer to the device extension. */
527 PSUPDRVDEVEXT pDevExt;
528 /** Session Cookie. */
529 uint32_t u32Cookie;
530 /** Set if is an unrestricted session, clear if restricted. */
531 bool fUnrestricted;
532
533 /** Set if we're in the hash table, clear if not. Protected by the hash
534 * table spinlock. */
535 bool fInHashTable;
536 /** Reference counter. */
537 uint32_t volatile cRefs;
538 /** Pointer to the next session with the same hash (common hash table).
539 * Protected by the hash table spinlock. */
540 PSUPDRVSESSION pCommonNextHash;
541 /** Pointer to the OS specific session pointer, if available and in use.
542 * This is atomically set and cleared as the session is inserted and removed
543 * from the hash table (protected by the session hash table spinlock). */
544 PSUPDRVSESSION *ppOsSessionPtr;
545 /** The process (id) of the session. */
546 RTPROCESS Process;
547 /** Which process this session is associated with.
548 * This is NIL_RTR0PROCESS for kernel sessions and valid for user ones. */
549 RTR0PROCESS R0Process;
550
551 /** The GVM associated with the session.
552 * This is set by VMMR0. */
553 PGVM pSessionGVM;
554 /** The VM associated with the session.
555 * This is set by VMMR0. */
556 PVM pSessionVM;
557 /** Set to pSessionVM if fast I/O controlls are enabled. */
558 PVM pFastIoCtrlVM;
559 /** Handle table for IPRT semaphore wrapper APIs.
560 * This takes care of its own locking in an IRQ safe manner. */
561 RTHANDLETABLE hHandleTable;
562 /** Load usage records (LIFO!). (protected by SUPDRVDEVEXT::mtxLdr) */
563 PSUPDRVLDRUSAGE volatile pLdrUsage;
564
565 /** Spinlock protecting the bundles, the GIP members and the
566 * fProcessCleanupDone flag. It continues to be valid until the last
567 * reference to the session is released. */
568 RTSPINLOCK Spinlock;
569 /** The ring-3 mapping of the GIP (readonly). */
570 RTR0MEMOBJ GipMapObjR3;
571 /** Set if the session is using the GIP. */
572 uint32_t fGipReferenced;
573 /** Bundle of locked memory objects. */
574 SUPDRVBUNDLE Bundle;
575 /** List of generic usage records. (protected by SUPDRVDEVEXT::SpinLock) */
576 PSUPDRVUSAGE volatile pUsage;
577
578 /** The user id of the session. (Set by the OS part.) */
579 RTUID Uid;
580 /** The group id of the session. (Set by the OS part.) */
581 RTGID Gid;
582 /** Per session tracer specfic data. */
583 uintptr_t uTracerData;
584 /** The thread currently actively talking to the tracer. (One at the time!) */
585 RTNATIVETHREAD hTracerCaller;
586 /** List of tracepoint providers associated with the session
587 * (SUPDRVTPPROVIDER). */
588 RTLISTANCHOR TpProviders;
589 /** The number of providers in TpProviders. */
590 uint32_t cTpProviders;
591 /** The number of threads active in supdrvIOCtl_TracerUmodProbeFire or
592 * SUPR0TracerUmodProbeFire. */
593 uint32_t volatile cTpProbesFiring;
594 /** User tracepoint modules (PSUPDRVTRACKERUMOD). */
595 RTLISTANCHOR TpUmods;
596 /** The user tracepoint module lookup table. */
597 struct SUPDRVTRACERUMOD *apTpLookupTable[32];
598 /** Whether this is a GIP test-mode client session or not. */
599 bool fGipTestMode;
600#ifndef SUPDRV_AGNOSTIC
601# if defined(RT_OS_DARWIN)
602 /** Pointer to the associated org_virtualbox_SupDrvClient object. */
603 void *pvSupDrvClient;
604 /** Whether this session has been opened or not. */
605 bool fOpened;
606# endif
607# if defined(RT_OS_OS2)
608 /** The system file number of this session. */
609 uint16_t sfn;
610 uint16_t Alignment; /**< Alignment */
611# endif
612# if defined(RT_OS_DARWIN) || defined(RT_OS_OS2) || defined(RT_OS_SOLARIS)
613 /** Pointer to the next session with the same hash. */
614 PSUPDRVSESSION pNextHash;
615# endif
616# if defined(RT_OS_WINDOWS) && defined(VBOX_WITH_HARDENING)
617 /** Pointer to the process protection structure for this session. */
618 struct SUPDRVNTPROTECT *pNtProtect;
619# endif
620#endif /* !SUPDRV_AGNOSTIC */
621} SUPDRVSESSION;
622
623
624/**
625 * Device extension.
626 */
627typedef struct SUPDRVDEVEXT
628{
629 /** Global cookie. */
630 uint32_t u32Cookie;
631 /** The actual size of SUPDRVSESSION. (SUPDRV_AGNOSTIC) */
632 uint32_t cbSession;
633
634 /** Spinlock to serialize the initialization, usage counting and objects.
635 * This is IRQ safe because we want to be able signal semaphores from the
636 * special HM context (and later maybe interrupt handlers), so we must be able
637 * to reference and dereference handles when IRQs are disabled. */
638 RTSPINLOCK Spinlock;
639
640 /** List of registered objects. Protected by the spinlock. */
641 PSUPDRVOBJ volatile pObjs;
642 /** List of free object usage records. */
643 PSUPDRVUSAGE volatile pUsageFree;
644
645 /** Loader mutex.
646 * This protects pvVMMR0, pvVMMR0Entry, pImages and SUPDRVSESSION::pLdrUsage. */
647#ifdef SUPDRV_USE_MUTEX_FOR_LDR
648 RTSEMMUTEX mtxLdr;
649#else
650 RTSEMFASTMUTEX mtxLdr;
651#endif
652
653 /** VMM Module 'handle'.
654 * 0 if the code VMM isn't loaded and Idt are nops. */
655 void * volatile pvVMMR0;
656 /** VMMR0EntryFast() pointer. */
657 DECLR0CALLBACKMEMBER(void, pfnVMMR0EntryFast, (PGVM pGVM, PVM pVM, VMCPUID idCpu, uint32_t uOperation));
658 /** VMMR0EntryEx() pointer. */
659 DECLR0CALLBACKMEMBER(int, pfnVMMR0EntryEx, (PGVM pGVM, PVM pVM, VMCPUID idCpu, uint32_t uOperation,
660 PSUPVMMR0REQHDR pReq, uint64_t u64Arg, PSUPDRVSESSION pSession));
661
662 /** Linked list of loaded code. */
663 PSUPDRVLDRIMAGE volatile pLdrImages;
664 /** Set if the image loading interface got disabled after loading all needed images */
665 bool fLdrLockedDown;
666
667 /** @name These members for detecting whether an API caller is in ModuleInit.
668 * Certain APIs are only permitted from ModuleInit, like for instance tracepoint
669 * registration.
670 * @{ */
671 /** The image currently executing its ModuleInit. */
672 PSUPDRVLDRIMAGE volatile pLdrInitImage;
673 /** The thread currently executing a ModuleInit function. */
674 RTNATIVETHREAD volatile hLdrInitThread;
675 /** The thread currently executing a ModuleTerm function. */
676 RTNATIVETHREAD volatile hLdrTermThread;
677 /** @} */
678
679 /** Number of times someone reported bad execution context via SUPR0BadContext.
680 * (This is times EFLAGS.AC is zero when we expected it to be 1.) */
681 uint32_t volatile cBadContextCalls;
682
683 /** GIP mutex.
684 * Any changes to any of the GIP members requires ownership of this mutex,
685 * except on driver init and termination. */
686#ifdef SUPDRV_USE_MUTEX_FOR_GIP
687 RTSEMMUTEX mtxGip;
688#else
689 RTSEMFASTMUTEX mtxGip;
690#endif
691 /** GIP spinlock protecting GIP members during Mp events.
692 * This is IRQ safe since be may get MP callbacks in contexts where IRQs are
693 * disabled (on some platforms). */
694 RTSPINLOCK hGipSpinlock;
695 /** Pointer to the Global Info Page (GIP). */
696 PSUPGLOBALINFOPAGE pGip;
697 /** The physical address of the GIP. */
698 RTHCPHYS HCPhysGip;
699 /** Number of processes using the GIP.
700 * (The updates are suspend while cGipUsers is 0.)*/
701 uint32_t volatile cGipUsers;
702 /** The ring-0 memory object handle for the GIP page. */
703 RTR0MEMOBJ GipMemObj;
704 /** The GIP timer handle. */
705 PRTTIMER pGipTimer;
706 /** If non-zero we've successfully called RTTimerRequestSystemGranularity(). */
707 uint32_t u32SystemTimerGranularityGrant;
708 /** The CPU id of the GIP master.
709 * This CPU is responsible for the updating the common GIP data and it is
710 * the one used to calculate TSC deltas relative to.
711 * (The initial master will have a 0 zero value, but it it goes offline the
712 * new master may have a non-zero value.) */
713 RTCPUID volatile idGipMaster;
714
715 /** Component factory mutex.
716 * This protects pComponentFactoryHead and component factory querying. */
717 RTSEMFASTMUTEX mtxComponentFactory;
718 /** The head of the list of registered component factories. */
719 PSUPDRVFACTORYREG pComponentFactoryHead;
720
721 /** Lock protecting The tracer members. */
722 RTSEMFASTMUTEX mtxTracer;
723 /** List of tracer providers (SUPDRVTPPROVIDER). */
724 RTLISTANCHOR TracerProviderList;
725 /** List of zombie tracer providers (SUPDRVTPPROVIDER). */
726 RTLISTANCHOR TracerProviderZombieList;
727 /** Pointer to the tracer registration record. */
728 PCSUPDRVTRACERREG pTracerOps;
729 /** The ring-0 session of a native tracer provider. */
730 PSUPDRVSESSION pTracerSession;
731 /** The image containing the tracer. */
732 PSUPDRVLDRIMAGE pTracerImage;
733 /** The tracer helpers. */
734 SUPDRVTRACERHLP TracerHlp;
735 /** The number of session having opened the tracer currently. */
736 uint32_t cTracerOpens;
737 /** The number of threads currently calling into the tracer. */
738 uint32_t volatile cTracerCallers;
739 /** Set if the tracer is being unloaded. */
740 bool fTracerUnloading;
741 /** Hash table for user tracer modules (SUPDRVVTGCOPY). */
742 RTLISTANCHOR aTrackerUmodHash[128];
743
744 /** @name Session Handle Table.
745 * @{ */
746 /** Spinlock protecting apSessionHashTab, cSessions,
747 * SUPDRVSESSION::ppOsSessionPtr, SUPDRVSESSION::pCommonNextHash, and possibly
748 * others depending on the OS. */
749 RTSPINLOCK hSessionHashTabSpinlock;
750 /** Session hash table hash table. The size of this table must make sense in
751 * comparison to GVMM_MAX_HANDLES. */
752 PSUPDRVSESSION apSessionHashTab[HC_ARCH_BITS == 64 ? 8191 : 127];
753 /** The number of open sessions. */
754 int32_t cSessions;
755 /** @} */
756
757 /** @name Invariant TSC frequency refinement.
758 * @{ */
759 /** Nanosecond timestamp at the start of the TSC frequency refinement phase. */
760 uint64_t nsStartInvarTscRefine;
761 /** TSC reading at the start of the TSC frequency refinement phase. */
762 uint64_t uTscStartInvarTscRefine;
763 /** The CPU id of the CPU that u64TscAnchor was measured on. */
764 RTCPUID idCpuInvarTscRefine;
765 /** Pointer to the timer used to refine the TSC frequency. */
766 PRTTIMER pInvarTscRefineTimer;
767 /** Stop the timer on the next tick because we saw a power event. */
768 bool volatile fInvTscRefinePowerEvent;
769 /** @} */
770
771 /** @name TSC-delta measurement.
772 * @{ */
773 /** Number of online/offline events, incremented each time a CPU goes online
774 * or offline. */
775 uint32_t volatile cMpOnOffEvents;
776 /** TSC-delta measurement mutext.
777 * At the moment, we don't want to have more than one measurement going on at
778 * any one time. We might be using broadcast IPIs which are heavy and could
779 * perhaps get in each others way. */
780#ifdef SUPDRV_USE_MUTEX_FOR_GIP
781 RTSEMMUTEX mtxTscDelta;
782#else
783 RTSEMFASTMUTEX mtxTscDelta;
784#endif
785 /** The set of CPUs we need to take measurements for. */
786 RTCPUSET TscDeltaCpuSet;
787 /** The set of CPUs we have completed taken measurements for. */
788 RTCPUSET TscDeltaObtainedCpuSet;
789 /** @} */
790
791#ifdef SUPDRV_USE_TSC_DELTA_THREAD
792 /** @name TSC-delta measurement thread.
793 * @{ */
794 /** Spinlock protecting enmTscDeltaThreadState. */
795 RTSPINLOCK hTscDeltaSpinlock;
796 /** TSC-delta measurement thread. */
797 RTTHREAD hTscDeltaThread;
798 /** The event signalled during state changes to the TSC-delta thread. */
799 RTSEMEVENT hTscDeltaEvent;
800 /** The state of the TSC-delta measurement thread. */
801 SUPDRVTSCDELTATHREADSTATE enmTscDeltaThreadState;
802 /** Thread timeout time before rechecking state in ms. */
803 RTMSINTERVAL cMsTscDeltaTimeout;
804 /** Whether the TSC-delta measurement was successful. */
805 int32_t volatile rcTscDelta;
806 /** Tell the thread we want TSC-deltas for all CPUs with retries. */
807 bool fTscThreadRecomputeAllDeltas;
808 /** @} */
809#endif
810
811 /** @name GIP test mode.
812 * @{ */
813 /** Reference counter for GIP test-mode sessions. */
814 uint32_t cGipTestModeRefs;
815 /** Cache of TSC frequency before enabling test-mode on invariant GIP systems. */
816 uint64_t uGipTestModeInvariantCpuHz;
817 /** @} */
818
819 /*
820 * Note! The non-agnostic bits must be at the very end of the structure!
821 */
822#ifndef SUPDRV_AGNOSTIC
823# ifdef RT_OS_WINDOWS
824 /** Callback object returned by ExCreateCallback. */
825 PCALLBACK_OBJECT pObjPowerCallback;
826 /** Callback handle returned by ExRegisterCallback. */
827 PVOID hPowerCallback;
828# elif defined(RT_OS_DARWIN) && defined(VBOX_WITH_DARWIN_R0_DARWIN_IMAGE_VERIFICATION)
829 /** Trusted root certificates for code signing validation. */
830 RTCRSTORE hRootStore;
831 /** Intermedite certificates for code signing validation. */
832 RTCRSTORE hAdditionalStore;
833# endif
834#endif
835} SUPDRVDEVEXT;
836
837/** Calculates the index into g_apSessionHashTab.*/
838#define SUPDRV_SESSION_HASH(a_pid) ( (a_pid) % RT_ELEMENTS(((SUPDRVDEVEXT *)NULL)->apSessionHashTab) )
839
840
841RT_C_DECLS_BEGIN
842
843/*******************************************************************************
844* OS Specific Functions *
845*******************************************************************************/
846/**
847 * Called to clean up the session structure before it's freed.
848 *
849 * @param pDevExt The device globals.
850 * @param pSession The session that's being cleaned up.
851 */
852void VBOXCALL supdrvOSCleanupSession(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession);
853
854/**
855 * Called to let the OS specfic code perform additional insertion work while
856 * still under the protection of the hash table spinlock.
857 *
858 * @param pDevExt The device globals.
859 * @param pSession The session that was inserted.
860 * @param pvUser User context specified to the insert call.
861 */
862void VBOXCALL supdrvOSSessionHashTabInserted(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, void *pvUser);
863
864/**
865 * Called to let the OS specfic code perform additional removal work while still
866 * under the protection of the hash table spinlock.
867 *
868 * @param pDevExt The device globals.
869 * @param pSession The session that was removed.
870 * @param pvUser User context specified to the remove call.
871 */
872void VBOXCALL supdrvOSSessionHashTabRemoved(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, void *pvUser);
873
874/**
875 * Called during GIP initializtion to calc the CPU group table size.
876 *
877 * This is currently only implemented on windows [lazy bird].
878 *
879 * @returns Number of bytes needed for SUPGIPCPUGROUP structures.
880 * @param pDevExt The device globals.
881 */
882size_t VBOXCALL supdrvOSGipGetGroupTableSize(PSUPDRVDEVEXT pDevExt);
883
884/**
885 * Called during GIP initialization to set up the group table and group count.
886 *
887 * This is currently only implemented on windows [lazy bird].
888 *
889 * @param pDevExt The device globals.
890 * @param pGip The GIP which group table needs initialization.
891 * It's only partially initialized at this point.
892 * @param cbGipCpuGroups What supdrvOSGipGetGroupTableSize returned.
893 */
894int VBOXCALL supdrvOSInitGipGroupTable(PSUPDRVDEVEXT pDevExt, PSUPGLOBALINFOPAGE pGip, size_t cbGipCpuGroups);
895
896/**
897 * Initializes the group related members when a CPU is added to the GIP.
898 *
899 * This is called both during GIP initalization and during an CPU online event.
900 *
901 * This is currently only implemented on windows [lazy bird].
902 *
903 * @returns CPU group number.
904 * @param pDevExt The device globals.
905 * @param pGip The GIP.
906 * @param pGipCpu The GIP CPU structure being initialized.
907 */
908void VBOXCALL supdrvOSGipInitGroupBitsForCpu(PSUPDRVDEVEXT pDevExt, PSUPGLOBALINFOPAGE pGip, PSUPGIPCPU pGipCpu);
909
910void VBOXCALL supdrvOSObjInitCreator(PSUPDRVOBJ pObj, PSUPDRVSESSION pSession);
911bool VBOXCALL supdrvOSObjCanAccess(PSUPDRVOBJ pObj, PSUPDRVSESSION pSession, const char *pszObjName, int *prc);
912bool VBOXCALL supdrvOSGetForcedAsyncTscMode(PSUPDRVDEVEXT pDevExt);
913bool VBOXCALL supdrvOSAreCpusOfflinedOnSuspend(void);
914bool VBOXCALL supdrvOSAreTscDeltasInSync(void);
915int VBOXCALL supdrvOSEnableVTx(bool fEnabled);
916RTCCUINTREG VBOXCALL supdrvOSChangeCR4(RTCCUINTREG fOrMask, RTCCUINTREG fAndMask);
917bool VBOXCALL supdrvOSSuspendVTxOnCpu(void);
918void VBOXCALL supdrvOSResumeVTxOnCpu(bool fSuspended);
919int VBOXCALL supdrvOSGetCurrentGdtRw(RTHCUINTPTR *pGdtRw);
920
921/**
922 * Try open the image using the native loader.
923 *
924 * @returns IPRT status code.
925 * @retval VERR_NOT_SUPPORTED if native loading isn't supported.
926 *
927 * @param pDevExt The device globals.
928 * @param pImage The image handle. pvImage should be set on
929 * success, pvImageAlloc can also be set if
930 * appropriate.
931 * @param pszFilename The file name - UTF-8, may containing UNIX
932 * slashes on non-UNIX systems.
933 */
934int VBOXCALL supdrvOSLdrOpen(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, const char *pszFilename);
935
936/**
937 * Notification call indicating that a image is being opened for the first time.
938 *
939 * Called for both native and non-native images (after supdrvOSLdrOpen). Can be
940 * used to log the load address of the image or inform the kernel about the
941 * alien image.
942 *
943 * @param pDevExt The device globals.
944 * @param pImage The image handle.
945 * @param pszFilename The file name - UTF-8, may containing UNIX
946 * slashes on non-UNIX systems.
947 */
948void VBOXCALL supdrvOSLdrNotifyOpened(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, const char *pszFilename);
949
950/**
951 * Validates an entry point address.
952 *
953 * Called before supdrvOSLdrLoad.
954 *
955 * @returns IPRT status code.
956 * @param pDevExt The device globals.
957 * @param pImage The image data (still in the open state).
958 * @param pv The address within the image.
959 * @param pbImageBits The image bits as loaded by ring-3.
960 * @param pszSymbol The name of the entrypoint being checked.
961 */
962int VBOXCALL supdrvOSLdrValidatePointer(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage,
963 void *pv, const uint8_t *pbImageBits, const char *pszSymbol);
964
965/**
966 * Load the image.
967 *
968 * @returns IPRT status code.
969 * @param pDevExt The device globals.
970 * @param pImage The image data (up to date). Adjust entrypoints
971 * and exports if necessary.
972 * @param pbImageBits The image bits as loaded by ring-3.
973 * @param pReq Pointer to the request packet so that the VMMR0
974 * entry points can be adjusted.
975 */
976int VBOXCALL supdrvOSLdrLoad(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, const uint8_t *pbImageBits, PSUPLDRLOAD pReq);
977
978/**
979 * Unload the image (only called if supdrvOSLdrOpen returned success).
980 *
981 * @param pDevExt The device globals.
982 * @param pImage The image data (mostly still valid).
983 */
984void VBOXCALL supdrvOSLdrUnload(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage);
985
986/**
987 * Notification call indicating that a image is being unloaded.
988 *
989 * Called for both native and non-native images. In the former case, it's
990 * called after supdrvOSLdrUnload.
991 *
992 * @param pDevExt The device globals.
993 * @param pImage The image handle.
994 */
995void VBOXCALL supdrvOSLdrNotifyUnloaded(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage);
996
997/**
998 * Queries a symbol address is a native module.
999 *
1000 * @returns IPRT status code.
1001 * @param pDevExt The device globals.
1002 * @param pImage The image to search.
1003 * @param pszSymbol The symbol to search for.
1004 * @param cchSymbol The length of the symbol.
1005 * @param ppvSymbol Where to return the symbol address if found.
1006 */
1007int VBOXCALL supdrvOSLdrQuerySymbol(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage,
1008 const char *pszSymbol, size_t cchSymbol, void **ppvSymbol);
1009
1010
1011#ifdef SUPDRV_WITH_MSR_PROBER
1012
1013/**
1014 * Tries to read an MSR.
1015 *
1016 * @returns One of the listed VBox status codes.
1017 * @retval VINF_SUCCESS if read successfully, value in *puValue.
1018 * @retval VERR_ACCESS_DENIED if we couldn't read it (GP).
1019 * @retval VERR_NOT_SUPPORTED if not supported.
1020 *
1021 * @param uMsr The MSR to read from.
1022 * @param idCpu The CPU to read the MSR on. NIL_RTCPUID
1023 * indicates any suitable CPU.
1024 * @param puValue Where to return the value.
1025 */
1026int VBOXCALL supdrvOSMsrProberRead(uint32_t uMsr, RTCPUID idCpu, uint64_t *puValue);
1027
1028/**
1029 * Tries to write an MSR.
1030 *
1031 * @returns One of the listed VBox status codes.
1032 * @retval VINF_SUCCESS if written successfully.
1033 * @retval VERR_ACCESS_DENIED if we couldn't write the value to it (GP).
1034 * @retval VERR_NOT_SUPPORTED if not supported.
1035 *
1036 * @param uMsr The MSR to write to.
1037 * @param idCpu The CPU to write the MSR on. NIL_RTCPUID
1038 * indicates any suitable CPU.
1039 * @param uValue The value to write.
1040 */
1041int VBOXCALL supdrvOSMsrProberWrite(uint32_t uMsr, RTCPUID idCpu, uint64_t uValue);
1042
1043/**
1044 * Tries to modify an MSR value.
1045 *
1046 * @returns One of the listed VBox status codes.
1047 * @retval VINF_SUCCESS if succeeded.
1048 * @retval VERR_NOT_SUPPORTED if not supported.
1049 *
1050 * @param idCpu The CPU to modify the MSR on. NIL_RTCPUID
1051 * indicates any suitable CPU.
1052 * @param pReq The request packet with input arguments and
1053 * where to store the results.
1054 */
1055int VBOXCALL supdrvOSMsrProberModify(RTCPUID idCpu, PSUPMSRPROBER pReq);
1056
1057#endif /* SUPDRV_WITH_MSR_PROBER */
1058
1059#if defined(RT_OS_DARWIN)
1060int VBOXCALL supdrvDarwinResumeSuspendedKbds(void);
1061#endif
1062
1063
1064/*********************************************************************************************************************************
1065* Shared Functions *
1066*********************************************************************************************************************************/
1067/* SUPDrv.c */
1068int VBOXCALL supdrvIOCtl(uintptr_t uIOCtl, PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPREQHDR pReqHdr, size_t cbReq);
1069int VBOXCALL supdrvIOCtlFast(uintptr_t uOperation, VMCPUID idCpu, PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession);
1070int VBOXCALL supdrvIDC(uintptr_t uIOCtl, PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPDRVIDCREQHDR pReqHdr);
1071int VBOXCALL supdrvInitDevExt(PSUPDRVDEVEXT pDevExt, size_t cbSession);
1072void VBOXCALL supdrvDeleteDevExt(PSUPDRVDEVEXT pDevExt);
1073int VBOXCALL supdrvCreateSession(PSUPDRVDEVEXT pDevExt, bool fUser, bool fUnrestricted, PSUPDRVSESSION *ppSession);
1074int VBOXCALL supdrvSessionHashTabInsert(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPDRVSESSION *ppOsSessionPtr, void *pvUser);
1075int VBOXCALL supdrvSessionHashTabRemove(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, void *pvUser);
1076PSUPDRVSESSION VBOXCALL supdrvSessionHashTabLookup(PSUPDRVDEVEXT pDevExt, RTPROCESS Process, RTR0PROCESS R0Process,
1077 PSUPDRVSESSION *ppOsSessionPtr);
1078uint32_t VBOXCALL supdrvSessionRetain(PSUPDRVSESSION pSession);
1079uint32_t VBOXCALL supdrvSessionRelease(PSUPDRVSESSION pSession);
1080void VBOXCALL supdrvBadContext(PSUPDRVDEVEXT pDevExt, const char *pszFile, uint32_t uLine, const char *pszExtra);
1081int VBOXCALL supdrvQueryVTCapsInternal(uint32_t *pfCaps);
1082int VBOXCALL supdrvLdrLoadError(int rc, PSUPLDRLOAD pReq, const char *pszFormat, ...);
1083int VBOXCALL supdrvLdrGetExportedSymbol(const char *pszSymbol, uintptr_t *puValue);
1084
1085/* SUPDrvGip.cpp */
1086int VBOXCALL supdrvGipCreate(PSUPDRVDEVEXT pDevExt);
1087void VBOXCALL supdrvGipDestroy(PSUPDRVDEVEXT pDevExt);
1088int VBOXCALL supdrvIOCtl_TscDeltaMeasure(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPTSCDELTAMEASURE pReq);
1089int VBOXCALL supdrvIOCtl_TscRead(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPTSCREAD pReq);
1090int VBOXCALL supdrvIOCtl_GipSetFlags(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, uint32_t fOrMask, uint32_t fAndMask);
1091
1092
1093/* SUPDrvTracer.cpp */
1094int VBOXCALL supdrvTracerInit(PSUPDRVDEVEXT pDevExt);
1095void VBOXCALL supdrvTracerTerm(PSUPDRVDEVEXT pDevExt);
1096void VBOXCALL supdrvTracerModuleUnloading(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage);
1097void VBOXCALL supdrvTracerCleanupSession(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession);
1098int VBOXCALL supdrvIOCtl_TracerUmodRegister(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession,
1099 RTR3PTR R3PtrVtgHdr, RTUINTPTR uVtgHdrAddr,
1100 RTR3PTR R3PtrStrTab, uint32_t cbStrTab,
1101 const char *pszModName, uint32_t fFlags);
1102int VBOXCALL supdrvIOCtl_TracerUmodDeregister(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, RTR3PTR R3PtrVtgHdr);
1103void VBOXCALL supdrvIOCtl_TracerUmodProbeFire(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPDRVTRACERUSRCTX pCtx);
1104int VBOXCALL supdrvIOCtl_TracerOpen(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, uint32_t uCookie, uintptr_t uArg);
1105int VBOXCALL supdrvIOCtl_TracerClose(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession);
1106int VBOXCALL supdrvIOCtl_TracerIOCtl(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, uintptr_t uCmd, uintptr_t uArg, int32_t *piRetVal);
1107extern PFNRT g_pfnSupdrvProbeFireKernel;
1108DECLASM(void) supdrvTracerProbeFireStub(void);
1109
1110#ifdef VBOX_WITH_NATIVE_DTRACE
1111const SUPDRVTRACERREG * VBOXCALL supdrvDTraceInit(void);
1112void VBOXCALL supdrvDTraceFini(void);
1113#endif
1114
1115RT_C_DECLS_END
1116
1117#endif /* !VBOX_INCLUDED_SRC_Support_SUPDrvInternal_h */
1118
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