VirtualBox

source: vbox/trunk/src/VBox/HostDrivers/Support/freebsd/SUPDrv-freebsd.c@ 90780

Last change on this file since 90780 was 90780, checked in by vboxsync, 3 years ago

SUP: VALID_PTR -> RT_VALID_PTR.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 18.8 KB
Line 
1/* $Id: SUPDrv-freebsd.c 90780 2021-08-23 09:25:17Z vboxsync $ */
2/** @file
3 * VBoxDrv - The VirtualBox Support Driver - FreeBSD specifics.
4 */
5
6/*
7 * Copyright (c) 2007 knut st. osmundsen <[email protected]>
8 *
9 * Permission is hereby granted, free of charge, to any person
10 * obtaining a copy of this software and associated documentation
11 * files (the "Software"), to deal in the Software without
12 * restriction, including without limitation the rights to use,
13 * copy, modify, merge, publish, distribute, sublicense, and/or sell
14 * copies of the Software, and to permit persons to whom the
15 * Software is furnished to do so, subject to the following
16 * conditions:
17 *
18 * The above copyright notice and this permission notice shall be
19 * included in all copies or substantial portions of the Software.
20 *
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
23 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
25 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
26 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
27 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
28 * OTHER DEALINGS IN THE SOFTWARE.
29 */
30
31
32/*********************************************************************************************************************************
33* Header Files *
34*********************************************************************************************************************************/
35#define LOG_GROUP LOG_GROUP_SUP_DRV
36/* Deal with conflicts first. */
37#include <sys/param.h>
38#undef PVM
39#include <sys/types.h>
40#include <sys/module.h>
41#include <sys/systm.h>
42#include <sys/errno.h>
43#include <sys/kernel.h>
44#include <sys/fcntl.h>
45#include <sys/conf.h>
46#include <sys/uio.h>
47
48#include "../SUPDrvInternal.h"
49#include <VBox/version.h>
50#include <iprt/initterm.h>
51#include <iprt/string.h>
52#include <iprt/spinlock.h>
53#include <iprt/process.h>
54#include <iprt/assert.h>
55#include <iprt/uuid.h>
56#include <VBox/log.h>
57#include <iprt/alloc.h>
58#include <iprt/err.h>
59#include <iprt/asm.h>
60
61#ifdef VBOX_WITH_HARDENING
62# define VBOXDRV_PERM 0600
63#else
64# define VBOXDRV_PERM 0666
65#endif
66
67
68/*********************************************************************************************************************************
69* Internal Functions *
70*********************************************************************************************************************************/
71static int VBoxDrvFreeBSDModuleEvent(struct module *pMod, int enmEventType, void *pvArg);
72static int VBoxDrvFreeBSDLoad(void);
73static int VBoxDrvFreeBSDUnload(void);
74
75static d_open_t VBoxDrvFreeBSDOpenUsr;
76static d_open_t VBoxDrvFreeBSDOpenSys;
77static void vboxdrvFreeBSDDtr(void *pvData);
78static d_ioctl_t VBoxDrvFreeBSDIOCtl;
79static int VBoxDrvFreeBSDIOCtlSlow(PSUPDRVSESSION pSession, u_long ulCmd, caddr_t pvData, struct thread *pTd);
80
81
82/*********************************************************************************************************************************
83* Global Variables *
84*********************************************************************************************************************************/
85/**
86 * Module info structure used by the kernel.
87 */
88static moduledata_t g_VBoxDrvFreeBSDModule =
89{
90 "vboxdrv",
91 VBoxDrvFreeBSDModuleEvent,
92 NULL
93};
94
95/** Declare the module as a pseudo device. */
96DECLARE_MODULE(vboxdrv, g_VBoxDrvFreeBSDModule, SI_SUB_PSEUDO, SI_ORDER_ANY);
97MODULE_VERSION(vboxdrv, 1);
98
99/**
100 * The /dev/vboxdrv character device entry points.
101 */
102static struct cdevsw g_VBoxDrvFreeBSDChrDevSwSys =
103{
104 .d_version = D_VERSION,
105 .d_open = VBoxDrvFreeBSDOpenSys,
106 .d_ioctl = VBoxDrvFreeBSDIOCtl,
107 .d_name = "vboxdrv"
108};
109/** The /dev/vboxdrv character device. */
110static struct cdev *g_pVBoxDrvFreeBSDChrDevSys;
111
112/**
113 * The /dev/vboxdrvu character device entry points.
114 */
115static struct cdevsw g_VBoxDrvFreeBSDChrDevSwUsr =
116{
117 .d_version = D_VERSION,
118 .d_open = VBoxDrvFreeBSDOpenUsr,
119 .d_ioctl = VBoxDrvFreeBSDIOCtl,
120 .d_name = "vboxdrvu"
121};
122/** The /dev/vboxdrvu character device. */
123static struct cdev *g_pVBoxDrvFreeBSDChrDevUsr;
124
125/** Reference counter. */
126static volatile uint32_t g_cUsers;
127
128/** The device extention. */
129static SUPDRVDEVEXT g_VBoxDrvFreeBSDDevExt;
130
131/**
132 * Module event handler.
133 *
134 * @param pMod The module structure.
135 * @param enmEventType The event type (modeventtype_t).
136 * @param pvArg Module argument. NULL.
137 *
138 * @return 0 on success, errno.h status code on failure.
139 */
140static int VBoxDrvFreeBSDModuleEvent(struct module *pMod, int enmEventType, void *pvArg)
141{
142 int rc;
143 switch (enmEventType)
144 {
145 case MOD_LOAD:
146 rc = VBoxDrvFreeBSDLoad();
147 break;
148
149 case MOD_UNLOAD:
150 mtx_unlock(&Giant);
151 rc = VBoxDrvFreeBSDUnload();
152 mtx_lock(&Giant);
153 break;
154
155 case MOD_SHUTDOWN:
156 case MOD_QUIESCE:
157 default:
158 return EOPNOTSUPP;
159 }
160
161 if (RT_SUCCESS(rc))
162 return 0;
163 return RTErrConvertToErrno(rc);
164}
165
166
167static int VBoxDrvFreeBSDLoad(void)
168{
169 g_cUsers = 0;
170
171 /*
172 * Initialize the runtime.
173 */
174 int rc = RTR0Init(0);
175 if (RT_SUCCESS(rc))
176 {
177 Log(("VBoxDrvFreeBSDLoad:\n"));
178
179 /*
180 * Initialize the device extension.
181 */
182 rc = supdrvInitDevExt(&g_VBoxDrvFreeBSDDevExt, sizeof(SUPDRVSESSION));
183 if (RT_SUCCESS(rc))
184 {
185 /*
186 * Configure character devices. Add symbolic links for compatibility.
187 */
188 g_pVBoxDrvFreeBSDChrDevSys = make_dev(&g_VBoxDrvFreeBSDChrDevSwSys, 0, UID_ROOT, GID_WHEEL, VBOXDRV_PERM, "vboxdrv");
189 g_pVBoxDrvFreeBSDChrDevUsr = make_dev(&g_VBoxDrvFreeBSDChrDevSwUsr, 1, UID_ROOT, GID_WHEEL, 0666, "vboxdrvu");
190 return VINF_SUCCESS;
191 }
192
193 printf("vboxdrv: supdrvInitDevExt failed, rc=%d\n", rc);
194 RTR0Term();
195 }
196 else
197 printf("vboxdrv: RTR0Init failed, rc=%d\n", rc);
198 return rc;
199}
200
201static int VBoxDrvFreeBSDUnload(void)
202{
203 Log(("VBoxDrvFreeBSDUnload:\n"));
204
205 if (g_cUsers > 0)
206 return VERR_RESOURCE_BUSY;
207
208 /*
209 * Reserve what we did in VBoxDrvFreeBSDInit.
210 */
211 destroy_dev(g_pVBoxDrvFreeBSDChrDevUsr);
212 destroy_dev(g_pVBoxDrvFreeBSDChrDevSys);
213
214 supdrvDeleteDevExt(&g_VBoxDrvFreeBSDDevExt);
215
216 RTR0TermForced();
217
218 memset(&g_VBoxDrvFreeBSDDevExt, 0, sizeof(g_VBoxDrvFreeBSDDevExt));
219 return VINF_SUCCESS;
220}
221
222
223/**
224 *
225 * @returns 0 on success, errno on failure.
226 * EBUSY if the device is used by someone else.
227 * @param pDev The device node.
228 * @param fOpen The open flags.
229 * @param iDevType Some device type thing we don't use.
230 * @param pTd The thread.
231 * @param fUnrestricted Set if opening /dev/vboxdrv, clear if /dev/vboxdrvu.
232 */
233static int vboxdrvFreeBSDOpenCommon(struct cdev *pDev, int fOpen, int iDevType, struct thread *pTd, bool fUnrestricted)
234{
235 PSUPDRVSESSION pSession;
236 int rc;
237
238 /*
239 * Let's be a bit picky about the flags...
240 */
241 if (fOpen != (FREAD | FWRITE /*=O_RDWR*/))
242 {
243 Log(("VBoxDrvFreeBSDOpen: fOpen=%#x expected %#x\n", fOpen, O_RDWR));
244 return EINVAL;
245 }
246
247 /*
248 * Create a new session.
249 */
250 rc = supdrvCreateSession(&g_VBoxDrvFreeBSDDevExt, true /* fUser */, fUnrestricted, &pSession);
251 if (RT_SUCCESS(rc))
252 {
253 /** @todo get (r)uid and (r)gid.
254 pSession->Uid = stuff;
255 pSession->Gid = stuff; */
256 rc = devfs_set_cdevpriv(pSession, vboxdrvFreeBSDDtr); Assert(rc == 0);
257 Log(("VBoxDrvFreeBSDOpen: pSession=%p\n", pSession));
258 ASMAtomicIncU32(&g_cUsers);
259 return 0;
260 }
261
262 return RTErrConvertToErrno(rc);
263}
264
265
266/** For vboxdrv. */
267static int VBoxDrvFreeBSDOpenSys(struct cdev *pDev, int fOpen, int iDevType, struct thread *pTd)
268{
269 return vboxdrvFreeBSDOpenCommon(pDev, fOpen, iDevType, pTd, true);
270}
271
272
273/** For vboxdrvu. */
274static int VBoxDrvFreeBSDOpenUsr(struct cdev *pDev, int fOpen, int iDevType, struct thread *pTd)
275{
276 return vboxdrvFreeBSDOpenCommon(pDev, fOpen, iDevType, pTd, false);
277}
278
279
280/**
281 * Close a file device previously opened by VBoxDrvFreeBSDOpen.
282 *
283 * @returns 0 on success.
284 * @param pvData The session being closed.
285 */
286static void vboxdrvFreeBSDDtr(void *pvData)
287{
288 PSUPDRVSESSION pSession = pvData;
289 Log(("vboxdrvFreeBSDDtr: pSession=%p\n", pSession));
290
291 /*
292 * Close the session.
293 */
294 supdrvSessionRelease(pSession);
295 ASMAtomicDecU32(&g_cUsers);
296}
297
298
299/**
300 * I/O control request.
301 *
302 * @returns depends...
303 * @param pDev The device.
304 * @param ulCmd The command.
305 * @param pvData Pointer to the data.
306 * @param fFile The file descriptor flags.
307 * @param pTd The calling thread.
308 */
309static int VBoxDrvFreeBSDIOCtl(struct cdev *pDev, u_long ulCmd, caddr_t pvData, int fFile, struct thread *pTd)
310{
311 PSUPDRVSESSION pSession;
312 devfs_get_cdevpriv((void **)&pSession);
313
314 /*
315 * Deal with the fast ioctl path first.
316 */
317 AssertCompile((SUP_IOCTL_FAST_DO_FIRST & 0xff) == (SUP_IOCTL_FLAG | 64));
318 if ( (uintptr_t)(ulCmd - SUP_IOCTL_FAST_DO_FIRST) < (uintptr_t)32
319 && pSession->fUnrestricted)
320 return supdrvIOCtlFast(ulCmd - SUP_IOCTL_FAST_DO_FIRST, *(uint32_t *)pvData, &g_VBoxDrvFreeBSDDevExt, pSession);
321
322 return VBoxDrvFreeBSDIOCtlSlow(pSession, ulCmd, pvData, pTd);
323}
324
325
326/**
327 * Deal with the 'slow' I/O control requests.
328 *
329 * @returns 0 on success, appropriate errno on failure.
330 * @param pSession The session.
331 * @param ulCmd The command.
332 * @param pvData The request data.
333 * @param pTd The calling thread.
334 */
335static int VBoxDrvFreeBSDIOCtlSlow(PSUPDRVSESSION pSession, u_long ulCmd, caddr_t pvData, struct thread *pTd)
336{
337 PSUPREQHDR pHdr;
338 uint32_t cbReq = IOCPARM_LEN(ulCmd);
339 void *pvUser = NULL;
340
341 /*
342 * Buffered request?
343 */
344 if ((IOC_DIRMASK & ulCmd) == IOC_INOUT)
345 {
346 pHdr = (PSUPREQHDR)pvData;
347 if (RT_UNLIKELY(cbReq < sizeof(*pHdr)))
348 {
349 OSDBGPRINT(("VBoxDrvFreeBSDIOCtlSlow: cbReq=%#x < %#x; ulCmd=%#lx\n", cbReq, (int)sizeof(*pHdr), ulCmd));
350 return EINVAL;
351 }
352 if (RT_UNLIKELY((pHdr->fFlags & SUPREQHDR_FLAGS_MAGIC_MASK) != SUPREQHDR_FLAGS_MAGIC))
353 {
354 OSDBGPRINT(("VBoxDrvFreeBSDIOCtlSlow: bad magic fFlags=%#x; ulCmd=%#lx\n", pHdr->fFlags, ulCmd));
355 return EINVAL;
356 }
357 if (RT_UNLIKELY( RT_MAX(pHdr->cbIn, pHdr->cbOut) != cbReq
358 || pHdr->cbIn < sizeof(*pHdr)
359 || pHdr->cbOut < sizeof(*pHdr)))
360 {
361 OSDBGPRINT(("VBoxDrvFreeBSDIOCtlSlow: max(%#x,%#x) != %#x; ulCmd=%#lx\n", pHdr->cbIn, pHdr->cbOut, cbReq, ulCmd));
362 return EINVAL;
363 }
364 }
365 /*
366 * Big unbuffered request?
367 */
368 else if ((IOC_DIRMASK & ulCmd) == IOC_VOID && !cbReq)
369 {
370 /*
371 * Read the header, validate it and figure out how much that needs to be buffered.
372 */
373 SUPREQHDR Hdr;
374 pvUser = *(void **)pvData;
375 int rc = copyin(pvUser, &Hdr, sizeof(Hdr));
376 if (RT_UNLIKELY(rc))
377 {
378 OSDBGPRINT(("VBoxDrvFreeBSDIOCtlSlow: copyin(%p,Hdr,) -> %#x; ulCmd=%#lx\n", pvUser, rc, ulCmd));
379 return rc;
380 }
381 if (RT_UNLIKELY((Hdr.fFlags & SUPREQHDR_FLAGS_MAGIC_MASK) != SUPREQHDR_FLAGS_MAGIC))
382 {
383 OSDBGPRINT(("VBoxDrvFreeBSDIOCtlSlow: bad magic fFlags=%#x; ulCmd=%#lx\n", Hdr.fFlags, ulCmd));
384 return EINVAL;
385 }
386 cbReq = RT_MAX(Hdr.cbIn, Hdr.cbOut);
387 if (RT_UNLIKELY( Hdr.cbIn < sizeof(Hdr)
388 || Hdr.cbOut < sizeof(Hdr)
389 || cbReq > _1M*16))
390 {
391 OSDBGPRINT(("VBoxDrvFreeBSDIOCtlSlow: max(%#x,%#x); ulCmd=%#lx\n", Hdr.cbIn, Hdr.cbOut, ulCmd));
392 return EINVAL;
393 }
394
395 /*
396 * Allocate buffer and copy in the data.
397 */
398 pHdr = (PSUPREQHDR)RTMemTmpAlloc(cbReq);
399 if (RT_UNLIKELY(!pHdr))
400 {
401 OSDBGPRINT(("VBoxDrvFreeBSDIOCtlSlow: failed to allocate buffer of %d bytes; ulCmd=%#lx\n", cbReq, ulCmd));
402 return ENOMEM;
403 }
404 rc = copyin(pvUser, pHdr, Hdr.cbIn);
405 if (RT_UNLIKELY(rc))
406 {
407 OSDBGPRINT(("VBoxDrvFreeBSDIOCtlSlow: copyin(%p,%p,%#x) -> %#x; ulCmd=%#lx\n",
408 pvUser, pHdr, Hdr.cbIn, rc, ulCmd));
409 RTMemTmpFree(pHdr);
410 return rc;
411 }
412 if (Hdr.cbIn < cbReq)
413 RT_BZERO((uint8_t *)pHdr + Hdr.cbIn, cbReq - Hdr.cbIn);
414 }
415 else
416 {
417 Log(("VBoxDrvFreeBSDIOCtlSlow: huh? cbReq=%#x ulCmd=%#lx\n", cbReq, ulCmd));
418 return EINVAL;
419 }
420
421 /*
422 * Process the IOCtl.
423 */
424 int rc = supdrvIOCtl(ulCmd, &g_VBoxDrvFreeBSDDevExt, pSession, pHdr, cbReq);
425 if (RT_LIKELY(!rc))
426 {
427 /*
428 * If unbuffered, copy back the result before returning.
429 */
430 if (pvUser)
431 {
432 uint32_t cbOut = pHdr->cbOut;
433 if (cbOut > cbReq)
434 {
435 OSDBGPRINT(("VBoxDrvFreeBSDIOCtlSlow: too much output! %#x > %#x; uCmd=%#lx!\n", cbOut, cbReq, ulCmd));
436 cbOut = cbReq;
437 }
438 rc = copyout(pHdr, pvUser, cbOut);
439 if (RT_UNLIKELY(rc))
440 OSDBGPRINT(("VBoxDrvFreeBSDIOCtlSlow: copyout(%p,%p,%#x) -> %d; uCmd=%#lx!\n", pHdr, pvUser, cbOut, rc, ulCmd));
441
442 Log(("VBoxDrvFreeBSDIOCtlSlow: returns %d / %d ulCmd=%lx\n", 0, pHdr->rc, ulCmd));
443
444 /* cleanup */
445 RTMemTmpFree(pHdr);
446 }
447 }
448 else
449 {
450 /*
451 * The request failed, just clean up.
452 */
453 if (pvUser)
454 RTMemTmpFree(pHdr);
455
456 Log(("VBoxDrvFreeBSDIOCtlSlow: ulCmd=%lx pData=%p failed, rc=%d\n", ulCmd, pvData, rc));
457 rc = EINVAL;
458 }
459
460 return rc;
461}
462
463
464/**
465 * The SUPDRV IDC entry point.
466 *
467 * @returns VBox status code, see supdrvIDC.
468 * @param uReq The request code.
469 * @param pReq The request.
470 */
471int VBOXCALL SUPDrvFreeBSDIDC(uint32_t uReq, PSUPDRVIDCREQHDR pReq)
472{
473 PSUPDRVSESSION pSession;
474
475 /*
476 * Some quick validations.
477 */
478 if (RT_UNLIKELY(!RT_VALID_PTR(pReq)))
479 return VERR_INVALID_POINTER;
480
481 pSession = pReq->pSession;
482 if (pSession)
483 {
484 if (RT_UNLIKELY(!RT_VALID_PTR(pReq->pSession)))
485 return VERR_INVALID_PARAMETER;
486 if (RT_UNLIKELY(pSession->pDevExt != &g_VBoxDrvFreeBSDDevExt))
487 return VERR_INVALID_PARAMETER;
488 }
489 else if (RT_UNLIKELY(uReq != SUPDRV_IDC_REQ_CONNECT))
490 return VERR_INVALID_PARAMETER;
491
492 /*
493 * Do the job.
494 */
495 return supdrvIDC(uReq, &g_VBoxDrvFreeBSDDevExt, pSession, pReq);
496}
497
498
499void VBOXCALL supdrvOSCleanupSession(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession)
500{
501 NOREF(pDevExt);
502 NOREF(pSession);
503}
504
505
506void VBOXCALL supdrvOSSessionHashTabInserted(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, void *pvUser)
507{
508 NOREF(pDevExt); NOREF(pSession); NOREF(pvUser);
509}
510
511
512void VBOXCALL supdrvOSSessionHashTabRemoved(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, void *pvUser)
513{
514 NOREF(pDevExt); NOREF(pSession); NOREF(pvUser);
515}
516
517
518void VBOXCALL supdrvOSObjInitCreator(PSUPDRVOBJ pObj, PSUPDRVSESSION pSession)
519{
520 NOREF(pObj);
521 NOREF(pSession);
522}
523
524
525bool VBOXCALL supdrvOSObjCanAccess(PSUPDRVOBJ pObj, PSUPDRVSESSION pSession, const char *pszObjName, int *prc)
526{
527 NOREF(pObj);
528 NOREF(pSession);
529 NOREF(pszObjName);
530 NOREF(prc);
531 return false;
532}
533
534
535bool VBOXCALL supdrvOSGetForcedAsyncTscMode(PSUPDRVDEVEXT pDevExt)
536{
537 return false;
538}
539
540
541bool VBOXCALL supdrvOSAreCpusOfflinedOnSuspend(void)
542{
543 /** @todo verify this. */
544 return false;
545}
546
547
548bool VBOXCALL supdrvOSAreTscDeltasInSync(void)
549{
550 return false;
551}
552
553
554int VBOXCALL supdrvOSLdrOpen(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, const char *pszFilename)
555{
556 NOREF(pDevExt); NOREF(pImage); NOREF(pszFilename);
557 return VERR_NOT_SUPPORTED;
558}
559
560
561int VBOXCALL supdrvOSLdrValidatePointer(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, void *pv,
562 const uint8_t *pbImageBits, const char *pszSymbol)
563{
564 NOREF(pDevExt); NOREF(pImage); NOREF(pv); NOREF(pbImageBits); NOREF(pszSymbol);
565 return VERR_NOT_SUPPORTED;
566}
567
568
569int VBOXCALL supdrvOSLdrLoad(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, const uint8_t *pbImageBits, PSUPLDRLOAD pReq)
570{
571 NOREF(pDevExt); NOREF(pImage); NOREF(pbImageBits); NOREF(pReq);
572 return VERR_NOT_SUPPORTED;
573}
574
575
576void VBOXCALL supdrvOSLdrUnload(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage)
577{
578 NOREF(pDevExt); NOREF(pImage);
579}
580
581
582void VBOXCALL supdrvOSLdrNotifyOpened(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, const char *pszFilename)
583{
584 NOREF(pDevExt); NOREF(pImage); NOREF(pszFilename);
585}
586
587
588void VBOXCALL supdrvOSLdrNotifyUnloaded(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage)
589{
590 NOREF(pDevExt); NOREF(pImage);
591}
592
593
594int VBOXCALL supdrvOSLdrQuerySymbol(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage,
595 const char *pszSymbol, size_t cchSymbol, void **ppvSymbol)
596{
597 RT_NOREF(pDevExt, pImage, pszSymbol, cchSymbol, ppvSymbol);
598 return VERR_WRONG_ORDER;
599}
600
601
602void VBOXCALL supdrvOSLdrRetainWrapperModule(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage)
603{
604 RT_NOREF(pDevExt, pImage);
605 AssertFailed();
606}
607
608
609void VBOXCALL supdrvOSLdrReleaseWrapperModule(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage)
610{
611 RT_NOREF(pDevExt, pImage);
612 AssertFailed();
613}
614
615#ifdef SUPDRV_WITH_MSR_PROBER
616
617int VBOXCALL supdrvOSMsrProberRead(uint32_t uMsr, RTCPUID idCpu, uint64_t *puValue)
618{
619 NOREF(uMsr); NOREF(idCpu); NOREF(puValue);
620 return VERR_NOT_SUPPORTED;
621}
622
623
624int VBOXCALL supdrvOSMsrProberWrite(uint32_t uMsr, RTCPUID idCpu, uint64_t uValue)
625{
626 NOREF(uMsr); NOREF(idCpu); NOREF(uValue);
627 return VERR_NOT_SUPPORTED;
628}
629
630
631int VBOXCALL supdrvOSMsrProberModify(RTCPUID idCpu, PSUPMSRPROBER pReq)
632{
633 NOREF(idCpu); NOREF(pReq);
634 return VERR_NOT_SUPPORTED;
635}
636
637#endif /* SUPDRV_WITH_MSR_PROBER */
638
639
640SUPR0DECL(int) SUPR0Printf(const char *pszFormat, ...)
641{
642 va_list va;
643 char szMsg[256];
644 int cch;
645
646 va_start(va, pszFormat);
647 cch = RTStrPrintfV(szMsg, sizeof(szMsg), pszFormat, va);
648 va_end(va);
649
650 printf("%s", szMsg);
651
652 return cch;
653}
654
655
656SUPR0DECL(uint32_t) SUPR0GetKernelFeatures(void)
657{
658 return 0;
659}
660
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