renamed .S files so msvc does not try to compile the .c files with the same name...
[reactos.git] / reactos / ntoskrnl / ex / i386 / interlck_asm.S
1 /* $Id: interlck.c 15557 2005-05-28 07:26:38Z hbirr $
2 *
3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * FILE: ntoskrnl/ex/i386/interlck.c
6 * PURPOSE: No purpose listed.
7 *
8 * PROGRAMMERS: No programmer listed.
9 */
10
11 #ifdef CONFIG_SMP
12 #define LOCK lock
13 #else
14 #define LOCK
15 #endif
16
17 .global @Exfi386InterlockedIncrementLong@4
18 @Exfi386InterlockedIncrementLong@4:
19 LOCK
20 addl $1,(%ecx)
21 lahf
22 andl $0xC000, %eax
23 ret
24
25 .global @Exfi386InterlockedDecrementLong@4
26 @Exfi386InterlockedDecrementLong@4:
27 LOCK
28 subl $1,(%ecx)
29 lahf
30 andl $0xC000, %eax
31 ret
32
33 .global @Exfi386InterlockedExchangeUlong@8
34 @Exfi386InterlockedExchangeUlong@8:
35 LOCK
36 xchgl %edx,(%ecx)
37 movl %edx,%eax
38 ret
39
40 .global _Exi386InterlockedIncrementLong@4
41 _Exi386InterlockedIncrementLong@4:
42 movl 4(%esp),%eax
43 LOCK
44 addl $1,(%eax)
45 lahf
46 andl $0xC000, %eax
47 ret $4
48
49 .global _Exi386InterlockedDecrementLong@4
50 _Exi386InterlockedDecrementLong@4:
51 movl 4(%esp),%eax
52 LOCK
53 subl $1,(%eax)
54 lahf
55 andl $0xC000, %eax
56 ret $4
57
58 .global _Exi386InterlockedExchangeUlong@8
59 _Exi386InterlockedExchangeUlong@8:
60 movl 4(%esp),%edx
61 movl 8(%esp),%eax
62 LOCK
63 xchgl %eax,(%edx)
64 ret $8
65
66 .global @InterlockedIncrement@4
67 @InterlockedIncrement@4:
68 movl $1,%eax
69 LOCK
70 xaddl %eax,(%ecx)
71 incl %eax
72 ret
73
74 .global @InterlockedDecrement@4
75 @InterlockedDecrement@4:
76 movl $-1,%eax
77 LOCK
78 xaddl %eax,(%ecx)
79 decl %eax
80 ret
81
82 .global @InterlockedExchange@8
83 @InterlockedExchange@8:
84 LOCK
85 xchgl %edx,(%ecx)
86 movl %edx,%eax
87 ret
88
89 .global @InterlockedExchangeAdd@8
90 @InterlockedExchangeAdd@8:
91 LOCK
92 xaddl %edx,(%ecx)
93 movl %edx,%eax
94 ret
95
96 .global @InterlockedClearBit@8
97 @InterlockedClearBit@8:
98 LOCK
99 btr %edx,(%ecx)
100 setc %al
101 ret
102
103 .global @InterlockedCompareExchange@12
104 @InterlockedCompareExchange@12:
105 movl 4(%esp),%eax
106 LOCK
107 cmpxchg %edx,(%ecx)
108 ret $4
109
110 .global @ExfpInterlockedExchange64@8
111 @ExfpInterlockedExchange64@8:
112 pushl %ebx
113 pushl %esi
114 movl %ecx,%esi
115 movl (%edx),%ebx
116 movl 4(%edx),%ecx
117 1:
118 movl (%esi),%eax
119 movl 4(%esi),%edx
120 LOCK
121 cmpxchg8b (%esi)
122 jnz 1b
123 popl %esi
124 popl %ebx
125 ret
126
127 .global @ExfInterlockedCompareExchange64@12
128 @ExfInterlockedCompareExchange64@12:
129 pushl %ebx
130 pushl %esi
131 movl %ecx,%esi
132 movl (%edx),%ebx
133 movl 4(%edx),%ecx
134 movl 12(%esp),%edx
135 movl (%edx),%eax
136 movl 4(%edx),%edx
137 LOCK
138 cmpxchg8b (%esi)
139 popl %esi
140 popl %ebx
141 ret $4
142
143 /* EOF */