* 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
This commit is contained in:
Axel Dörfler 2008-09-14 08:52:14 +00:00
parent 7b7464670e
commit 4722f139ea

View File

@ -17,6 +17,7 @@
#include <boot_device.h>
#include <commpage.h>
#include <debug.h>
#include <smp.h>
#include <tls.h>
#include <vm.h>
@ -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;