ReactOS  0.4.14-dev-376-gaedba84
ExInterlocked.c File Reference
#include <stddef.h>
#include <kmt_test.h>
Include dependency graph for ExInterlocked.c:

Go to the source code of this file.

Macros

#define SaveState(State)
 
#define CheckState(OldState, NewState)
 
#define CheckInterlockedCmpXchg(Function, Type, Print, Val, Cmp, Xchg, ExpectedValue, ExpectedRet)
 
#define CheckInterlockedCmpXchgI(Function, Type, Print, Val, Cmp, Xchg, ExpectedValue, ExpectedRet, ...)
 
#define CheckInterlockedOp(Function, Type, Print, Val, Op, ExpectedValue, ExpectedRet, ...)
 
#define CheckInterlockedOpNoArg(Function, Type, Print, Val, ExpectedValue, ExpectedRet, ...)
 
#define CheckInterlockedOpLarge(Function, Type, Print, Val, Op, ExpectedValue, ExpectedRet, ...)
 
#define CheckInterlockedOpLargeNoRet(Function, Type, Print, Val, Op, ExpectedValue)
 

Functions

 __declspec (__declspec() long __fastcall InterlockedIncrement(long *) dllimport)
 
static VOID TestInterlockedFunctional (VOID)
 
 START_TEST (ExInterlocked)
 

Macro Definition Documentation

◆ CheckInterlockedCmpXchg

#define CheckInterlockedCmpXchg (   Function,
  Type,
  Print,
  Val,
  Cmp,
  Xchg,
  ExpectedValue,
  ExpectedRet 
)
Value:
do \
{ \
Type Ret##Type = 0; \
Type Value##Type = Val; \
Status = STATUS_SUCCESS; \
_SEH2_TRY { \
SaveState(OldState); \
Ret##Type = Function(&Value##Type, Xchg, Cmp); \
SaveState(NewState); \
CheckState(&OldState, &NewState); \
Status = _SEH2_GetExceptionCode(); \
} _SEH2_END; \
ok_eq_hex(Status, STATUS_SUCCESS); \
ok_eq_print(Ret##Type, ExpectedRet, Print); \
ok_eq_print(Value##Type, ExpectedValue, Print); \
} while (0)
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2343
Type
Definition: Type.h:6
void Print(USHORT Window, LPSTR p)
Definition: hardware.c:797
static LPOVERLAPPED_COMPLETION_ROUTINE Function
Definition: sync.c:684
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
Status
Definition: gdiplustypes.h:24
_SEH2_END
Definition: create.c:4424
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
return STATUS_SUCCESS
Definition: btrfs.c:2938

Definition at line 143 of file ExInterlocked.c.

◆ CheckInterlockedCmpXchgI

#define CheckInterlockedCmpXchgI (   Function,
  Type,
  Print,
  Val,
  Cmp,
  Xchg,
  ExpectedValue,
  ExpectedRet,
  ... 
)
Value:
do \
{ \
Type Ret##Type = 0; \
Type Value##Type = Val; \
Type Compare##Type = Cmp; \
Type Exchange##Type = Xchg; \
Status = STATUS_SUCCESS; \
_SEH2_TRY { \
SaveState(OldState); \
Ret##Type = Function(&Value##Type, &Exchange##Type, \
&Compare##Type, ##__VA_ARGS__); \
SaveState(NewState); \
CheckState(&OldState, &NewState); \
Status = _SEH2_GetExceptionCode(); \
} _SEH2_END; \
ok_eq_hex(Status, STATUS_SUCCESS); \
ok_eq_print(Ret##Type, ExpectedRet, Print); \
ok_eq_print(Value##Type, ExpectedValue, Print); \
ok_eq_print(Exchange##Type, Xchg, Print); \
ok_eq_print(Compare##Type, Cmp, Print); \
} while(0)
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2343
Type
Definition: Type.h:6
void Print(USHORT Window, LPSTR p)
Definition: hardware.c:797
static LPOVERLAPPED_COMPLETION_ROUTINE Function
Definition: sync.c:684
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
Status
Definition: gdiplustypes.h:24
_SEH2_END
Definition: create.c:4424
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
return STATUS_SUCCESS
Definition: btrfs.c:2938

Definition at line 162 of file ExInterlocked.c.

◆ CheckInterlockedOp

#define CheckInterlockedOp (   Function,
  Type,
  Print,
  Val,
  Op,
  ExpectedValue,
  ExpectedRet,
  ... 
)
Value:
do \
{ \
Type Ret##Type = 0; \
Type Value##Type = Val; \
Status = STATUS_SUCCESS; \
_SEH2_TRY { \
SaveState(OldState); \
Ret##Type = Function(&Value##Type, Op, ##__VA_ARGS__); \
SaveState(NewState); \
CheckState(&OldState, &NewState); \
Status = _SEH2_GetExceptionCode(); \
} _SEH2_END; \
ok_eq_hex(Status, STATUS_SUCCESS); \
ok_eq_print(Ret##Type, ExpectedRet, Print); \
ok_eq_print(Value##Type, ExpectedValue, Print); \
} while (0)
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2343
Type
Definition: Type.h:6
void Print(USHORT Window, LPSTR p)
Definition: hardware.c:797
static LPOVERLAPPED_COMPLETION_ROUTINE Function
Definition: sync.c:684
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
Status
Definition: gdiplustypes.h:24
_SEH2_END
Definition: create.c:4424
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
return STATUS_SUCCESS
Definition: btrfs.c:2938

Definition at line 186 of file ExInterlocked.c.

◆ CheckInterlockedOpLarge

#define CheckInterlockedOpLarge (   Function,
  Type,
  Print,
  Val,
  Op,
  ExpectedValue,
  ExpectedRet,
  ... 
)
Value:
do \
{ \
Type Ret##Type = Large(0); \
Type Value##Type = Val; \
Status = STATUS_SUCCESS; \
_SEH2_TRY { \
SaveState(OldState); \
Ret##Type = Function(&Value##Type, Op, ##__VA_ARGS__); \
SaveState(NewState); \
CheckState(&OldState, &NewState); \
Status = _SEH2_GetExceptionCode(); \
} _SEH2_END; \
ok_eq_hex(Status, STATUS_SUCCESS); \
ok_eq_print(Ret##Type.QuadPart, ExpectedRet, Print); \
ok_eq_print(Value##Type.QuadPart, ExpectedValue, Print); \
} while (0)
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2343
Type
Definition: Type.h:6
void Print(USHORT Window, LPSTR p)
Definition: hardware.c:797
static LPOVERLAPPED_COMPLETION_ROUTINE Function
Definition: sync.c:684
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
Status
Definition: gdiplustypes.h:24
_SEH2_END
Definition: create.c:4424
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
return STATUS_SUCCESS
Definition: btrfs.c:2938

Definition at line 224 of file ExInterlocked.c.

◆ CheckInterlockedOpLargeNoRet

#define CheckInterlockedOpLargeNoRet (   Function,
  Type,
  Print,
  Val,
  Op,
  ExpectedValue 
)
Value:
do \
{ \
Type Value##Type = Val; \
Status = STATUS_SUCCESS; \
_SEH2_TRY { \
SaveState(OldState); \
Function(&Value##Type, Op); \
SaveState(NewState); \
CheckState(&OldState, &NewState); \
Status = _SEH2_GetExceptionCode(); \
} _SEH2_END; \
ok_eq_hex(Status, STATUS_SUCCESS); \
ok_eq_print(Value##Type.QuadPart, ExpectedValue, Print); \
} while (0)
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2343
Type
Definition: Type.h:6
void Print(USHORT Window, LPSTR p)
Definition: hardware.c:797
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
Status
Definition: gdiplustypes.h:24
_SEH2_END
Definition: create.c:4424
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
return STATUS_SUCCESS
Definition: btrfs.c:2938

Definition at line 243 of file ExInterlocked.c.

◆ CheckInterlockedOpNoArg

#define CheckInterlockedOpNoArg (   Function,
  Type,
  Print,
  Val,
  ExpectedValue,
  ExpectedRet,
  ... 
)
Value:
do \
{ \
Type Ret##Type = 0; \
Type Value##Type = Val; \
Status = STATUS_SUCCESS; \
_SEH2_TRY { \
SaveState(OldState); \
Ret##Type = Function(&Value##Type, ##__VA_ARGS__); \
SaveState(NewState); \
CheckState(&OldState, &NewState); \
Status = _SEH2_GetExceptionCode(); \
} _SEH2_END; \
ok_eq_hex(Status, STATUS_SUCCESS); \
ok_eq_print(Ret##Type, ExpectedRet, Print); \
ok_eq_print(Value##Type, ExpectedValue, Print); \
} while (0)
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2343
Type
Definition: Type.h:6
void Print(USHORT Window, LPSTR p)
Definition: hardware.c:797
static LPOVERLAPPED_COMPLETION_ROUTINE Function
Definition: sync.c:684
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
Status
Definition: gdiplustypes.h:24
_SEH2_END
Definition: create.c:4424
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
return STATUS_SUCCESS
Definition: btrfs.c:2938

Definition at line 205 of file ExInterlocked.c.

◆ CheckState

#define CheckState (   OldState,
  NewState 
)
Value:
do \
{ \
(void)OldState; \
(void)NewState; \
} while (0)
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49

◆ SaveState

#define SaveState (   State)

Function Documentation

◆ __declspec()

__declspec ( __declspec() long __fastcall InterlockedIncrement(long *)  dllimport)

Definition at line 11 of file ExInterlocked.c.

40 {
41  unsigned long esi, edi, ebx, ebp, esp;
42 } PROCESSOR_STATE;
43 #elif defined(_M_AMD64)
44 typedef struct
45 {
46  unsigned long long rsi, rdi, rbx, rbp, rsp, r12, r13, r14, r15;
47 } PROCESSOR_STATE;
48 #else
49 // dummy
50 typedef int PROCESSOR_STATE;
51 #endif
52 
53 /* TODO: these need to be rewritten in proper assembly to account for registers
54  * saved by the caller */
55 #if defined(_MSC_VER) && defined(_M_IX86)
56 #define SaveState(State) do \
57 { \
58  __asm lea ecx, [State] \
59  __asm mov [ecx], esi \
60  __asm mov [ecx+4], edi \
61  __asm mov [ecx+8], ebx \
62  __asm mov [ecx+12], ebp \
63  __asm mov [ecx+16], esp \
64 } while (0)
65 
66 #define CheckState(OldState, NewState) do \
67 { \
68  /* TODO: MSVC uses esi and saves it before, so this is okay */ \
69  /*ok_eq_hex((OldState)->esi, (NewState)->esi);*/ \
70  ok_eq_hex((OldState)->edi, (NewState)->edi); \
71  ok_eq_hex((OldState)->ebx, (NewState)->ebx); \
72  ok_eq_hex((OldState)->ebp, (NewState)->ebp); \
73  ok_eq_hex((OldState)->esp, (NewState)->esp); \
74 } while (0)
75 
76 #elif defined(__GNUC__) && defined(_M_IX86)
77 #define SaveState(State) \
78  asm volatile( \
79  "movl\t%%esi, (%%ecx)\n\t" \
80  "movl\t%%edi, 4(%%ecx)\n\t" \
81  "movl\t%%ebx, 8(%%ecx)\n\t" \
82  "movl\t%%ebp, 12(%%ecx)\n\t" \
83  "movl\t%%esp, 16(%%ecx)" \
84  : : "c" (&State) : "memory" \
85  );
86 
87 #define CheckState(OldState, NewState) do \
88 { \
89  /* TODO: GCC 4.7 uses esi and saves it before, so this is okay */ \
90  /*ok_eq_hex((OldState)->esi, (NewState)->esi);*/ \
91  ok_eq_hex((OldState)->edi, (NewState)->edi); \
92  /* TODO: GCC 4.4 uses ebx and saves it before, so this is okay */ \
93  /*ok_eq_hex((OldState)->ebx, (NewState)->ebx);*/ \
94  ok_eq_hex((OldState)->ebp, (NewState)->ebp); \
95  ok_eq_hex((OldState)->esp, (NewState)->esp); \
96 } while (0)
97 #elif defined(__GNUC__) && defined(_M_AMD64)
98 #define SaveState(State) \
99  asm volatile( \
100  "mov\t%%rsi, (%%rcx)\n\t" \
101  "mov\t%%rdi, 8(%%rcx)\n\t" \
102  "mov\t%%rbx, 16(%%rcx)\n\t" \
103  "mov\t%%rbp, 24(%%rcx)\n\t" \
104  "mov\t%%rsp, 32(%%rcx)\n\t" \
105  "mov\t%%r12, 40(%%rcx)\n\t" \
106  "mov\t%%r13, 48(%%rcx)\n\t" \
107  "mov\t%%r14, 56(%%rcx)\n\t" \
108  "mov\t%%r15, 64(%%rcx)" \
109  : : "c" (&State) : "memory" \
110  );
111 
112 #define CheckState(OldState, NewState) do \
113 { \
114  ok_eq_hex((OldState)->rsi, (NewState)->rsi); \
115  ok_eq_hex((OldState)->rdi, (NewState)->rdi); \
116  ok_eq_hex((OldState)->rbx, (NewState)->rbx); \
117  ok_eq_hex((OldState)->rbp, (NewState)->rbp); \
118  ok_eq_hex((OldState)->rsp, (NewState)->rsp); \
119  ok_eq_hex((OldState)->r12, (NewState)->r12); \
120  ok_eq_hex((OldState)->r13, (NewState)->r13); \
121  ok_eq_hex((OldState)->r14, (NewState)->r14); \
122  ok_eq_hex((OldState)->r15, (NewState)->r15); \
123 } while (0)
124 #else
125 #define SaveState(State)
126 #define CheckState(OldState, NewState) do \
127 { \
128  (void)OldState; \
129  (void)NewState; \
130 } while (0)
131 #endif
132 
133 static
135 Large(
137 {
138  LARGE_INTEGER Ret;
139  Ret.QuadPart = Value;
140  return Ret;
141 }
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2343
ecx edi ebx edx edi decl ecx esi eax jecxz decl eax andl eax esi movl edx movl TEMP incl eax andl eax ecx incl ebx eax jnz xchgl ecx incl TEMP esp ecx subl ebx pushl ecx ecx edx ecx ecx mm0 mm4 mm0 mm4 mm1 mm5 mm1 mm5 mm2 mm6 mm2 mm6 mm3 mm7 mm3 mm7 paddd mm0 paddd mm4 paddd mm0 paddd mm4 paddd mm0 paddd mm4 movq mm1 movq mm5 mm1 mm5 paddd mm0 paddd mm4 mm0 mm4 packssdw mm0 packssdw mm4 mm1 punpckldq mm0 pand mm1 pand mm0 por mm1 movq edi esi edx edi decl ecx jnz popl ecx ecx jecxz mm0 mm0 mm1 mm1 mm2 mm2 mm3 mm3 paddd mm0 paddd mm0 paddd mm0 movq mm1 mm1 paddd mm0 mm0 packssdw mm0 movd eax movw edi esi edx esi ecx mm0 mm4 mm0 mm4 mm1 mm5 mm1 mm5 mm2 mm6 mm2 mm6 mm3 mm7 mm3 mm7 paddd mm0 paddd mm4 paddd mm0 paddd mm4 paddd mm0 paddd mm4 movq mm1 movq mm5 mm1 mm5 paddd mm1 paddd mm5 mm1 mm5 packssdw mm1 packssdw mm5 psubd mm0 psubd mm4 psubsw mm0 psubsw mm4 mm1 punpckldq mm0 pand mm1 pand mm0 por mm1 movq edi esi edx edi decl ecx jnz mm0 mm0 mm1 mm1 mm2 mm2 mm3 mm3 paddd mm0 paddd mm0 paddd mm0 movq mm1 mm1 paddd mm1 mm1 packssdw mm1 psubd mm0 psubsw mm0 movd eax movw edi emms popl ebx popl esi popl edi mov ebp
Definition: synth_sse3d.h:248
ecx edi ebx edx edi decl ecx esi eax jecxz decl eax andl eax esi movl edx movl TEMP incl eax andl eax ecx incl ebx eax jnz xchgl ecx incl TEMP esi
Definition: synth_sse3d.h:103
ecx edi ebx edx edi decl ecx esi eax jecxz decl eax andl eax esi movl edx movl TEMP incl eax andl eax ecx incl ebx eax jnz xchgl ecx incl TEMP esp ecx subl ebx pushl ecx ecx edx ecx ecx mm0 mm4 mm0 mm4 mm1 mm5 mm1 mm5 mm2 mm6 mm2 mm6 mm3 mm7 mm3 mm7 paddd mm0 paddd mm4 paddd mm0 paddd mm4 paddd mm0 paddd mm4 movq mm1 movq mm5 mm1 mm5 paddd mm0 paddd mm4 mm0 mm4 packssdw mm0 packssdw mm4 mm1 punpckldq mm0 pand mm1 pand mm0 por mm1 movq edi esi edx edi decl ecx jnz popl ecx ecx jecxz mm0 mm0 mm1 mm1 mm2 mm2 mm3 mm3 paddd mm0 paddd mm0 paddd mm0 movq mm1 mm1 paddd mm0 mm0 packssdw mm0 movd eax movw edi esi edx edi
Definition: synth_sse3d.h:185
uint64_t ULONGLONG
Definition: typedefs.h:65
ecx edi ebx edx edi decl ecx esi eax jecxz decl eax andl ebx
Definition: synth_sse3d.h:83
LONGLONG QuadPart
Definition: typedefs.h:112

◆ START_TEST()

START_TEST ( ExInterlocked  )

Definition at line 386 of file ExInterlocked.c.

387 {
388  KIRQL Irql;
390 
391  /* functional testing */
395  KeLowerIrql(Irql);
396 }
#define KeRaiseIrql(irql, oldIrql)
Definition: env_spec_w32.h:597
#define KeLowerIrql(oldIrql)
Definition: env_spec_w32.h:602
static VOID TestInterlockedFunctional(VOID)
_Out_ PKIRQL Irql
Definition: csq.h:179
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID _In_opt_ PKSPIN_LOCK SpinLock
Definition: iofuncs.h:798
UCHAR KIRQL
Definition: env_spec_w32.h:591
FORCEINLINE VOID KeInitializeSpinLock(_Out_ PKSPIN_LOCK SpinLock)
Definition: kefuncs.h:251
#define HIGH_LEVEL
Definition: env_spec_w32.h:703

◆ TestInterlockedFunctional()

static VOID TestInterlockedFunctional ( VOID  )
static

Definition at line 262 of file ExInterlocked.c.

263 {
265  PKSPIN_LOCK pSpinLock = &SpinLock;
266  PROCESSOR_STATE OldState, NewState;
267 
268  /* on x86, most of these are supported intrinsically and don't need a spinlock! */
269 #if defined _M_IX86 || defined _M_AMD64
270  pSpinLock = NULL;
271 #endif
272 
273  /* CompareExchange */
274  /* macro version */
277  /* these only exist as macros on x86 */
282  /* exported function */
283 #undef InterlockedCompareExchange
284 #ifdef _M_IX86
287 #endif
288  /* only exists as a macro */
291  /* macro version */
292  CheckInterlockedCmpXchgI(ExInterlockedCompareExchange64, LONGLONG, "%I64d", 17, 4LL, 20LL, 17LL, 17LL, pSpinLock);
293  CheckInterlockedCmpXchgI(ExInterlockedCompareExchange64, LONGLONG, "%I64d", 17, 17LL, 21LL, 21LL, 17LL, pSpinLock);
294 #ifdef _M_IX86
295  /* exported function */
296  CheckInterlockedCmpXchgI((ExInterlockedCompareExchange64), LONGLONG, "%I64d", 17, 4LL, 20LL, 17LL, 17LL, pSpinLock);
297  CheckInterlockedCmpXchgI((ExInterlockedCompareExchange64), LONGLONG, "%I64d", 17, 17LL, 21LL, 21LL, 17LL, pSpinLock);
298  /* fastcall version */
299  CheckInterlockedCmpXchgI(ExfInterlockedCompareExchange64, LONGLONG, "%I64d", 17, 4LL, 20LL, 17LL, 17LL);
300  CheckInterlockedCmpXchgI(ExfInterlockedCompareExchange64, LONGLONG, "%I64d", 17, 17LL, 21LL, 21LL, 17LL);
301 #endif
302 
303  /* Exchange */
304  CheckInterlockedOp(InterlockedExchange, LONG, "%ld", 5, 8, 8L, 5L);
306 #undef InterlockedExchange
307 #ifdef _M_IX86
308  CheckInterlockedOp(InterlockedExchange, LONG, "%ld", 5, 8, 8L, 5L);
309  CheckInterlockedOp(ExInterlockedExchangeUlong, ULONG, "%lu", 212, 121, 121LU, 212LU, pSpinLock);
310  CheckInterlockedOp((ExInterlockedExchangeUlong), ULONG, "%lu", 212, 121, 121LU, 212LU, pSpinLock);
311  CheckInterlockedOp(Exi386InterlockedExchangeUlong, ULONG, "%lu", 212, 121, 121LU, 212LU);
312  CheckInterlockedOp(Exfi386InterlockedExchangeUlong, ULONG, "%lu", 212, 121, 121LU, 212LU);
313 #endif
314 
315  /* ExchangeAdd */
316  /* TODO: ExInterlockedExchangeAddLargeInteger? */
317  CheckInterlockedOp(InterlockedExchangeAdd, LONG, "%ld", 312, 7, 319L, 312L);
318 #undef InterlockedExchangeAdd
319 #ifdef _M_IX86
320  CheckInterlockedOp(InterlockedExchangeAdd, LONG, "%ld", 312, 7, 319L, 312L);
321 #endif
322 
323  /* Add */
324  /* these DO need a valid spinlock even on x86 */
325  CheckInterlockedOpLarge(ExInterlockedAddLargeInteger, LARGE_INTEGER, "%I64d", Large(23), Large(7), 30LL, 23LL, &SpinLock);
327  CheckInterlockedOp(ExInterlockedAddUlong, ULONG, "%lu", 239, 44, 283LU, 239LU, &SpinLock);
328 #undef ExInterlockedAddUlong
329  CheckInterlockedOp(ExInterlockedAddUlong, ULONG, "%lu", 239, 44, 283LU, 239LU, &SpinLock);
330 
331  /* Increment */
332  CheckInterlockedOpNoArg(InterlockedIncrement, LONG, "%ld", 2341L, 2342L, 2342L);
336 #undef InterlockedIncrement
337 #ifdef _M_IX86
338  CheckInterlockedOpNoArg(InterlockedIncrement, LONG, "%ld", 2341L, 2342L, 2342L);
352 #endif
353 
354  /* Decrement */
355  CheckInterlockedOpNoArg(InterlockedDecrement, LONG, "%ld", 1745L, 1744L, 1744L);
359 #undef InterlockedDecrement
360 #ifdef _M_IX86
361  CheckInterlockedOpNoArg(InterlockedDecrement, LONG, "%ld", 1745L, 1744L, 1744L);
375 #endif
376 
377  /* And, Or, Xor */
378  CheckInterlockedOp(InterlockedAnd, LONG, "0x%lx", 0x1234L, 0x1111L, 0x1010L, 0x1234L);
379  CheckInterlockedOp(InterlockedOr, LONG, "0x%lx", 0x1234L, 0x1111L, 0x1335L, 0x1234L);
380  CheckInterlockedOp(InterlockedXor, LONG, "0x%lx", 0x1234L, 0x1111L, 0x0325L, 0x1234L);
381 #ifdef _WIN64
382  CheckInterlockedOp(InterlockedXor64, LONGLONG, "0x%I64x", 0x200001234LL, 0x100001111LL, 0x300000325LL, 0x200001234LL);
383 #endif
384 }
#define InterlockedAnd
Definition: interlocked.h:62
#define LL
Definition: tui.h:85
#define MAXLONG
Definition: umtypes.h:116
#define CheckInterlockedCmpXchg(Function, Type, Print, Val, Cmp, Xchg, ExpectedValue, ExpectedRet)
LONG NTSTATUS
Definition: precomp.h:26
INTERLOCKED_RESULT NTAPI ExInterlockedIncrementLong(IN PLONG Addend, IN PKSPIN_LOCK Lock)
Definition: interlocked.c:253
#define InterlockedIncrementRelease
Definition: interlocked.h:203
#define InterlockedCompareExchange
Definition: interlocked.h:104
#define CheckInterlockedOp(Function, Type, Print, Val, Op, ExpectedValue, ExpectedRet,...)
#define InterlockedCompareExchangeAcquire
Definition: interlocked.h:105
KSPIN_LOCK * PKSPIN_LOCK
Definition: env_spec_w32.h:73
NTKERNELAPI VOID FASTCALL ExInterlockedAddLargeStatistic(IN PLARGE_INTEGER Addend, IN ULONG Increment)
Definition: interlocked.c:103
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID _In_opt_ PKSPIN_LOCK SpinLock
Definition: iofuncs.h:798
NTKERNELAPI LONGLONG FASTCALL ExInterlockedCompareExchange64(IN OUT PLONGLONG Destination, IN PLONGLONG Exchange, IN PLONGLONG Comparand, IN PKSPIN_LOCK Lock)
Definition: interlocked.c:113
long LONG
Definition: pedump.c:60
#define InterlockedCompareExchangePointer
Definition: interlocked.h:129
smooth NULL
Definition: ftsmooth.c:416
#define InterlockedDecrementRelease
Definition: interlocked.h:136
#define CheckInterlockedOpLarge(Function, Type, Print, Val, Op, ExpectedValue, ExpectedRet,...)
#define InterlockedExchangeAdd
Definition: interlocked.h:181
#define InterlockedXor64
Definition: interlocked.h:291
int64_t LONGLONG
Definition: typedefs.h:66
LONG NTAPI Exi386InterlockedExchangeUlong(PLONG Target, LONG Exch, LONG Compare)
Definition: stubs.c:48
#define InterlockedExchangePointer(Target, Value)
Definition: dshow.h:45
#define InterlockedDecrementAcquire
Definition: interlocked.h:135
static const WCHAR L[]
Definition: oid.c:1250
#define InterlockedDecrement
Definition: armddk.h:52
LONG NTAPI Exi386InterlockedDecrementLong(PLONG Addend)
Definition: stubs.c:38
#define MINLONG
Definition: umtypes.h:115
#define CheckInterlockedCmpXchgI(Function, Type, Print, Val, Cmp, Xchg, ExpectedValue, ExpectedRet,...)
#define InterlockedOr
Definition: interlocked.h:224
INTERLOCKED_RESULT NTAPI ExInterlockedDecrementLong(IN PLONG Addend, IN PKSPIN_LOCK Lock)
Definition: interlocked.c:267
#define InterlockedCompareExchangeRelease
Definition: interlocked.h:106
#define InterlockedExchange
Definition: armddk.h:54
Status
Definition: gdiplustypes.h:24
LONG NTAPI Exi386InterlockedIncrementLong(PLONG Addend)
Definition: stubs.c:43
#define InterlockedIncrement
Definition: armddk.h:53
LARGE_INTEGER NTAPI ExInterlockedAddLargeInteger(IN OUT PLARGE_INTEGER Addend, IN LARGE_INTEGER Increment, IN OUT PKSPIN_LOCK Lock)
Definition: interlocked.c:62
ULONG NTAPI ExInterlockedAddUlong(IN OUT PULONG Addend, IN ULONG Increment, IN OUT PKSPIN_LOCK Lock)
Definition: interlocked.c:88
#define CheckInterlockedOpNoArg(Function, Type, Print, Val, ExpectedValue, ExpectedRet,...)
unsigned int ULONG
Definition: retypes.h:1
#define CheckInterlockedOpLargeNoRet(Function, Type, Print, Val, Op, ExpectedValue)
#define InterlockedIncrementAcquire
Definition: interlocked.h:202
ULONG NTAPI ExInterlockedExchangeUlong(IN PULONG Target, IN ULONG Value, IN PKSPIN_LOCK Lock)
Definition: interlocked.c:281
#define InterlockedXor
Definition: interlocked.h:266

Referenced by START_TEST().