Dear All,
We have a driver, developed to support Busmaster DMA operation. As such,
it uses a callback routine, often known as AdapterControl, which is
invoked by making a call to IoAllocateAdapterChannel.
My concern is that the callback routine runs at IRQL DISPATCH_LEVEL. As
such, it is my understanding that it cannot tolerate any page faults that
might be generated by making accesses to pageable memory. How can I be
confident that none of the memory accesses that are made from within
AdapterControl could lead to access violations?
Can I be sure that accesses to local (stack-based) variables from within
AdapterControl are safe (it seems that this must be so, but I’m not sure
why). There are a number of parameters passed to AdapterControl. We do not
use DeviceObject or Irp in our Busmaster application. MapRegisterBase is a
pointer supplied by the HAL and I would assume that this would be safe.
However, we use the context parameter to pass in a pointer to some DMA
parameters. It would seem that this referenced data should reside in
non-paged space, otherwise there is the potential for pagefaults and
consequently an exception. Is this correct and what is the best way to
ensure that this memory containing the DMA parameters can be safely
accessed?
Additionally, the call to IoAllocateAdapterChannel must be called at IRQL
DISPATCH_LEVEL and so it is bounded by a KeRaiseIrql/KeLowerIrql pair. It
would seem that accesses to pageable memory from within this bounded
region might also be unsafe. In this case, would it be best to transfer
all parameters used by IoAllocateAdapterChannel to local (stack-based)
variables outside this region?
Could the above scenario explain a reported “Blue Screen” on Win2K that
read
-----------------------------snip-----------------------------
STOP:0x000001E (0C0000005, 0xBD1FFC5A, 0x00000000, 0x00000020)
KMODE_EXCEPTION_NOT_HANDLED
*** ADDRESSS BD1FFC5A base at BD1EE000, DateStamp 3ab89e57 - ourdriver.sys
-----------------------------snip-----------------------------
The report suggests that the callback routine was not being used at this
time and so the driver was not running at IRQL DISPATCH_LEVEL. What other
situations might give rise to this access violation?
This seems quite an important issue but I haven’t seen much made of it in
the literature. Have I missed something?
Thanks for any help,
Richard
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