-/* $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__)
/*
__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");
"_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)
__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");
__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");
__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");
__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");
__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)
"\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"
"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");