"movl $1, %%eax \n\t"\r
"lock \n\t"\r
"xadd %%eax, %1 \n\t"\r
- "inc %%eax "\r
+ "inc %%eax \n\t"\r
: "=a" (Result), // %0\r
"+m" (*Value) // %1\r
: // no inputs that aren't also outputs\r
);\r
\r
return Result;\r
-\r
}\r
\r
\r
"movl $-1, %%eax \n\t"\r
"lock \n\t"\r
"xadd %%eax, %1 \n\t"\r
- "dec %%eax "\r
- : "=a" (Result), // %0\r
- "+m" (*Value) // %1\r
- : // no inputs that aren't also outputs\r
+ "dec %%eax \n\t"\r
+ : "=a" (Result), // %0\r
+ "+m" (*Value) // %1\r
+ : // no inputs that aren't also outputs\r
: "memory",\r
"cc"\r
);\r
return Result;\r
}\r
\r
+\r
/**\r
Performs an atomic compare exchange operation on a 16-bit unsigned integer.\r
\r
IN UINT16 ExchangeValue\r
)\r
{\r
-\r
__asm__ __volatile__ (\r
- " \n\t"\r
"lock \n\t"\r
"cmpxchgw %1, %2 \n\t"\r
- : "=a" (CompareValue)\r
- : "q" (ExchangeValue),\r
- "m" (*Value),\r
- "0" (CompareValue)\r
+ : "=a" (CompareValue) // %0\r
+ : "q" (ExchangeValue), // %1\r
+ "m" (*Value), // %2\r
+ "0" (CompareValue) // %3\r
: "memory",\r
"cc"\r
);\r
return CompareValue;\r
}\r
\r
+\r
/**\r
Performs an atomic compare exchange operation on a 32-bit unsigned integer.\r
\r
IN UINT32 ExchangeValue\r
)\r
{\r
-\r
__asm__ __volatile__ (\r
- " \n\t"\r
"lock \n\t"\r
"cmpxchgl %1, %2 \n\t"\r
- : "=a" (CompareValue) // %0\r
- : "q" (ExchangeValue), // %1\r
- "m" (*Value), // %2\r
- "0" (CompareValue) // %4\r
+ : "=a" (CompareValue) // %0\r
+ : "q" (ExchangeValue), // %1\r
+ "m" (*Value), // %2\r
+ "0" (CompareValue) // %3\r
: "memory",\r
"cc"\r
);\r
return CompareValue;\r
}\r
\r
+\r
/**\r
Performs an atomic compare exchange operation on a 64-bit unsigned integer.\r
\r
)\r
{\r
__asm__ __volatile__ (\r
- " \n\t"\r
"push %%ebx \n\t"\r
"movl %2,%%ebx \n\t"\r
"lock \n\t"\r
"movl $1, %%eax \n\t"\r
"lock \n\t"\r
"xadd %%eax, %1 \n\t"\r
- "inc %%eax "\r
+ "inc %%eax \n\t"\r
: "=a" (Result), // %0\r
"+m" (*Value) // %1\r
: // no inputs that aren't also outputs\r
"movl $-1, %%eax \n\t"\r
"lock \n\t"\r
"xadd %%eax, %1 \n\t"\r
- "dec %%eax "\r
- : "=a" (Result), // %0\r
- "+m" (*Value) // %1\r
- : // no inputs that aren't also outputs\r
+ "dec %%eax \n\t"\r
+ : "=a" (Result), // %0\r
+ "+m" (*Value) // %1\r
+ : // no inputs that aren't also outputs\r
: "memory",\r
"cc"\r
);\r
IN UINT16 ExchangeValue\r
)\r
{\r
-\r
-\r
__asm__ __volatile__ (\r
"lock \n\t"\r
- "cmpxchgw %3, %1 "\r
- : "=a" (CompareValue),\r
- "=m" (*Value)\r
- : "a" (CompareValue),\r
- "r" (ExchangeValue),\r
- "m" (*Value)\r
+ "cmpxchgw %3, %1 \n\t"\r
+ : "=a" (CompareValue), // %0\r
+ "=m" (*Value) // %1\r
+ : "a" (CompareValue), // %2\r
+ "r" (ExchangeValue), // %3\r
+ "m" (*Value) // %4\r
: "memory",\r
"cc"\r
);\r
IN UINT32 ExchangeValue\r
)\r
{\r
-\r
-\r
__asm__ __volatile__ (\r
"lock \n\t"\r
- "cmpxchgl %3, %1 "\r
- : "=a" (CompareValue), // %0\r
- "=m" (*Value) // %1\r
- : "a" (CompareValue), // %2\r
- "r" (ExchangeValue), // %3\r
- "m" (*Value)\r
+ "cmpxchgl %3, %1 \n\t"\r
+ : "=a" (CompareValue), // %0\r
+ "=m" (*Value) // %1\r
+ : "a" (CompareValue), // %2\r
+ "r" (ExchangeValue), // %3\r
+ "m" (*Value) // %4\r
: "memory",\r
"cc"\r
);\r
IN UINT64 ExchangeValue\r
)\r
{\r
-\r
__asm__ __volatile__ (\r
"lock \n\t"\r
- "cmpxchgq %3, %1 "\r
- : "=a" (CompareValue), // %0\r
- "=m" (*Value) // %1\r
- : "a" (CompareValue), // %2\r
- "r" (ExchangeValue), // %3\r
- "m" (*Value)\r
+ "cmpxchgq %3, %1 \n\t"\r
+ : "=a" (CompareValue), // %0\r
+ "=m" (*Value) // %1\r
+ : "a" (CompareValue), // %2\r
+ "r" (ExchangeValue), // %3\r
+ "m" (*Value) // %4\r
: "memory",\r
"cc"\r
);\r
\r
return CompareValue;\r
}\r
-\r
-\r