VirtualBox

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


Ignore:
Timestamp:
Aug 11, 2009 9:41:58 AM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
50921
Message:

IPRT,SUPDrv: Changed RTTHREADPREEMPTSTATE breaking binary compatibility - increased the major SUPDrv version.

Location:
trunk/src/VBox/Runtime
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/include/internal/iprt.h

    r22139 r22150  
    131131#endif
    132132
     133/** @def RT_ASSERT_PREEMPT_CPUID_DISABLE
     134 * For use in RTThreadPreemptDisable implementations after having disabled
     135 * preemption.  Requires iprt/mp.h. */
     136#ifdef RT_MORE_STRICT
     137# define RT_ASSERT_PREEMPT_CPUID_DISABLE(pStat) \
     138    do \
     139    { \
     140        Assert((pStat)->idCpu == NIL_RTCPUID); \
     141        (pStat)->idCpu = RTMpCpuId(); \
     142    } while (0)
     143#else
     144# define RT_ASSERT_PREEMPT_CPUID_DISABLE(pStat) \
     145    Assert((pStat)->idCpu == NIL_RTCPUID)
     146#endif
     147
     148/** @def RT_ASSERT_PREEMPT_CPUID_RESTORE
     149 * For use in RTThreadPreemptRestore implementations before restoring
     150 * preemption.  Requires iprt/mp.h. */
     151#ifdef RT_MORE_STRICT
     152# define RT_ASSERT_PREEMPT_CPUID_RESTORE(pStat) \
     153    do \
     154    { \
     155        RTCPUID const idAssertCpuNow = RTMpCpuId(); \
     156        AssertMsg((pStat)->idCpu == idAssertCpuNow,  ("%#x, %#x\n", (pStat)->idCpu, idAssertCpuNow)); \
     157        (pStat)->idCpu = NIL_RTCPUID; \
     158    } while (0)
     159#else
     160# define RT_ASSERT_PREEMPT_CPUID_RESTORE(pStat)         do { } while (0)
     161#endif
     162
     163
    133164/** @def RT_ASSERT_INTS_ON
    134165 * Asserts that interrupts are disabled when RT_MORE_STRICT is defined.   */
  • trunk/src/VBox/Runtime/r0drv/darwin/threadpreempt-r0drv-darwin.cpp

    r22052 r22150  
    141141{
    142142    AssertPtr(pState);
    143     Assert(pState->uchDummy != 42);
    144     pState->uchDummy = 42;
     143    Assert(pState->u32Reserved == 0);
     144    pState->u32Reserved = 42;
    145145
    146146    /*
     
    164164    ASMSetFlags(fSavedFlags);
    165165    Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
     166    RT_ASSERT_PREEMPT_CPUID_DISABLE(pState);
    166167}
    167168
     
    170171{
    171172    AssertPtr(pState);
    172     Assert(pState->uchDummy == 42);
    173     pState->uchDummy = 0;
     173    Assert(pState->u32Reserved == 42);
     174    pState->u32Reserved = 0;
     175    RT_ASSERT_PREEMPT_CPUID_RESTORE(pState);
    174176
    175177    RTCPUID idCpu = RTMpCpuId();
  • trunk/src/VBox/Runtime/r0drv/freebsd/thread-r0drv-freebsd.c

    r21536 r22150  
    143143{
    144144    AssertPtr(pState);
    145     Assert(pState->uchDummy != 42);
    146     pState->uchDummy = 42;
     145    Assert(pState->u32Reserved == 0);
     146    pState->u32Reserved = 42;
    147147
    148148    critical_enter();
     149    RT_ASSERT_PREEMPT_CPUID_DISABLE(pState);
    149150}
    150151
     
    153154{
    154155    AssertPtr(pState);
    155     Assert(pState->uchDummy == 42);
    156     pState->uchDummy = 0;
     156    Assert(pState->u32Reserved == 42);
     157    pState->u32Reserved = 0;
    157158
     159    RT_ASSERT_PREEMPT_CPUID_RESTORE(pState);
    158160    critical_exit();
    159161}
  • trunk/src/VBox/Runtime/r0drv/generic/RTThreadPreemptDisable-r0drv-generic.cpp

    r21337 r22150  
    4242{
    4343    AssertPtr(pState);
    44     Assert(pState->uchDummy != 42);
    45     pState->uchDummy = 42;
     44    Assert(pState->u32Reserved == 0);
     45    pState->u32Reserved = 42;
    4646}
    4747RT_EXPORT_SYMBOL(RTThreadPreemptDisable);
  • trunk/src/VBox/Runtime/r0drv/generic/RTThreadPreemptRestore-r0drv-generic.cpp

    r21337 r22150  
    4242{
    4343    AssertPtr(pState);
    44     Assert(pState->uchDummy == 42);
    45     pState->uchDummy = 0;
     44    Assert(pState->u32Reserved == 42);
     45    pState->u32Reserved = 0;
    4646}
    4747RT_EXPORT_SYMBOL(RTThreadPreemptRestore);
  • trunk/src/VBox/Runtime/r0drv/linux/thread-r0drv-linux.c

    r22057 r22150  
    3535#include "the-linux-kernel.h"
    3636#include "internal/iprt.h"
    37 
    3837#include <iprt/thread.h>
     38
    3939#include <iprt/asm.h>
    4040#include <iprt/assert.h>
    4141#include <iprt/err.h>
     42#include <iprt/mp.h>
    4243
    4344
     
    160161#ifdef CONFIG_PREEMPT
    161162    AssertPtr(pState);
    162     Assert(pState->uchDummy != 42);
    163     pState->uchDummy = 42;
     163    Assert(pState->u32Reserved == 0);
     164    pState->u32Reserved = 42;
    164165    preempt_disable();
     166    RT_ASSERT_PREEMPT_CPUID_DISABLE(pState);
    165167
    166168#else /* !CONFIG_PREEMPT */
    167169    int32_t c;
    168170    AssertPtr(pState);
     171    Assert(pState->u32Reserved == 0);
    169172
    170173    /* Do our own accounting. */
    171174    c = ASMAtomicIncS32(&g_acPreemptDisabled[smp_processor_id()]);
    172175    AssertMsg(c > 0 && c < 32, ("%d\n", c));
    173     pState->uchDummy = (unsigned char )c;
     176    pState->u32Reserved = c;
     177    RT_ASSERT_PREEMPT_CPUID_DISABLE(pState);
    174178#endif
    175179}
     
    181185#ifdef CONFIG_PREEMPT
    182186    AssertPtr(pState);
    183     Assert(pState->uchDummy == 42);
    184     pState->uchDummy = 0;
     187    Assert(pState->u32Reserved == 42);
     188    RT_ASSERT_PREEMPT_CPUID_RESTORE(pState);
    185189    preempt_enable();
    186190
     
    188192    int32_t volatile *pc;
    189193    AssertPtr(pState);
    190     AssertMsg(pState->uchDummy > 0 && pState->uchDummy < 32, ("%d\n", pState->uchDummy));
     194    AssertMsg(pState->u32Reserved > 0 && pState->u32Reserved < 32, ("%d\n", pState->u32Reserved));
     195    RT_ASSERT_PREEMPT_CPUID_RESTORE(pState);
    191196
    192197    /* Do our own accounting. */
    193198    pc = &g_acPreemptDisabled[smp_processor_id()];
    194     AssertMsg(pState->uchDummy == (uint32_t)*pc, ("uchDummy=%d *pc=%d \n", pState->uchDummy, *pc));
    195     ASMAtomicUoWriteS32(pc, pState->uchDummy - 1);
    196 #endif
     199    AssertMsg(pState->u32Reserved == (uint32_t)*pc, ("u32Reserved=%d *pc=%d \n", pState->u32Reserved, *pc));
     200    ASMAtomicUoWriteS32(pc, pState->u32Reserved - 1);
     201#endif
     202    pState->u32Reserved = 0;
    197203}
    198204RT_EXPORT_SYMBOL(RTThreadPreemptRestore);
  • trunk/src/VBox/Runtime/r0drv/nt/thread-r0drv-nt.cpp

    r21536 r22150  
    169169
    170170    KeRaiseIrql(DISPATCH_LEVEL, &pState->uchOldIrql);
     171    RT_ASSERT_PREEMPT_CPUID_DISABLE(pState);
    171172}
    172173
     
    176177    AssertPtr(pState);
    177178
     179    RT_ASSERT_PREEMPT_CPUID_RESTORE(pState);
    178180    KeLowerIrql(pState->uchOldIrql);
    179181    pState->uchOldIrql = 255;
  • trunk/src/VBox/Runtime/r0drv/os2/thread-r0drv-os2.cpp

    r21536 r22150  
    134134{
    135135    AssertPtr(pState);
     136    Assert(pState->u32Reserved == 0);
    136137
    137138    /* No preemption on OS/2, so do our own accounting. */
    138139    int32_t c = ASMAtomicIncS32(&g_acPreemptDisabled[ASMGetApicId()]);
    139140    AssertMsg(c > 0 && c < 32, ("%d\n", c));
    140     pState->uchDummy = (unsigned char)c;
     141    pState->u32Reserved = c;
     142    RT_ASSERT_PREEMPT_CPUID_DISABLE(pState);
    141143}
    142144
     
    145147{
    146148    AssertPtr(pState);
    147     AssertMsg(pState->uchDummy > 0 && pState->uchDummy < 32, ("%d\n", pState->uchDummy));
     149    AssertMsg(pState->u32Reserved > 0 && pState->u32Reserved < 32, ("%d\n", pState->u32Reserved));
     150    RT_ASSERT_PREEMPT_CPUID_RESTORE(pState);
    148151
    149152    /* No preemption on OS/2, so do our own accounting. */
    150153    int32_t volatile *pc = &g_acPreemptDisabled[ASMGetApicId()];
    151     AssertMsg(pState->uchDummy == (uint32_t)*pc, ("uchDummy=%d *pc=%d \n", pState->uchDummy, *pc));
    152     ASMAtomicUoWriteS32(pc, pState->uchDummy - 1);
    153     pState->uchDummy = 0;
     154    AssertMsg(pState->u32Reserved == (uint32_t)*pc, ("uchDummy=%d *pc=%d \n", pState->u32Reserved, *pc));
     155    ASMAtomicUoWriteS32(pc, pState->u32Reserved - 1);
     156    pState->u32Reserved = 0;
    154157}
    155158
  • trunk/src/VBox/Runtime/r0drv/solaris/thread-r0drv-solaris.c

    r22073 r22150  
    142142{
    143143    AssertPtr(pState);
    144     Assert(pState->uchDummy != 42);
    145     pState->uchDummy = 42;
     144    Assert(pState->u32Reserved == 0);
     145    pState->u32Reserved = 42;
    146146
    147147    kpreempt_disable();
     148    RT_ASSERT_PREEMPT_CPUID_DISABLE(pState);
    148149}
    149150
     
    152153{
    153154    AssertPtr(pState);
    154     Assert(pState->uchDummy == 42);
    155     pState->uchDummy = 0;
     155    Assert(pState->u32Reserved == 42);
     156    pState->u32Reserved = 0;
     157    RT_ASSERT_PREEMPT_CPUID_RESTORE(pState);
    156158
    157159    kpreempt_enable();
  • trunk/src/VBox/Runtime/r0drv/solaris/vbi/thread-r0drv-solaris.c

    r22073 r22150  
    4040#include <iprt/assert.h>
    4141#include <iprt/err.h>
     42#include <iprt/mp.h>
    4243
    4344
     
    138139{
    139140    AssertPtr(pState);
    140     Assert(pState->uchDummy != 42);
    141     pState->uchDummy = 42;
     141    Assert(pState->u32Reserved == 0);
     142    pState->u32Reserved = 42;
    142143    vbi_preempt_disable();
     144    RT_ASSERT_PREEMPT_CPUID_DISABLE(pState);
    143145}
    144146
     
    147149{
    148150    AssertPtr(pState);
    149     Assert(pState->uchDummy == 42);
    150     pState->uchDummy = 0;
     151    Assert(pState->u32Reserved == 42);
     152    pState->u32Reserved = 0;
     153    RT_ASSERT_PREEMPT_CPUID_RESTORE(pState);
    151154    vbi_preempt_enable();
    152155}
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