Reboot & shutdown...
Reboot & shutdown...
well I dont think I have yet seen one of you guys OS's actually reboot or shutdown the computer its self, they just hang the system and require the user to manually hit reset... so I was wondering just how you would add this functionality in? is this a BIOS call?
Re:Reboot & shutdown...
I was just about to ask that,
How do you make the OS reboot or Shut Down?? ;D
How do you make the OS reboot or Shut Down?? ;D
Re:Reboot & shutdown...
Just pulse the CPU reset line to the keyboard controller:
Code: Select all
void reboot(void)
{
u_char temp;
cli();
/* flush the keyboard controller */
do
{
temp = inb(0x64);
if (temp & 1)
inb(0x60);
}while(temp & 2);
/* send the CPU reset line */
outb(0x64, 0xFE);
hlt();
}
Re:Reboot & shutdown...
Officially, I think, according to intel's manual, is to triple fault the cpu if you want to shut it down.
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Reboot & shutdown...
nah, it won't "shut down"; just reset. only a proper call to real-mode APM bios will be able to do such a performance (unless your name is Bill and your OS has a driver support from every motherboard manufacturer ...)dronkit wrote: Officially, I think, according to intel's manual, is to triple fault the cpu if you want to shut it down.
Re:Reboot & shutdown...
Right, it will just reboot. However, this is what intel says in the manual for
the 386
the 386
Oh no, thanks god I'm not(unless your name is Bill and your OS has a driver support from every motherboard manufacturer ...)
Re:Reboot & shutdown...
A computer won't necessarily reboot on a triple fault, either: that is just a conventional way for the motherboard to handle it. All that the CPU does on a triple fault is set up a special bus condition, which the motherboard chipset picks up on. I have a computer at home which does not reboot on a triple fault: it just hangs. Handy for OS development.
The only guaranteed way to induce a reboot is through the keyboard controller. The only guaranteed ways to turn off the computer are through APM (old-ish) or ACPI (difficult).
The only guaranteed way to induce a reboot is through the keyboard controller. The only guaranteed ways to turn off the computer are through APM (old-ish) or ACPI (difficult).
Re:Reboot & shutdown...
Ok, ill just leave it with the reboot code for now... and shutdown can come later... also, is it just a myth that manually shuting down your comp by holding down the power button is bad for it and damage the computer? or will this be alright, and just make sure all the data is saved to disk then have a screen saying "its now save to shut down" so they can do it manually?
Re:Reboot & shutdown...
You're the OS developer; it's up to you. The actual hardware won't get damaged regardless of how you shut down.