VirtualBox

Changeset 29765 in vbox


Ignore:
Timestamp:
May 24, 2010 7:07:28 PM (15 years ago)
Author:
vboxsync
Message:

*-r0drv-freebsd.c: Little cleanup and don't wire the pages twice during alloc or we will leak memory

Location:
trunk/src/VBox/Runtime/r0drv/freebsd
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r0drv/freebsd/alloc-r0drv-freebsd.c

    r28298 r29765  
    7777            do
    7878            {
    79                 vm_pindex_t PageIndex = OFF_TO_IDX(AddressDst);
    80                 vm_page_t   pPage;
     79                vm_page_t pPage;
    8180
    82                 pPage = vm_page_alloc(NULL, PageIndex,
     81                pPage = vm_page_alloc(NULL, 0,
    8382                                      VM_ALLOC_NOBUSY | VM_ALLOC_SYSTEM |
    8483                                      VM_ALLOC_WIRED  | VM_ALLOC_NOOBJ);
    8584                if (pPage)
    8685                {
    87                     vm_page_lock_queues();
    88                     vm_page_wire(pPage);
    89                     vm_page_unlock_queues();
    9086                    /* Put the page into the page table now. */
    91 #if __FreeBSD_version >= 701105
    92                     pmap_enter(kernel_map->pmap, AddressDst, VM_PROT_NONE, pPage,
    93                                VM_PROT_ALL, TRUE);
    94 #else
    95                     pmap_enter(kernel_map->pmap, AddressDst, pPage,
    96                                VM_PROT_ALL, TRUE);
    97 #endif
     87                    MY_PMAP_ENTER(kernel_map->pmap, AddressDst, pPage, VM_PROT_ALL,
     88                                  TRUE);
    9889                }
    9990                else
  • trunk/src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c

    r29763 r29765  
    4444#include "internal/memobj.h"
    4545
    46 /**
    47  * Our pmap_enter version
    48  */
    49 #if __FreeBSD_version >= 701105
    50 # define MY_PMAP_ENTER(pPhysMap, AddrR3, pPage, fProt, fWired) \
    51     pmap_enter(pPhysMap, AddrR3, VM_PROT_NONE, pPage, fProt, fWired)
    52 #else
    53 # define MY_PMAP_ENTER(pPhysMap, AddrR3, pPage, fProt, fWired) \
    54     pmap_enter(pPhysMap, AddrR3, pPage, fProt, fWired)
    55 #endif
    56 
    57 /**
    58  * Check whether we can use kmem_alloc_attr for low allocs.
    59  */
    60 #if    (__FreeBSD_version >= 900011) \
    61     || (__FreeBSD_version < 900000 && __FreeBSD_version >= 800505) \
    62     || (__FreeBSD_version < 800000 && __FreeBSD_version >= 703101)
    63 # define USE_KMEM_ALLOC_ATTR
    64 #endif
    65 
    6646/*******************************************************************************
    6747*   Structures and Typedefs                                                    *
  • trunk/src/VBox/Runtime/r0drv/freebsd/the-freebsd-kernel.h

    r27146 r29765  
    7070#include <machine/cpu.h>
    7171
    72 /*#ifdef __cplusplus
    73 # error "This header doesn't work for C++ code. Sorry, typical kernel crap."
    74 #endif*/
    75 
     72/**
     73 * Wrappers arount the sleepq_ KPI.
     74 */
    7675#if __FreeBSD_version >= 800026
    7776# define SLEEPQ_TIMEDWAIT(EventInt) sleepq_timedwait(EventInt, 0)
     
    8685#endif
    8786
     87/**
     88 * Our pmap_enter version
     89 */
     90#if __FreeBSD_version >= 701105
     91# define MY_PMAP_ENTER(pPhysMap, AddrR3, pPage, fProt, fWired) \
     92    pmap_enter(pPhysMap, AddrR3, VM_PROT_NONE, pPage, fProt, fWired)
     93#else
     94# define MY_PMAP_ENTER(pPhysMap, AddrR3, pPage, fProt, fWired) \
     95    pmap_enter(pPhysMap, AddrR3, pPage, fProt, fWired)
    8896#endif
     97
     98/**
     99 * Check whether we can use kmem_alloc_attr for low allocs.
     100 */
     101#if    (__FreeBSD_version >= 900011) \
     102    || (__FreeBSD_version < 900000 && __FreeBSD_version >= 800505) \
     103    || (__FreeBSD_version < 800000 && __FreeBSD_version >= 703101)
     104# define USE_KMEM_ALLOC_ATTR
     105#endif
     106
     107#endif
Note: See TracChangeset for help on using the changeset viewer.

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