Reboot: Difference between revisions

89 bytes added ,  14 years ago
Cleanup, still needs more work
[unchecked revision][unchecked revision]
m (volatile is not actually neccessary in this case)
(Cleanup, still needs more work)
Line 2:
 
# load a 0-sized IDT and issue an interrupt (that'll triple fault and reset)
# Use the 8042 keyboard controller to pulse the CPU's RESET pin
# the 'pulse RESET line from 8042 controller'
 
== Short code to do a 8042 reset ==
void reboot()
<source lang="c">
{
void reboot()
unsigned char good = 0x02;
{
while ((good & 0x02) != 0)
unsigned char good = inport(0x64)0x02;
while ((good & 0x02) != 0)
outport(0x64, 0xFE);
frz good = inport(0x64);
outport(0x64, 0xFE);
}
frz();
}
</source>
 
 
==AlternateAnnotated code for reboot()==
<source lang="c">
<pre>
typedef unsigned char uchar;
typedef uchar byte;
Line 53 ⟶ 56:
asm volatile ("HLT"); /* if that didn't work, halt the CPU */
}
</presource>
 
[[Category:Power management]]
Anonymous user