From caf377abcfaa12bfe993866e7293ebb47e5b2830 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Tue, 25 Feb 2025 11:22:54 +0300 Subject: [PATCH] Use 0xcf9 write for system reset It's probably the most bulletproof way on modern systems. Old 0x64 writes does nothing on some systems --- arch/x86_32/kernel.s | 4 ++++ arch/x86_64/kernel.s | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/arch/x86_32/kernel.s b/arch/x86_32/kernel.s index 5d49453..c29d355 100644 --- a/arch/x86_32/kernel.s +++ b/arch/x86_32/kernel.s @@ -470,6 +470,10 @@ ProcessorIn32: ret ProcessorReset: + mov al, 0xe + mov dx, 0xcf9 + out dx, al + in al,0x64 test al,2 jne ProcessorReset diff --git a/arch/x86_64/kernel.s b/arch/x86_64/kernel.s index 2b938ce..569f915 100644 --- a/arch/x86_64/kernel.s +++ b/arch/x86_64/kernel.s @@ -780,6 +780,10 @@ MMArchSafeCopy: ret ProcessorReset: + mov al, 0xe + mov dx, 0xcf9 + out dx, al + in al,0x64 test al,2 jne ProcessorReset