~ubuntu-branches/ubuntu/raring/virtualbox-ose/raring

« back to all changes in this revision

Viewing changes to src/VBox/Runtime/r0drv/darwin/memobj-r0drv-darwin.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2009-12-18 16:44:29 UTC
  • mfrom: (0.3.3 upstream) (0.4.6 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091218164429-jd34ccexpv5na11a
Tags: 3.1.2-dfsg-1ubuntu1
* Merge from Debian unstable (LP: #498219), remaining changes:
  - Disable update action
    - debian/patches/u01-disable-update-action.dpatch
  - VirtualBox should go in Accessories, not in System tools (LP: #288590)
    - debian/virtualbox-ose-qt.files/virtualbox-ose.desktop
  - Add Apport hook
    - debian/virtualbox-ose.files/source_virtualbox-ose.py
    - debian/virtualbox-ose.install
  - Add Launchpad integration
    - debian/control
    - debian/lpi-bug.xpm
    - debian/patches/u02-lp-integration.dpatch
* Fixes the following bugs:
  - Kernel module fails to build with Linux >= 2.6.32 (LP: #474625)
  - X.Org drivers need to be rebuilt against X-Server 1.7 (LP: #495935)
  - The *-source packages try to build the kernel modules even though the
    kernel headers aren't available (LP: #473334)
* Replace *-source packages with transitional packages for *-dkms.
* Adapt u01-disable-update-action.dpatch and u02-lp-integration.dpatch for
  new upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
*   Header Files                                                               *
34
34
*******************************************************************************/
35
35
#include "the-darwin-kernel.h"
36
 
 
 
36
#include "internal/iprt.h"
37
37
#include <iprt/memobj.h>
38
38
 
39
39
#include <iprt/alloc.h>
44
44
#include <iprt/process.h>
45
45
#include <iprt/string.h>
46
46
#include <iprt/thread.h>
47
 
 
48
47
#include "internal/memobj.h"
49
48
 
50
49
/*#define USE_VM_MAP_WIRE - may re-enable later when non-mapped allocations are added. */
655
654
 *
656
655
 * @return IPRT status code.
657
656
 *
658
 
 * @param ppMem     Where to store the memory object pointer.
659
 
 * @param pv        First page.
660
 
 * @param cb        Number of bytes.
661
 
 * @param Task      The task \a pv and \a cb refers to.
 
657
 * @param   ppMem           Where to store the memory object pointer.
 
658
 * @param   pv              First page.
 
659
 * @param   cb              Number of bytes.
 
660
 * @param   fAccess         The desired access, a combination of RTMEM_PROT_READ
 
661
 *                          and RTMEM_PROT_WRITE.
 
662
 * @param   Task            The task \a pv and \a cb refers to.
662
663
 */
663
 
static int rtR0MemObjNativeLock(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb, task_t Task)
 
664
static int rtR0MemObjNativeLock(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb, uint32_t fAccess, task_t Task)
664
665
{
 
666
    NOREF(fAccess);
665
667
#ifdef USE_VM_MAP_WIRE
666
668
    vm_map_t Map = get_task_map(Task);
667
669
    Assert(Map);
729
731
}
730
732
 
731
733
 
732
 
int rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3Ptr, size_t cb, RTR0PROCESS R0Process)
 
734
int rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3Ptr, size_t cb, uint32_t fAccess, RTR0PROCESS R0Process)
733
735
{
734
 
    return rtR0MemObjNativeLock(ppMem, (void *)R3Ptr, cb, (task_t)R0Process);
 
736
    return rtR0MemObjNativeLock(ppMem, (void *)R3Ptr, cb, fAccess, (task_t)R0Process);
735
737
}
736
738
 
737
739
 
738
 
int rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb)
 
740
int rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb, uint32_t fAccess)
739
741
{
740
 
    return rtR0MemObjNativeLock(ppMem, pv, cb, kernel_task);
 
742
    return rtR0MemObjNativeLock(ppMem, pv, cb, fAccess, kernel_task);
741
743
}
742
744
 
743
745
 
759
761
    AssertReturn(pvFixed == (void *)-1, VERR_NOT_SUPPORTED);
760
762
 
761
763
    /*
 
764
     * Check that the specified alignment is supported.
 
765
     */
 
766
    if (uAlignment > PAGE_SIZE)
 
767
        return VERR_NOT_SUPPORTED;
 
768
 
 
769
    /*
762
770
     * Must have a memory descriptor that we can map.
763
771
     */
764
772
    int rc = VERR_INVALID_PARAMETER;
854
862
 
855
863
int rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, RTR3PTR R3PtrFixed, size_t uAlignment, unsigned fProt, RTR0PROCESS R0Process)
856
864
{
 
865
    /*
 
866
     * Check for unsupported things.
 
867
     */
857
868
    AssertReturn(R3PtrFixed == (RTR3PTR)-1, VERR_NOT_SUPPORTED);
 
869
    if (uAlignment > PAGE_SIZE)
 
870
        return VERR_NOT_SUPPORTED;
858
871
 
859
872
    /*
860
873
     * Must have a memory descriptor.