Shutdown the computer

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
Coconut9
Member
Member
Posts: 51
Joined: Sat May 20, 2017 1:25 am
Location: PCI bus: 3, slot: 9, function: 5

Shutdown the computer

Post by Coconut9 »

How can I shutdown NOT REBOOT the computer at protected mode using assembly?
(NASM for x86 CPU)
How people react when a new update of your OS is coming:
Linux user: Cool, more free stuff!
Mac user: Ooh I have to pay!
Windows user: Ah not again!
FallenAvatar
Member
Member
Posts: 283
Joined: Mon Jan 03, 2011 6:58 pm

Re: Shutdown the computer

Post by FallenAvatar »

User avatar
BrightLight
Member
Member
Posts: 901
Joined: Sat Dec 27, 2014 9:11 am
Location: Maadi, Cairo, Egypt
Contact:

Re: Shutdown the computer

Post by BrightLight »

ARISTOS wrote:How can I shutdown NOT REBOOT the computer at protected mode using assembly?
(NASM for x86 CPU)
The same way you would using any other language.
You know your OS is advanced when you stop using the Intel programming guide as a reference.
onlyonemac
Member
Member
Posts: 1146
Joined: Sat Mar 01, 2014 2:59 pm

Re: Shutdown the computer

Post by onlyonemac »

Maybe you should first figure out why it is rebooting the computer? Are you just triggering a protection fault and letting the system reset itself?
When you start writing an OS you do the minimum possible to get the x86 processor in a usable state, then you try to get as far away from it as possible.

Syntax checkup:
Wrong: OS's, IRQ's, zero'ing
Right: OSes, IRQs, zeroing
LtG
Member
Member
Posts: 384
Joined: Thu Aug 13, 2015 4:57 pm

Re: Shutdown the computer

Post by LtG »

onlyonemac wrote:Maybe you should first figure out why it is rebooting the computer? Are you just triggering a protection fault and letting the system reset itself?
I took it the OP isn't interested how to reboot, and thus made the distinction.

Nice use of google and the Wiki though =)

http://lmgtfy.com/?q=osdev+shutdown
User avatar
Schol-R-LEA
Member
Member
Posts: 1925
Joined: Fri Oct 27, 2006 9:42 am
Location: Athens, GA, USA

Re: Shutdown the computer

Post by Schol-R-LEA »

@ARISTOS, please elaborate on what you need, and what you have tried. The question leaves a lot of details out that we will need in order to answer it, starting with, what code have you already seen that works for rebooting, but not shutting down? It is unusual for a code example or tutorial to cover one but not the other, without at least a link to a parallel one for the other problem. Also, the answers would require details about the platform; since you mentioned NASM, we can probably assume x86 protected mode, but if you are in either real mode or long mode, the answers will be different.
LtG wrote:
onlyonemac wrote:Maybe you should first figure out why it is rebooting the computer? Are you just triggering a protection fault and letting the system reset itself?
I took it the OP isn't interested how to reboot, and thus made the distinction.
I think that you missed OnlyOneMac's point, though I am not sure that OOM understood the OP's point either.

Onlyonemac seems to be reading this as 'the code I wrote to shut the system off is causing it to reboot instead', and concluded that the code in question is causing a segfault, making it look as if it were running 'correctly' but doing the wrong thing (that is, that the information the OP had was given as being for shutting down but was actually the code for a soft reboot) when in fact it is buggy.

However, that seems to assume facts not in evidence. The OP never stated that the code in use is rebooting the OS, or mentioned any existing code at all. There just isn't enough information in the original post, period.

So, I repeat: @ARISTOS, please elaborate on what you need, and what you have tried.
Last edited by Schol-R-LEA on Sun May 21, 2017 10:05 pm, edited 1 time in total.
Rev. First Speaker Schol-R-LEA;2 LCF ELF JAM POEE KoR KCO PPWMTF
Ordo OS Project
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.
User avatar
Sik
Member
Member
Posts: 251
Joined: Wed Aug 17, 2016 4:55 am

Re: Shutdown the computer

Post by Sik »

Yeah I also assumed it was just asking explicitly for shutdown and not reboot. I know there are a lot of tutorials around on how to reboot the computer (without making use of APM and ACPI), but not as much stuff explaining how to turn off the computer (or for that matter, how to reboot without resorting to legacy tricks).
LtG
Member
Member
Posts: 384
Joined: Thu Aug 13, 2015 4:57 pm

Re: Shutdown the computer

Post by LtG »

Schol-R-LEA wrote:
LtG wrote:
onlyonemac wrote:Maybe you should first figure out why it is rebooting the computer? Are you just triggering a protection fault and letting the system reset itself?
I took it the OP isn't interested how to reboot, and thus made the distinction.
I think that you missed OnlyOneMac's point, though I am not sure that OOM understood the OP's point either.

Onlyonemac seems to be reading this as 'the code I wrote to shut the system off is causing it to reboot instead', and concluded that the code in question is causing a segfault, making it look as if it were running 'correctly' but doing the wrong thing (that is, that the information the OP had was given as being for shutting down but was actually the code for a soft reboot) when in fact it is buggy.
I guess I should've been clearer. I think I got OOM's point: "triple fault -> reboot", or something along those lines. I was trying to convey that the reason "NOT REBOOT" was mentioned in OP is because presumably the OP has found how to reboot but not found how to shut down, and is therefore explicitly stating that he/she isn't interested in help with rebooting.

So I was trying to say that "NOT REBOOT" was mentioned to avoid possible mix-ups and that the OP isn't interested in reboot and that's the reason reboot is even mentioned in OP.
Post Reply