VirtualBox

Changeset 71700 in vbox for trunk/include


Ignore:
Timestamp:
Apr 6, 2018 11:32:36 AM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
121795
Message:

iprt/asm.h: Use SSE2 fence instructions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/asm.h

    r71522 r71700  
    15241524DECLINLINE(void) ASMMemoryFence(void)
    15251525{
    1526     /** @todo use mfence? check if all cpus we care for support it. */
    1527 #if ARCH_BITS == 16
     1526#if defined(RT_ARCH_AMD64) || (defined(RT_ARCH_X86) && !defined(RT_WITH_OLD_CPU_SUPPORT))
     1527# if RT_INLINE_ASM_GNU_STYLE
     1528    __asm__ __volatile__ (".byte 0x0f,0xae,0xf0\n\t");
     1529# elif RT_INLINE_ASM_USES_INTRIN
     1530    _mm_mfence();
     1531# else
     1532    __asm
     1533    {
     1534        _emit   0x0f
     1535        _emit   0xae
     1536        _emit   0xf0
     1537    }
     1538# endif
     1539#elif ARCH_BITS == 16
    15281540    uint16_t volatile u16;
    15291541    ASMAtomicXchgU16(&u16, 0);
     
    15401552DECLINLINE(void) ASMWriteFence(void)
    15411553{
    1542     /** @todo use sfence? check if all cpus we care for support it. */
     1554#if defined(RT_ARCH_AMD64) || (defined(RT_ARCH_X86) && !defined(RT_WITH_OLD_CPU_SUPPORT))
     1555# if RT_INLINE_ASM_GNU_STYLE
     1556    __asm__ __volatile__ (".byte 0x0f,0xae,0xf8\n\t");
     1557# elif RT_INLINE_ASM_USES_INTRIN
     1558    _mm_sfence();
     1559# else
     1560    __asm
     1561    {
     1562        _emit   0x0f
     1563        _emit   0xae
     1564        _emit   0xf8
     1565    }
     1566# endif
     1567#else
    15431568    ASMMemoryFence();
     1569#endif
    15441570}
    15451571
     
    15501576DECLINLINE(void) ASMReadFence(void)
    15511577{
    1552     /** @todo use lfence? check if all cpus we care for support it. */
     1578#if defined(RT_ARCH_AMD64) || (defined(RT_ARCH_X86) && !defined(RT_WITH_OLD_CPU_SUPPORT))
     1579# if RT_INLINE_ASM_GNU_STYLE
     1580    __asm__ __volatile__ (".byte 0x0f,0xae,0xe8\n\t");
     1581# elif RT_INLINE_ASM_USES_INTRIN
     1582    _mm_lfence();
     1583# else
     1584    __asm
     1585    {
     1586        _emit   0x0f
     1587        _emit   0xae
     1588        _emit   0xe8
     1589    }
     1590# endif
     1591#else
    15531592    ASMMemoryFence();
     1593#endif
    15541594}
    15551595
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