VirtualBox

source: vbox/trunk/src/VBox/Runtime/r0drv/solaris/vbi/memobj-r0drv-solaris.c@ 36555

最後變更 在這個檔案從36555是 36555,由 vboxsync 提交於 14 年 前

Use DECLHIDDEN, especially in IPRT.

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 17.4 KB
 
1/* $Id: memobj-r0drv-solaris.c 36555 2011-04-05 12:34:09Z vboxsync $ */
2/** @file
3 * IPRT - Ring-0 Memory Objects, Solaris.
4 */
5
6/*
7 * Copyright (C) 2006-2007 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.alldomusa.eu.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
28/*******************************************************************************
29* Header Files *
30*******************************************************************************/
31#include "../the-solaris-kernel.h"
32#include "internal/iprt.h"
33#include <iprt/memobj.h>
34
35#include <iprt/assert.h>
36#include <iprt/err.h>
37#include <iprt/log.h>
38#include <iprt/mem.h>
39#include <iprt/param.h>
40#include <iprt/process.h>
41#include "internal/memobj.h"
42
43/*******************************************************************************
44* Structures and Typedefs *
45*******************************************************************************/
46/**
47 * The Solaris version of the memory object structure.
48 */
49typedef struct RTR0MEMOBJSOLARIS
50{
51 /** The core structure. */
52 RTR0MEMOBJINTERNAL Core;
53 /** Pointer to kernel memory cookie. */
54 ddi_umem_cookie_t Cookie;
55 /** Shadow locked pages. */
56 void *pvHandle;
57 /** Access during locking. */
58 int fAccess;
59} RTR0MEMOBJSOLARIS, *PRTR0MEMOBJSOLARIS;
60
61
62
63DECLHIDDEN(int) rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
64{
65 PRTR0MEMOBJSOLARIS pMemSolaris = (PRTR0MEMOBJSOLARIS)pMem;
66
67 switch (pMemSolaris->Core.enmType)
68 {
69 case RTR0MEMOBJTYPE_LOW:
70 vbi_lowmem_free(pMemSolaris->Core.pv, pMemSolaris->Core.cb);
71 break;
72
73 case RTR0MEMOBJTYPE_CONT:
74 case RTR0MEMOBJTYPE_PHYS:
75 vbi_phys_free(pMemSolaris->Core.pv, pMemSolaris->Core.cb);
76 break;
77
78 case RTR0MEMOBJTYPE_PHYS_NC:
79#if 0
80 vbi_phys_free(pMemSolaris->Core.pv, pMemSolaris->Core.cb);
81#else
82 if (pMemSolaris->Core.u.Phys.fAllocated == true)
83 ddi_umem_free(pMemSolaris->Cookie);
84 else
85 vbi_pages_free(pMemSolaris->pvHandle, pMemSolaris->Core.cb);
86#endif
87 break;
88
89 case RTR0MEMOBJTYPE_PAGE:
90 ddi_umem_free(pMemSolaris->Cookie);
91 break;
92
93 case RTR0MEMOBJTYPE_LOCK:
94 vbi_unlock_va(pMemSolaris->Core.pv, pMemSolaris->Core.cb, pMemSolaris->fAccess, pMemSolaris->pvHandle);
95 break;
96
97 case RTR0MEMOBJTYPE_MAPPING:
98 vbi_unmap(pMemSolaris->Core.pv, pMemSolaris->Core.cb);
99 break;
100
101 case RTR0MEMOBJTYPE_RES_VIRT:
102 {
103 if (pMemSolaris->Core.u.ResVirt.R0Process == NIL_RTR0PROCESS)
104 vmem_xfree(heap_arena, pMemSolaris->Core.pv, pMemSolaris->Core.cb);
105 else
106 AssertFailed();
107 break;
108 }
109
110 default:
111 AssertMsgFailed(("enmType=%d\n", pMemSolaris->Core.enmType));
112 return VERR_INTERNAL_ERROR;
113 }
114
115 return VINF_SUCCESS;
116}
117
118
119DECLHIDDEN(int) rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
120{
121 /* Create the object. */
122 PRTR0MEMOBJSOLARIS pMemSolaris = (PRTR0MEMOBJSOLARIS)rtR0MemObjNew(sizeof(*pMemSolaris), RTR0MEMOBJTYPE_PAGE, NULL, cb);
123 if (!pMemSolaris)
124 return VERR_NO_MEMORY;
125
126 void *virtAddr = ddi_umem_alloc(cb, DDI_UMEM_SLEEP, &pMemSolaris->Cookie);
127 if (!virtAddr)
128 {
129 rtR0MemObjDelete(&pMemSolaris->Core);
130 return VERR_NO_PAGE_MEMORY;
131 }
132
133 pMemSolaris->Core.pv = virtAddr;
134 pMemSolaris->pvHandle = NULL;
135 *ppMem = &pMemSolaris->Core;
136 return VINF_SUCCESS;
137}
138
139
140DECLHIDDEN(int) rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
141{
142 NOREF(fExecutable);
143
144 /* Create the object */
145 PRTR0MEMOBJSOLARIS pMemSolaris = (PRTR0MEMOBJSOLARIS)rtR0MemObjNew(sizeof(*pMemSolaris), RTR0MEMOBJTYPE_LOW, NULL, cb);
146 if (!pMemSolaris)
147 return VERR_NO_MEMORY;
148
149 /* Allocate physically low page-aligned memory. */
150 uint64_t physAddr = _4G - 1;
151 caddr_t virtAddr = vbi_lowmem_alloc(physAddr, cb);
152 if (virtAddr == NULL)
153 {
154 rtR0MemObjDelete(&pMemSolaris->Core);
155 return VERR_NO_LOW_MEMORY;
156 }
157 pMemSolaris->Core.pv = virtAddr;
158 pMemSolaris->pvHandle = NULL;
159 *ppMem = &pMemSolaris->Core;
160 return VINF_SUCCESS;
161}
162
163
164DECLHIDDEN(int) rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
165{
166 NOREF(fExecutable);
167 return rtR0MemObjNativeAllocPhys(ppMem, cb, _4G - 1, PAGE_SIZE /* alignment */);
168}
169
170
171DECLHIDDEN(int) rtR0MemObjNativeAllocPhysNC(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest)
172{
173#if HC_ARCH_BITS == 64
174 PRTR0MEMOBJSOLARIS pMemSolaris = (PRTR0MEMOBJSOLARIS)rtR0MemObjNew(sizeof(*pMemSolaris), RTR0MEMOBJTYPE_PHYS_NC, NULL, cb);
175 if (!pMemSolaris)
176 return VERR_NO_MEMORY;
177
178 /* Allocate physically non-contiguous page-aligned memory. */
179 uint64_t physAddr = PhysHighest;
180
181# if 0
182 /*
183 * The contig_alloc() way of allocating NC pages is broken or does not match our semantics. Refer #4716 for details.
184 */
185# if 0
186 /* caddr_t virtAddr = vbi_phys_alloc(&physAddr, cb, PAGE_SIZE, 0 /* non-contiguous */);
187# endif
188 caddr_t virtAddr = ddi_umem_alloc(cb, DDI_UMEM_SLEEP, &pMemSolaris->Cookie);
189 if (RT_UNLIKELY(virtAddr == NULL))
190 {
191 rtR0MemObjDelete(&pMemSolaris->Core);
192 return VERR_NO_MEMORY;
193 }
194 pMemSolaris->Core.pv = virtAddr;
195 pMemSolaris->Core.u.Phys.PhysBase = physAddr;
196 pMemSolaris->Core.u.Phys.fAllocated = true;
197 pMemSolaris->pvHandle = NULL;
198# else
199 void *pvPages = vbi_pages_alloc(&physAddr, cb);
200 if (!pvPages)
201 {
202 LogRel(("rtR0MemObjNativeAllocPhysNC: vbi_pages_alloc failed.\n"));
203 rtR0MemObjDelete(&pMemSolaris->Core);
204 return VERR_NO_MEMORY;
205 }
206 pMemSolaris->Core.pv = NULL;
207 pMemSolaris->Core.u.Phys.PhysBase = physAddr;
208 pMemSolaris->Core.u.Phys.fAllocated = false;
209 pMemSolaris->pvHandle = pvPages;
210# endif
211
212 Assert(!(physAddr & PAGE_OFFSET_MASK));
213 *ppMem = &pMemSolaris->Core;
214 return VINF_SUCCESS;
215#else
216 /** @todo rtR0MemObjNativeAllocPhysNC / solaris */
217 return VERR_NOT_SUPPORTED; /* see the RTR0MemObjAllocPhysNC specs */
218#endif
219}
220
221
222DECLHIDDEN(int) rtR0MemObjNativeAllocPhys(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest, size_t uAlignment)
223{
224 AssertMsgReturn(PhysHighest >= 16 *_1M, ("PhysHigest=%RHp\n", PhysHighest), VERR_NOT_SUPPORTED);
225
226 PRTR0MEMOBJSOLARIS pMemSolaris = (PRTR0MEMOBJSOLARIS)rtR0MemObjNew(sizeof(*pMemSolaris), RTR0MEMOBJTYPE_PHYS, NULL, cb);
227 if (!pMemSolaris)
228 return VERR_NO_MEMORY;
229
230 AssertCompile(NIL_RTHCPHYS == UINT64_MAX);
231
232 /* Allocate physically contiguous memory aligned as specified. */
233 uint64_t physAddr = PhysHighest;
234 caddr_t virtAddr = vbi_phys_alloc(&physAddr, cb, uAlignment, 1 /* contiguous */);
235 if (RT_UNLIKELY(virtAddr == NULL))
236 {
237 rtR0MemObjDelete(&pMemSolaris->Core);
238 return VERR_NO_CONT_MEMORY;
239 }
240 Assert(!(physAddr & PAGE_OFFSET_MASK));
241 Assert(physAddr < PhysHighest);
242 Assert(physAddr + cb <= PhysHighest);
243#if 0
244 if (uAlignment != PAGE_SIZE)
245 {
246 /* uAlignment is always a multiple of PAGE_SIZE */
247 pgcnt_t cPages = (cb + uAlignment - 1) >> PAGE_SHIFT;
248 void *pvPage = virtAddr;
249 while (cPages-- > 0)
250 {
251 uint64_t u64Page = vbi_va_to_pa(pvPage);
252 if (u64Page & (uAlignment - 1))
253 {
254 LogRel(("rtR0MemObjNativeAllocPhys: alignment mismatch! cb=%u uAlignment=%u physAddr=%#x\n", cb, uAlignment, u64Page));
255 vbi_phys_free(virtAddr, cb);
256 rtR0MemObjDelete(&pMemSolaris->Core);
257 return VERR_NO_MEMORY;
258 }
259 pvPage = (void *)((uintptr_t)pvPage + PAGE_SIZE);
260 }
261 }
262#endif
263 pMemSolaris->Core.pv = virtAddr;
264 pMemSolaris->Core.u.Cont.Phys = physAddr;
265 pMemSolaris->pvHandle = NULL;
266 *ppMem = &pMemSolaris->Core;
267 return VINF_SUCCESS;
268}
269
270
271DECLHIDDEN(int) rtR0MemObjNativeEnterPhys(PPRTR0MEMOBJINTERNAL ppMem, RTHCPHYS Phys, size_t cb, uint32_t uCachePolicy)
272{
273 AssertReturn(uCachePolicy == RTMEM_CACHE_POLICY_DONT_CARE, VERR_NOT_SUPPORTED);
274
275 /* Create the object. */
276 PRTR0MEMOBJSOLARIS pMemSolaris = (PRTR0MEMOBJSOLARIS)rtR0MemObjNew(sizeof(*pMemSolaris), RTR0MEMOBJTYPE_PHYS, NULL, cb);
277 if (!pMemSolaris)
278 return VERR_NO_MEMORY;
279
280 /* There is no allocation here, it needs to be mapped somewhere first. */
281 pMemSolaris->Core.u.Phys.fAllocated = false;
282 pMemSolaris->Core.u.Phys.PhysBase = Phys;
283 pMemSolaris->Core.u.Phys.uCachePolicy = uCachePolicy;
284 *ppMem = &pMemSolaris->Core;
285 return VINF_SUCCESS;
286}
287
288
289DECLHIDDEN(int) rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3Ptr, size_t cb, uint32_t fAccess,
290 RTR0PROCESS R0Process)
291{
292 AssertReturn(R0Process == RTR0ProcHandleSelf(), VERR_INVALID_PARAMETER);
293 NOREF(fAccess);
294
295 /* Create the locking object */
296 PRTR0MEMOBJSOLARIS pMemSolaris = (PRTR0MEMOBJSOLARIS)rtR0MemObjNew(sizeof(*pMemSolaris), RTR0MEMOBJTYPE_LOCK, (void *)R3Ptr, cb);
297 if (!pMemSolaris)
298 return VERR_NO_MEMORY;
299
300 int fPageAccess = S_READ;
301 if (fAccess & RTMEM_PROT_WRITE)
302 fPageAccess = S_WRITE;
303 if (fAccess & RTMEM_PROT_EXEC)
304 fPageAccess = S_EXEC;
305 void *pvPageList = NULL;
306
307 /* Lock down user pages */
308 int rc = vbi_lock_va((caddr_t)R3Ptr, cb, fPageAccess, &pvPageList);
309 if (rc != 0)
310 {
311 LogRel(("rtR0MemObjNativeLockUser: vbi_lock_va failed rc=%d\n", rc));
312 rtR0MemObjDelete(&pMemSolaris->Core);
313 return VERR_LOCK_FAILED;
314 }
315
316 pMemSolaris->Core.u.Lock.R0Process = (RTR0PROCESS)vbi_proc();
317 pMemSolaris->pvHandle = pvPageList;
318 pMemSolaris->fAccess = fPageAccess;
319 *ppMem = &pMemSolaris->Core;
320 return VINF_SUCCESS;
321}
322
323
324DECLHIDDEN(int) rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb, uint32_t fAccess)
325{
326 NOREF(fAccess);
327
328 PRTR0MEMOBJSOLARIS pMemSolaris = (PRTR0MEMOBJSOLARIS)rtR0MemObjNew(sizeof(*pMemSolaris), RTR0MEMOBJTYPE_LOCK, pv, cb);
329 if (!pMemSolaris)
330 return VERR_NO_MEMORY;
331
332 int fPageAccess = S_READ;
333 if (fAccess & RTMEM_PROT_WRITE)
334 fPageAccess = S_WRITE;
335 if (fAccess & RTMEM_PROT_EXEC)
336 fPageAccess = S_EXEC;
337 void *pvPageList = NULL;
338 int rc = vbi_lock_va((caddr_t)pv, cb, fPageAccess, &pvPageList);
339 if (rc != 0)
340 {
341 LogRel(("rtR0MemObjNativeLockKernel: vbi_lock_va failed rc=%d\n", rc));
342 rtR0MemObjDelete(&pMemSolaris->Core);
343 return VERR_LOCK_FAILED;
344 }
345
346 pMemSolaris->Core.u.Lock.R0Process = NIL_RTR0PROCESS;
347 pMemSolaris->pvHandle = pvPageList;
348 pMemSolaris->fAccess = fPageAccess;
349 *ppMem = &pMemSolaris->Core;
350 return VINF_SUCCESS;
351}
352
353
354DECLHIDDEN(int) rtR0MemObjNativeReserveKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pvFixed, size_t cb, size_t uAlignment)
355{
356 PRTR0MEMOBJSOLARIS pMemSolaris;
357
358 /*
359 * Use xalloc.
360 */
361 void *pv = vmem_xalloc(heap_arena, cb, uAlignment, 0 /*phase*/, 0 /*nocross*/,
362 NULL /*minaddr*/, NULL /*maxaddr*/, VM_SLEEP);
363 if (RT_UNLIKELY(!pv))
364 return VERR_NO_MEMORY;
365
366 /* Create the object. */
367 pMemSolaris = (PRTR0MEMOBJSOLARIS)rtR0MemObjNew(sizeof(*pMemSolaris), RTR0MEMOBJTYPE_RES_VIRT, pv, cb);
368 if (!pMemSolaris)
369 {
370 LogRel(("rtR0MemObjNativeReserveKernel failed to alloc memory object.\n"));
371 vmem_xfree(heap_arena, pv, cb);
372 return VERR_NO_MEMORY;
373 }
374
375 pMemSolaris->Core.u.ResVirt.R0Process = NIL_RTR0PROCESS;
376 *ppMem = &pMemSolaris->Core;
377 return VINF_SUCCESS;
378}
379
380
381DECLHIDDEN(int) rtR0MemObjNativeReserveUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3PtrFixed, size_t cb, size_t uAlignment, RTR0PROCESS R0Process)
382{
383 return VERR_NOT_SUPPORTED;
384}
385
386
387DECLHIDDEN(int) rtR0MemObjNativeMapKernel(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, void *pvFixed, size_t uAlignment,
388 unsigned fProt, size_t offSub, size_t cbSub)
389{
390 /** @todo rtR0MemObjNativeMapKernel / Solaris - Should be fairly simple alloc kernel memory and memload it. */
391 return VERR_NOT_SUPPORTED;
392}
393
394
395DECLHIDDEN(int) rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, PRTR0MEMOBJINTERNAL pMemToMap, RTR3PTR R3PtrFixed,
396 size_t uAlignment, unsigned fProt, RTR0PROCESS R0Process)
397{
398 AssertMsgReturn(R3PtrFixed == (RTR3PTR)-1, ("%p\n", R3PtrFixed), VERR_NOT_SUPPORTED);
399 AssertMsgReturn(R0Process == RTR0ProcHandleSelf(), ("%p != %p\n", R0Process, RTR0ProcHandleSelf()), VERR_NOT_SUPPORTED);
400 if (uAlignment != PAGE_SIZE)
401 return VERR_NOT_SUPPORTED;
402
403 PRTR0MEMOBJSOLARIS pMemToMapSolaris = (PRTR0MEMOBJSOLARIS)pMemToMap;
404 size_t cb = pMemToMapSolaris->Core.cb;
405 void *pv = pMemToMapSolaris->Core.pv;
406 pgcnt_t cPages = (cb + PAGE_SIZE - 1) >> PAGE_SHIFT;
407
408 /* Create the mapping object */
409 PRTR0MEMOBJSOLARIS pMemSolaris = (PRTR0MEMOBJSOLARIS)rtR0MemObjNew(sizeof(*pMemSolaris), RTR0MEMOBJTYPE_MAPPING, pv, cb);
410 if (RT_UNLIKELY(!pMemSolaris))
411 return VERR_NO_MEMORY;
412
413 uint64_t *paPhysAddrs = kmem_zalloc(sizeof(uint64_t) * cPages, KM_SLEEP);
414 if (RT_UNLIKELY(!paPhysAddrs))
415 return VERR_NO_MEMORY;
416
417 if ( pMemToMapSolaris->Core.enmType == RTR0MEMOBJTYPE_PHYS_NC
418 && pMemSolaris->Core.u.Phys.fAllocated == false)
419 {
420 /*
421 * The PhysNC object has no kernel mapping backing it. The call to vbi_pages_premap()
422 * prepares the physical pages to be mapped into user or kernel space.
423 */
424 int rc = vbi_pages_premap(pMemToMapSolaris->pvHandle, cb, paPhysAddrs);
425 if (rc)
426 {
427 LogRel(("rtR0MemObjNativeMapUser: vbi_pages_premap failed. rc=%d\n", rc));
428 kmem_free(paPhysAddrs, sizeof(uint64_t) * cPages);
429 rtR0MemObjDelete(&pMemSolaris->Core);
430 return VERR_MAP_FAILED;
431 }
432 }
433 else
434 {
435 /*
436 * All other memory object types have allocated memory with kernel mappings.
437 */
438 for (pgcnt_t iPage = 0; iPage < cPages; iPage++)
439 {
440 paPhysAddrs[iPage] = vbi_va_to_pa(pv);
441 if (RT_UNLIKELY(paPhysAddrs[iPage] == -(uint64_t)1))
442 {
443 LogRel(("rtR0MemObjNativeMapUser: no page to map.\n"));
444 kmem_free(paPhysAddrs, sizeof(uint64_t) * cPages);
445 rtR0MemObjDelete(&pMemSolaris->Core);
446 return VERR_MAP_FAILED;
447 }
448 pv = (void *)((uintptr_t)pv + PAGE_SIZE);
449 }
450 }
451
452 caddr_t virtAddr = NULL;
453 int rc = vbi_user_map(&virtAddr, fProt, paPhysAddrs, cb);
454 if (rc != 0)
455 {
456 LogRel(("rtR0MemObjNativeMapUser: vbi mapping failure.\n"));
457 kmem_free(paPhysAddrs, sizeof(uint64_t) * cPages);
458 rtR0MemObjDelete(&pMemSolaris->Core);
459 return VERR_MAP_FAILED;
460 }
461
462 pMemSolaris->Core.u.Mapping.R0Process = (RTR0PROCESS)vbi_proc();
463 pMemSolaris->Core.pv = virtAddr;
464 *ppMem = &pMemSolaris->Core;
465 kmem_free(paPhysAddrs, sizeof(uint64_t) * cPages);
466 return VINF_SUCCESS;
467}
468
469
470DECLHIDDEN(int) rtR0MemObjNativeProtect(PRTR0MEMOBJINTERNAL pMem, size_t offSub, size_t cbSub, uint32_t fProt)
471{
472 NOREF(pMem);
473 NOREF(offSub);
474 NOREF(cbSub);
475 NOREF(fProt);
476 return VERR_NOT_SUPPORTED;
477}
478
479
480DECLHIDDEN(RTHCPHYS) rtR0MemObjNativeGetPagePhysAddr(PRTR0MEMOBJINTERNAL pMem, size_t iPage)
481{
482 PRTR0MEMOBJSOLARIS pMemSolaris = (PRTR0MEMOBJSOLARIS)pMem;
483
484 switch (pMemSolaris->Core.enmType)
485 {
486 case RTR0MEMOBJTYPE_PAGE:
487 case RTR0MEMOBJTYPE_LOW:
488 case RTR0MEMOBJTYPE_LOCK:
489 {
490 uint8_t *pb = (uint8_t *)pMemSolaris->Core.pv + ((size_t)iPage << PAGE_SHIFT);
491 return vbi_va_to_pa(pb);
492 }
493
494 /*
495 * Although mapping can be handled by vbi_va_to_pa(offset) like the above case,
496 * request it from the parent so that we have a clear distinction between CONT/PHYS_NC.
497 */
498 case RTR0MEMOBJTYPE_MAPPING:
499 return rtR0MemObjNativeGetPagePhysAddr(pMemSolaris->Core.uRel.Child.pParent, iPage);
500
501 case RTR0MEMOBJTYPE_CONT:
502 case RTR0MEMOBJTYPE_PHYS:
503 return pMemSolaris->Core.u.Cont.Phys + (iPage << PAGE_SHIFT);
504
505 case RTR0MEMOBJTYPE_PHYS_NC:
506 if (pMemSolaris->Core.u.Phys.fAllocated == true)
507 {
508 uint8_t *pb = (uint8_t *)pMemSolaris->Core.pv + ((size_t)iPage << PAGE_SHIFT);
509 return vbi_va_to_pa(pb);
510 }
511 return vbi_page_to_pa(pMemSolaris->pvHandle, iPage);
512
513 case RTR0MEMOBJTYPE_RES_VIRT:
514 default:
515 return NIL_RTHCPHYS;
516 }
517}
518
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette