how to shut down
Posted: Wed Nov 05, 2003 12:44 pm
how can i shut down computer through programming.
is there some port and what should i write there.
is there some port and what should i write there.
Unless I'm mistaking, the power button takes you to SMM. That code (which is usually not replaced by hobbyist OSes) runs in a realmode-like environment, and is usually used for system management things, such as shutting down etc.tom1000000 wrote: Hi,
APM would be good except AFAIK it doesn't support software control of the power button.
If you press the power button in WindowsXP it does a proper shutdown, closing down applications etc before cutting the power.
Can APM support that? Or do you require ACPI to have software control over the power button.
k, thanksPype.Clicker wrote: chances are that the system polls the reason why SMM has been entered and discovers it is due to the power-off button pressed. It will then leave a message to the OS and return to normal 'protected' mode.
From then, the kernel can discover the message from SMM, and schedule everything in order to shutdown the system (just as if you launched a 'shutdown' system command).
Once everything is cleaned, you return to real/virtual mode and asks the BIOS to turn off the system's power for you ...