From 2c057d9bc1e37e63b787d5668397420e465f534d Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Wed, 19 Mar 2025 20:33:08 +0200 Subject: [PATCH] [HALX86] Set the NMI disable flag when accessing CMOS registers An NMI while accessing the CMOS can leave it in an undefined state. NMIs are used on x64 SMP for CPU freeze in the debugger. --- hal/halx86/generic/cmos.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hal/halx86/generic/cmos.c b/hal/halx86/generic/cmos.c index 45ad8840956..7e4fb57a6e9 100644 --- a/hal/halx86/generic/cmos.c +++ b/hal/halx86/generic/cmos.c @@ -24,8 +24,8 @@ UCHAR NTAPI HalpReadCmos(IN UCHAR Reg) { - /* Select the register */ - WRITE_PORT_UCHAR(CMOS_CONTROL_PORT, Reg); + /* Select the register (0x80 to disable NMIs) */ + WRITE_PORT_UCHAR(CMOS_CONTROL_PORT, 0x80 | Reg); /* Query the value */ return READ_PORT_UCHAR(CMOS_DATA_PORT); @@ -37,8 +37,8 @@ NTAPI HalpWriteCmos(IN UCHAR Reg, IN UCHAR Value) { - /* Select the register */ - WRITE_PORT_UCHAR(CMOS_CONTROL_PORT, Reg); + /* Select the register (0x80 to disable NMIs) */ + WRITE_PORT_UCHAR(CMOS_CONTROL_PORT, 0x80 | Reg); /* Write the value */ WRITE_PORT_UCHAR(CMOS_DATA_PORT, Value);