It’s NOT a hack.
In fact, it’s a jolly bad idea for a driver to rely on a stack passed by a
caller, even if that caller is the operating system. I cannot guarantee the
integrity of my driver if I’m running on their stack and not on mine. This
is one of the reasons why I advocate running drivers at Ring 1 and not at
Ring 0, the architecture will automatically switch to the Ring 1 stack and
take you out of the OS-provided stack.
Would I use a stack that I know is insufficient ? Don’t bet on it. Would I
call it worth of a production driver ? Nah. Unless of course “production”
means “stay away from the hardware”. But it’s a driver, eh ? Not an
application.
Alberto.
-----Original Message-----
From: Roddy, Mark [mailto:xxxxx@stratus.com]
Sent: Thursday, May 15, 2003 10:33 AM
To: NT Developers Interest List
Subject: [ntdev] Re: data strctures in kernel mode drivers
Maybe there ought to be an NTDEV Anti-FAQ: a list of hideous kernel hacks
that, if you are contemplating doing in a production driver, you should
rethink your design and/or consider the possiblity that you are caught in
the Alberto Vortex 
-----Original Message-----
From: Moreira, Alberto [mailto:xxxxx@compuware.com]
Sent: Thursday, May 15, 2003 10:13 AM
To: NT Developers Interest List
Subject: [ntdev] Re: data strctures in kernel mode drivers
It takes two machine instructions to switch stacks.
Alberto.
-----Original Message-----
From: yatindra vaishnav [mailto:xxxxx@hotmail.com]
Sent: Thursday, May 15, 2003 4:42 AM
To: NT Developers Interest List
Subject: [ntdev] Re: data strctures in kernel mode drivers
Mayank,
There is a limitation of the kernel stack of 12KB, so keep that in
the mind and then implement the methods. You can use any amount of global
data as per the need and in that case u need to take care of the race
condition and the proper dealing of locking issues as per your need. You can
do any thing what you do in the user level application but with a few
limitation of kernel.
See in-lines.
Good luck
>From: “Mayank Kumar”
>Reply-To: “NT Developers Interest List”
>To: “NT Developers Interest List”
>Subject: [ntdev] data strctures in kernel mode drivers
>Date: Thu, 15 May 2003 13:51:01 +0530
>
>Hi all
>i wanted to know the following about kernel mode drivers:-
>
>–what all data structures can i use in the kernel mode
>–is there any restrictions on using any particular kind (arrays, static
>variables, dynamic variables,link lists ,etc)
>
>what should be the approach ??
[Yogi] Look above.
>i want to make a processing engine in the kernel mode driver which will
need
>to use many kinds
>of data structures, static arrays, link lists,dynamic arrays, etc. But
first
>i want to test it in the user mode and then move it to the kernel
>mode.
>
>– what is the equivalent of malloc in kernel mode
[Yogi] ExAllocatePool and ExAllocatePoolWithTag and in the NDIS
NdisAllocateMemory is there.
>– can i allocate a static array like AbcType abc[100]
[Yogi] Yes, you can do that but u shud not do that coz at any time u can get
out of stack.
>– can i do a static int a ;
[Yogi]Yes u can do that.
>– when do i need to use MDL’s
[Yogi]Whenever u need to do some thing related to the Address conversion
from logical to the Physical.
>
>
>
>regards
>Mayank
>
>
>
>
>—
>You are currently subscribed to ntdev as: xxxxx@hotmail.com
>To unsubscribe send a blank email to xxxxx@lists.osr.com
_____
Can write well? Let’s talk. Right now! http:
—
You are currently subscribed to ntdev as: xxxxx@compuware.com
To unsubscribe send a blank email to xxxxx@lists.osr.com
—
You are currently subscribed to ntdev as: xxxxx@stratus.com
To unsubscribe send a blank email to xxxxx@lists.osr.com
The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it.
—
You are currently subscribed to ntdev as: xxxxx@compuware.com
To unsubscribe send a blank email to xxxxx@lists.osr.com
The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it.</http:>