我认为 NMI 没有错。
外部 NMI 已过时,它们很难在 SMP 系统中路由。那个看门狗定时器也已经过时了,它要么是辅助 PIT,要么是主 PIT 的有限第四通道:
----------P00440047--------------------------
PORT 0044-0047 - Microchannel - PROGRAMMABLE INTERVAL TIMER 2
SeeAlso: PORT 0040h,PORT 0048h
0044 RW PIT counter 3 (PS/2)
used as fail-safe timer. generates an NMI on time out.
for user generated NMI see at 0462.
0047 -W PIT control word register counter 3 (PS/2, EISA)
bit 7-6 = 00 counter 3 select
= 01 reserved
= 10 reserved
= 11 reserved
bit 5-4 = 00 counter latch command counter 3
= 01 read/write counter bits 0-7 only
= 1x reserved
bit 3-0 = 00
----------P0048004B--------------------------
PORT 0048-004B - EISA - PROGRAMMABLE INTERVAL TIMER 2
Note: this second timer is also supported by many Intel chipsets
SeeAlso: PORT 0040h,PORT 0044h
0048 RW EISA PIT2 counter 3 (Watchdog Timer)
0049 ?? EISA 8254 timer 2, not used (counter 4)
004A RW EISA PIT2 counter 5 (CPU speed control)
004B -W EISA PIT2 control word
这些硬件已经消失,现代系统上不存在。我已经测试了我的机器,但我没有。
英特尔芯片组没有:
只有主 PIT。
现代计时器是 LAPIC 计时器和 HPET (Linux did even resort to using the PMC registers)。
Windows 确实支持 HW WDT,事实上微软只要定义一个 ACPI 扩展:the WDAT table。
但是,此 WDT 只能在硬件中重新启动或关闭系统,而无需软件的干预。
// Configures the watchdog hardware to perform a reboot
// when it is fired.
//
#define WATCHDOG_ACTION_SET_REBOOT 0x11
//
// Determines if the watchdog hardware is configured to perform
// a system shutdown when fired.
//
#define WATCHDOG_ACTION_QUERY_SHUTDOWN 0x12
//
// Configures the watchdog hardware to perform a system shutdown
// when fired.
//
#define WATCHDOG_ACTION_SET_SHUTDOWN 0x13
Microsoft 对此 WDT 设置了相当高的要求,因为它必须在启动过程中尽早设置,在 PnP 枚举(即 PCI(e) 枚举)之前。
这不是检查系统错误的计时器。
顺便说一句,我没有这个计时器(我的系统缺少 WDAT 表),我不希望在客户端硬件上找到它。
错误检查 0x101 是由软件 WDT 引起的,它是在 ntoskrnl.exe 的函数内引发的。
此函数由KeUpdateRunTime 和从DriverEntry 开始的另一个调用链调用:
根据Windows Internals, KeUpdateRunTime is used to update the internal ticks counting of Windows.
我希望只有一个逻辑处理器负责这件事,尽管我不确定 Windows 管家时间的准确程度。
我还希望这个软件 WDT 以主从方式实现:每个 CPU 都会递增自己的计数器,并且设计的 CPU 会定期检查计数器(或任何等效实现)。
0x101 错误检查文档的措辞似乎暗示了这一点:
CLOCK_WATCHDOG_TIMEOUT 错误检查的值为 0x00000101。这表明多处理器系统中的辅助处理器上的预期时钟中断在分配的时间间隔内未收到。
再说一次,我不是 Windows 这部分的专家(可能是用户 MdRm),这可能是完全错误的,但如果不是,你可能最好听从 Alex 的建议并少用一个启动逻辑 CPU。
然后,您可以使用英特尔手册中所述的 INIT-SIPI-SIPI 序列在该 CPU 上执行代码,但您必须小心,因为发布处理器正在使用分页,而睡眠处理器尚未启动(处理器将实际启动 -模式)。
初始化 CPU 可能有点麻烦,但毕竟不是太多。
窃取它可能会导致除 WDT 之外的其他问题,例如,如果 Windows 仅将中断路由到该处理器。
我不知道是否有驱动 API 来注销逻辑处理器,我没有发现 hal.dll 和 ntoskrnl.exe 的导出。