Page 1 of 1
Reboot & shutdown...
Posted: Wed Oct 30, 2002 3:38 am
by eliscool
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...
Posted: Wed Oct 30, 2002 3:42 am
by Berserk
I was just about to ask that,
How do you make the OS reboot or Shut Down?? ;D
Re:Reboot & shutdown...
Posted: Wed Oct 30, 2002 7:06 am
by Whatever5k
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...
Posted: Wed Oct 30, 2002 8:17 am
by dronkit
Officially, I think, according to intel's manual, is to triple fault the cpu if you want to shut it down.
Re:Reboot & shutdown...
Posted: Wed Oct 30, 2002 8:45 am
by Pype.Clicker
dronkit wrote:
Officially, I think, according to intel's manual, is to triple fault the cpu if you want to shut it down.
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 ...)
Re:Reboot & shutdown...
Posted: Wed Oct 30, 2002 8:55 am
by dronkit
Right, it will just reboot. However, this is what intel says in the manual for
the 386
(unless your name is Bill and your OS has a driver support from every motherboard manufacturer ...)
Oh no, thanks god I'm not
Re:Reboot & shutdown...
Posted: Wed Oct 30, 2002 12:34 pm
by Tim
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).
Re:Reboot & shutdown...
Posted: Wed Oct 30, 2002 8:46 pm
by eliscool
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...
Posted: Thu Oct 31, 2002 8:20 am
by Tim
You're the OS developer; it's up to you. The actual hardware won't get damaged regardless of how you shut down.
Re:Reboot & shutdown...
Posted: Thu Oct 31, 2002 3:48 pm
by Schol-R-LEA
[attachment deleted by admin]