-void InterlockedExchange(void);
- __asm__("\n\t.global _InterlockedExchange\n\t"
- "_InterlockedExchange:\n\t"
- "pushl %ebp\n\t"
- "movl %esp,%ebp\n\t"
- "pushl %eax\n\t"
- "pushl %ebx\n\t"
- "movl 12(%ebp),%eax\n\t"
- "movl 8(%ebp),%ebx\n\t"
- "xchgl %eax,(%ebx)\n\t"
- "popl %ebx\n\t"
- "popl %eax\n\t"
- "movl %ebp,%esp\n\t"
- "popl %ebp\n\t"
- "ret\n\t");
-
-void InterlockedExchangeAdd(void);
- __asm__("\n\t.global _InterlockedExchangeAdd\n\t"
- "_InterlockedExchangeAdd:\n\t"
- "movl 8(%esp),%eax\n\t"
- "movl 4(%esp),%ebx\n\t"
- "xaddl %eax,(%ebx)\n\t"
- "ret\n\t");
-
-void InterlockedCompareExchange(void);
- __asm__("\n\t.global _InterlockedCompareExchange\n\t"
- "_InterlockedCompareExchange:\n\t"
- "movl 12(%esp),%eax\n\t"
- "movl 8(%esp),%edx\n\t"
- "movl 4(%esp),%ebx\n\t"
- "cmpxchg %edx,(%ebx)\n\t"
- "movl %edx,%eax\n\t"
- "ret\n\t");
+/**********************************************************************
+ * FASTCALL: @InterlockedDecrement@0
+ * STDCALL : _InterlockedDecrement@4
+ */
+LONG
+FASTCALL
+InterlockedDecrement (
+ PLONG Addend
+ );
+__asm__(
+ "\n\t.global _InterlockedDecrement@4\n\t"
+ "_InterlockedDecrement@4:\n\t"
+ "movl $0xffffffff,%eax\n\t"
+ "movl 4(%esp),%ebx\n\t"
+ "xaddl %eax,(%ebx)\n\t"
+ "decl %eax\n\t"
+ "ret $4\n\t"
+ );
+
+/**********************************************************************
+ * FASTCALL: @InterlockedExchange@0
+ * STDCALL : _InterlockedExchange@8
+ */
+LONG
+FASTCALL
+InterlockedExchange (
+ PLONG Target,
+ LONG Value
+ );
+__asm__(
+ "\n\t.global _InterlockedExchange@8\n\t"
+ "_InterlockedExchange@8:\n\t"
+ "pushl %ebp\n\t"
+ "movl %esp,%ebp\n\t"
+ "pushl %eax\n\t"
+ "pushl %ebx\n\t"
+ "movl 12(%ebp),%eax\n\t"
+ "movl 8(%ebp),%ebx\n\t"
+ "xchgl %eax,(%ebx)\n\t"
+ "popl %ebx\n\t"
+ "popl %eax\n\t"
+ "movl %ebp,%esp\n\t"
+ "popl %ebp\n\t"
+ "ret $8\n\t"
+ );
+/*
+__asm__(
+#ifndef CONFIG_USE_FASTCALL
+ ".global _InterlockedExchange@8\n"
+ "_InterlockedExchange@8:\n"
+ "\tmovl 4(%esp), %ecx\n"
+ "\tmovl 8(%esp), %edx\n"
+#else
+ ".global @InterlockedExchange@0\n"
+ "@InterlockedExchange@0:\n"
+#endif
+ "\tmovl %ecx, %eax\n"
+ "__InterlockedExchange_Loop:\n"
+ "\tlock\n"
+ "\tcmpxchg %ecx, %edx\n"
+ "\tjne __InterlockedExchange_Loop\n"
+#ifndef CONFIG_USE_FASTCALL
+ "\tmovl %ecx, 4(%esp)\n"
+ "\tret $8\n"
+#else
+ "\tret\n"
+#endif
+ );
+*/
+
+
+/**********************************************************************
+ * FASTCALL: @InterlockedExchangeAdd@0
+ * STDCALL : _InterlockedExchangeAdd@8
+ */
+LONG
+FASTCALL
+InterlockedExchangeAdd (
+ PLONG Addend,
+ LONG Value
+ );
+__asm__(
+ "\n\t.global _InterlockedExchangeAdd@8\n\t"
+ "_InterlockedExchangeAdd@8:\n\t"
+ "movl 8(%esp),%eax\n\t"
+ "movl 4(%esp),%ebx\n\t"
+ "xaddl %eax,(%ebx)\n\t"
+ "ret $8\n\t"
+ );
+/*
+__asm__(
+#ifndef CONFIG_USE_FASTCALL
+ ".global _InterlockedExchangeAdd@8\n"
+ "\t_InterlockedExchangeAdd@8:\n"
+ "\tmovl 4(%esp), %ecx\n"
+ "\tmovl 8(%esp), %edx\n"
+#else
+ ".global @InterlockedExchangeAdd@0\n"
+ "\t@InterlockedExchangeAdd@0:\n"
+#endif
+ "\txadd %edx, %ecx\n"
+ "\tmovl %edx, %eax\n"
+#ifndef CONFIG_USE_FASTCALL
+ "\tret $8\n"
+#else
+ "\tret\n"
+#endif
+ );
+*/
+
+
+/**********************************************************************
+ * FASTCALL: @InterlockedCompareExchange@4
+ * STDCALL : _InterlockedCompareExchange@12
+ */
+PVOID
+FASTCALL
+InterlockedCompareExchange (
+ PVOID * Destination,
+ PVOID Exchange,
+ PVOID Comperand
+ );
+__asm__(
+ "\n\t.global _InterlockedCompareExchange@12\n\t"
+ "_InterlockedCompareExchange@12:\n\t"
+ "movl 12(%esp),%eax\n\t"
+ "movl 8(%esp),%edx\n\t"
+ "movl 4(%esp),%ebx\n\t"
+ "cmpxchg %edx,(%ebx)\n\t"
+ "movl %edx,%eax\n\t"
+ "ret $12\n\t"
+ );
+/*
+__asm__(
+#ifndef CONFIG_USE_FASTCALL
+ ".global _InterlockedCompareExchange@12\n"
+ "\t_InterlockedCompareExchange@12:\n"
+ "\tmovl 4(%esp), %ecx\n"
+ "\tmovl 8(%esp), %edx\n"
+ "\tmovl 12(%esp), %eax\n"
+#else
+ ".global @InterlockedCompareExchange@4\n"
+ "\t@InterlockedCompareExchange@4:\n"
+ "\tmovl 4(%esp), %eax\n"
+#endif
+ "\tcmpxchg %ecx, %edx\n"
+#ifndef CONFIG_USE_FASTCALL
+ "\tret $12\n"
+#else
+ "\tret $4\n"
+#endif
+*/
+
+
+/* EOF */