2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS system libraries
4 * FILE: lib/rtl/i386/interlck.S
5 * PURPOSE: Rtl Interlocked Functions for x86
6 * PROGRAMMERS: Timo Kreuzer
11 /* FUNCTIONS ****************************************************************/
16 * RtlInterlockedPopEntrySList(
17 * IN PSLIST_HEADER ListHead);
19 .global _ExpInterlockedPopEntrySListResume@0
20 .global _ExpInterlockedPopEntrySListEnd@0
21 .global _ExpInterlockedPopEntrySListFault@0
22 .global _RtlInterlockedPopEntrySList@4
23 _RtlInterlockedPopEntrySList@4:
29 /* Load ListHead into ebp */
31 _ExpInterlockedPopEntrySListResume@0:
32 /* Load ListHead->Next into eax */
35 /* Load ListHead->Depth and ListHead->Sequence into edx */
39 /* Check if ListHead->Next is NULL */
43 /* Copy Depth and Sequence number and adjust Depth */
46 _ExpInterlockedPopEntrySListFault@0:
47 /* Get next pointer */
49 _ExpInterlockedPopEntrySListEnd@0:
50 /* If [ebp] equals edx:eax, exchange it with ecx:ebx */
51 LOCK cmpxchg8b qword ptr [ebp]
53 /* If not equal, retry with edx:eax, being the content of [ebp] now */
54 jnz _ExpInterlockedPopEntrySListResume@0
56 /* Restore registers and return */
65 * RtlInterlockedPushEntrySList(
66 * IN PSLIST_HEADER ListHead,
67 * IN PSLIST_ENTRY ListEntry);
69 .global _RtlInterlockedPushEntrySList@8
70 _RtlInterlockedPushEntrySList@8:
76 /* Load ListHead into ebp */
79 /* Load ListEntry into ebx */
82 /* Load ListHead->Next into eax */
85 /* Load ListHead->Depth and ListHead->Sequence into edx */
89 /* Set ListEntry->Next to ListHead->Next */
92 /* Copy ListHead->Depth and ListHead->Sequence and adjust them */
93 lea ecx, [edx + 0x10001]
95 /* If [ebp] equals edx:eax, exchange it with ecx:ebx */
96 LOCK cmpxchg8b qword ptr [ebp]
98 /* If not equal, retry with edx:eax, being the content of [ebp] now */
101 /* Restore registers and return */
109 * RtlInterlockedFlushSList(
110 * IN PSINGLE_LIST_ENTRY ListHead);
112 .global _RtlInterlockedFlushSList@4
113 _RtlInterlockedFlushSList@4:
122 /* Load ListHead into ebp */
125 /* Load ListHead->Next into eax */
128 /* Load ListHead->Depth and ListHead->Sequence into edx */
132 /* Check if ListHead->Next is NULL */
136 /* Copy Depth and Sequence number to ecx */
139 /* Clear Depth in cx */
142 /* If [ebp] equals edx:eax, exchange it with ecx:ebx */
143 LOCK cmpxchg8b qword ptr [ebp]
145 /* If not equal, retry with edx:eax, being the content of [ebp] now */
148 /* Restore registers and return */