VirtualBox

Ignore:
Timestamp:
Mar 20, 2015 1:00:25 PM (10 years ago)
Author:
vboxsync
Message:

threadctxhooks-r0drv-linux.c: Be a little bit more careful with EFLAGS in the context hook callouts.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r0drv/linux/threadctxhooks-r0drv-linux.c

    r54802 r54866  
    3737#include <iprt/err.h>
    3838#include <iprt/asm.h>
     39#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
     40# include <iprt/asm-amd64-x86.h>
     41#endif
    3942#include "internal/thread.h"
    4043
     
    8588{
    8689    PRTTHREADCTXINT pThis = RT_FROM_MEMBER(pPreemptNotifier, RTTHREADCTXINT, hPreemptNotifier);
     90#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
     91    RTCCUINTREG fSavedEFlags = ASMGetFlags();
     92    stac();
     93#endif
     94
    8795    AssertPtr(pThis);
    8896    AssertPtr(pThis->pfnThreadCtxHook);
     
    9098    Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
    9199
    92     stac();
    93100    pThis->pfnThreadCtxHook(RTTHREADCTXEVENT_PREEMPTING, pThis->pvUser);
     101
     102#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
    94103    clac();
     104    ASMSetFlags(fSavedEFlags);
     105#endif
    95106}
    96107
     
    108119{
    109120    PRTTHREADCTXINT pThis = RT_FROM_MEMBER(pPreemptNotifier, RTTHREADCTXINT, hPreemptNotifier);
     121#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
     122    RTCCUINTREG fSavedEFlags = ASMGetFlags();
     123    stac();
     124#endif
     125
    110126    AssertPtr(pThis);
    111127    AssertPtr(pThis->pfnThreadCtxHook);
    112128    Assert(pThis->fRegistered);
    113129
    114     stac();
     130
    115131    pThis->pfnThreadCtxHook(RTTHREADCTXEVENT_RESUMED, pThis->pvUser);
     132
     133#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
    116134    clac();
     135    ASMSetFlags(fSavedEFlags);
     136#endif
    117137}
    118138
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