VirtualBox

source: vbox/trunk/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c@ 7352

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

Handle RTR0MEMOBJTYPE_PHYS_NC during free.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Rev
File size: 36.6 KB
Line 
1/* $Revision: 6477 $ */
2/** @file
3 * innotek Portable Runtime - Ring-0 Memory Objects, Linux.
4 */
5
6/*
7 * Copyright (C) 2006-2007 innotek GmbH
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
28/*******************************************************************************
29* Header Files *
30*******************************************************************************/
31#include "the-linux-kernel.h"
32
33#include <iprt/memobj.h>
34#include <iprt/alloc.h>
35#include <iprt/assert.h>
36#include <iprt/log.h>
37#include <iprt/string.h>
38#include <iprt/process.h>
39#include "internal/memobj.h"
40
41/* early 2.6 kernels */
42#ifndef PAGE_SHARED_EXEC
43# define PAGE_SHARED_EXEC PAGE_SHARED
44#endif
45#ifndef PAGE_READONLY_EXEC
46# define PAGE_READONLY_EXEC PAGE_READONLY
47#endif
48
49
50/*******************************************************************************
51* Structures and Typedefs *
52*******************************************************************************/
53/**
54 * The Darwin version of the memory object structure.
55 */
56typedef struct RTR0MEMOBJLNX
57{
58 /** The core structure. */
59 RTR0MEMOBJINTERNAL Core;
60 /** Set if the allocation is contiguous.
61 * This means it has to be given back as one chunk. */
62 bool fContiguous;
63 /** Set if we've vmap'ed thed memory into ring-0. */
64 bool fMappedToRing0;
65 /** The pages in the apPages array. */
66 size_t cPages;
67 /** Array of struct page pointers. (variable size) */
68 struct page *apPages[1];
69} RTR0MEMOBJLNX, *PRTR0MEMOBJLNX;
70
71
72/**
73 * Helper that converts from a RTR0PROCESS handle to a linux task.
74 *
75 * @returns The corresponding Linux task.
76 * @param R0Process IPRT ring-0 process handle.
77 */
78struct task_struct *rtR0ProcessToLinuxTask(RTR0PROCESS R0Process)
79{
80 /** @todo fix rtR0ProcessToLinuxTask!! */
81 return R0Process == RTR0ProcHandleSelf() ? current : NULL;
82}
83
84
85/**
86 * Compute order. Some functions allocate 2^order pages.
87 *
88 * @returns order.
89 * @param cPages Number of pages.
90 */
91static int rtR0MemObjLinuxOrder(size_t cPages)
92{
93 int iOrder;
94 size_t cTmp;
95
96 for (iOrder = 0, cTmp = cPages; cTmp >>= 1; ++iOrder)
97 ;
98 if (cPages & ~((size_t)1 << iOrder))
99 ++iOrder;
100
101 return iOrder;
102}
103
104
105/**
106 * Converts from RTMEM_PROT_* to Linux PAGE_*.
107 *
108 * @returns Linux page protection constant.
109 * @param fProt The IPRT protection mask.
110 * @param fKernel Whether it applies to kernel or user space.
111 */
112static pgprot_t rtR0MemObjLinuxConvertProt(unsigned fProt, bool fKernel)
113{
114 switch (fProt)
115 {
116 default:
117 AssertMsgFailed(("%#x %d\n", fProt, fKernel));
118 case RTMEM_PROT_NONE:
119 return PAGE_NONE;
120
121 case RTMEM_PROT_READ:
122 return fKernel ? PAGE_KERNEL_RO : PAGE_READONLY;
123
124 case RTMEM_PROT_WRITE:
125 case RTMEM_PROT_WRITE | RTMEM_PROT_READ:
126 return fKernel ? PAGE_KERNEL : PAGE_SHARED;
127
128 case RTMEM_PROT_EXEC:
129 case RTMEM_PROT_EXEC | RTMEM_PROT_READ:
130#if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)
131 if (fKernel)
132 {
133 pgprot_t fPg = MY_PAGE_KERNEL_EXEC;
134 pgprot_val(fPg) &= ~_PAGE_RW;
135 return fPg;
136 }
137 return PAGE_READONLY_EXEC;
138#else
139 return fKernel ? MY_PAGE_KERNEL_EXEC : PAGE_READONLY_EXEC;
140#endif
141
142 case RTMEM_PROT_WRITE | RTMEM_PROT_EXEC:
143 case RTMEM_PROT_WRITE | RTMEM_PROT_EXEC | RTMEM_PROT_READ:
144 return fKernel ? MY_PAGE_KERNEL_EXEC : PAGE_SHARED_EXEC;
145 }
146}
147
148
149/**
150 * Internal worker that allocates physical pages and creates the memory object for them.
151 *
152 * @returns IPRT status code.
153 * @param ppMemLnx Where to store the memory object pointer.
154 * @param enmType The object type.
155 * @param cb The number of bytes to allocate.
156 * @param fFlagsLnx The page allocation flags (GPFs).
157 * @param fContiguous Whether the allocation must be contiguous.
158 */
159static int rtR0MemObjLinuxAllocPages(PRTR0MEMOBJLNX *ppMemLnx, RTR0MEMOBJTYPE enmType, size_t cb, unsigned fFlagsLnx, bool fContiguous)
160{
161 size_t iPage;
162 size_t cPages = cb >> PAGE_SHIFT;
163 struct page *paPages;
164
165 /*
166 * Allocate a memory object structure that's large enough to contain
167 * the page pointer array.
168 */
169 PRTR0MEMOBJLNX pMemLnx = (PRTR0MEMOBJLNX)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJLNX, apPages[cPages]), enmType, NULL, cb);
170 if (!pMemLnx)
171 return VERR_NO_MEMORY;
172 pMemLnx->cPages = cPages;
173
174 /*
175 * Allocate the pages.
176 * For small allocations we'll try contiguous first and then fall back on page by page.
177 */
178#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 22)
179 if ( fContiguous
180 || cb <= PAGE_SIZE * 2)
181 {
182 paPages = alloc_pages(fFlagsLnx, rtR0MemObjLinuxOrder(cb >> PAGE_SHIFT));
183 if (paPages)
184 {
185 fContiguous = true;
186 for (iPage = 0; iPage < cPages; iPage++)
187 pMemLnx->apPages[iPage] = &paPages[iPage];
188 }
189 else if (fContiguous)
190 {
191 rtR0MemObjDelete(&pMemLnx->Core);
192 return VERR_NO_MEMORY;
193 }
194 }
195
196 if (!fContiguous)
197 {
198 for (iPage = 0; iPage < cPages; iPage++)
199 {
200 pMemLnx->apPages[iPage] = alloc_page(fFlagsLnx);
201 if (RT_UNLIKELY(!pMemLnx->apPages[iPage]))
202 {
203 while (iPage-- > 0)
204 __free_page(pMemLnx->apPages[iPage]);
205 rtR0MemObjDelete(&pMemLnx->Core);
206 return VERR_NO_MEMORY;
207 }
208 }
209 }
210
211#else /* < 2.4.22 */
212 /** @todo figure out why we didn't allocate page-by-page on 2.4.21 and older... */
213 paPages = alloc_pages(fFlagsLnx, rtR0MemObjLinuxOrder(cb >> PAGE_SHIFT));
214 if (!paPages)
215 {
216 rtR0MemObjDelete(&pMemLnx->Core);
217 return VERR_NO_MEMORY;
218 }
219 for (iPage = 0; iPage < cPages; iPage++)
220 {
221 pMemLnx->apPages[iPage] = &paPages[iPage];
222 if (pgprot_val(MY_PAGE_KERNEL_EXEC) != pgprot_val(PAGE_KERNEL))
223 MY_CHANGE_PAGE_ATTR(pMemLnx->apPages[iPage], 1, MY_PAGE_KERNEL_EXEC);
224 if (PageHighMem(pMemLnx->apPages[iPage]))
225 BUG();
226 }
227
228 fContiguous = true;
229#endif /* < 2.4.22 */
230 pMemLnx->fContiguous = fContiguous;
231
232 /*
233 * Reserve the pages.
234 */
235 for (iPage = 0; iPage < cPages; iPage++)
236 SetPageReserved(pMemLnx->apPages[iPage]);
237
238 *ppMemLnx = pMemLnx;
239 return VINF_SUCCESS;
240}
241
242
243/**
244 * Frees the physical pages allocated by the rtR0MemObjLinuxAllocPages() call.
245 *
246 * This method does NOT free the object.
247 *
248 * @param pMemLnx The object which physical pages should be freed.
249 */
250static void rtR0MemObjLinuxFreePages(PRTR0MEMOBJLNX pMemLnx)
251{
252 size_t iPage = pMemLnx->cPages;
253 if (iPage > 0)
254 {
255 /*
256 * Restore the page flags.
257 */
258 while (iPage-- > 0)
259 {
260 ClearPageReserved(pMemLnx->apPages[iPage]);
261#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 22)
262#else
263 if (pgprot_val(MY_PAGE_KERNEL_EXEC) != pgprot_val(PAGE_KERNEL))
264 MY_CHANGE_PAGE_ATTR(pMemLnx->apPages[iPage], 1, PAGE_KERNEL);
265#endif
266 }
267
268 /*
269 * Free the pages.
270 */
271#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 22)
272 if (!pMemLnx->fContiguous)
273 {
274 iPage = pMemLnx->cPages;
275 while (iPage-- > 0)
276 __free_page(pMemLnx->apPages[iPage]);
277 }
278 else
279#endif
280 __free_pages(pMemLnx->apPages[0], rtR0MemObjLinuxOrder(pMemLnx->cPages));
281
282 pMemLnx->cPages = 0;
283 }
284}
285
286
287/**
288 * Maps the allocation into ring-0.
289 *
290 * This will update the RTR0MEMOBJLNX::Core.pv and RTR0MEMOBJ::fMappedToRing0 members.
291 *
292 * Contiguous mappings that isn't in 'high' memory will already be mapped into kernel
293 * space, so we'll use that mapping if possible. If execute access is required, we'll
294 * play safe and do our own mapping.
295 *
296 * @returns IPRT status code.
297 * @param pMemLnx The linux memory object to map.
298 * @param fExecutable Whether execute access is required.
299 */
300static int rtR0MemObjLinuxVMap(PRTR0MEMOBJLNX pMemLnx, bool fExecutable)
301{
302 int rc = VINF_SUCCESS;
303
304 /*
305 * Choose mapping strategy.
306 */
307 bool fMustMap = fExecutable
308 || !pMemLnx->fContiguous;
309 if (!fMustMap)
310 {
311 size_t iPage = pMemLnx->cPages;
312 while (iPage-- > 0)
313 if (PageHighMem(pMemLnx->apPages[iPage]))
314 {
315 fMustMap = true;
316 break;
317 }
318 }
319
320 Assert(!pMemLnx->Core.pv);
321 Assert(!pMemLnx->fMappedToRing0);
322
323 if (fMustMap)
324 {
325 /*
326 * Use vmap - 2.4.22 and later.
327 */
328#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 22)
329 pgprot_t fPg;
330 pgprot_val(fPg) = _PAGE_PRESENT | _PAGE_RW;
331# ifdef _PAGE_NX
332 if (!fExecutable)
333 pgprot_val(fPg) |= _PAGE_NX;
334# endif
335
336# ifdef VM_MAP
337 pMemLnx->Core.pv = vmap(&pMemLnx->apPages[0], pMemLnx->cPages, VM_MAP, fPg);
338# else
339 pMemLnx->Core.pv = vmap(&pMemLnx->apPages[0], pMemLnx->cPages, VM_ALLOC, fPg);
340# endif
341 if (pMemLnx->Core.pv)
342 pMemLnx->fMappedToRing0 = true;
343 else
344 rc = VERR_MAP_FAILED;
345#else /* < 2.4.22 */
346 rc = VERR_NOT_SUPPORTED;
347#endif
348 }
349 else
350 {
351 /*
352 * Use the kernel RAM mapping.
353 */
354 pMemLnx->Core.pv = phys_to_virt(page_to_phys(pMemLnx->apPages[0]));
355 Assert(pMemLnx->Core.pv);
356 }
357
358 return rc;
359}
360
361
362/**
363 * Undos what rtR0MemObjLinuxVMap() did.
364 *
365 * @param pMemLnx The linux memory object.
366 */
367static void rtR0MemObjLinuxVUnmap(PRTR0MEMOBJLNX pMemLnx)
368{
369#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 22)
370 if (pMemLnx->fMappedToRing0)
371 {
372 Assert(pMemLnx->Core.pv);
373 vunmap(pMemLnx->Core.pv);
374 pMemLnx->fMappedToRing0 = false;
375 }
376#else /* < 2.4.22 */
377 Assert(!pMemLnx->fMappedToRing0);
378#endif
379 pMemLnx->Core.pv = NULL;
380}
381
382
383int rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
384{
385 PRTR0MEMOBJLNX pMemLnx = (PRTR0MEMOBJLNX)pMem;
386
387 /*
388 * Release any memory that we've allocated or locked.
389 */
390 switch (pMemLnx->Core.enmType)
391 {
392 case RTR0MEMOBJTYPE_LOW:
393 case RTR0MEMOBJTYPE_PAGE:
394 case RTR0MEMOBJTYPE_CONT:
395 case RTR0MEMOBJTYPE_PHYS:
396 case RTR0MEMOBJTYPE_PHYS_NC:
397 rtR0MemObjLinuxVUnmap(pMemLnx);
398 rtR0MemObjLinuxFreePages(pMemLnx);
399 break;
400
401 case RTR0MEMOBJTYPE_LOCK:
402 if (pMemLnx->Core.u.Lock.R0Process != NIL_RTR0PROCESS)
403 {
404 size_t iPage;
405 struct task_struct *pTask = rtR0ProcessToLinuxTask(pMemLnx->Core.u.Lock.R0Process);
406 Assert(pTask);
407 if (pTask && pTask->mm)
408 down_read(&pTask->mm->mmap_sem);
409
410 iPage = pMemLnx->cPages;
411 while (iPage-- > 0)
412 {
413 if (!PageReserved(pMemLnx->apPages[iPage]))
414 SetPageDirty(pMemLnx->apPages[iPage]);
415 page_cache_release(pMemLnx->apPages[iPage]);
416 }
417
418 if (pTask && pTask->mm)
419 up_read(&pTask->mm->mmap_sem);
420 }
421 else
422 AssertFailed(); /* not implemented for R0 */
423 break;
424
425 case RTR0MEMOBJTYPE_RES_VIRT:
426 Assert(pMemLnx->Core.pv);
427 if (pMemLnx->Core.u.ResVirt.R0Process != NIL_RTR0PROCESS)
428 {
429 struct task_struct *pTask = rtR0ProcessToLinuxTask(pMemLnx->Core.u.Lock.R0Process);
430 Assert(pTask);
431 if (pTask && pTask->mm)
432 {
433 down_write(&pTask->mm->mmap_sem);
434 MY_DO_MUNMAP(pTask->mm, (unsigned long)pMemLnx->Core.pv, pMemLnx->Core.cb);
435 up_write(&pTask->mm->mmap_sem);
436 }
437 }
438 else
439 {
440 vunmap(pMemLnx->Core.pv);
441
442 Assert(pMemLnx->cPages == 1 && pMemLnx->apPages[0] != NULL);
443 __free_page(pMemLnx->apPages[0]);
444 pMemLnx->apPages[0] = NULL;
445 pMemLnx->cPages = 0;
446 }
447 pMemLnx->Core.pv = NULL;
448 break;
449
450 case RTR0MEMOBJTYPE_MAPPING:
451 Assert(pMemLnx->cPages == 0); Assert(pMemLnx->Core.pv);
452 if (pMemLnx->Core.u.ResVirt.R0Process != NIL_RTR0PROCESS)
453 {
454 struct task_struct *pTask = rtR0ProcessToLinuxTask(pMemLnx->Core.u.Lock.R0Process);
455 Assert(pTask);
456 if (pTask && pTask->mm)
457 {
458 down_write(&pTask->mm->mmap_sem);
459 MY_DO_MUNMAP(pTask->mm, (unsigned long)pMemLnx->Core.pv, pMemLnx->Core.cb);
460 up_write(&pTask->mm->mmap_sem);
461 }
462 }
463 else
464 vunmap(pMemLnx->Core.pv);
465 pMemLnx->Core.pv = NULL;
466 break;
467
468 default:
469 AssertMsgFailed(("enmType=%d\n", pMemLnx->Core.enmType));
470 return VERR_INTERNAL_ERROR;
471 }
472 return VINF_SUCCESS;
473}
474
475
476int rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
477{
478 PRTR0MEMOBJLNX pMemLnx;
479 int rc;
480
481#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 22)
482 rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_PAGE, cb, GFP_HIGHUSER, false /* non-contiguous */);
483#else
484 rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_PAGE, cb, GFP_USER, false /* non-contiguous */);
485#endif
486 if (RT_SUCCESS(rc))
487 {
488 rc = rtR0MemObjLinuxVMap(pMemLnx, fExecutable);
489 if (RT_SUCCESS(rc))
490 {
491 *ppMem = &pMemLnx->Core;
492 return rc;
493 }
494
495 rtR0MemObjLinuxFreePages(pMemLnx);
496 rtR0MemObjDelete(&pMemLnx->Core);
497 }
498
499 return rc;
500}
501
502
503int rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
504{
505 PRTR0MEMOBJLNX pMemLnx;
506 int rc;
507
508#ifdef RT_ARCH_AMD64
509# ifdef GFP_DMA32
510 rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_LOW, cb, GFP_DMA32, false /* non-contiguous */);
511 if (RT_FAILURE(rc))
512# endif
513 rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_LOW, cb, GFP_DMA, false /* non-contiguous */);
514#else
515 rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_LOW, cb, GFP_USER, false /* non-contiguous */);
516#endif
517 if (RT_SUCCESS(rc))
518 {
519 rc = rtR0MemObjLinuxVMap(pMemLnx, fExecutable);
520 if (RT_SUCCESS(rc))
521 {
522 *ppMem = &pMemLnx->Core;
523 return rc;
524 }
525
526 rtR0MemObjLinuxFreePages(pMemLnx);
527 rtR0MemObjDelete(&pMemLnx->Core);
528 }
529
530 return rc;
531}
532
533
534int rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
535{
536 PRTR0MEMOBJLNX pMemLnx;
537 int rc;
538
539#ifdef RT_ARCH_AMD64
540# ifdef GFP_DMA32
541 rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_CONT, cb, GFP_DMA32, true /* contiguous */);
542 if (RT_FAILURE(rc))
543# endif
544 rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_CONT, cb, GFP_DMA, true /* contiguous */);
545#else
546 rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_CONT, cb, GFP_USER, true /* contiguous */);
547#endif
548 if (RT_SUCCESS(rc))
549 {
550 rc = rtR0MemObjLinuxVMap(pMemLnx, fExecutable);
551 if (RT_SUCCESS(rc))
552 {
553#ifdef RT_STRICT
554 size_t iPage = pMemLnx->cPages;
555 while (iPage-- > 0)
556 Assert(page_to_phys(pMemLnx->apPages[iPage]) < _4G);
557#endif
558 pMemLnx->Core.u.Cont.Phys = page_to_phys(pMemLnx->apPages[0]);
559 *ppMem = &pMemLnx->Core;
560 return rc;
561 }
562
563 rtR0MemObjLinuxFreePages(pMemLnx);
564 rtR0MemObjDelete(&pMemLnx->Core);
565 }
566
567 return rc;
568}
569
570
571/**
572 * Worker for rtR0MemObjLinuxAllocPhysSub that tries one allocation strategy.
573 *
574 * @returns IPRT status.
575 * @param ppMemLnx Where to
576 * @param enmType The object type.
577 * @param cb The size of the allocation.
578 * @param PhysHighest See rtR0MemObjNativeAllocPhys.
579 * @param fGfp The Linux GFP flags to use for the allocation.
580 */
581static int rtR0MemObjLinuxAllocPhysSub2(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJTYPE enmType, size_t cb, RTHCPHYS PhysHighest, unsigned fGfp)
582{
583 PRTR0MEMOBJLNX pMemLnx;
584 int rc;
585
586 rc = rtR0MemObjLinuxAllocPages(&pMemLnx, enmType, cb, fGfp,
587 enmType == RTR0MEMOBJTYPE_PHYS /* contiguous / non-contiguous */);
588 if (RT_FAILURE(rc))
589 return rc;
590
591 /*
592 * Check the addresses if necessary. (Can be optimized a bit for PHYS.)
593 */
594 if (PhysHighest != NIL_RTHCPHYS)
595 {
596 size_t iPage = pMemLnx->cPages;
597 while (iPage-- > 0)
598 if (page_to_phys(pMemLnx->apPages[iPage]) >= PhysHighest)
599 {
600 rtR0MemObjLinuxFreePages(pMemLnx);
601 rtR0MemObjDelete(&pMemLnx->Core);
602 return VERR_NO_MEMORY;
603 }
604 }
605
606 /*
607 * Complete the object.
608 */
609 if (enmType == RTR0MEMOBJTYPE_PHYS)
610 {
611 pMemLnx->Core.u.Phys.PhysBase = page_to_phys(pMemLnx->apPages[0]);
612 pMemLnx->Core.u.Phys.fAllocated = true;
613 }
614 *ppMem = &pMemLnx->Core;
615 return rc;
616}
617
618
619/**
620 * Worker for rtR0MemObjNativeAllocPhys and rtR0MemObjNativeAllocPhysNC.
621 *
622 * @returns IPRT status.
623 * @param ppMem Where to store the memory object pointer on success.
624 * @param enmType The object type.
625 * @param cb The size of the allocation.
626 * @param PhysHighest See rtR0MemObjNativeAllocPhys.
627 */
628static int rtR0MemObjLinuxAllocPhysSub(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJTYPE enmType, size_t cb, RTHCPHYS PhysHighest)
629{
630 int rc;
631
632 /*
633 * There are two clear cases and that's the <=16MB and anything-goes ones.
634 * When the physical address limit is somewhere inbetween those two we'll
635 * just have to try, starting with HIGHUSER and working our way thru the
636 * different types, hoping we'll get lucky.
637 *
638 * We should probably move this physical address restriction logic up to
639 * the page alloc function as it would be more efficient there. But since
640 * we don't expect this to be a performance issue just yet it can wait.
641 */
642 if (PhysHighest == NIL_RTHCPHYS)
643 rc = rtR0MemObjLinuxAllocPhysSub2(ppMem, enmType, cb, PhysHighest, GFP_HIGHUSER);
644 else if (PhysHighest <= _1M * 16)
645 rc = rtR0MemObjLinuxAllocPhysSub2(ppMem, enmType, cb, PhysHighest, GFP_DMA);
646 else
647 {
648 rc = VERR_NO_MEMORY;
649 if (RT_FAILURE(rc))
650 rc = rtR0MemObjLinuxAllocPhysSub2(ppMem, enmType, cb, PhysHighest, GFP_HIGHUSER);
651 if (RT_FAILURE(rc))
652 rc = rtR0MemObjLinuxAllocPhysSub2(ppMem, enmType, cb, PhysHighest, GFP_USER);
653#ifdef GFP_DMA32
654 if (RT_FAILURE(rc))
655 rc = rtR0MemObjLinuxAllocPhysSub2(ppMem, enmType, cb, PhysHighest, GFP_DMA32);
656#endif
657 if (RT_FAILURE(rc))
658 rc = rtR0MemObjLinuxAllocPhysSub2(ppMem, enmType, cb, PhysHighest, GFP_DMA);
659 }
660 return rc;
661}
662
663
664int rtR0MemObjNativeAllocPhys(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest)
665{
666 return rtR0MemObjLinuxAllocPhysSub(ppMem, RTR0MEMOBJTYPE_PHYS, cb, PhysHighest);
667}
668
669
670int rtR0MemObjNativeAllocPhysNC(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest)
671{
672 return rtR0MemObjLinuxAllocPhysSub(ppMem, RTR0MEMOBJTYPE_PHYS_NC, cb, PhysHighest);
673}
674
675
676int rtR0MemObjNativeEnterPhys(PPRTR0MEMOBJINTERNAL ppMem, RTHCPHYS Phys, size_t cb)
677{
678 /*
679 * All we need to do here is to validate that we can use
680 * ioremap on the specified address (32/64-bit dma_addr_t).
681 */
682 PRTR0MEMOBJLNX pMemLnx;
683 dma_addr_t PhysAddr = Phys;
684 AssertMsgReturn(PhysAddr == Phys, ("%#llx\n", (unsigned long long)Phys), VERR_ADDRESS_TOO_BIG);
685
686 pMemLnx = (PRTR0MEMOBJLNX)rtR0MemObjNew(sizeof(*pMemLnx), RTR0MEMOBJTYPE_PHYS, NULL, cb);
687 if (!pMemLnx)
688 return VERR_NO_MEMORY;
689
690 pMemLnx->Core.u.Phys.PhysBase = PhysAddr;
691 pMemLnx->Core.u.Phys.fAllocated = false;
692 Assert(!pMemLnx->cPages);
693 *ppMem = &pMemLnx->Core;
694 return VINF_SUCCESS;
695}
696
697
698int rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3Ptr, size_t cb, RTR0PROCESS R0Process)
699{
700 const int cPages = cb >> PAGE_SHIFT;
701 struct task_struct *pTask = rtR0ProcessToLinuxTask(R0Process);
702 struct vm_area_struct **papVMAs;
703 PRTR0MEMOBJLNX pMemLnx;
704 int rc = VERR_NO_MEMORY;
705
706 /*
707 * Check for valid task and size overflows.
708 */
709 if (!pTask)
710 return VERR_NOT_SUPPORTED;
711 if (((size_t)cPages << PAGE_SHIFT) != cb)
712 return VERR_OUT_OF_RANGE;
713
714 /*
715 * Allocate the memory object and a temporary buffer for the VMAs.
716 */
717 pMemLnx = (PRTR0MEMOBJLNX)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJLNX, apPages[cPages]), RTR0MEMOBJTYPE_LOCK, (void *)R3Ptr, cb);
718 if (!pMemLnx)
719 return VERR_NO_MEMORY;
720
721 papVMAs = (struct vm_area_struct **)RTMemAlloc(sizeof(*papVMAs) * cPages);
722 if (papVMAs)
723 {
724 down_read(&pTask->mm->mmap_sem);
725
726 /*
727 * Get user pages.
728 */
729 rc = get_user_pages(pTask, /* Task for fault acounting. */
730 pTask->mm, /* Whose pages. */
731 R3Ptr, /* Where from. */
732 cPages, /* How many pages. */
733 1, /* Write to memory. */
734 0, /* force. */
735 &pMemLnx->apPages[0], /* Page array. */
736 papVMAs); /* vmas */
737 if (rc == cPages)
738 {
739 /*
740 * Flush dcache (required?) and protect against fork.
741 */
742 /** @todo The Linux fork() protection will require more work if this API
743 * is to be used for anything but locking VM pages. */
744 while (rc-- > 0)
745 {
746 flush_dcache_page(pMemLnx->apPages[rc]);
747 papVMAs[rc]->vm_flags |= VM_DONTCOPY;
748 }
749
750 up_read(&pTask->mm->mmap_sem);
751
752 RTMemFree(papVMAs);
753
754 pMemLnx->Core.u.Lock.R0Process = R0Process;
755 pMemLnx->cPages = cPages;
756 Assert(!pMemLnx->fMappedToRing0);
757 *ppMem = &pMemLnx->Core;
758
759 return VINF_SUCCESS;
760 }
761
762 /*
763 * Failed - we need to unlock any pages that we succeeded to lock.
764 */
765 while (rc-- > 0)
766 {
767 if (!PageReserved(pMemLnx->apPages[rc]))
768 SetPageDirty(pMemLnx->apPages[rc]);
769 page_cache_release(pMemLnx->apPages[rc]);
770 }
771
772 up_read(&pTask->mm->mmap_sem);
773
774 RTMemFree(papVMAs);
775 rc = VERR_LOCK_FAILED;
776 }
777
778 rtR0MemObjDelete(&pMemLnx->Core);
779 return rc;
780}
781
782
783int rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb)
784{
785 /* What is there to lock? Should/Can we fake this? */
786 return VERR_NOT_SUPPORTED;
787}
788
789
790int rtR0MemObjNativeReserveKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pvFixed, size_t cb, size_t uAlignment)
791{
792#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 22)
793 const size_t cPages = cb >> PAGE_SHIFT;
794 struct page *pDummyPage;
795 struct page **papPages;
796
797 /* check for unsupported stuff. */
798 AssertMsgReturn(pvFixed == (void *)-1, ("%p\n", pvFixed), VERR_NOT_SUPPORTED);
799 AssertMsgReturn(uAlignment <= PAGE_SIZE, ("%#x\n", uAlignment), VERR_NOT_SUPPORTED);
800
801 /*
802 * Allocate a dummy page and create a page pointer array for vmap such that
803 * the dummy page is mapped all over the reserved area.
804 */
805 pDummyPage = alloc_page(GFP_HIGHUSER);
806 if (!pDummyPage)
807 return VERR_NO_MEMORY;
808 papPages = RTMemAlloc(sizeof(*papPages) * cPages);
809 if (papPages)
810 {
811 void *pv;
812 size_t iPage = cPages;
813 while (iPage-- > 0)
814 papPages[iPage] = pDummyPage;
815# ifdef VM_MAP
816 pv = vmap(papPages, cPages, VM_MAP, PAGE_KERNEL_RO);
817# else
818 pv = vmap(papPages, cPages, VM_ALLOC, PAGE_KERNEL_RO);
819# endif
820 RTMemFree(papPages);
821 if (pv)
822 {
823 PRTR0MEMOBJLNX pMemLnx = (PRTR0MEMOBJLNX)rtR0MemObjNew(sizeof(*pMemLnx), RTR0MEMOBJTYPE_RES_VIRT, pv, cb);
824 if (pMemLnx)
825 {
826 pMemLnx->Core.u.ResVirt.R0Process = NIL_RTR0PROCESS;
827 pMemLnx->cPages = 1;
828 pMemLnx->apPages[0] = pDummyPage;
829 *ppMem = &pMemLnx->Core;
830 return VINF_SUCCESS;
831 }
832 vunmap(pv);
833 }
834 }
835 __free_page(pDummyPage);
836 return VERR_NO_MEMORY;
837
838#else /* < 2.4.22 */
839 /*
840 * Could probably use ioremap here, but the caller is in a better position than us
841 * to select some safe physical memory.
842 */
843 return VERR_NOT_SUPPORTED;
844#endif
845}
846
847
848/**
849 * Worker for rtR0MemObjNativeReserveUser and rtR0MemObjNativerMapUser that creates
850 * an empty user space mapping.
851 *
852 * The caller takes care of acquiring the mmap_sem of the task.
853 *
854 * @returns Pointer to the mapping.
855 * (void *)-1 on failure.
856 * @param R3PtrFixed (RTR3PTR)-1 if anywhere, otherwise a specific location.
857 * @param cb The size of the mapping.
858 * @param uAlignment The alignment of the mapping.
859 * @param pTask The Linux task to create this mapping in.
860 * @param fProt The RTMEM_PROT_* mask.
861 */
862static void *rtR0MemObjLinuxDoMmap(RTR3PTR R3PtrFixed, size_t cb, size_t uAlignment, struct task_struct *pTask, unsigned fProt)
863{
864 unsigned fLnxProt;
865 unsigned long ulAddr;
866
867 /*
868 * Convert from IPRT protection to mman.h PROT_ and call do_mmap.
869 */
870 fProt &= (RTMEM_PROT_NONE | RTMEM_PROT_READ | RTMEM_PROT_WRITE | RTMEM_PROT_EXEC);
871 if (fProt == RTMEM_PROT_NONE)
872 fLnxProt = PROT_NONE;
873 else
874 {
875 fLnxProt = 0;
876 if (fProt & RTMEM_PROT_READ)
877 fLnxProt |= PROT_READ;
878 if (fProt & RTMEM_PROT_WRITE)
879 fLnxProt |= PROT_WRITE;
880 if (fProt & RTMEM_PROT_EXEC)
881 fLnxProt |= PROT_EXEC;
882 }
883
884 if (R3PtrFixed != (RTR3PTR)-1)
885 ulAddr = do_mmap(NULL, R3PtrFixed, cb, fLnxProt, MAP_SHARED | MAP_ANONYMOUS | MAP_FIXED, 0);
886 else
887 {
888 ulAddr = do_mmap(NULL, 0, cb, fLnxProt, MAP_SHARED | MAP_ANONYMOUS, 0);
889 if ( !(ulAddr & ~PAGE_MASK)
890 && (ulAddr & (uAlignment - 1)))
891 {
892 /** @todo implement uAlignment properly... We'll probably need to make some dummy mappings to fill
893 * up alignment gaps. This is of course complicated by fragmentation (which we might have cause
894 * ourselves) and further by there begin two mmap strategies (top / bottom). */
895 /* For now, just ignore uAlignment requirements... */
896 }
897 }
898 if (ulAddr & ~PAGE_MASK) /* ~PAGE_MASK == PAGE_OFFSET_MASK */
899 return (void *)-1;
900 return (void *)ulAddr;
901}
902
903
904int rtR0MemObjNativeReserveUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3PtrFixed, size_t cb, size_t uAlignment, RTR0PROCESS R0Process)
905{
906 PRTR0MEMOBJLNX pMemLnx;
907 void *pv;
908 struct task_struct *pTask = rtR0ProcessToLinuxTask(R0Process);
909 if (!pTask)
910 return VERR_NOT_SUPPORTED;
911
912 /*
913 * Let rtR0MemObjLinuxDoMmap do the difficult bits.
914 */
915 down_write(&pTask->mm->mmap_sem);
916 pv = rtR0MemObjLinuxDoMmap(R3PtrFixed, cb, uAlignment, pTask, RTMEM_PROT_NONE);
917 up_write(&pTask->mm->mmap_sem);
918 if (pv == (void *)-1)
919 return VERR_NO_MEMORY;
920
921 pMemLnx = (PRTR0MEMOBJLNX)rtR0MemObjNew(sizeof(*pMemLnx), RTR0MEMOBJTYPE_RES_VIRT, pv, cb);
922 if (!pMemLnx)
923 {
924 down_write(&pTask->mm->mmap_sem);
925 MY_DO_MUNMAP(pTask->mm, (unsigned long)pv, cb);
926 up_write(&pTask->mm->mmap_sem);
927 return VERR_NO_MEMORY;
928 }
929
930 pMemLnx->Core.u.ResVirt.R0Process = R0Process;
931 *ppMem = &pMemLnx->Core;
932 return VINF_SUCCESS;
933}
934
935
936int rtR0MemObjNativeMapKernel(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, void *pvFixed, size_t uAlignment, unsigned fProt)
937{
938 int rc = VERR_NO_MEMORY;
939 PRTR0MEMOBJLNX pMemLnxToMap = (PRTR0MEMOBJLNX)pMemToMap;
940 PRTR0MEMOBJLNX pMemLnx;
941
942 /* Fail if requested to do something we can't. */
943 AssertMsgReturn(pvFixed == (void *)-1, ("%p\n", pvFixed), VERR_NOT_SUPPORTED);
944 AssertMsgReturn(uAlignment <= PAGE_SIZE, ("%#x\n", uAlignment), VERR_NOT_SUPPORTED);
945
946 /*
947 * Create the IPRT memory object.
948 */
949 pMemLnx = (PRTR0MEMOBJLNX)rtR0MemObjNew(sizeof(*pMemLnx), RTR0MEMOBJTYPE_MAPPING, NULL, pMemLnxToMap->Core.cb);
950 if (pMemLnx)
951 {
952 if (pMemLnxToMap->cPages)
953 {
954#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 22)
955 /*
956 * Use vmap - 2.4.22 and later.
957 */
958 pgprot_t fPg = rtR0MemObjLinuxConvertProt(fProt, true /* kernel */);
959# ifdef VM_MAP
960 pMemLnx->Core.pv = vmap(&pMemLnxToMap->apPages[0], pMemLnxToMap->cPages, VM_MAP, fPg);
961# else
962 pMemLnx->Core.pv = vmap(&pMemLnxToMap->apPages[0], pMemLnxToMap->cPages, VM_ALLOC, fPg);
963# endif
964 if (pMemLnx->Core.pv)
965 {
966 pMemLnx->fMappedToRing0 = true;
967 rc = VINF_SUCCESS;
968 }
969 else
970 rc = VERR_MAP_FAILED;
971
972#else /* < 2.4.22 */
973 /*
974 * Only option here is to share mappings if possible and forget about fProt.
975 */
976 if (rtR0MemObjIsRing3(pMemToMap))
977 rc = VERR_NOT_SUPPORTED;
978 else
979 {
980 rc = VINF_SUCCESS;
981 if (!pMemLnxToMap->Core.pv)
982 rc = rtR0MemObjLinuxVMap(pMemLnxToMap, !!(fProt & RTMEM_PROT_EXEC));
983 if (RT_SUCCESS(rc))
984 {
985 Assert(pMemLnxToMap->Core.pv);
986 pMemLnx->Core.pv = pMemLnxToMap->Core.pv;
987 }
988 }
989#endif
990 }
991 else
992 {
993 /*
994 * MMIO / physical memory.
995 */
996 Assert(pMemLnxToMap->Core.enmType == RTR0MEMOBJTYPE_PHYS && !pMemLnxToMap->Core.u.Phys.fAllocated);
997 pMemLnx->Core.pv = ioremap(pMemLnxToMap->Core.u.Phys.PhysBase, pMemLnxToMap->Core.cb);
998 if (pMemLnx->Core.pv)
999 {
1000 /** @todo fix protection. */
1001 rc = VINF_SUCCESS;
1002 }
1003 }
1004 if (RT_SUCCESS(rc))
1005 {
1006 pMemLnx->Core.u.Mapping.R0Process = NIL_RTR0PROCESS;
1007 *ppMem = &pMemLnx->Core;
1008 return VINF_SUCCESS;
1009 }
1010 rtR0MemObjDelete(&pMemLnx->Core);
1011 }
1012
1013 return rc;
1014}
1015
1016
1017int rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, RTR3PTR R3PtrFixed, size_t uAlignment, unsigned fProt, RTR0PROCESS R0Process)
1018{
1019 struct task_struct *pTask = rtR0ProcessToLinuxTask(R0Process);
1020 PRTR0MEMOBJLNX pMemLnxToMap = (PRTR0MEMOBJLNX)pMemToMap;
1021 int rc = VERR_NO_MEMORY;
1022 PRTR0MEMOBJLNX pMemLnx;
1023
1024 /*
1025 * Check for restrictions.
1026 */
1027 if (!pTask)
1028 return VERR_NOT_SUPPORTED;
1029
1030 /*
1031 * Create the IPRT memory object.
1032 */
1033 pMemLnx = (PRTR0MEMOBJLNX)rtR0MemObjNew(sizeof(*pMemLnx), RTR0MEMOBJTYPE_MAPPING, NULL, pMemLnxToMap->Core.cb);
1034 if (pMemLnx)
1035 {
1036 /*
1037 * Allocate user space mapping.
1038 */
1039 void *pv;
1040 down_write(&pTask->mm->mmap_sem);
1041 pv = rtR0MemObjLinuxDoMmap(R3PtrFixed, pMemLnxToMap->Core.cb, uAlignment, pTask, fProt);
1042 if (pv != (void *)-1)
1043 {
1044 /*
1045 * Map page by page into the mmap area.
1046 * This is generic, paranoid and not very efficient.
1047 */
1048 pgprot_t fPg = rtR0MemObjLinuxConvertProt(fProt, false /* user */);
1049 unsigned long ulAddrCur = (unsigned long)pv;
1050 const size_t cPages = pMemLnxToMap->Core.cb >> PAGE_SHIFT;
1051 size_t iPage;
1052 rc = 0;
1053 if (pMemLnxToMap->cPages)
1054 {
1055 for (iPage = 0; iPage < cPages; iPage++, ulAddrCur += PAGE_SIZE)
1056 {
1057#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) || defined(HAVE_26_STYLE_REMAP_PAGE_RANGE)
1058 struct vm_area_struct *vma = find_vma(pTask->mm, ulAddrCur); /* this is probably the same for all the pages... */
1059 AssertBreak(vma, rc = VERR_INTERNAL_ERROR);
1060#endif
1061
1062#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11)
1063 rc = remap_pfn_range(vma, ulAddrCur, page_to_pfn(pMemLnxToMap->apPages[iPage]), PAGE_SIZE, fPg);
1064#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) || defined(HAVE_26_STYLE_REMAP_PAGE_RANGE)
1065 rc = remap_page_range(vma, ulAddrCur, page_to_phys(pMemLnxToMap->apPages[iPage]), PAGE_SIZE, fPg);
1066#else /* 2.4 */
1067 rc = remap_page_range(ulAddrCur, page_to_phys(pMemLnxToMap->apPages[iPage]), PAGE_SIZE, fPg);
1068#endif
1069 if (rc)
1070 break;
1071 }
1072 }
1073 else
1074 {
1075 RTHCPHYS Phys;
1076 if (pMemLnxToMap->Core.enmType == RTR0MEMOBJTYPE_PHYS)
1077 Phys = pMemLnxToMap->Core.u.Phys.PhysBase;
1078 else if (pMemLnxToMap->Core.enmType == RTR0MEMOBJTYPE_CONT)
1079 Phys = pMemLnxToMap->Core.u.Cont.Phys;
1080 else
1081 {
1082 AssertMsgFailed(("%d\n", pMemLnxToMap->Core.enmType));
1083 Phys = NIL_RTHCPHYS;
1084 }
1085 if (Phys != NIL_RTHCPHYS)
1086 {
1087 for (iPage = 0; iPage < cPages; iPage++, ulAddrCur += PAGE_SIZE, Phys += PAGE_SIZE)
1088 {
1089#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) || defined(HAVE_26_STYLE_REMAP_PAGE_RANGE)
1090 struct vm_area_struct *vma = find_vma(pTask->mm, ulAddrCur); /* this is probably the same for all the pages... */
1091 AssertBreak(vma, rc = VERR_INTERNAL_ERROR);
1092#endif
1093
1094#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11)
1095 rc = remap_pfn_range(vma, ulAddrCur, Phys, PAGE_SIZE, fPg);
1096#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) || defined(HAVE_26_STYLE_REMAP_PAGE_RANGE)
1097 rc = remap_page_range(vma, ulAddrCur, Phys, PAGE_SIZE, fPg);
1098#else /* 2.4 */
1099 rc = remap_page_range(ulAddrCur, Phys, PAGE_SIZE, fPg);
1100#endif
1101 if (rc)
1102 break;
1103 }
1104 }
1105 }
1106 if (!rc)
1107 {
1108 up_write(&pTask->mm->mmap_sem);
1109
1110 pMemLnx->Core.pv = pv;
1111 pMemLnx->Core.u.Mapping.R0Process = R0Process;
1112 *ppMem = &pMemLnx->Core;
1113 return VINF_SUCCESS;
1114 }
1115
1116 /*
1117 * Bail out.
1118 */
1119 MY_DO_MUNMAP(pTask->mm, (unsigned long)pv, pMemLnxToMap->Core.cb);
1120 if (rc != VERR_INTERNAL_ERROR)
1121 rc = VERR_NO_MEMORY;
1122 }
1123
1124 up_write(&pTask->mm->mmap_sem);
1125
1126 rtR0MemObjDelete(&pMemLnx->Core);
1127 }
1128
1129 return rc;
1130}
1131
1132
1133RTHCPHYS rtR0MemObjNativeGetPagePhysAddr(PRTR0MEMOBJINTERNAL pMem, size_t iPage)
1134{
1135 PRTR0MEMOBJLNX pMemLnx = (PRTR0MEMOBJLNX)pMem;
1136
1137 if (pMemLnx->cPages)
1138 return page_to_phys(pMemLnx->apPages[iPage]);
1139
1140 switch (pMemLnx->Core.enmType)
1141 {
1142 case RTR0MEMOBJTYPE_CONT:
1143 return pMemLnx->Core.u.Cont.Phys + (iPage << PAGE_SHIFT);
1144
1145 case RTR0MEMOBJTYPE_PHYS:
1146 return pMemLnx->Core.u.Phys.PhysBase + (iPage << PAGE_SHIFT);
1147
1148 /* the parent knows */
1149 case RTR0MEMOBJTYPE_MAPPING:
1150 return rtR0MemObjNativeGetPagePhysAddr(pMemLnx->Core.uRel.Child.pParent, iPage);
1151
1152 /* cPages > 0 */
1153 case RTR0MEMOBJTYPE_LOW:
1154 case RTR0MEMOBJTYPE_LOCK:
1155 case RTR0MEMOBJTYPE_PHYS_NC:
1156 case RTR0MEMOBJTYPE_PAGE:
1157 default:
1158 AssertMsgFailed(("%d\n", pMemLnx->Core.enmType));
1159 /* fall thru */
1160
1161 case RTR0MEMOBJTYPE_RES_VIRT:
1162 return NIL_RTHCPHYS;
1163 }
1164}
1165
Note: See TracBrowser for help on using the repository browser.

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