KeInitializeEvent and IRQL

So, for lack of a real life, I was reading the DDK, and under the reference
page for KeInitializeEvent is says:
“Callers of this routine must be running at IRQL PASSIVE_LEVEL.” I could
have sworn that it used to say: “Callers of this routine must be running at
IRQL < DISPATCH_LEVEL.” However I dusted off the NT 4.0 DDK which says:
“Callers of this routine must be running at IRQL PASSIVE_LEVEL.” Huh.

So I look through ntddk.h to see what might be in a KEVENT that would cause
it to require field initialization at PASSIVE_LEVEL.
typedef struct _KEVENT {
DISPATCHER_HEADER Header;
} KEVENT, *PKEVENT, *RESTRICTED_POINTER PRKEVENT;

typedef struct _DISPATCHER_HEADER {
UCHAR Type;
UCHAR Absolute;
UCHAR Size;
UCHAR Inserted;
LONG SignalState;
LIST_ENTRY WaitListHead;
} DISPATCHER_HEADER;

Perhaps it might be that WaitListHead? I thought this unlikely, and a simple
experiment established that the KEVENT is basically initialized to zero with
the list intialized to point to itself.

So, anybody have a clue as to why, other than “we can do whatever we want,
it’s our operating system” the DDK insists that this stuffing of zeroes into
memory locations has to be done at PASSIVE_LEVEL? In fact, I can see no
reason why KeInitializeEvent couldn’t be called at ANY IRQL, as long as the
memory is non-pageable.

Mark Roddy
Windows 2000/NT Consultant
Hollis Technology Solutions
www.hollistech.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

I think you’re right. There is no real reason (I think) which permits
calling this routine at any Irql (or at least < DISPATCH_LEVEL).
Every dispatcher object must be resident by definition and this
initialization doesn’t touch any other memory than object itself.
Really KeInitializeEvent looks like this:

NTKERNELAPI
VOID
KeInitializeEvent (
IN PRKEVENT Event,
IN EVENT_TYPE Type,
IN BOOLEAN State
)
{
Event->Header.Type = Type;
Event->Header.Size = sizeof(KEVENT)/sizeof(ULONG);
Event->Header.SignalState = (LONG)State;
InitializeListHead(&Event->Header.WaitListHead);
}

So by my mind there is no reason to restrict calls to this routine
to PASSIVE_LEVEL only.

Or someone at Microsoft has another [better :-))] idea ???

Paul

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Mark Roddy
Sent: Friday, February 02, 2001 4:55 PM
To: NT Developers Interest List
Subject: [ntdev] KeInitializeEvent and IRQL

So, for lack of a real life, I was reading the DDK, and under the
reference
page for KeInitializeEvent is says:
“Callers of this routine must be running at IRQL PASSIVE_LEVEL.” I could
have sworn that it used to say: “Callers of this routine must be running
at
IRQL < DISPATCH_LEVEL.” However I dusted off the NT 4.0 DDK which says:
“Callers of this routine must be running at IRQL PASSIVE_LEVEL.” Huh.

So I look through ntddk.h to see what might be in a KEVENT that would
cause
it to require field initialization at PASSIVE_LEVEL.
typedef struct _KEVENT {
DISPATCHER_HEADER Header;
} KEVENT, *PKEVENT, *RESTRICTED_POINTER PRKEVENT;

typedef struct _DISPATCHER_HEADER {
UCHAR Type;
UCHAR Absolute;
UCHAR Size;
UCHAR Inserted;
LONG SignalState;
LIST_ENTRY WaitListHead;
} DISPATCHER_HEADER;

Perhaps it might be that WaitListHead? I thought this unlikely, and a
simple
experiment established that the KEVENT is basically initialized to zero
with
the list intialized to point to itself.

So, anybody have a clue as to why, other than “we can do whatever we
want,
it’s our operating system” the DDK insists that this stuffing of zeroes
into
memory locations has to be done at PASSIVE_LEVEL? In fact, I can see no
reason why KeInitializeEvent couldn’t be called at ANY IRQL, as long as
the
memory is non-pageable.

Mark Roddy
Windows 2000/NT Consultant
Hollis Technology Solutions
www.hollistech.com


You are currently subscribed to ntdev as: xxxxx@compelson.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

> So, anybody have a clue as to why, other than "we can do whatever we want,

it’s our operating system" the DDK insists that this stuffing of zeroes
into
memory locations has to be done at PASSIVE_LEVEL? In fact, I can see no
reason why KeInitializeEvent couldn’t be called at ANY IRQL, as long as
the
memory is non-pageable.

I agree. KeInitializeEvent is a macro which just fills memory (nonpaged
memory - KEVENT cannot be in the paged memory) with zeroes.
So, it is strange that there are IRQL requirements for such operations.

As about the compatibility with the future releases - MS will hardly be able
to re-implement KeInitializeEvent as a function in the future NT releases -
this will break existing NT4/w2k/WDM binaries.

Max


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Mark,

I probably comes under category of CYA.

Gary G. Little
Sr. Staff Engineer
Broadband Storage, LLC
xxxxx@broadstor.com
xxxxx@delphieng.com

-----Original Message-----
From: Mark Roddy [mailto:xxxxx@hollistech.com]
Sent: Friday, February 02, 2001 4:21 AM
To: NT Developers Interest List
Subject: [ntdev] KeInitializeEvent and IRQL

So, for lack of a real life, I was reading the DDK, and under the reference
page for KeInitializeEvent is says:
“Callers of this routine must be running at IRQL PASSIVE_LEVEL.” I could
have sworn that it used to say: “Callers of this routine must be running at
IRQL < DISPATCH_LEVEL.” However I dusted off the NT 4.0 DDK which says:
“Callers of this routine must be running at IRQL PASSIVE_LEVEL.” Huh.

So I look through ntddk.h to see what might be in a KEVENT that would cause
it to require field initialization at PASSIVE_LEVEL.
typedef struct _KEVENT {
DISPATCHER_HEADER Header;
} KEVENT, *PKEVENT, *RESTRICTED_POINTER PRKEVENT;

typedef struct _DISPATCHER_HEADER {
UCHAR Type;
UCHAR Absolute;
UCHAR Size;
UCHAR Inserted;
LONG SignalState;
LIST_ENTRY WaitListHead;
} DISPATCHER_HEADER;

Perhaps it might be that WaitListHead? I thought this unlikely, and a simple
experiment established that the KEVENT is basically initialized to zero with
the list intialized to point to itself.

So, anybody have a clue as to why, other than “we can do whatever we want,
it’s our operating system” the DDK insists that this stuffing of zeroes into
memory locations has to be done at PASSIVE_LEVEL? In fact, I can see no
reason why KeInitializeEvent couldn’t be called at ANY IRQL, as long as the
memory is non-pageable.

Mark Roddy
Windows 2000/NT Consultant
Hollis Technology Solutions
www.hollistech.com


You are currently subscribed to ntdev as: xxxxx@delphieng.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com