VirtualBox

Changeset 21497 in vbox for trunk/src/VBox/Runtime


Ignore:
Timestamp:
Jul 10, 2009 8:24:18 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
49946
Message:

RTR0MemObj*: correctly reject unsupported alignment requirements (VERR_NOT_SUPPORTED).

Location:
trunk/src/VBox/Runtime/r0drv
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r0drv/darwin/memobj-r0drv-darwin.cpp

    r20525 r21497  
    756756
    757757    /*
     758     * Check that the specified alignment is supported.
     759     */
     760    if (uAlignment > PAGE_SIZE)
     761        return VERR_NOT_SUPPORTED;
     762
     763    /*
    758764     * Must have a memory descriptor that we can map.
    759765     */
     
    851857int rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, RTR3PTR R3PtrFixed, size_t uAlignment, unsigned fProt, RTR0PROCESS R0Process)
    852858{
     859    /*
     860     * Check for unsupported things.
     861     */
    853862    AssertReturn(R3PtrFixed == (RTR3PTR)-1, VERR_NOT_SUPPORTED);
     863    if (uAlignment > PAGE_SIZE)
     864        return VERR_NOT_SUPPORTED;
    854865
    855866    /*
  • trunk/src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c

    r20525 r21497  
    442442
    443443    /*
     444     * Check that the specified alignment is supported.
     445     */
     446    if (uAlignment > PAGE_SIZE)
     447        return VERR_NOT_SUPPORTED;
     448
     449    /*
    444450     * Create the object.
    445451     */
     
    515521    AssertMsgReturn(pvFixed == (void *)-1, ("%p\n", pvFixed), VERR_NOT_SUPPORTED);
    516522
     523    /*
     524     * Check that the specified alignment is supported.
     525     */
     526    if (uAlignment > PAGE_SIZE)
     527        return VERR_NOT_SUPPORTED;
     528
     529
     530
    517531/* Phys: see pmap_mapdev in i386/i386/pmap.c (http://fxr.watson.org/fxr/source/i386/i386/pmap.c?v=RELENG62#L2860) */
    518532
     
    588602int rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, RTR3PTR R3PtrFixed, size_t uAlignment, unsigned fProt, RTR0PROCESS R0Process)
    589603{
     604    /*
     605     * Check for unsupported stuff.
     606     */
    590607    AssertMsgReturn(R0Process == RTR0ProcHandleSelf(), ("%p != %p\n", R0Process, RTR0ProcHandleSelf()), VERR_NOT_SUPPORTED);
    591608    AssertMsgReturn(R3PtrFixed == (RTR3PTR)-1, ("%p\n", R3PtrFixed), VERR_NOT_SUPPORTED);
     609    if (uAlignment > PAGE_SIZE)
     610        return VERR_NOT_SUPPORTED;
    592611
    593612    int             rc;
  • trunk/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c

    r21314 r21497  
    904904    /* check for unsupported stuff. */
    905905    AssertMsgReturn(pvFixed == (void *)-1, ("%p\n", pvFixed), VERR_NOT_SUPPORTED);
    906     AssertMsgReturn(uAlignment <= PAGE_SIZE, ("%#x\n", uAlignment), VERR_NOT_SUPPORTED);
     906    if (uAlignment > PAGE_SIZE)
     907        return VERR_NOT_SUPPORTED;
    907908
    908909    /*
     
    10181019
    10191020    /*
     1021     * Check that the specified alignment is supported.
     1022     */
     1023    if (uAlignment > PAGE_SIZE)
     1024        return VERR_NOT_SUPPORTED;
     1025
     1026    /*
    10201027     * Let rtR0MemObjLinuxDoMmap do the difficult bits.
    10211028     */
     
    10511058    AssertMsgReturn(!offSub && !cbSub, ("%#x %#x\n", offSub, cbSub), VERR_NOT_SUPPORTED);
    10521059    AssertMsgReturn(pvFixed == (void *)-1, ("%p\n", pvFixed), VERR_NOT_SUPPORTED);
    1053     AssertMsgReturn(uAlignment <= PAGE_SIZE, ("%#x\n", uAlignment), VERR_NOT_SUPPORTED);
     1060    if (uAlignment > PAGE_SIZE)
     1061        return VERR_NOT_SUPPORTED;
    10541062
    10551063    /*
     
    11351143     */
    11361144    if (!pTask)
     1145        return VERR_NOT_SUPPORTED;
     1146    if (uAlignment > PAGE_SIZE)
    11371147        return VERR_NOT_SUPPORTED;
    11381148
  • trunk/src/VBox/Runtime/r0drv/nt/memobj-r0drv-nt.cpp

    r20525 r21497  
    654654
    655655    /*
     656     * Check that the specified alignment is supported.
     657     */
     658    if (uAlignment > PAGE_SIZE)
     659        return VERR_NOT_SUPPORTED;
     660
     661    /*
    656662     * There are two basic cases here, either we've got an MDL and can
    657663     * map it using MmMapLockedPages, or we've got a contiguous physical
  • trunk/src/VBox/Runtime/r0drv/os2/memobj-r0drv-os2.cpp

    r20525 r21497  
    310310    AssertMsgReturn(pvFixed == (void *)-1, ("%p\n", pvFixed), VERR_NOT_SUPPORTED);
    311311
     312    /*
     313     * Check that the specified alignment is supported.
     314     */
     315    if (uAlignment > PAGE_SIZE)
     316        return VERR_NOT_SUPPORTED;
     317
     318
    312319/** @todo finish the implementation. */
    313320
     
    331338            {
    332339                /* no ring-0 mapping, so allocate a mapping in the process. */
    333                 AssertMsgReturn(uAlignment == PAGE_SIZE, ("%#zx\n", uAlignment), VERR_NOT_SUPPORTED);
    334340                AssertMsgReturn(fProt & RTMEM_PROT_WRITE, ("%#x\n", fProt), VERR_NOT_SUPPORTED);
    335341                Assert(!pMemToMapOs2->Core.u.Phys.fAllocated);
     
    383389    AssertMsgReturn(R0Process == RTR0ProcHandleSelf(), ("%p != %p\n", R0Process, RTR0ProcHandleSelf()), VERR_NOT_SUPPORTED);
    384390    AssertMsgReturn(R3PtrFixed == (RTR3PTR)-1, ("%p\n", R3PtrFixed), VERR_NOT_SUPPORTED);
     391    if (uAlignment > PAGE_SIZE)
     392        return VERR_NOT_SUPPORTED;
    385393
    386394    int rc;
     
    405413            {
    406414                /* no ring-0 mapping, so allocate a mapping in the process. */
    407                 AssertMsgReturn(uAlignment == PAGE_SIZE, ("%#zx\n", uAlignment), VERR_NOT_SUPPORTED);
    408415                AssertMsgReturn(fProt & RTMEM_PROT_WRITE, ("%#x\n", fProt), VERR_NOT_SUPPORTED);
    409416                Assert(!pMemToMapOs2->Core.u.Phys.fAllocated);
  • trunk/src/VBox/Runtime/r0drv/solaris/memobj-r0drv-solaris.c

    r20525 r21497  
    322322                              unsigned fProt, size_t offSub, size_t cbSub)
    323323{
    324     /* @todo rtR0MemObjNativeMapKernel / Solaris - Should be fairly simple alloc kernel memory and memload it. */
     324    /** @todo rtR0MemObjNativeMapKernel / Solaris - Should be fairly simple alloc kernel memory and memload it. */
    325325    return VERR_NOT_IMPLEMENTED;
    326326}
     
    357357        as_rangeunlock(useras);
    358358        cmn_err(CE_NOTE, "rtR0MemObjNativeMapUser: map_addr alignment(%ld) failed.\n", uAlignment);
     359        if (uAlignment > PAGE_SIZE)
     360            return VERR_NOT_SUPPORTED;
    359361        return VERR_MAP_FAILED;
    360362    }
  • trunk/src/VBox/Runtime/r0drv/solaris/vbi/memobj-r0drv-solaris.c

    r20526 r21497  
    265265                              unsigned fProt, size_t offSub, size_t cbSub)
    266266{
    267     /* @todo rtR0MemObjNativeMapKernel / Solaris - Should be fairly simple alloc kernel memory and memload it. */
     267    /** @todo rtR0MemObjNativeMapKernel / Solaris - Should be fairly simple alloc kernel memory and memload it. */
    268268    return VERR_NOT_IMPLEMENTED;
    269269}
     
    273273    AssertMsgReturn(R3PtrFixed == (RTR3PTR)-1, ("%p\n", R3PtrFixed), VERR_NOT_SUPPORTED);
    274274    AssertMsgReturn(R0Process == RTR0ProcHandleSelf(), ("%p != %p\n", R0Process, RTR0ProcHandleSelf()), VERR_NOT_SUPPORTED);
    275     AssertMsgReturn(uAlignment == 0 || uAlignment == PAGE_SIZE, ("%d\n", uAlignment), VERR_NOT_SUPPORTED);
     275    if (uAlignment > PAGE_SIZE)
     276        return VERR_NOT_SUPPORTED;
    276277
    277278    PRTR0MEMOBJSOLARIS pMemToMapSolaris = (PRTR0MEMOBJSOLARIS)pMemToMap;
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