VirtualBox

Ignore:
Timestamp:
Aug 7, 2009 3:26:56 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
50819
Message:

iprt/r0drv/solaris: context assertions (RT_MORE_STRICT).

Location:
trunk/src/VBox/Runtime/r0drv/solaris/vbi
Files:
11 edited

Legend:

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

    • Property svn:keywords set to Author Date Id Revision
    r21292 r22073  
    2929 */
    3030
     31
     32/*******************************************************************************
     33*   Header Files                                                               *
     34*******************************************************************************/
    3135#include "the-solaris-kernel.h"
    3236#include <iprt/log.h>
     37
    3338#include <iprt/assert.h>
    3439
  • trunk/src/VBox/Runtime/r0drv/solaris/vbi/RTMpPokeCpu-r0drv-solaris.c

    r19501 r22073  
    3434*******************************************************************************/
    3535#include "the-solaris-kernel.h"
     36#include "internal/iprt.h"
    3637#include <iprt/mp.h>
     38
     39#include <iprt/asm.h>
    3740#include <iprt/err.h>
    3841
     
    4144RTDECL(int) RTMpPokeCpu(RTCPUID idCpu)
    4245{
     46    RT_ASSERT_INTS_ON();
    4347    vbi_poke_cpu(idCpu);
    4448    return VINF_SUCCESS;
  • trunk/src/VBox/Runtime/r0drv/solaris/vbi/alloc-r0drv-solaris.c

    • Property svn:keywords changed from Id to Author Date Id Revision
    r9149 r22073  
    3434*******************************************************************************/
    3535#include "the-solaris-kernel.h"
     36#include "internal/iprt.h"
     37#include <iprt/mem.h>
    3638
    37 #include <iprt/alloc.h>
    3839#include <iprt/assert.h>
    39 #include <iprt/types.h>
    4040#include <iprt/param.h>
     41#include <iprt/thread.h>
    4142#include "r0drv/alloc-r0drv.h"
     43
    4244
    4345
     
    9395    AssertPtr(pPhys);
    9496    Assert(cb > 0);
     97    RT_ASSERT_PREEMPTIBLE();
    9598
    9699    /* Allocate physically contiguous page-aligned memory. */
     
    111114RTR0DECL(void) RTMemContFree(void *pv, size_t cb)
    112115{
     116    RT_ASSERT_PREEMPTIBLE();
    113117    if (pv)
    114118        vbi_contig_free(pv, cb);
  • trunk/src/VBox/Runtime/r0drv/solaris/vbi/memobj-r0drv-solaris.c

    • Property svn:keywords changed from Id to Author Date Id Revision
    r21633 r22073  
    3434*******************************************************************************/
    3535#include "the-solaris-kernel.h"
    36 
     36#include "internal/iprt.h"
    3737#include <iprt/memobj.h>
     38
     39#include <iprt/assert.h>
     40#include <iprt/err.h>
     41#include <iprt/log.h>
    3842#include <iprt/mem.h>
    39 #include <iprt/err.h>
    40 #include <iprt/assert.h>
    41 #include <iprt/log.h>
    4243#include <iprt/param.h>
    4344#include <iprt/process.h>
     
    326327            cmn_err(CE_NOTE, "rtR0MemObjNativeMapUser: no page to map.\n");
    327328            rc = VERR_MAP_FAILED;
    328             goto done;
     329            goto l_done;
    329330        }
    330331        pv = (void *)((uintptr_t)pv + PAGE_SIZE);
     
    337338        rc = VERR_MAP_FAILED;
    338339        rtR0MemObjDelete(&pMemSolaris->Core);
    339         goto done;
     340        goto l_done;
    340341    }
    341342    else
     
    345346    pMemSolaris->Core.pv = addr;
    346347    *ppMem = &pMemSolaris->Core;
    347 done:
     348l_done:
    348349    kmem_free(paddrs, sizeof(uint64_t) * cPages);
    349350    return rc;
  • trunk/src/VBox/Runtime/r0drv/solaris/vbi/mp-r0drv-solaris.c

    r19391 r22073  
    3434*******************************************************************************/
    3535#include "the-solaris-kernel.h"
    36 
     36#include "internal/iprt.h"
    3737#include <iprt/mp.h>
     38
     39#include <iprt/asm.h>
    3840#include <iprt/cpuset.h>
    3941#include <iprt/err.h>
    40 #include <iprt/asm.h>
    4142#include "r0drv/mp-r0drv.h"
     43
    4244
    4345
     
    160162{
    161163    RTMPARGS Args;
     164    RT_ASSERT_INTS_ON();
    162165
    163166    Args.pfnWorker = pfnWorker;
     
    203206    int rc;
    204207    RTMPARGS Args;
     208    RT_ASSERT_INTS_ON();
    205209
    206210    /* The caller is supposed to have disabled preemption, but take no chances. */
     
    249253    int rc;
    250254    RTMPARGS Args;
     255    RT_ASSERT_INTS_ON();
    251256
    252257    if (idCpu >= vbi_cpu_count())
  • trunk/src/VBox/Runtime/r0drv/solaris/vbi/mpnotification-r0drv-solaris.c

    r11982 r22073  
    3333*******************************************************************************/
    3434#include "the-solaris-kernel.h"
     35#include "internal/iprt.h"
    3536
     37#include <iprt/err.h>
    3638#include <iprt/mp.h>
    37 #include <iprt/err.h>
    3839#include "r0drv/mp-r0drv.h"
     40
     41
     42/*******************************************************************************
     43*   Global Variables                                                           *
     44*******************************************************************************/
     45static vbi_cpu_watch_t *g_hVbiCpuWatch = NULL;
    3946
    4047
     
    5057}
    5158
    52 static vbi_cpu_watch_t *watch_handle = NULL;
    5359
    5460int rtR0MpNotificationNativeInit(void)
     
    5662    if (vbi_revision_level < 2)
    5763        return VERR_NOT_SUPPORTED;
    58     if (watch_handle != NULL)
    59         return VERR_INVALID_PARAMETER;
    60     watch_handle = vbi_watch_cpus(rtMpNotificationSolarisCallback, NULL, 0);
     64    if (g_hVbiCpuWatch != NULL)
     65        return VERR_WRONG_ORDER;
     66    g_hVbiCpuWatch = vbi_watch_cpus(rtMpNotificationSolarisCallback, NULL, 0);
    6167    return VINF_SUCCESS;
    6268}
     
    6571void rtR0MpNotificationNativeTerm(void)
    6672{
    67     if (vbi_revision_level >= 2 && watch_handle != NULL)
    68         vbi_ignore_cpus(watch_handle);
    69     watch_handle = NULL;
     73    if (vbi_revision_level >= 2 && g_hVbiCpuWatch != NULL)
     74        vbi_ignore_cpus(g_hVbiCpuWatch);
     75    g_hVbiCpuWatch = NULL;
    7076}
    7177
  • trunk/src/VBox/Runtime/r0drv/solaris/vbi/process-r0drv-solaris.c

    • Property svn:keywords changed from Id to Author Date Id Revision
    r9149 r22073  
    2929 */
    3030
     31
    3132/*******************************************************************************
    3233*   Header Files                                                               *
    3334*******************************************************************************/
    3435#include "the-solaris-kernel.h"
     36#include "internal/iprt.h"
     37#include <iprt/process.h>
    3538
    36 #include <iprt/process.h>
    3739
    3840
  • trunk/src/VBox/Runtime/r0drv/solaris/vbi/thread-r0drv-solaris.c

    • Property svn:keywords changed from Id to Author Date Id Revision
    r21595 r22073  
    3434*******************************************************************************/
    3535#include "the-solaris-kernel.h"
     36#include "internal/iprt.h"
     37#include <iprt/thread.h>
    3638
    37 #include <iprt/thread.h>
    3839#include <iprt/asm.h>
    3940#include <iprt/assert.h>
    4041#include <iprt/err.h>
     42
    4143
    4244
     
    5153    clock_t cTicks;
    5254    unsigned long timeout;
     55    RT_ASSERT_PREEMPTIBLE();
    5356
    5457    if (!cMillies)
     
    9699RTDECL(bool) RTThreadYield(void)
    97100{
     101    RT_ASSERT_PREEMPTIBLE();
    98102    return vbi_yield();
    99103}
  • trunk/src/VBox/Runtime/r0drv/solaris/vbi/thread2-r0drv-solaris.c

    • Property svn:keywords changed from Id to Author Date Id Revision
    r9149 r22073  
    2929 */
    3030
     31
    3132/*******************************************************************************
    3233*   Header Files                                                               *
    3334*******************************************************************************/
    3435#include "the-solaris-kernel.h"
     36#include "internal/iprt.h"
     37#include <iprt/thread.h>
    3538
    3639#include <iprt/assert.h>
    3740#include <iprt/err.h>
    38 #include <iprt/thread.h>
     41#include "internal/thread.h"
    3942
    40 #include "internal/thread.h"
     43
    4144
    4245int rtThreadNativeInit(void)
     
    9093{
    9194    PRTTHREADINT pThreadInt = (PRTTHREADINT)pvThreadInt;
    92     int rc;
    9395
    94     rc = rtThreadMain(pThreadInt, (RTNATIVETHREAD)vbi_curthread(), &pThreadInt->szName[0]);
     96    rtThreadMain(pThreadInt, (RTNATIVETHREAD)vbi_curthread(), &pThreadInt->szName[0]);
    9597    vbi_thread_exit();
    9698}
     
    99101int rtThreadNativeCreate(PRTTHREADINT pThreadInt, PRTNATIVETHREAD pNativeThread)
    100102{
    101     int rc;
    102     void *pKernThread = vbi_thread_create(rtThreadNativeMain, pThreadInt,
    103                                            sizeof (pThreadInt), minclsyspri);
    104     if (pKernThread)
     103    void   *pvKernThread;
     104    RT_ASSERT_PREEMPTIBLE();
     105
     106    pvKernThread = vbi_thread_create(rtThreadNativeMain, pThreadInt, sizeof(pThreadInt), minclsyspri);
     107    if (pvKernThread)
    105108    {
    106         *pNativeThread = (RTNATIVETHREAD)pKernThread;
     109        *pNativeThread = (RTNATIVETHREAD)pvKernThread;
    107110        return VINF_SUCCESS;
    108111    }
    109112
    110     return RTErrConvertFromErrno(rc);
     113    return VERR_OUT_OF_RESOURCES;
    111114}
    112115
  • trunk/src/VBox/Runtime/r0drv/solaris/vbi/time-r0drv-solaris.c

    • Property svn:keywords changed from Id to Author Date Id Revision
    r9149 r22073  
    3333*   Header Files                                                               *
    3434*******************************************************************************/
     35#define RTTIME_INCL_TIMESPEC
    3536#include "the-solaris-kernel.h"
    36 #define RTTIME_INCL_TIMESPEC
    37 
     37#include "internal/iprt.h"
    3838#include <iprt/time.h>
    3939
     
    6767    return RTTimeSpecSetNano(pTime, vbi_tod());
    6868}
     69
  • trunk/src/VBox/Runtime/r0drv/solaris/vbi/timer-r0drv-solaris.c

    • Property svn:keywords changed from Id to Author Date Id Revision
    r14318 r22073  
    1 /** $Id$ */
     1/* $Id$ */
    22/** @file
    33 * IPRT - Timer, Ring-0 Driver, Solaris.
     
    3434*******************************************************************************/
    3535#include "the-solaris-kernel.h"
    36 
     36#include "internal/iprt.h"
    3737#include <iprt/timer.h>
    38 #include <iprt/time.h>
     38
     39#include <iprt/asm.h>
     40#include <iprt/assert.h>
     41#include <iprt/err.h>
     42#include <iprt/mem.h>
    3943#include <iprt/mp.h>
    4044#include <iprt/spinlock.h>
    41 #include <iprt/err.h>
    42 #include <iprt/asm.h>
    43 #include <iprt/assert.h>
    44 #include <iprt/alloc.h>
    45 
     45#include <iprt/time.h>
     46#include <iprt/thread.h>
    4647#include "internal/magics.h"
    4748
     
    7071    uint64_t                interval;
    7172    /** simple Solaris timer handle. */
    72     vbi_stimer_t            *stimer;
     73    vbi_stimer_t           *stimer;
    7374    /** global Solaris timer handle. */
    74     vbi_gtimer_t            *gtimer;
     75    vbi_gtimer_t           *gtimer;
    7576    /** The user callback. */
    7677    PFNRTTIMER              pfnTimer;
    7778    /** The argument for the user callback. */
    78     void                    *pvUser;
     79    void                   *pvUser;
    7980} RTTIMER;
     81
     82
     83/*******************************************************************************
     84*   Defined Constants And Macros                                               *
     85*******************************************************************************/
     86/** Validates that the timer is valid. */
     87#define RTTIMER_ASSERT_VALID_RET(pTimer) \
     88    do \
     89    { \
     90        AssertPtrReturn(pTimer, VERR_INVALID_HANDLE); \
     91        AssertReturn((pTimer)->u32Magic == RTTIMER_MAGIC, VERR_INVALID_HANDLE); \
     92    } while (0)
    8093
    8194
     
    93106RTDECL(int) RTTimerCreateEx(PRTTIMER *ppTimer, uint64_t u64NanoInterval, unsigned fFlags, PFNRTTIMER pfnTimer, void *pvUser)
    94107{
     108    RT_ASSERT_PREEMPTIBLE();
    95109    *ppTimer = NULL;
    96110
     
    149163
    150164
    151 /**
    152  * Validates the timer handle.
    153  *
    154  * @returns true if valid, false if invalid.
    155  * @param   pTimer  The handle.
    156  */
    157 DECLINLINE(bool) rtTimerIsValid(PRTTIMER pTimer)
    158 {
    159     AssertReturn(VALID_PTR(pTimer), false);
    160     AssertReturn(pTimer->u32Magic == RTTIMER_MAGIC, false);
    161     return true;
    162 }
    163 
    164 
    165165RTDECL(int) RTTimerDestroy(PRTTIMER pTimer)
    166166{
    167167    if (pTimer == NULL)
    168168        return VINF_SUCCESS;
    169     if (!rtTimerIsValid(pTimer))
    170         return VERR_INVALID_HANDLE;
     169    RTTIMER_ASSERT_VALID_RET(pTimer);
     170    RT_ASSERT_INTS_ON();
    171171
    172172    /*
     
    174174     */
    175175    RTTimerStop(pTimer);
    176     pTimer->u32Magic++;
     176    ASMAtomicWriteU32(pTimer, ~RTTIMER_MAGIC);
    177177    RTMemFree(pTimer);
    178178    return VINF_SUCCESS;
     
    182182RTDECL(int) RTTimerStart(PRTTIMER pTimer, uint64_t u64First)
    183183{
    184     int cpu = VBI_ANY_CPU;
    185 
    186     if (!rtTimerIsValid(pTimer))
    187         return VERR_INVALID_HANDLE;
     184    RTTIMER_ASSERT_VALID_RET(pTimer);
     185    RT_ASSERT_INTS_ON();
     186
    188187    if (!pTimer->fSuspended)
    189188        return VERR_TIMER_ACTIVE;
     
    198197    else
    199198    {
     199        int cpu = VBI_ANY_CPU;
    200200        if (pTimer->fSpecificCpu)
    201201            cpu = pTimer->iCpu;
     
    215215RTDECL(int) RTTimerStop(PRTTIMER pTimer)
    216216{
    217     if (!rtTimerIsValid(pTimer))
    218         return VERR_INVALID_HANDLE;
     217    RTTIMER_ASSERT_VALID_RET(pTimer);
     218    RT_ASSERT_INTS_ON();
     219
    219220    if (pTimer->fSuspended)
    220221        return VERR_TIMER_SUSPENDED;
Note: See TracChangeset for help on using the changeset viewer.

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