How can I shutdown NOT REBOOT the computer at protected mode using assembly?
(NASM for x86 CPU)
Shutdown the computer
- Coconut9
- Member
- Posts: 51
- Joined: Sat May 20, 2017 1:25 am
- Location: PCI bus: 3, slot: 9, function: 5
Shutdown the computer
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!
Linux user: Cool, more free stuff!
Mac user: Ooh I have to pay!
Windows user: Ah not again!
-
- Member
- Posts: 283
- Joined: Mon Jan 03, 2011 6:58 pm
- BrightLight
- Member
- Posts: 901
- Joined: Sat Dec 27, 2014 9:11 am
- Location: Maadi, Cairo, Egypt
- Contact:
Re: Shutdown the computer
The same way you would using any other language.ARISTOS wrote:How can I shutdown NOT REBOOT the computer at protected mode using assembly?
(NASM for x86 CPU)
You know your OS is advanced when you stop using the Intel programming guide as a reference.
-
- Member
- Posts: 1146
- Joined: Sat Mar 01, 2014 2:59 pm
Re: Shutdown the computer
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
Syntax checkup:
Wrong: OS's, IRQ's, zero'ing
Right: OSes, IRQs, zeroing
Re: Shutdown the computer
I took it the OP isn't interested how to reboot, and thus made the distinction.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?
Nice use of google and the Wiki though =)
http://lmgtfy.com/?q=osdev+shutdown
- Schol-R-LEA
- Member
- Posts: 1925
- Joined: Fri Oct 27, 2006 9:42 am
- Location: Athens, GA, USA
Re: Shutdown the computer
@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.
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.
I think that you missed OnlyOneMac's point, though I am not sure that OOM understood the OP's point either.LtG wrote:I took it the OP isn't interested how to reboot, and thus made the distinction.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?
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.
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.
Re: Shutdown the computer
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
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.Schol-R-LEA wrote:I think that you missed OnlyOneMac's point, though I am not sure that OOM understood the OP's point either.LtG wrote:I took it the OP isn't interested how to reboot, and thus made the distinction.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?
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.
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.