I can hear some of you saying "Why would you want to do that? Windows is not a real-time operating system.'
However, since I want to access some on-board registers frequently, I can't use a TIMER because it can't fire more often than every 0.5 msec. It requires a kernel driver to get at the registers.
I don't intend my driver for public distribution, just as a performance measuring tool to run on my own computer.
The onboard hardware can generate an interrupt whenever there's something for the driver to know about. But I'm not sure I can safely hook an ISR to this interrupt. Hence the alternative of polling the hardware. Ideally I want to poll it at a 10 microsecond interval.
1. Use a high priority thread in my application that just checks the precise system time and every 10 usec it will send a control IRP to the driver. This is certainly doable on my 4-core computer.
2. Use the APIC timer on the CPU whose registers I want to get to, and hook an interrupt vector to the timer. This has the same problem as I would have hooking to the interrupt generated by the measurement hardware itself.
3. Take advantage of the HPET which (I think) is implemented on my AMD Ryzen 3. I tried bcdedit setting useplatformclock = yes, with the hope that ExQueryTimerResolution would give me a shorter interval, but it still showed min = 5000 (0.5 ms), and ExSetTimerResolution allowed me to set it to 4988. So apparently either HPET isn't on my system or Windows doesn't take advantage of it. Anyone have any tips about exploiting the HPET? Any documentation from AMD on how to access the HPET from a driver?
4. Is there some other way of using the kernel API to achieve the result?
5. Is there a driver somewhere that my driver could use to do this? Perhaps one that uses the APIC timer?
I'm hoping I don't have to put up with a 50 times slower sampling rate (as using KeSetTimer would provide), or wrestling with the interrupt vector issue.
BTW, I've posted other discussions here about connecting to the right interrupt vector.
It looks like you're new here. If you want to get involved, click one of these buttons!
|Upcoming OSR Seminars|
|Developing Minifilters||29 July 2019||OSR Seminar Space|
|Writing WDF Drivers||23 Sept 2019||OSR Seminar Space|
|Kernel Debugging||21 Oct 2019||OSR Seminar Space|
|Internals & Software Drivers||18 Nov 2019||Dulles, VA|