reactos/ntoskrnl/ex/i386
diff -u -r1.9 -r1.10
--- interlck.c 9 Sep 2004 18:51:17 -0000 1.9
+++ interlck.c 12 Dec 2004 17:48:20 -0000 1.10
@@ -1,10 +1,16 @@
-/* $Id: interlck.c,v 1.9 2004/09/09 18:51:17 hbirr Exp $
+/* $Id: interlck.c,v 1.10 2004/12/12 17:48:20 hbirr Exp $
*
* reactos/ntoskrnl/ex/i386/interlck.c
*
*/
#include <ntoskrnl.h>
+#ifdef MP
+#define LOCK "lock "
+#else
+#define LOCK " "
+#endif
+
#if defined(__GNUC__)
/*
@@ -86,7 +92,7 @@
__asm__("\n\t.global @Exfi386InterlockedExchangeUlong@8\n\t"
"@Exfi386InterlockedExchangeUlong@8:\n\t"
- "xchgl %edx,(%ecx)\n\t"
+ LOCK"xchgl %edx,(%ecx)\n\t"
"movl %edx,%eax\n\t"
"ret\n\t");
@@ -182,7 +188,7 @@
"_Exi386InterlockedExchangeUlong@8:\n\t"
"movl 4(%esp),%edx\n\t"
"movl 8(%esp),%eax\n\t"
- "xchgl %eax,(%edx)\n\t"
+ LOCK"xchgl %eax,(%edx)\n\t"
"ret $8\n\t");
#elif defined(_MSC_VER)
@@ -225,7 +231,7 @@
__asm__("\n\t.global @InterlockedIncrement@4\n\t"
"@InterlockedIncrement@4:\n\t"
"movl $1,%eax\n\t"
- "xaddl %eax,(%ecx)\n\t"
+ LOCK"xaddl %eax,(%ecx)\n\t"
"incl %eax\n\t"
"ret\n\t");
@@ -262,7 +268,7 @@
__asm__("\n\t.global @InterlockedDecrement@4\n\t"
"@InterlockedDecrement@4:\n\t"
"movl $-1,%eax\n\t"
- "xaddl %eax,(%ecx)\n\t"
+ LOCK"xaddl %eax,(%ecx)\n\t"
"decl %eax\n\t"
"ret\n\t");
@@ -301,7 +307,7 @@
__asm__("\n\t.global @InterlockedExchange@8\n\t"
"@InterlockedExchange@8:\n\t"
- "xchgl %edx,(%ecx)\n\t"
+ LOCK"xchgl %edx,(%ecx)\n\t"
"movl %edx,%eax\n\t"
"ret\n\t");
@@ -337,7 +343,7 @@
__asm__("\n\t.global @InterlockedExchangeAdd@8\n\t"
"@InterlockedExchangeAdd@8:\n\t"
- "xaddl %edx,(%ecx)\n\t"
+ LOCK"xaddl %edx,(%ecx)\n\t"
"movl %edx,%eax\n\t"
"ret\n\t");
@@ -374,7 +380,7 @@
__asm__("\n\t.global @InterlockedCompareExchange@12\n\t"
"@InterlockedCompareExchange@12:\n\t"
"movl 4(%esp),%eax\n\t"
- "cmpxchg %edx,(%ecx)\n\t"
+ LOCK"cmpxchg %edx,(%ecx)\n\t"
"ret $4\n\t");
#elif defined(_MSC_VER)
@@ -412,7 +418,7 @@
"\n1:\t"
"movl (%esi),%eax\n\t"
"movl 4(%esi),%edx\n\t"
- "lock cmpxchg8b (%esi)\n\t"
+ LOCK"cmpxchg8b (%esi)\n\t"
"jnz 1b\n\t"
"popl %esi\n\t"
"popl %ebx\n\t"
@@ -441,7 +447,7 @@
"movl 12(%esp),%edx\n\t"
"movl (%edx),%eax\n\t"
"movl 4(%edx),%edx\n\t"
- "lock cmpxchg8b (%esi)\n\t"
+ LOCK"cmpxchg8b (%esi)\n\t"
"popl %esi\n\t"
"popl %ebx\n\t"
"ret $4\n\t");