Changeset 95073 in vbox
- Timestamp:
- May 24, 2022 1:32:10 PM (3 years ago)
- svn:sync-xref-src-repo-rev:
- 151543
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/asm.h
r95071 r95073 2083 2083 uint64_t u64Ret; 2084 2084 # 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. */ 2089 2094 __asm__ __volatile__("xchgl %%ebx, %1\n\t" 2090 "lock; cmpxchg8b %3\n\t"2095 "lock; cmpxchg8b (%3)\n\t" 2091 2096 "xchgl %%ebx, %1\n\t" 2092 2097 : "=A" (u64Ret) 2093 2098 : "DS" ((uint32_t)u64New) 2094 2099 , "c" ((uint32_t)(u64New >> 32)) 2095 , " m" (*pu64)2100 , "r" (pu64) /* Do not use "m" here*/ 2096 2101 , "0" (u64Old) 2097 2102 : "memory"
Note:
See TracChangeset
for help on using the changeset viewer.