Author |
Message |
ctimko
Joined: Wed Oct 14, 2009 9:39 am Posts: 198 Location: United States
|
Shutting Down
I was wondering if anyone knew how to shutdown the computer after the operating system was finished. Do you send a HLT and then set some bit, or does just the HLT do the trick?
_________________ Charles Timko push %esp ;Musings of a computer addict
|
Sun Oct 25, 2009 7:10 pm |
|
|
Love4Boobies
Joined: Sat Jul 25, 2009 11:26 am Posts: 81
|
Re: Shutting Down
All HLT does is halt the execution stream until an interrupt. Most often, HLT is used in endless loops (which are close to your aim) as such: CLI won't do the trick here because all types of hardware interrupts can stop the halt (IRQs, IPIs, SMIs, NMIs). Another problem is that HLT only affects the CPU, which is not responsible for anything else. Hence, you cannot stop other components this way. The right way to do it is to use ACPI and if that's not available, fall back to APM (i.e., if you're running code on an x86 PC with BIOS). Cheers, Bogdan
|
Mon Oct 26, 2009 12:00 am |
|
|
Kieran
Site Admin
Joined: Sat Jul 25, 2009 7:44 am Posts: 274 Location: United Kingdom
|
Re: Shutting Down
Yes, APM is the correct way to do it, however there is also a way of doing a shutdown using the keyboard controller, I cannot remember the exact way, but im sure it wont be to hard to locate.
_________________ Thank you for reading,
Kieran C G Foot
|
Mon Oct 26, 2009 4:03 am |
|
|
Love4Boobies
Joined: Sat Jul 25, 2009 11:26 am Posts: 81
|
Re: Shutting Down
I was suggesting ACPI over APM. And no, the 8042 controller can send a RESET# signal, you won't be able to shut down using that.
Cheers, Bogdan
|
Mon Oct 26, 2009 4:29 am |
|
|
Kieran
Site Admin
Joined: Sat Jul 25, 2009 7:44 am Posts: 274 Location: United Kingdom
|
Re: Shutting Down
lol Well I couldnt remember exactly what, but yes it is only a restart sorry.
_________________ Thank you for reading,
Kieran C G Foot
|
Mon Oct 26, 2009 5:40 am |
|
|
Jarvix
Site Admin
Joined: Sun Aug 16, 2009 7:28 am Posts: 60 Location: The Netherlands
|
Re: Shutting Down
The keyboard controller can be used for reboots, not for shutdowns.
The ACPI or APM can be used. I prefer ACPI too. The ACPI is available on all new PCs, since it is used for controller power and thermal too.
I have read a topic of the forums of osdev.org about shutting down using the ACPI.
// Jarvix/PHPnerd
_________________ Jinix {Operating System}
|
Tue Oct 27, 2009 9:43 am |
|
|
Love4Boobies
Joined: Sat Jul 25, 2009 11:26 am Posts: 81
|
Re: Shutting Down
The 25th guy who repeats what I've said wins a prize! Cheers, Bogdan
|
Tue Oct 27, 2009 11:41 am |
|
|
Kieran
Site Admin
Joined: Sat Jul 25, 2009 7:44 am Posts: 274 Location: United Kingdom
|
Re: Shutting Down
Can i post again to get the prize??? lol
On a serious note, ACPI is a plus for any OS, Im working on implementing it in my own os atm.
_________________ Thank you for reading,
Kieran C G Foot
|
Tue Oct 27, 2009 11:44 am |
|
|
Love4Boobies
Joined: Sat Jul 25, 2009 11:26 am Posts: 81
|
Re: Shutting Down
ACPI is a big universe. I've been playing around with it for years. Just like many other standards, it's a piece of crap but it's the best we've got. The fact that it's so big and complex also makes it difficult to implement, especially for hobbyists. I thus recommend ACPICA, Intel's reference implementation. Port that and you're set. Another advantage to using ACPICA is that even if ACPI were to change in some drastic way, ACPICA would be updated by Intel. If anyone cares (I know I don't), it's what Linux uses. Cheers, Bogdan
|
Tue Oct 27, 2009 11:53 am |
|
|
ctimko
Joined: Wed Oct 14, 2009 9:39 am Posts: 198 Location: United States
|
Re: Shutting Down
Thanks for the responses. Who ever first mentioned ACPI you get +rep from me...when it gets implemented. I had been looking in the wrong place for the answer, and I didn't think about that for some reason (even though I had been staring at it in BIOS for a while now...).
_________________ Charles Timko push %esp ;Musings of a computer addict
|
Tue Oct 27, 2009 2:11 pm |
|
|