ReactOS 0.4.15-dev-6054-gbddd8b0
ExSequencedList.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS kernel-mode tests
3 * LICENSE: GPLv2+ - See COPYING in the top level directory
4 * PURPOSE: Kernel-Mode Test Suite sequenced singly-linked list test
5 * PROGRAMMER: Thomas Faber <thomas.faber@reactos.org>
6 */
7
9union _SLIST_HEADER;
12
13#include <kmt_test.h>
14
15/* TODO: SLIST_HEADER is a lot different for x64 */
16#ifndef _M_AMD64
17#define CheckSListHeader(ListHead, ExpectedPointer, ExpectedDepth) do \
18{ \
19 ok_eq_pointer((ListHead)->Next.Next, ExpectedPointer); \
20 /*ok_eq_pointer(FirstEntrySList(ListHead), ExpectedPointer);*/ \
21 ok_eq_uint((ListHead)->Depth, ExpectedDepth); \
22 ok_eq_uint((ListHead)->Sequence, ExpectedSequence); \
23 ok_eq_uint(ExQueryDepthSList(ListHead), ExpectedDepth); \
24 ok_irql(HIGH_LEVEL); \
25 ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:"); \
26} while (0)
27
28#define PXLIST_HEADER PSLIST_HEADER
29#define PXLIST_ENTRY PSLIST_ENTRY
30#define PushXList ExInterlockedPushEntrySList
31#define PopXList ExInterlockedPopEntrySList
32#define FlushXList ExInterlockedFlushSList
33#define ok_free_xlist ok_eq_pointer
34#define CheckXListHeader CheckSListHeader
35#define TestXListFunctional TestSListFunctional
36#include "ExXList.h"
37
38#undef ExInterlockedPushEntrySList
39#undef ExInterlockedPopEntrySList
40#define TestXListFunctional TestSListFunctionalExports
41#include "ExXList.h"
42#endif
43
44START_TEST(ExSequencedList)
45{
46#ifndef _M_AMD64
47 PSLIST_HEADER ListHead;
49 USHORT ExpectedSequence = 0;
50 PKSPIN_LOCK pSpinLock = &SpinLock;
53 SIZE_T EntriesSize = 5 * sizeof *Entries;
54 KIRQL Irql;
55
57#ifdef _M_IX86
58 pSpinLock = NULL;
59#endif
60
61 /* make sure stuff is as un-aligned as possible ;) */
62 Buffer = ExAllocatePoolWithTag(NonPagedPool, sizeof *ListHead + EntriesSize + 1, 'TLqS');
63 ListHead = (PVOID)&Buffer[1];
64 Entries = (PVOID)&ListHead[1];
66
67 RtlFillMemory(Entries, EntriesSize, 0x55);
68 RtlFillMemory(ListHead, sizeof *ListHead, 0x55);
69 InitializeSListHead(ListHead);
70 CheckSListHeader(ListHead, NULL, 0);
71 TestSListFunctional(ListHead, Entries, pSpinLock);
72
73 RtlFillMemory(Entries, EntriesSize, 0x55);
74 RtlFillMemory(ListHead, sizeof *ListHead, 0x55);
75 ExInitializeSListHead(ListHead);
76 CheckSListHeader(ListHead, NULL, 0);
77 TestSListFunctionalExports(ListHead, Entries, pSpinLock);
78
81#endif
82}
#define CheckSListHeader(ListHead, ExpectedPointer, ExpectedDepth)
static const ENTRY Entries[]
#define START_TEST(x)
Definition: atltest.h:75
Definition: bufpool.h:45
_Out_ PKIRQL Irql
Definition: csq.h:179
#define NULL
Definition: types.h:112
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
UCHAR KIRQL
Definition: env_spec_w32.h:591
ULONG KSPIN_LOCK
Definition: env_spec_w32.h:72
#define KeRaiseIrql(irql, oldIrql)
Definition: env_spec_w32.h:597
#define HIGH_LEVEL
Definition: env_spec_w32.h:703
KSPIN_LOCK * PKSPIN_LOCK
Definition: env_spec_w32.h:73
#define KeLowerIrql(oldIrql)
Definition: env_spec_w32.h:602
#define NonPagedPool
Definition: env_spec_w32.h:307
#define KeInitializeSpinLock(sl)
Definition: env_spec_w32.h:604
#define RtlFillMemory(Dest, Length, Fill)
Definition: winternl.h:593
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
#define __fastcall
Definition: sync.c:38
unsigned short USHORT
Definition: pedump.c:61
Definition: ntbasedef.h:628
void * PVOID
Definition: typedefs.h:50
ULONG_PTR SIZE_T
Definition: typedefs.h:80
char * PCHAR
Definition: typedefs.h:51
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFSPINLOCK * SpinLock
Definition: wdfsync.h:228
#define ExInterlockedPushEntrySList(SListHead, SListEntry, Lock)
Definition: exfuncs.h:163
#define ExInterlockedPopEntrySList(SListHead, Lock)
Definition: exfuncs.h:166
#define ExInitializeSListHead
FORCEINLINE VOID InitializeSListHead(_Out_ PSLIST_HEADER SListHead)
Definition: rtlfuncs.h:3351
#define PSLIST_ENTRY
Definition: rtltypes.h:134