1 | /* $Id: SUPDrv-os2.cpp 51770 2014-07-01 18:14:02Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBoxDrv - The VirtualBox Support Driver - OS/2 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 | * Header Files *
|
---|
33 | *******************************************************************************/
|
---|
34 | #define LOG_GROUP LOG_GROUP_SUP_DRV
|
---|
35 | #define __STDC_CONSTANT_MACROS
|
---|
36 | #define __STDC_LIMIT_MACROS
|
---|
37 |
|
---|
38 | #include <os2ddk/bsekee.h>
|
---|
39 | #undef RT_MAX
|
---|
40 |
|
---|
41 | #include "SUPDrvInternal.h"
|
---|
42 | #include <VBox/version.h>
|
---|
43 | #include <iprt/initterm.h>
|
---|
44 | #include <iprt/string.h>
|
---|
45 | #include <iprt/spinlock.h>
|
---|
46 | #include <iprt/process.h>
|
---|
47 | #include <iprt/assert.h>
|
---|
48 | #include <VBox/log.h>
|
---|
49 | #include <iprt/param.h>
|
---|
50 |
|
---|
51 |
|
---|
52 | /*******************************************************************************
|
---|
53 | * Global Variables *
|
---|
54 | *******************************************************************************/
|
---|
55 | /**
|
---|
56 | * Device extention & session data association structure.
|
---|
57 | */
|
---|
58 | static SUPDRVDEVEXT g_DevExt;
|
---|
59 | /** Spinlock protecting g_apSessionHashTab. */
|
---|
60 | static RTSPINLOCK g_Spinlock = NIL_RTSPINLOCK;
|
---|
61 | /** Hash table */
|
---|
62 | static PSUPDRVSESSION g_apSessionHashTab[19];
|
---|
63 | /** Calculates the index into g_apSessionHashTab.*/
|
---|
64 | #define SESSION_HASH(sfn) ((sfn) % RT_ELEMENTS(g_apSessionHashTab))
|
---|
65 |
|
---|
66 | RT_C_DECLS_BEGIN
|
---|
67 | /* Defined in SUPDrvA-os2.asm */
|
---|
68 | extern uint16_t g_offLogHead;
|
---|
69 | extern uint16_t volatile g_offLogTail;
|
---|
70 | extern uint16_t const g_cchLogMax;
|
---|
71 | extern char g_szLog[];
|
---|
72 | /* (init only:) */
|
---|
73 | extern char g_szInitText[];
|
---|
74 | extern uint16_t g_cchInitText;
|
---|
75 | extern uint16_t g_cchInitTextMax;
|
---|
76 | RT_C_DECLS_END
|
---|
77 |
|
---|
78 |
|
---|
79 | /*******************************************************************************
|
---|
80 | * Internal Functions *
|
---|
81 | *******************************************************************************/
|
---|
82 |
|
---|
83 |
|
---|
84 |
|
---|
85 | /**
|
---|
86 | * 32-bit Ring-0 initialization.
|
---|
87 | *
|
---|
88 | * @returns 0 on success, non-zero on failure.
|
---|
89 | * @param pszArgs Pointer to the device arguments.
|
---|
90 | */
|
---|
91 | DECLASM(int) VBoxDrvInit(const char *pszArgs)
|
---|
92 | {
|
---|
93 | /*
|
---|
94 | * Initialize the runtime.
|
---|
95 | */
|
---|
96 | int rc = RTR0Init(0);
|
---|
97 | if (RT_SUCCESS(rc))
|
---|
98 | {
|
---|
99 | Log(("VBoxDrvInit: pszArgs=%s\n", pszArgs));
|
---|
100 |
|
---|
101 | /*
|
---|
102 | * Initialize the device extension.
|
---|
103 | */
|
---|
104 | rc = supdrvInitDevExt(&g_DevExt, sizeof(SUPDRVSESSION));
|
---|
105 | if (RT_SUCCESS(rc))
|
---|
106 | {
|
---|
107 | /*
|
---|
108 | * Initialize the session hash table.
|
---|
109 | */
|
---|
110 | rc = RTSpinlockCreate(&g_Spinlock, RTSPINLOCK_FLAGS_INTERRUPT_SAFE, "VBoxDrvOS2");
|
---|
111 | if (RT_SUCCESS(rc))
|
---|
112 | {
|
---|
113 | /*
|
---|
114 | * Process the commandline. Later.
|
---|
115 | */
|
---|
116 | bool fVerbose = true;
|
---|
117 |
|
---|
118 | /*
|
---|
119 | * Success
|
---|
120 | */
|
---|
121 | if (fVerbose)
|
---|
122 | {
|
---|
123 | strcpy(&g_szInitText[0],
|
---|
124 | "\r\n"
|
---|
125 | "VirtualBox.org Support Driver for OS/2 version " VBOX_VERSION_STRING "\r\n"
|
---|
126 | "Copyright (C) 2007 Knut St. Osmundsen\r\n"
|
---|
127 | "Copyright (C) 2007 Oracle Corporation\r\n");
|
---|
128 | g_cchInitText = strlen(&g_szInitText[0]);
|
---|
129 | }
|
---|
130 | return VINF_SUCCESS;
|
---|
131 | }
|
---|
132 | g_cchInitText = RTStrPrintf(&g_szInitText[0], g_cchInitTextMax, "VBoxDrv.sys: RTSpinlockCreate failed, rc=%Rrc\n", rc);
|
---|
133 | supdrvDeleteDevExt(&g_DevExt);
|
---|
134 | }
|
---|
135 | else
|
---|
136 | g_cchInitText = RTStrPrintf(&g_szInitText[0], g_cchInitTextMax, "VBoxDrv.sys: supdrvInitDevExt failed, rc=%Rrc\n", rc);
|
---|
137 | RTR0Term();
|
---|
138 | }
|
---|
139 | else
|
---|
140 | g_cchInitText = RTStrPrintf(&g_szInitText[0], g_cchInitTextMax, "VBoxDrv.sys: RTR0Init failed, rc=%Rrc\n", rc);
|
---|
141 | return rc;
|
---|
142 | }
|
---|
143 |
|
---|
144 |
|
---|
145 | DECLASM(int) VBoxDrvOpen(uint16_t sfn)
|
---|
146 | {
|
---|
147 | int rc;
|
---|
148 | PSUPDRVSESSION pSession;
|
---|
149 |
|
---|
150 | /*
|
---|
151 | * Create a new session.
|
---|
152 | */
|
---|
153 | rc = supdrvCreateSession(&g_DevExt, true /* fUser */, true /*fUnrestricted*/, &pSession);
|
---|
154 | if (RT_SUCCESS(rc))
|
---|
155 | {
|
---|
156 | pSession->sfn = sfn;
|
---|
157 |
|
---|
158 | /*
|
---|
159 | * Insert it into the hash table.
|
---|
160 | */
|
---|
161 | unsigned iHash = SESSION_HASH(sfn);
|
---|
162 | RTSpinlockAcquire(g_Spinlock);
|
---|
163 | pSession->pNextHash = g_apSessionHashTab[iHash];
|
---|
164 | g_apSessionHashTab[iHash] = pSession;
|
---|
165 | RTSpinlockReleaseNoInts(g_Spinlock);
|
---|
166 | }
|
---|
167 |
|
---|
168 | Log(("VBoxDrvOpen: g_DevExt=%p pSession=%p rc=%d pid=%d\n", &g_DevExt, pSession, rc, (int)RTProcSelf()));
|
---|
169 | return rc;
|
---|
170 | }
|
---|
171 |
|
---|
172 |
|
---|
173 | DECLASM(int) VBoxDrvClose(uint16_t sfn)
|
---|
174 | {
|
---|
175 | Log(("VBoxDrvClose: pid=%d sfn=%d\n", (int)RTProcSelf(), sfn));
|
---|
176 |
|
---|
177 | /*
|
---|
178 | * Remove from the hash table.
|
---|
179 | */
|
---|
180 | PSUPDRVSESSION pSession;
|
---|
181 | const RTPROCESS Process = RTProcSelf();
|
---|
182 | const unsigned iHash = SESSION_HASH(sfn);
|
---|
183 | RTSpinlockAcquire(g_Spinlock);
|
---|
184 |
|
---|
185 | pSession = g_apSessionHashTab[iHash];
|
---|
186 | if (pSession)
|
---|
187 | {
|
---|
188 | if ( pSession->sfn == sfn
|
---|
189 | && pSession->Process == Process)
|
---|
190 | {
|
---|
191 | g_apSessionHashTab[iHash] = pSession->pNextHash;
|
---|
192 | pSession->pNextHash = NULL;
|
---|
193 | }
|
---|
194 | else
|
---|
195 | {
|
---|
196 | PSUPDRVSESSION pPrev = pSession;
|
---|
197 | pSession = pSession->pNextHash;
|
---|
198 | while (pSession)
|
---|
199 | {
|
---|
200 | if ( pSession->sfn == sfn
|
---|
201 | && pSession->Process == Process)
|
---|
202 | {
|
---|
203 | pPrev->pNextHash = pSession->pNextHash;
|
---|
204 | pSession->pNextHash = NULL;
|
---|
205 | break;
|
---|
206 | }
|
---|
207 |
|
---|
208 | /* next */
|
---|
209 | pPrev = pSession;
|
---|
210 | pSession = pSession->pNextHash;
|
---|
211 | }
|
---|
212 | }
|
---|
213 | }
|
---|
214 | RTSpinlockReleaseNoInts(g_Spinlock);
|
---|
215 | if (!pSession)
|
---|
216 | {
|
---|
217 | OSDBGPRINT(("VBoxDrvIoctl: WHUT?!? pSession == NULL! This must be a mistake... pid=%d sfn=%d\n", (int)Process, sfn));
|
---|
218 | return VERR_INVALID_PARAMETER;
|
---|
219 | }
|
---|
220 |
|
---|
221 | /*
|
---|
222 | * Close the session.
|
---|
223 | */
|
---|
224 | supdrvSessionRelease(pSession);
|
---|
225 | return 0;
|
---|
226 | }
|
---|
227 |
|
---|
228 |
|
---|
229 | DECLASM(int) VBoxDrvIOCtlFast(uint16_t sfn, uint8_t iFunction)
|
---|
230 | {
|
---|
231 | /*
|
---|
232 | * Find the session.
|
---|
233 | */
|
---|
234 | const RTPROCESS Process = RTProcSelf();
|
---|
235 | const unsigned iHash = SESSION_HASH(sfn);
|
---|
236 | PSUPDRVSESSION pSession;
|
---|
237 |
|
---|
238 | RTSpinlockAcquire(g_Spinlock);
|
---|
239 | pSession = g_apSessionHashTab[iHash];
|
---|
240 | if (pSession && pSession->Process != Process)
|
---|
241 | {
|
---|
242 | do pSession = pSession->pNextHash;
|
---|
243 | while ( pSession
|
---|
244 | && ( pSession->sfn != sfn
|
---|
245 | || pSession->Process != Process));
|
---|
246 |
|
---|
247 | if (RT_LIKELY(pSession))
|
---|
248 | supdrvSessionRetain(pSession);
|
---|
249 | }
|
---|
250 | RTSpinlockReleaseNoInts(g_Spinlock);
|
---|
251 | if (RT_UNLIKELY(!pSession))
|
---|
252 | {
|
---|
253 | OSDBGPRINT(("VBoxDrvIoctl: WHUT?!? pSession == NULL! This must be a mistake... pid=%d\n", (int)Process));
|
---|
254 | return VERR_INVALID_PARAMETER;
|
---|
255 | }
|
---|
256 |
|
---|
257 | /*
|
---|
258 | * Dispatch the fast IOCtl.
|
---|
259 | */
|
---|
260 | supdrvIOCtlFast(iFunction, 0, &g_DevExt, pSession);
|
---|
261 | supdrvSessionRelease(pSession);
|
---|
262 | return 0;
|
---|
263 | }
|
---|
264 |
|
---|
265 |
|
---|
266 | DECLASM(int) VBoxDrvIOCtl(uint16_t sfn, uint8_t iCat, uint8_t iFunction, void *pvParm, void *pvData, uint16_t *pcbParm, uint16_t *pcbData)
|
---|
267 | {
|
---|
268 | /*
|
---|
269 | * Find the session.
|
---|
270 | */
|
---|
271 | const RTPROCESS Process = RTProcSelf();
|
---|
272 | const unsigned iHash = SESSION_HASH(sfn);
|
---|
273 | PSUPDRVSESSION pSession;
|
---|
274 |
|
---|
275 | RTSpinlockAcquire(g_Spinlock);
|
---|
276 | pSession = g_apSessionHashTab[iHash];
|
---|
277 | if (pSession && pSession->Process != Process)
|
---|
278 | {
|
---|
279 | do pSession = pSession->pNextHash;
|
---|
280 | while ( pSession
|
---|
281 | && ( pSession->sfn != sfn
|
---|
282 | || pSession->Process != Process));
|
---|
283 |
|
---|
284 | if (RT_LIKELY(pSession))
|
---|
285 | supdrvSessionRetain(pSession);
|
---|
286 | }
|
---|
287 | RTSpinlockReleaseNoInts(g_Spinlock);
|
---|
288 | if (!pSession)
|
---|
289 | {
|
---|
290 | OSDBGPRINT(("VBoxDrvIoctl: WHUT?!? pSession == NULL! This must be a mistake... pid=%d\n", (int)Process));
|
---|
291 | return VERR_INVALID_PARAMETER;
|
---|
292 | }
|
---|
293 |
|
---|
294 | /*
|
---|
295 | * Verify the category and dispatch the IOCtl.
|
---|
296 | */
|
---|
297 | if (RT_LIKELY(iCat == SUP_CTL_CATEGORY))
|
---|
298 | {
|
---|
299 | Log(("VBoxDrvIOCtl: pSession=%p iFunction=%#x pvParm=%p pvData=%p *pcbParm=%d *pcbData=%d\n", pSession, iFunction, pvParm, pvData, *pcbParm, *pcbData));
|
---|
300 | Assert(pvParm);
|
---|
301 | Assert(!pvData);
|
---|
302 |
|
---|
303 | /*
|
---|
304 | * Lock the header.
|
---|
305 | */
|
---|
306 | PSUPREQHDR pHdr = (PSUPREQHDR)pvParm;
|
---|
307 | AssertReturn(*pcbParm == sizeof(*pHdr), VERR_INVALID_PARAMETER);
|
---|
308 | KernVMLock_t Lock;
|
---|
309 | int rc = KernVMLock(VMDHL_WRITE, pHdr, *pcbParm, &Lock, (KernPageList_t *)-1, NULL);
|
---|
310 | AssertMsgReturn(!rc, ("KernVMLock(VMDHL_WRITE, %p, %#x, &p, NULL, NULL) -> %d\n", pHdr, *pcbParm, &Lock, rc), VERR_LOCK_FAILED);
|
---|
311 |
|
---|
312 | /*
|
---|
313 | * Validate the header.
|
---|
314 | */
|
---|
315 | if (RT_LIKELY((pHdr->fFlags & SUPREQHDR_FLAGS_MAGIC_MASK) == SUPREQHDR_FLAGS_MAGIC))
|
---|
316 | {
|
---|
317 | uint32_t cbReq = RT_MAX(pHdr->cbIn, pHdr->cbOut);
|
---|
318 | if (RT_LIKELY( pHdr->cbIn >= sizeof(*pHdr)
|
---|
319 | && pHdr->cbOut >= sizeof(*pHdr)
|
---|
320 | && cbReq <= _1M*16))
|
---|
321 | {
|
---|
322 | /*
|
---|
323 | * Lock the rest of the buffer if necessary.
|
---|
324 | */
|
---|
325 | if (((uintptr_t)pHdr & PAGE_OFFSET_MASK) + cbReq > PAGE_SIZE)
|
---|
326 | {
|
---|
327 | rc = KernVMUnlock(&Lock);
|
---|
328 | AssertMsgReturn(!rc, ("KernVMUnlock(Lock) -> %#x\n", rc), VERR_LOCK_FAILED);
|
---|
329 |
|
---|
330 | rc = KernVMLock(VMDHL_WRITE, pHdr, cbReq, &Lock, (KernPageList_t *)-1, NULL);
|
---|
331 | AssertMsgReturn(!rc, ("KernVMLock(VMDHL_WRITE, %p, %#x, &p, NULL, NULL) -> %d\n", pHdr, cbReq, &Lock, rc), VERR_LOCK_FAILED);
|
---|
332 | }
|
---|
333 |
|
---|
334 | /*
|
---|
335 | * Process the IOCtl.
|
---|
336 | */
|
---|
337 | rc = supdrvIOCtl(iFunction, &g_DevExt, pSession, pHdr);
|
---|
338 | }
|
---|
339 | else
|
---|
340 | {
|
---|
341 | OSDBGPRINT(("VBoxDrvIOCtl: max(%#x,%#x); iCmd=%#x\n", pHdr->cbIn, pHdr->cbOut, iFunction));
|
---|
342 | rc = VERR_INVALID_PARAMETER;
|
---|
343 | }
|
---|
344 | }
|
---|
345 | else
|
---|
346 | {
|
---|
347 | OSDBGPRINT(("VBoxDrvIOCtl: bad magic fFlags=%#x; iCmd=%#x\n", pHdr->fFlags, iFunction));
|
---|
348 | rc = VERR_INVALID_PARAMETER;
|
---|
349 | }
|
---|
350 |
|
---|
351 | /*
|
---|
352 | * Unlock and return.
|
---|
353 | */
|
---|
354 | int rc2 = KernVMUnlock(&Lock);
|
---|
355 | AssertMsg(!rc2, ("rc2=%d\n", rc2)); NOREF(rc2);s
|
---|
356 | }
|
---|
357 | else
|
---|
358 | rc = VERR_NOT_SUPPORTED;
|
---|
359 |
|
---|
360 | supdrvSessionRelease(pSession);
|
---|
361 | Log2(("VBoxDrvIOCtl: returns %d\n", rc));
|
---|
362 | return rc;
|
---|
363 | }
|
---|
364 |
|
---|
365 |
|
---|
366 | void VBOXCALL supdrvOSCleanupSession(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession)
|
---|
367 | {
|
---|
368 | NOREF(pDevExt);
|
---|
369 | NOREF(pSession);
|
---|
370 | }
|
---|
371 |
|
---|
372 |
|
---|
373 | void VBOXCALL supdrvOSSessionHashTabInserted(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, void *pvUser)
|
---|
374 | {
|
---|
375 | NOREF(pDevExt); NOREF(pSession); NOREF(pvUser);
|
---|
376 | }
|
---|
377 |
|
---|
378 |
|
---|
379 | void VBOXCALL supdrvOSSessionHashTabRemoved(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, void *pvUser)
|
---|
380 | {
|
---|
381 | NOREF(pDevExt); NOREF(pSession); NOREF(pvUser);
|
---|
382 | }
|
---|
383 |
|
---|
384 |
|
---|
385 | void VBOXCALL supdrvOSObjInitCreator(PSUPDRVOBJ pObj, PSUPDRVSESSION pSession)
|
---|
386 | {
|
---|
387 | NOREF(pObj);
|
---|
388 | NOREF(pSession);
|
---|
389 | }
|
---|
390 |
|
---|
391 |
|
---|
392 | bool VBOXCALL supdrvOSObjCanAccess(PSUPDRVOBJ pObj, PSUPDRVSESSION pSession, const char *pszObjName, int *prc)
|
---|
393 | {
|
---|
394 | NOREF(pObj);
|
---|
395 | NOREF(pSession);
|
---|
396 | NOREF(pszObjName);
|
---|
397 | NOREF(prc);
|
---|
398 | return false;
|
---|
399 | }
|
---|
400 |
|
---|
401 |
|
---|
402 | bool VBOXCALL supdrvOSGetForcedAsyncTscMode(PSUPDRVDEVEXT pDevExt)
|
---|
403 | {
|
---|
404 | NOREF(pDevExt);
|
---|
405 | return false;
|
---|
406 | }
|
---|
407 |
|
---|
408 |
|
---|
409 | int VBOXCALL supdrvOSLdrOpen(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, const char *pszFilename)
|
---|
410 | {
|
---|
411 | NOREF(pDevExt); NOREF(pImage); NOREF(pszFilename);
|
---|
412 | return VERR_NOT_SUPPORTED;
|
---|
413 | }
|
---|
414 |
|
---|
415 |
|
---|
416 | void VBOXCALL supdrvOSLdrNotifyOpened(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage)
|
---|
417 | {
|
---|
418 | NOREF(pDevExt); NOREF(pImage);
|
---|
419 | }
|
---|
420 |
|
---|
421 |
|
---|
422 | int VBOXCALL supdrvOSLdrValidatePointer(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, void *pv, const uint8_t *pbImageBits)
|
---|
423 | {
|
---|
424 | NOREF(pDevExt); NOREF(pImage); NOREF(pv); NOREF(pbImageBits);
|
---|
425 | return VERR_NOT_SUPPORTED;
|
---|
426 | }
|
---|
427 |
|
---|
428 |
|
---|
429 | int VBOXCALL supdrvOSLdrLoad(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, const uint8_t *pbImageBits, PSUPLDRLOAD pReq)
|
---|
430 | {
|
---|
431 | NOREF(pDevExt); NOREF(pImage); NOREF(pbImageBits); NOREF(pReq);
|
---|
432 | return VERR_NOT_SUPPORTED;
|
---|
433 | }
|
---|
434 |
|
---|
435 |
|
---|
436 | void VBOXCALL supdrvOSLdrUnload(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage)
|
---|
437 | {
|
---|
438 | NOREF(pDevExt); NOREF(pImage);
|
---|
439 | }
|
---|
440 |
|
---|
441 |
|
---|
442 | #ifdef SUPDRV_WITH_MSR_PROBER
|
---|
443 |
|
---|
444 | int VBOXCALL supdrvOSMsrProberRead(uint32_t uMsr, RTCPUID idCpu, uint64_t *puValue)
|
---|
445 | {
|
---|
446 | NOREF(uMsr); NOREF(idCpu); NOREF(puValue);
|
---|
447 | return VERR_NOT_SUPPORTED;
|
---|
448 | }
|
---|
449 |
|
---|
450 |
|
---|
451 | int VBOXCALL supdrvOSMsrProberWrite(uint32_t uMsr, RTCPUID idCpu, uint64_t uValue)
|
---|
452 | {
|
---|
453 | NOREF(uMsr); NOREF(idCpu); NOREF(uValue);
|
---|
454 | return VERR_NOT_SUPPORTED;
|
---|
455 | }
|
---|
456 |
|
---|
457 |
|
---|
458 | int VBOXCALL supdrvOSMsrProberModify(RTCPUID idCpu, PSUPMSRPROBER pReq)
|
---|
459 | {
|
---|
460 | NOREF(idCpu); NOREF(pReq);
|
---|
461 | return VERR_NOT_SUPPORTED;
|
---|
462 | }
|
---|
463 |
|
---|
464 | #endif /* SUPDRV_WITH_MSR_PROBER */
|
---|
465 |
|
---|
466 |
|
---|
467 | /**
|
---|
468 | * Callback for writing to the log buffer.
|
---|
469 | *
|
---|
470 | * @returns number of bytes written.
|
---|
471 | * @param pvArg Unused.
|
---|
472 | * @param pachChars Pointer to an array of utf-8 characters.
|
---|
473 | * @param cbChars Number of bytes in the character array pointed to by pachChars.
|
---|
474 | */
|
---|
475 | static DECLCALLBACK(size_t) VBoxDrvLogOutput(void *pvArg, const char *pachChars, size_t cbChars)
|
---|
476 | {
|
---|
477 | size_t cchWritten = 0;
|
---|
478 | while (cbChars-- > 0)
|
---|
479 | {
|
---|
480 | const uint16_t offLogHead = g_offLogHead;
|
---|
481 | const uint16_t offLogHeadNext = (offLogHead + 1) & (g_cchLogMax - 1);
|
---|
482 | if (offLogHeadNext == g_offLogTail)
|
---|
483 | break; /* no */
|
---|
484 | g_szLog[offLogHead] = *pachChars++;
|
---|
485 | g_offLogHead = offLogHeadNext;
|
---|
486 | cchWritten++;
|
---|
487 | }
|
---|
488 | return cchWritten;
|
---|
489 | }
|
---|
490 |
|
---|
491 |
|
---|
492 | SUPR0DECL(int) SUPR0Printf(const char *pszFormat, ...)
|
---|
493 | {
|
---|
494 | va_list va;
|
---|
495 |
|
---|
496 | #if 0 //def DEBUG_bird
|
---|
497 | va_start(va, pszFormat);
|
---|
498 | RTLogComPrintfV(pszFormat, va);
|
---|
499 | va_end(va);
|
---|
500 | #endif
|
---|
501 |
|
---|
502 | va_start(va, pszFormat);
|
---|
503 | int cch = RTLogFormatV(VBoxDrvLogOutput, NULL, pszFormat, va);
|
---|
504 | va_end(va);
|
---|
505 |
|
---|
506 | return cch;
|
---|
507 | }
|
---|