Bona Fide OS Development
http://forums.osdever.net/

Shutting Down
http://forums.osdever.net/viewtopic.php?f=6&t=60
Page 1 of 1

Author:  ctimko [ Sun Oct 25, 2009 7:10 pm ]
Post subject:  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?

Author:  Love4Boobies [ Mon Oct 26, 2009 12:00 am ]
Post subject:  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:

Code:
hang:
hlt
jmp hang


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

Author:  Kieran [ Mon Oct 26, 2009 4:03 am ]
Post subject:  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.

Author:  Love4Boobies [ Mon Oct 26, 2009 4:29 am ]
Post subject:  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

Author:  Kieran [ Mon Oct 26, 2009 5:40 am ]
Post subject:  Re: Shutting Down

lol Well I couldnt remember exactly what, but yes it is only a restart sorry.

Author:  Jarvix [ Tue Oct 27, 2009 9:43 am ]
Post subject:  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

Author:  Love4Boobies [ Tue Oct 27, 2009 11:41 am ]
Post subject:  Re: Shutting Down

The 25th guy who repeats what I've said wins a prize! 8-)

Cheers,
Bogdan

Author:  Kieran [ Tue Oct 27, 2009 11:44 am ]
Post subject:  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.

Author:  Love4Boobies [ Tue Oct 27, 2009 11:53 am ]
Post subject:  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

Author:  ctimko [ Tue Oct 27, 2009 2:11 pm ]
Post subject:  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...).

Page 1 of 1 All times are UTC - 6 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/