From a99269023713da3217c0ecfaf9eb11b3ce7141b7 Mon Sep 17 00:00:00 2001 From: Stefan Lankes Date: Mon, 31 Jul 2017 01:23:13 +0200 Subject: [PATCH] determine the current LVT level before checking the level --- arch/x86/kernel/apic.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x86/kernel/apic.c b/arch/x86/kernel/apic.c index 033ebda04..1192490b8 100644 --- a/arch/x86/kernel/apic.c +++ b/arch/x86/kernel/apic.c @@ -1041,6 +1041,7 @@ static void apic_err_handler(struct state *s) void shutdown_system(void) { int if_bootprocessor = (boot_processor == apic_cpu_id()); + uint32_t max_lvt; irq_disable(); @@ -1063,6 +1064,7 @@ void shutdown_system(void) if (if_bootprocessor) LOG_INFO("Disable APIC\n"); + max_lvt = apic_lvt_entries(); if (max_lvt >= 4) lapic_write(APIC_LVT_TSR, 0x10000); // disable thermal sensor interrupt if (max_lvt >= 5)