1 /* $Id: interlck.c,v 1.9 2001/07/06 21:30:33 ekohl Exp $
3 * reactos/ntoskrnl/rtl/interlck.c
6 #include <reactos/config.h>
8 #include <internal/debug.h>
12 /**********************************************************************
13 * FASTCALL: @InterlockedIncrement@4
14 * STDCALL : _InterlockedIncrement@4
17 InterlockedIncrement(PLONG Addend
);
19 * FUNCTION: Increments a caller supplied variable of type LONG as an
22 * Addend = Points to a variable whose value is to be increment
23 * RETURNS: The incremented value
26 __asm__("\n\t.global @InterlockedIncrement@4\n\t"
27 "@InterlockedIncrement@4:\n\t"
29 "xaddl %eax,(%ecx)\n\t"
34 /**********************************************************************
35 * FASTCALL: @InterlockedDecrement@4
36 * STDCALL : _InterlockedDecrement@4
39 InterlockedDecrement(PLONG Addend
);
41 __asm__("\n\t.global @InterlockedDecrement@4\n\t"
42 "@InterlockedDecrement@4:\n\t"
44 "xaddl %eax,(%ecx)\n\t"
49 /**********************************************************************
50 * FASTCALL: @InterlockedExchange@8
51 * STDCALL : _InterlockedExchange@8
55 InterlockedExchange(PLONG Target
,
58 __asm__("\n\t.global @InterlockedExchange@8\n\t"
59 "@InterlockedExchange@8:\n\t"
61 "xchgl %edx,(%ecx)\n\t"
65 /**********************************************************************
66 * FASTCALL: @InterlockedExchangeAdd@8
67 * STDCALL: _InterlockedExchangeAdd@8
70 InterlockedExchangeAdd(PLONG Addend
,
73 __asm__("\n\t.global @InterlockedExchangeAdd@8\n\t"
74 "@InterlockedExchangeAdd@8:\n\t"
75 "xaddl %edx,(%ecx)\n\t"
80 /**********************************************************************
81 * FASTCALL: @InterlockedCompareExchange@12
82 * STDCALL: _InterlockedCompareExchange@12
85 InterlockedCompareExchange(PVOID
*Destination
,
89 __asm__("\n\t.global @InterlockedCompareExchange@12\n\t"
90 "@InterlockedCompareExchange@12:\n\t"
91 "movl 4(%esp),%eax\n\t"
92 "cmpxchg %edx,(%ecx)\n\t"