Bona Fide OS Developer
View unanswered posts | View active topics It is currently Thu Mar 28, 2024 1:35 pm



Post new topic Reply to topic  [ 10 posts ] 
 Shutting Down 
Author Message

Joined: Wed Oct 14, 2009 9:39 am
Posts: 198
Location: United States
Post 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
Profile WWW

Joined: Sat Jul 25, 2009 11:26 am
Posts: 81
Post 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


Mon Oct 26, 2009 12:00 am
Profile
Site Admin

Joined: Sat Jul 25, 2009 7:44 am
Posts: 274
Location: United Kingdom
Post 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
Profile WWW

Joined: Sat Jul 25, 2009 11:26 am
Posts: 81
Post 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
Profile
Site Admin

Joined: Sat Jul 25, 2009 7:44 am
Posts: 274
Location: United Kingdom
Post 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
Profile WWW
Site Admin

Joined: Sun Aug 16, 2009 7:28 am
Posts: 60
Location: The Netherlands
Post 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
Profile WWW

Joined: Sat Jul 25, 2009 11:26 am
Posts: 81
Post Re: Shutting Down
The 25th guy who repeats what I've said wins a prize! 8-)

Cheers,
Bogdan


Tue Oct 27, 2009 11:41 am
Profile
Site Admin

Joined: Sat Jul 25, 2009 7:44 am
Posts: 274
Location: United Kingdom
Post 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
Profile WWW

Joined: Sat Jul 25, 2009 11:26 am
Posts: 81
Post 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
Profile

Joined: Wed Oct 14, 2009 9:39 am
Posts: 198
Location: United States
Post 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
Profile WWW
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 


Who is online

Users browsing this forum: No registered users and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by Vjacheslav Trushkin and tweaked by the BF Team.