Re: [NTDEV][WINXP] Cute code in AllocateAdapterChannel

Ok, the Driver Verifier on XP is the culprit for the cute “deadfood”. That
makes sense and No, I wasn’t getting “funny” with the
map registers sent to the call back. Expecting it to be zero, I was using it
to set a NULL value for a scatter/gather list. Consider
a target returning a Test Unit Ready to a SCSI initiator in a fibre channel
driver, you have in effect a 0 length DMA transfer that
has to be serialized/synchronized with any other non zero length payload.
This is what I’ve been trying to do, and seeing that
“deadfood” when 2000 returned 0 kinda got my dander up a bit.

So, Peter, I can’t just complete the packet and return it … Returning
means it has to go to the Initiator on the other end of the
fibre optic cable and to do that I either call Get/PutScatterGatherList or
AllocateAdapterChannel. The first doesn’t work since
you can’t build an MDL with a zero buffer length, and if you try it anyway,
Verifier gets really really angry.

By the way, I’ve been using XP for 2000 driver check out ever since I down
loaded 2446 and read in the WinDbg docs about
verifier tests that are enabled only on XP. Would you by any chance know if
Verifier is also the culprit that is allocating a PTE on
this transfer when I call AllocateAdapterChannel? When I do a lot of these I
see PTE steadily drop.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Peter G. Viscarola
Sent: Wednesday, April 11, 2001 11:56 AM
To: NT Developers Interest List
Subject: [ntdev] Re: [NTDEV][WINXP] Cute code in AllocateAdapterChannel

Hi Gary,

Just “checked in” on the list after weeks of not having read it.

OK, I’ll bite: Why would you want to call AllocateAdapterChannel() for a
zero length transfer??

Why not

if(iostack->Parameters.Write.Length == 0) {
Irp->IoStatus.Status = STATUS_SUCCESS;
Irp->IoStatus.Information = 0;
IoCompleteRequest(Irp, 0);
return(STATUS_SUCCESS);
}

I know that’s now what you’re asking…

Now to the REAL reason I’m writing… Regarding why you’re seeing “deadf00d”
as the map register base (this is not presently for public consumption…
please do not post):

This is caused by Driver Verifier. It turns out that there are some drivers
that do “clever” things when MapRegisterBase is zero. Perhaps your driver
is one of them, eh? In any case, MapRegisterBase is essentially supposed to
be opaque. It has no real meaning outside the HAL, and is merely supposed
to be passed TO the driver, and later BACK to the HAL.

To “fool” these drivers, Driver Verifier passes “deadf00d” back to the
driver, instead of zero, anytime MapRegisterBase is returned by the HAL as
zero. This is SUPPOSED to result in the driver doing the right thing (and
treating the request as a real transfer and flushing the adapter buffers,
etc.)

HTH,

Peter

“Gary Little” wrote in message news:…
>
> Windows XP, Whistler build 2462.
>
> Don’t ya just love it when somebody gets “cute” in critical code and costs
> you hours so they could get a giggle? I do hope this is purely
coincidence,
> but here is what happened to me on the way to the forum while debugging my
> infamous zero length transfer problem.
>
> To do zero length transfers, I sense a zero buffer length and instead of
> calling DmaOperations->GetScatterGatherList, I call
> DmaOperations->AllocateAdapterChannel, passing it valid parameters with
> NumberOfMapRegisters set to 0. In the callback I then used MapRegisterBase
> to sense if the transfer length is zero. But things kept going bump in the
> night. So, off I trek into the debugger to take a trip through the call
back
> function.
>
> When what to my wondering eyes I beheld … not a value of 0 … noooo not
> even a 1, which I could understand, but “deadf00d”. that’s right … pass
> AllopcateAdapterChannel a 0 NumberOfMapRegisters, and you get “deadf00d”.
>
> Ha Ha Ha … said I. I do hope that is simply the coincidental result of a
> bug, or that I missed something in setting up to call
> AllocateAdapterChannel. I really really do, because if it’s a genuine
“cute”
> code giggle I think we need to ban the son-of-a-bitch, and break all of
> his/her/its fingers. (and that’s when I’m thinking NICE thoughts)
>
> There. That’s off my chest. I needed that.
>
> By the way … side by side, Windows 2000 does not return “deadf00d”, it
> returns 0.
>
> Gary
>
>
> —
> 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: 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