Page 1 of 1
Shutdown the computer
Posted: Sat May 20, 2017 1:33 am
by Coconut9
How can I shutdown NOT REBOOT the computer at protected mode using assembly?
(NASM for x86 CPU)
Re: Shutdown the computer
Posted: Sat May 20, 2017 1:42 am
by FallenAvatar
Re: Shutdown the computer
Posted: Sat May 20, 2017 4:34 am
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.
Re: Shutdown the computer
Posted: Sat May 20, 2017 4:46 am
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?
Re: Shutdown the computer
Posted: Sat May 20, 2017 7:15 am
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
Re: Shutdown the computer
Posted: Sun May 21, 2017 12:01 pm
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.
Re: Shutdown the computer
Posted: Sun May 21, 2017 8:02 pm
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).
Re: Shutdown the computer
Posted: Sun May 21, 2017 10:11 pm
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.