Enabled FASTCALL calling convention
[reactos.git] / reactos / ntoskrnl / rtl / interlck.c
1 /* $Id: interlck.c,v 1.9 2001/07/06 21:30:33 ekohl Exp $
2 *
3 * reactos/ntoskrnl/rtl/interlck.c
4 *
5 */
6 #include <reactos/config.h>
7 #include <ntos.h>
8 #include <internal/debug.h>
9
10 #define USE_FASTCALL
11
12 /**********************************************************************
13 * FASTCALL: @InterlockedIncrement@4
14 * STDCALL : _InterlockedIncrement@4
15 */
16 LONG FASTCALL
17 InterlockedIncrement(PLONG Addend);
18 /*
19 * FUNCTION: Increments a caller supplied variable of type LONG as an
20 * atomic operation
21 * ARGUMENTS;
22 * Addend = Points to a variable whose value is to be increment
23 * RETURNS: The incremented value
24 */
25
26 __asm__("\n\t.global @InterlockedIncrement@4\n\t"
27 "@InterlockedIncrement@4:\n\t"
28 "movl $1,%eax\n\t"
29 "xaddl %eax,(%ecx)\n\t"
30 "incl %eax\n\t"
31 "ret\n\t");
32
33
34 /**********************************************************************
35 * FASTCALL: @InterlockedDecrement@4
36 * STDCALL : _InterlockedDecrement@4
37 */
38 LONG FASTCALL
39 InterlockedDecrement(PLONG Addend);
40
41 __asm__("\n\t.global @InterlockedDecrement@4\n\t"
42 "@InterlockedDecrement@4:\n\t"
43 "movl $-1,%eax\n\t"
44 "xaddl %eax,(%ecx)\n\t"
45 "decl %eax\n\t"
46 "ret\n\t");
47
48
49 /**********************************************************************
50 * FASTCALL: @InterlockedExchange@8
51 * STDCALL : _InterlockedExchange@8
52 */
53
54 LONG FASTCALL
55 InterlockedExchange(PLONG Target,
56 LONG Value);
57
58 __asm__("\n\t.global @InterlockedExchange@8\n\t"
59 "@InterlockedExchange@8:\n\t"
60 "movl (%ecx),%eax\n"
61 "xchgl %edx,(%ecx)\n\t"
62 "ret\n\t");
63
64
65 /**********************************************************************
66 * FASTCALL: @InterlockedExchangeAdd@8
67 * STDCALL: _InterlockedExchangeAdd@8
68 */
69 LONG FASTCALL
70 InterlockedExchangeAdd(PLONG Addend,
71 LONG Value);
72
73 __asm__("\n\t.global @InterlockedExchangeAdd@8\n\t"
74 "@InterlockedExchangeAdd@8:\n\t"
75 "xaddl %edx,(%ecx)\n\t"
76 "movl %edx,%eax\n\t"
77 "ret\n\t");
78
79
80 /**********************************************************************
81 * FASTCALL: @InterlockedCompareExchange@12
82 * STDCALL: _InterlockedCompareExchange@12
83 */
84 PVOID FASTCALL
85 InterlockedCompareExchange(PVOID *Destination,
86 PVOID Exchange,
87 PVOID Comperand);
88
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"
93 "ret $4\n\t");
94
95 /* EOF */