2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * FILE: ntoskrnl/ex/i386/fastinterlck_asm.S
5 * PURPOSE: FASTCALL Interlocked Functions
6 * PROGRAMMERS: Alex Ionescu (alex@relsoft.net)
9 /* INCLUDES ******************************************************************/
13 #include <internal/i386/asmmacro.S>
15 /* FUNCTIONS ****************************************************************/
20 * NOTE: These functions must obey the following rules:
21 * - Acquire locks only on MP systems.
22 * - Be safe at HIGH_LEVEL (no paged access).
24 * - Disable interrups.
29 *ExInterlockedAddLargeStatistic(IN PLARGE_INTEGER Addend,
32 PUBLIC @ExInterlockedAddLargeStatistic@8
33 @ExInterlockedAddLargeStatistic@8:
39 /* Check for carry bit and return */
45 lock adc dword ptr [ecx+4], 0
47 /* Do the addition and add the carry */
48 add dword ptr [ecx], edx
49 adc dword ptr [ecx+4], 0
58 *ExInterlockedPopEntrySList(IN PSINGLE_LIST_ENTRY ListHead,
59 * IN PKSPIN_LOCK Lock)
61 PUBLIC @ExInterlockedPopEntrySList@8
62 PUBLIC @InterlockedPopEntrySList@4
63 PUBLIC _ExpInterlockedPopEntrySListResume@0
64 PUBLIC _ExpInterlockedPopEntrySListFault@0
65 PUBLIC _ExpInterlockedPopEntrySListEnd@0
66 @ExInterlockedPopEntrySList@8:
67 @InterlockedPopEntrySList@4:
76 /* Get sequence number and link pointer */
77 _ExpInterlockedPopEntrySListResume@0:
81 /* Check if the list is empty */
85 /* Copy depth and adjust it */
88 /* Get next pointer and do the exchange */
89 _ExpInterlockedPopEntrySListFault@0:
91 _ExpInterlockedPopEntrySListEnd@0:
92 LOCK cmpxchg8b qword ptr [ebp]
93 jnz _ExpInterlockedPopEntrySListResume@0
95 /* Restore registers and return */
103 *ExInterlockedPushEntrySList(IN PSINGLE_LIST_ENTRY ListHead,
104 * IN PSINGLE_LIST_ENTRY ListEntry,
105 * IN PKSPIN_LOCK Lock)
107 PUBLIC @ExInterlockedPushEntrySList@12
108 @ExInterlockedPushEntrySList@12:
110 /* So we can fall through below */
113 PUBLIC @InterlockedPushEntrySList@8
114 @InterlockedPushEntrySList@8:
120 /* Pointer to list */
124 /* Get sequence number and link pointer */
129 /* Set link pointer */
132 /* Copy sequence number and adjust it */
133 lea ecx, [edx + HEX(10001)]
135 /* Do the exchange */
136 LOCK cmpxchg8b qword ptr [ebp]
139 /* Restore registers and return */
146 *ExInterlockedFlushSList(IN PSINGLE_LIST_ENTRY ListHead)
148 PUBLIC @ExInterlockedFlushSList@4
149 @ExInterlockedFlushSList@4:
158 /* Pointer to list */
161 /* Get sequence number and link pointer */
166 /* Check if the list is empty */
170 /* Clear depth and pointer */
174 /* Do the exchange */
175 LOCK cmpxchg8b qword ptr [ebp]
178 /* Restore registers and return */