From 4722f139ea3d649ea1657d1ffe2351f3a38d9a6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sun, 14 Sep 2008 08:52:14 +0000 Subject: [PATCH] * If we're in the kernel debugger, we won't even try to use ACPI to power off, as we cannot do so with interrupts turned off (ACPI needs to allocate memory dynamically). * Turn off interrupts right before going to sleep (_GTS), this at least works in VMware, maybe it also works on real hardware. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27500 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/arch/x86/arch_cpu.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/system/kernel/arch/x86/arch_cpu.cpp b/src/system/kernel/arch/x86/arch_cpu.cpp index 0a69df19ac..7b416d3f2e 100644 --- a/src/system/kernel/arch/x86/arch_cpu.cpp +++ b/src/system/kernel/arch/x86/arch_cpu.cpp @@ -17,6 +17,7 @@ #include #include +#include #include #include #include @@ -95,13 +96,19 @@ x86_optimized_functions gOptimizedFunctions = { static status_t acpi_shutdown(void) { + if (debug_debugger_running()) + return B_ERROR; + acpi_module_info* acpi; if (get_module(B_ACPI_MODULE_NAME, (module_info**)&acpi) != B_OK) return B_NOT_SUPPORTED; status_t status = acpi->enter_sleep_state(ACPI_POWER_STATE_OFF); - if (status == B_OK) + if (status == B_OK) { + cpu_status state = disable_interrupts(); status = acpi->enter_sleep_state(ACPI_POWER_STATE_OFF); + restore_interrupts(state); + } put_module(B_ACPI_MODULE_NAME); return status;