ReactOS  0.4.14-dev-583-g2a1ba2c
KeIrql.c File Reference
#include <kmt_test.h>
#include <debug.h>
Include dependency graph for KeIrql.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

 __declspec (__declspec() void __stdcall KeLowerIrql(unsigned char) dllimport)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Function Documentation

◆ __declspec()

__declspec ( __declspec() void __stdcall KeLowerIrql(unsigned char dllimport)

Definition at line 9 of file KeIrql.c.

22 {
23  KIRQL Irql, Irql2, PrevIrql, SynchIrql;
24 
25  /* we should be called at PASSIVE_LEVEL */
26  ok_irql(PASSIVE_LEVEL);
27 
28  PrevIrql = KeGetCurrentIrql();
29 
30  /* SYNCH_LEVEL is different for UP/MP */
32  SynchIrql = IPI_LEVEL - 2;
33  else
34  SynchIrql = DISPATCH_LEVEL;
35 
36  /* some Irqls MUST work */
37  {
40  PROFILE_LEVEL, IPI_LEVEL, /*POWER_LEVEL,*/ SynchIrql, HIGH_LEVEL };
41  int i;
42  for (i = 0; i < sizeof Irqls / sizeof Irqls[0]; ++i)
43  {
44  KeRaiseIrql(Irqls[i], &Irql2);
45  ok_eq_uint(Irql2, PrevIrql);
46  ok_irql(Irqls[i]);
47  KeLowerIrql(Irql2);
48  ok_irql(PrevIrql);
49  }
50  }
51 
52  /* raising/lowering to the current level should have no effect */
53  ok_irql(PASSIVE_LEVEL);
57  ok_irql(PASSIVE_LEVEL);
58 
59  /* try to raise to each Irql and back */
60  for (Irql = PASSIVE_LEVEL; Irql <= HIGH_LEVEL; ++Irql)
61  {
62  DPRINT("Raising to %u\n", Irql);
63  KeRaiseIrql(Irql, &Irql2);
64  ok_eq_uint(Irql2, PrevIrql);
65  KeLowerIrql(Irql2);
66  ok_irql(PrevIrql);
67  }
68 
69  /* go through all Irqls in order, skip the ones that the system doesn't accept */
70  for (Irql = PASSIVE_LEVEL; Irql <= HIGH_LEVEL; ++Irql)
71  {
72  DPRINT("Raising to %u\n", Irql);
73  KeRaiseIrql(Irql, &Irql2);
74  ok_eq_uint(Irql2, PrevIrql);
75  Irql2 = KeGetCurrentIrql();
76  ok(Irql2 <= Irql, "New Irql is %u, expected <= requested value of %u\n", Irql2, Irql);
77  PrevIrql = Irql2;
78  }
79 
80  ok_irql(HIGH_LEVEL);
81 
82  /* now go back again, skipping the ones that don't work */
83  for (Irql = HIGH_LEVEL; Irql > PASSIVE_LEVEL;)
84  {
85  DPRINT("Lowering to %u\n", Irql - 1);
86  KeLowerIrql(Irql - 1);
87  Irql2 = KeGetCurrentIrql();
88  ok(Irql2 < Irql, "New Irql is %u, expected <= requested value of %u\n", Irql2, Irql - 1);
89  if (Irql2 < Irql)
90  Irql = Irql2;
91  else
92  --Irql;
93  }
94 
95  /* test KeRaiseIrqlToDpcLevel */
96  ok_irql(PASSIVE_LEVEL);
98  ok_irql(DISPATCH_LEVEL);
101  ok_irql(DISPATCH_LEVEL);
104 
105  /* test KeRaiseIrqlToSynchLevel */
106  ok_irql(PASSIVE_LEVEL);
108  ok_irql(SynchIrql);
111  ok_irql(SynchIrql);
112  ok_eq_uint(Irql, SynchIrql);
114 
115  /* these bugcheck on a checked build but run fine on free! */
116  if (!KmtIsCheckedBuild)
117  {
120  ok_irql(APC_LEVEL);
122  ok_irql(HIGH_LEVEL);
124  }
125 
126 #ifndef _M_AMD64
127  /* try the actual exports, not only the fastcall versions */
128  ok_irql(PASSIVE_LEVEL);
130  ok_irql(HIGH_LEVEL);
132  (KeLowerIrql)(Irql);
133  ok_irql(PASSIVE_LEVEL);
134 #endif
135 
136  /* make sure we exit gracefully */
137  ok_irql(PASSIVE_LEVEL);
139 }
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
#define KeRaiseIrql(irql, oldIrql)
Definition: env_spec_w32.h:597
IN OUT PLONG IN OUT PLONG Addend IN OUT PLONG IN LONG IN OUT PLONG IN LONG Increment KeRaiseIrqlToDpcLevel
Definition: CrNtStubs.h:67
#define LOW_LEVEL
Definition: env_spec_w32.h:694
#define KeLowerIrql(oldIrql)
Definition: env_spec_w32.h:602
_Out_ PKIRQL Irql
Definition: csq.h:179
#define CMCI_LEVEL
UCHAR KIRQL
Definition: env_spec_w32.h:591
BOOLEAN KmtIsCheckedBuild
#define CLOCK_LEVEL
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
BOOLEAN KmtIsMultiProcessorBuild
void DPRINT(...)
Definition: polytest.cpp:61
#define IPI_LEVEL
Definition: env_spec_w32.h:701
#define CLOCK2_LEVEL
Definition: env_spec_w32.h:700
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
#define HIGH_LEVEL
Definition: env_spec_w32.h:703
#define PROFILE_LEVEL
Definition: env_spec_w32.h:698
#define ok(value,...)
Definition: atltest.h:57
#define CLOCK1_LEVEL
Definition: env_spec_w32.h:699
#define ok_eq_uint(value, expected)
Definition: kmt_test.h:239
#define APC_LEVEL
Definition: env_spec_w32.h:695
KIRQL NTAPI KeRaiseIrqlToSynchLevel(VOID)
Definition: pic.c:156