VirtualBox

Changeset 95073 in vbox


Ignore:
Timestamp:
May 24, 2022 1:32:10 PM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
151543
Message:

iprt/asm.h: Fix to the x86/gcc version of ASMAtomicCmpXchgExU64 to prevent the PIC3 testcase from crashing.

File:
1 edited

Legend:

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

    r95071 r95073  
    20832083    uint64_t u64Ret;
    20842084#   if defined(PIC) || defined(__PIC__)
    2085     /* NB: this code uses a memory clobber description, because the clean
    2086      * solution with an output value for *pu64 makes gcc run out of registers.
    2087      * This will cause suboptimal code, and anyone with a better solution is
    2088      * welcome to improve this. */
     2085    /* Note #1: This code uses a memory clobber description, because the clean
     2086                solution with an output value for *pu64 makes gcc run out of
     2087                registers.  This will cause suboptimal code, and anyone with a
     2088                better solution is welcome to improve this.
     2089
     2090       Note #2: We must prevent gcc from encoding the memory access, as it
     2091                may go via the GOT if we're working on a global variable (like
     2092                in the testcase).  Thus we request a register (%3) and
     2093                dereference it ourselves. */
    20892094    __asm__ __volatile__("xchgl %%ebx, %1\n\t"
    2090                          "lock; cmpxchg8b %3\n\t"
     2095                         "lock; cmpxchg8b (%3)\n\t"
    20912096                         "xchgl %%ebx, %1\n\t"
    20922097                         : "=A" (u64Ret)
    20932098                         : "DS" ((uint32_t)u64New)
    20942099                         , "c" ((uint32_t)(u64New >> 32))
    2095                          , "m" (*pu64)
     2100                         , "r" (pu64) /* Do not use "m" here*/
    20962101                         , "0" (u64Old)
    20972102                         : "memory"
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