VirtualBox

Changeset 4717 in vbox for trunk/src/VBox/Runtime/r0drv


Ignore:
Timestamp:
Sep 12, 2007 6:44:18 AM (17 years ago)
Author:
vboxsync
Message:

Solaris changes.

Location:
trunk/src/VBox/Runtime/r0drv/solaris
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r0drv/solaris/assert-r0drv-solaris.c

    r4071 r4717  
    3737#endif
    3838
    39     printf("\r\n!!Assertion Failed!!\r\n"
    40            "Expression: %s\r\n"
    41            "Location  : %s(%d) %s\r\n",
    42            pszExpr, pszFile, uLine, pszFunction);
     39    uprintf("\r\n!!Assertion Failed!!\r\n"
     40            "Expression: %s\r\n"
     41            "Location  : %s(%d) %s\r\n",
     42            pszExpr, pszFile, uLine, pszFunction);
    4343}
    4444
     
    5959    szMsg[sizeof(szMsg) - 1] = '\0';
    6060    va_end(va);
    61     printf("%s", szMsg);
     61    uprintf("%s", szMsg);
    6262}
    6363
  • trunk/src/VBox/Runtime/r0drv/solaris/memobj-r0drv-solaris.c

    r4474 r4717  
    101101
    102102        case RTR0MEMOBJTYPE_PAGE:
    103             kmem_free(pMemSolaris->Core.pv, pMemSolaris->Core.cb);
     103            ddi_umem_free(pMemSolaris->Cookie);
    104104            break;
    105105
     
    107107        {
    108108            cmn_err(CE_NOTE, "rtR0MemObjNativeFree: LOCK\n");
    109             struct as* addrSpace;
     109            struct as *addrSpace;
    110110            if (pMemSolaris->Core.u.Lock.R0Process == NIL_RTR0PROCESS)
    111111                addrSpace = &kas;
     
    119119        case RTR0MEMOBJTYPE_MAPPING:
    120120        {
    121             struct hat* hatSpace;
    122             struct as* addrSpace;
     121            struct hat *hatSpace;
     122            struct as *addrSpace;
    123123            cmn_err(CE_NOTE, "rtR0MemObjNativeFree: MAPPING\n");
    124124            if (pMemSolaris->Core.u.Mapping.R0Process == NIL_RTR0PROCESS)
     
    164164        return VERR_NO_MEMORY;
    165165
    166     /** @todo r=bird: The man page says: "The allocated memory is at least double-word aligned, so it can hold any C data structure. No greater alignment can be assumed." */
    167     void* virtAddr = kmem_alloc(cb, KM_SLEEP);
     166    void *virtAddr = ddi_umem_alloc(cb, DDI_UMEM_SLEEP, &pMemSolaris->Cookie);
    168167    if (!virtAddr)
    169168    {
    170169        rtR0MemObjDelete(&pMemSolaris->Core);
    171         return VERR_NO_MEMORY;
     170        return VERR_NO_PAGE_MEMORY;
    172171    }
    173172   
     
    215214    {
    216215        rtR0MemObjDelete(&pMemSolaris->Core);
    217         return VERR_NO_MEMORY;
     216        return VERR_NO_CONT_MEMORY;
    218217    }
    219218
     
    258257int rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3Ptr, size_t cb, RTR0PROCESS R0Process)
    259258{
    260     /* Create the object */
     259    /* Create the locking object */
    261260    PRTR0MEMOBJSOLARIS pMemSolaris = (PRTR0MEMOBJSOLARIS)rtR0MemObjNew(sizeof(*pMemSolaris), RTR0MEMOBJTYPE_LOCK, (void *)R3Ptr, cb);
    262261    if (!pMemSolaris)
     
    270269    page_t **ppl;
    271270
     271    /* Lock down user pages */
    272272    int rc = as_pagelock(useras, &ppl, (caddr_t)R3Ptr, cb, S_WRITE);
    273273    if (rc != 0)
    274274    {
    275275        cmn_err(CE_NOTE,"rtR0MemObjNativeLockUser: as_pagelock failed rc=%d\n", rc);
    276         return VERR_NO_MEMORY;
     276        return VERR_LOCK_FAILED;
    277277    }
    278278
     
    281281        as_pageunlock(useras, ppl, (caddr_t)R3Ptr, cb, S_WRITE);
    282282        cmn_err(CE_NOTE, "rtR0MemObjNativeLockUser: as_pagelock failed to get shadow pages\n");
    283         return VERR_NO_MEMORY;
     283        return VERR_LOCK_FAILED;
    284284    }
    285285   
     
    293293int rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb)
    294294{
    295     /* Create the object */
     295    /* Create the locking object */
    296296    PRTR0MEMOBJSOLARIS pMemSolaris = (PRTR0MEMOBJSOLARIS)rtR0MemObjNew(sizeof(*pMemSolaris), RTR0MEMOBJTYPE_LOCK, pv, cb);
    297297    if (!pMemSolaris)
     
    301301    page_t **ppl;
    302302   
     303    /* Lock down kernel pages */
    303304    int rc = as_pagelock(&kas, &ppl, virtAddr, cb, S_WRITE);
    304305    if (rc != 0)
    305         return VERR_NO_MEMORY;
     306    {
     307        cmn_err(CE_NOTE,"rtR0MemObjNativeLockKernel: as_pagelock failed rc=%d\n", rc);
     308        return VERR_LOCK_FAILED;
     309    }
    306310
    307311    if (!ppl)
    308312    {
    309313        as_pageunlock(&kas, ppl, virtAddr, cb, S_WRITE);
    310         cmn_err(CE_NOTE, "rtR0MemObjNativeLockUser: failed to get shadow pages\n");
    311         return VERR_NO_MEMORY;
     314        cmn_err(CE_NOTE, "rtR0MemObjNativeLockKernel: failed to get shadow pages\n");
     315        return VERR_LOCK_FAILED;
    312316    }
    313317
     
    333337{
    334338    PRTR0MEMOBJSOLARIS pMemToMapSolaris = (PRTR0MEMOBJSOLARIS)pMemToMap;   
    335     size_t size = P2ROUNDUP(pMemToMapSolaris->Core.cb, PAGE_SIZE); /* r=bird: not necessary, see the specs / caller implementation. */
     339    size_t size = pMemToMapSolaris->Core.cb;
    336340    void *pv = pMemToMapSolaris->Core.pv;
    337341    pgcnt_t cPages = btop(size);
     
    364368            return VERR_NO_MEMORY;
    365369        }
    366         /** @todo r=bird: check address against uAlignment, just fail if it's not matching. */
     370       
     371        /* Check address against alignment, fail if it doesn't match */
     372        if ((uintptr_t)addr & (uAlignment - 1))
     373        {
     374            as_rangeunlock(&kas);
     375            cmn_err(CE_NOTE, "rtR0MemObjNativeMapKernel: map_addr alignment(%ld) failed.\n", uAlignment);
     376            return VERR_MAP_FAILED;
     377        }
    367378    }
    368379   
     
    401412{
    402413    PRTR0MEMOBJSOLARIS pMemToMapSolaris = (PRTR0MEMOBJSOLARIS)pMemToMap;   
    403     size_t size = P2ROUNDUP(pMemToMapSolaris->Core.cb, PAGE_SIZE); /** @todo r=bird: this isn't necessary, see the specs. */
     414    size_t size = pMemToMapSolaris->Core.cb;
    404415    proc_t *userproc = (proc_t *)R0Process;
    405416    struct as *useras = userproc->p_as;
     
    441452            as_rangeunlock(useras);
    442453            cmn_err(CE_NOTE, "rtR0MemObjNativeMapUser: map_addr failed\n");
    443             return VERR_NO_MEMORY;
    444         }
    445 
    446         /** @todo r=bird: check address against uAlignment, just fail if it's not matching. */
     454            return VERR_MAP_FAILED;
     455        }
     456       
     457        /* Check address against alignment, fail if it doesn't match */
     458        if ((uintptr_t)addr & (uAlignment - 1))
     459        {
     460            as_rangeunlock(useras);
     461            cmn_err(CE_NOTE, "rtR0MemObjNativeMapUser: map_addr alignment(%ld) failed.\n", uAlignment);
     462            return VERR_MAP_FAILED;
     463        }
    447464    }
    448465   
     
    456473    {
    457474        cmn_err(CE_NOTE, "rtR0MemObjNativeMapUser: as_map failure.\n");
    458         return VERR_NO_MEMORY;
     475        return VERR_MAP_FAILED;
    459476    }
    460477
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