Anton, and guys,
I don’t need to modify the IDT. If you want details, take a look at the
Intel IA32 Systems Programming Guide, Volume 1: section 8.6 teaches how to
generate interrupts inside the processor. You have to write a quadword to
the Interrupt Command Register which includes the vector the interrupt
should use.
I have actually used this in several machines, both 32 and 64 bit, under XP,
Vista and 2003, and so far - knock on wood - no problems. Except of course
this issue of sharing interrupts.
Since I wrote my other post yesterday, I found a few things. I first tried
to tell IoConnectInterrupt to give me the vector nonshared, and the
consequence was, the network subsystem couldn’t allocate a vector and it
wouldn’t come up. I then found that if I really tightened the window between
the point my dma engine writes the hw status to the device extension and the
time I clear it, the probability of the network to vector an interrupt
through my chip’s ISR dropped down to negligible. By the way, an
InterlockedAnd call gave me the ideal way to clear the hw status while
reading it to test if the interrupt is mine!
It also looks like I can configure the interrupt vector as LevelSensitive
and yet give it an edge at interrupt time - it seems that, well, an edge is
followed by a level anyway, so, the hardware’s happy and I don’t seem to
lose interrupts. My skeletons and brain aneurisms tumble happily and I
haven’t experienced a problem yet, both under Vista 32-bit and XP64 which
are my main targets at this moment.
Last but not least, I have added a Registry entry to my driver: if
MsiInterrupts = 1, it generates this fake MSI interrupt. If it is zero, I
have a kernel-side thread that polls the chip every n milliseconds (also
configurable through a Registry entry) for completions. And if the user sets
MsiInterrupts = 2, I generate IPI interrupts instead - yes, it works! So, if
the local APIC isn’t accessible, the polling will pick up the completions.
It’s a trifle slower, but hey, it seems to work!
I may have to add a tweak or two to make it run on AMD platforms, I haven’t
tried it yet.
Alberto.
----- Original Message -----
From:
To: “Windows System Software Devs Interest List”
Sent: Monday, November 26, 2007 11:45 PM
Subject: RE:[ntdev] Question about interrupt levels
> Alberto,
>
> I am afraid you are going to fail on x64 because of the PatchGuard - it
> would not allow you to
> modify IDT, would it??? Furthermore, even if you try it on 32-bit XP,
> there is no guarantee that it will work on any machine. Don’t forget that
> not all motherboards are equipped with IOAPIC - if the target motherboard
> does not support IOAPIC, the local APICs on all CPUs are going to be
> disabled in BIOS settings, so that you will have no chance to take
> advantage of the whole thing.
>
> To summarize, I would not do it, unless I target some known-in-advance
> machine(s) with known-in-advance configuration…
>
> Anton Bassov
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer