reactos/ntoskrnl/include/internal
diff -u -r1.40 -r1.41
--- ex.h 17 Aug 2004 21:47:36 -0000 1.40
+++ ex.h 9 Sep 2004 18:51:16 -0000 1.41
@@ -105,5 +105,10 @@
IN struct _KEVENT_PAIR* EventPair
);
+LONGLONG
+FASTCALL
+ExfpInterlockedExchange64(LONGLONG volatile * Destination,
+ PLONGLONG Exchange);
+
#endif /* __NTOSKRNL_INCLUDE_INTERNAL_EXECUTIVE_H */
reactos/ntoskrnl/ex
diff -u -r1.15 -r1.16
--- interlck.c 15 Aug 2004 16:39:01 -0000 1.15
+++ interlck.c 9 Sep 2004 18:51:17 -0000 1.16
@@ -1,4 +1,4 @@
-/* $Id: interlck.c,v 1.15 2004/08/15 16:39:01 chorns Exp $
+/* $Id: interlck.c,v 1.16 2004/09/09 18:51:17 hbirr Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@@ -219,23 +219,6 @@
}
/*
- * @unimplemented
- */
-LONGLONG
-FASTCALL
-ExfInterlockedCompareExchange64(
- IN OUT LONGLONG volatile *Destination,
- IN PLONGLONG ExChange,
- IN PLONGLONG Comperand
- )
-{
- LONGLONG oldval;
-
- UNIMPLEMENTED;
- return oldval;
-}
-
-/*
* @implemented
*/
ULONG FASTCALL
reactos/ntoskrnl/ex/i386
diff -u -r1.8 -r1.9
--- interlck.c 15 Aug 2004 16:39:01 -0000 1.8
+++ interlck.c 9 Sep 2004 18:51:17 -0000 1.9
@@ -1,4 +1,4 @@
-/* $Id: interlck.c,v 1.8 2004/08/15 16:39:01 chorns Exp $
+/* $Id: interlck.c,v 1.9 2004/09/09 18:51:17 hbirr Exp $
*
* reactos/ntoskrnl/ex/i386/interlck.c
*
@@ -394,4 +394,60 @@
#error Unknown compiler for inline assembler
#endif
+/**********************************************************************
+ * FASTCALL: @InterlockedCompareExchange64@8
+ */
+#if defined(__GNUC__)
+LONGLONG FASTCALL
+ExfpInterlockedExchange64(LONGLONG volatile * Destination,
+ PLONGLONG Exchange);
+
+__asm__("\n\t.global @ExfpInterlockedExchange64@8\n\t"
+ "@ExfpInterlockedExchange64@8:\n\t"
+ "pushl %ebx\n\t"
+ "pushl %esi\n\t"
+ "movl %ecx,%esi\n\t"
+ "movl (%edx),%ebx\n\t"
+ "movl 4(%edx),%ecx\n\t"
+ "\n1:\t"
+ "movl (%esi),%eax\n\t"
+ "movl 4(%esi),%edx\n\t"
+ "lock cmpxchg8b (%esi)\n\t"
+ "jnz 1b\n\t"
+ "popl %esi\n\t"
+ "popl %ebx\n\t"
+ "ret\n\t");
+
+#else
+#error Unknown compiler for inline assembler
+#endif
+
+/**********************************************************************
+ * FASTCALL: @ExfInterlockedCompareExchange@12
+ */
+#if defined(__GNUC__)
+LONGLONG FASTCALL
+ExfInterlockedCompareExchange64(LONGLONG volatile * Destination,
+ PLONGLONG Exchange,
+ PLONGLONG Comperand);
+
+__asm__("\n\t.global @ExfInterlockedCompareExchange64@12\n\t"
+ "@ExfInterlockedCompareExchange64@12:\n\t"
+ "pushl %ebx\n\t"
+ "pushl %esi\n\t"
+ "movl %ecx,%esi\n\t"
+ "movl (%edx),%ebx\n\t"
+ "movl 4(%edx),%ecx\n\t"
+ "movl 12(%esp),%edx\n\t"
+ "movl (%edx),%eax\n\t"
+ "movl 4(%edx),%edx\n\t"
+ "lock cmpxchg8b (%esi)\n\t"
+ "popl %esi\n\t"
+ "popl %ebx\n\t"
+ "ret $4\n\t");
+
+#else
+#error Unknown compiler for inline assembler
+#endif
+
/* EOF */