VirtualBox

Ignore:
Timestamp:
Aug 16, 2007 3:07:51 PM (17 years ago)
Author:
vboxsync
Message:

Solaris changes.

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

Legend:

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

    r4071 r4178  
    3737    PRTMEMHDR pHdr;
    3838    if (fFlags & RTMEMHDR_FLAG_ZEROED)
    39         pHdr = (PRTMEMHDR)kmem_zalloc(cb + sizeof(*pHdr), KM_NOSLEEP);
     39        pHdr = (PRTMEMHDR)kmem_zalloc(cb + sizeof(*pHdr), KM_SLEEP);
    4040    else
    41         pHdr = (PRTMEMHDR)kmem_alloc(cb + sizeof(*pHdr), KM_NOSLEEP);
     41        pHdr = (PRTMEMHDR)kmem_alloc(cb + sizeof(*pHdr), KM_SLEEP);
    4242    if (pHdr)
    4343    {
     
    7474RTR0DECL(void *) RTMemContAlloc(PRTCCPHYS pPhys, size_t cb)
    7575{
    76     /* Solaris currently supports allocating contiguous memory
    77      * only for DMA drivers which requires passing the driver's
    78      * device ID, and upper/lower DMA memory limits
    79      * Currently thus disabled since RTMemContAlloc isn't really used
    80      * anywhere significant yet (only in GuestAdditions which is not
    81      * there for Solaris)
    82      * ddi_umem_alloc doesn't allocate contiguous memory!
    83      */
    84     /**@todo Implement RTMemContAlloc on Solaris - there is no way around this. */
     76    /** @todo: implement RTMemContAlloc in Solaris */
     77    /* ddi_umem_alloc without PAGEABLE flag might produce contiguous physical memory, but
     78        the documentation doesn't talk about contiguous at all :(
     79       If we can use ddi_umem_alloc we need to keep track of the ddi_umem_cookie
     80       which kernel allocates, but the ContFree() function only passes us back
     81       the address. Maybe we could for each ContAlloc build a linked list of
     82       structures that have the cookie and corresponding virtual address. */
    8583    return NULL;
    8684}
  • trunk/src/VBox/Runtime/r0drv/solaris/semevent-r0drv-solaris.c

    r4071 r4178  
    5050    uint32_t volatile   cWaking;
    5151    /** The Solaris mutex protecting this structure and pairing up the with the cv. */
    52     struct mutex        Mtx;
     52    kmutex_t            Mtx;
    5353    /** The Solaris condition variable. */
    5454    kcondvar_t          Cnd;
     
    104104    {
    105105        mutex_exit(&pEventInt->Mtx);
     106        cv_destroy(&pEventInt->Cnd);
    106107        mutex_destroy(&pEventInt->Mtx);
    107         cv_destroy(&pEventInt->Cnd);
    108108        RTMemFree(pEventInt);
    109109    }
     
    166166        else
    167167            cTicks = 0;
    168         cTicks += timeout;
     168        timeout += cTicks;
    169169       
    170170        ASMAtomicIncU32(&pEventInt->cWaiters);
     
    178178            {
    179179                rc = VERR_SEM_DESTROYED;
    180                 /** @todo r=bird: better make sure you're the last guy out before doing the cleanup.... */
    181                 mutex_exit(&pEventInt->Mtx);
    182                 cv_destroy(&pEventInt->Cnd);
    183                 mutex_destroy(&pEventInt->Mtx);
    184                 RTMemFree(pEventInt);
    185                 return rc;
     180                if (!ASMAtomicDecU32(&pEventInt->cWaking))
     181                {
     182                    mutex_exit(&pEventInt->Mtx);
     183                    cv_destroy(&pEventInt->Cnd);
     184                    mutex_destroy(&pEventInt->Mtx);
     185                    RTMemFree(pEventInt);
     186                    return rc;
     187                }
    186188            }
    187189
  • trunk/src/VBox/Runtime/r0drv/solaris/semfastmutex-r0drv-solaris.c

    r4071 r4178  
    4242    uint32_t            u32Magic;
    4343    /** The Solaris mutex. */
    44     struct mutex        Mtx;
     44    kmutex_t            Mtx;
    4545} RTSEMFASTMUTEXINTERNAL, *PRTSEMFASTMUTEXINTERNAL;
    4646
  • trunk/src/VBox/Runtime/r0drv/solaris/spinlock-r0drv-solaris.c

    r4071 r4178  
    4141    uint32_t volatile   u32Magic;
    4242    /** A Solaris spinlock. */
    43     struct mutex        Mtx;
     43    kmutex_t            Mtx;
    4444} RTSPINLOCKINTERNAL, *PRTSPINLOCKINTERNAL;
    4545
     
    5959     */
    6060    pSpinlockInt->u32Magic = RTSPINLOCK_MAGIC;
    61     mutex_init(&pSpinlockInt->Mtx, "iprt-spinlock", MUTEX_SPIN, NULL);
     61    mutex_init(&pSpinlockInt->Mtx, "IPRT Spinlock", MUTEX_SPIN, NULL);
    6262    *pSpinlock = pSpinlockInt;
    6363    return VINF_SUCCESS;
  • trunk/src/VBox/Runtime/r0drv/solaris/the-solaris-kernel.h

    r4071 r4178  
    2929#include <sys/sdt.h>
    3030#include <sys/schedctl.h>
     31#include <sys/time.h>
    3132
    32 /* commented for now
     33/* commented for now 
    3334#include <iprt/cdefs.h>
    34 
    3535__BEGIN_DECLS
    36 extern int nanosleep(const struct timespec *, struct timespec *);
    3736
    3837__END_DECLS
  • trunk/src/VBox/Runtime/r0drv/solaris/thread-r0drv-solaris.c

    r4071 r4178  
    3535{
    3636    int cTicks;
    37 
     37    unsigned long timeout;
     38   
    3839    if (!cMillies)
    3940    {
     
    4647    else
    4748        cTicks = 0;
    48    
    49     /* hm, maybe we could also use nanosleep() */
     49#if 0
     50    timeout = ddi_get_lbolt();
     51    timeout += cTicks;
     52 
     53    kcondvar_t cnd;
     54    kmutex_t mtx;
     55    mutex_init(&mtx, "IPRT Sleep Mutex", MUTEX_DRIVER, NULL);
     56    cv_init(&cnd, "IPRT Sleep CV", CV_DRIVER, NULL);
     57    mutex_enter(&mtx);
     58    cv_timedwait (&cnd, &mtx, 9000 * timeout);
     59    mutex_exit(&mtx);
     60    cv_destroy(&cnd);
     61    mutex_destroy(&mtx);
     62#endif
     63
     64#if 1
    5065    delay(cTicks);
    51    
    52 /*   Hmm, no same effect as using delay()
     66#endif
     67
     68#if 0
     69    /*   Hmm, no same effect as using delay() */
    5370    struct timespec t;
    5471    t.tv_sec = 0;
    5572    t.tv_nsec = cMillies * 1000000L;
    5673    nanosleep (&t, NULL);
    57 */   
     74#endif
     75
    5876    return VINF_SUCCESS;
    5977}
  • trunk/src/VBox/Runtime/r0drv/solaris/thread2-r0drv-solaris.c

    r4071 r4178  
    3939
    4040
    41 /** @todo Solaris native threading, when more info. on priority etc. (namely default prio value) is available */
    4241int rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType)
    4342{
     
    5655    }
    5756
    58     THREAD_CHANGE_PRI(curthread, iPriority);
     57    pri_t threadPrio = iPriority;
     58    curthread->t_pri = threadPrio;
    5959    return VINF_SUCCESS;
    6060}
     
    8888{
    8989    int rc;
    90     /** @todo passing hardcoded priority: 52. Find what default priority to pass */
     90    /** @todo Passing hardcoded priority of 52, Find correct default priority */
    9191    /* We know its from 0 to 127 priority, but what's the default?? */
    9292    kthread_t* pKernThread = thread_create(NULL, NULL, rtThreadNativeMain, pThreadInt, 0,
    9393                                           curproc, LMS_USER, 52);
    94     if (rc == 0)
     94    if (pKernThread)
    9595    {
    9696        *pNativeThread = (RTNATIVETHREAD)pKernThread;
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