Skip to content

Instantly share code, notes, and snippets.

@msullivan
Created June 20, 2016 22:18
Show Gist options
  • Save msullivan/461a5affc992025530c0f936740046b4 to your computer and use it in GitHub Desktop.
Save msullivan/461a5affc992025530c0f936740046b4 to your computer and use it in GitHub Desktop.
code to reboot a pc using keyboard controller
void reboot(void)
{
while (1) { /* keep trying if it doesn't work */
/* wait for the output buffer to be empty */
while (inb(KEYBOARD_CMD_PORT) & KEYBOARD_OUTBUF_FULL_MASK)
;
/* send the command to have the keyboard controller reboot the machine.
* wtf. */
outb(KEYBOARD_CMD_PORT, KEYBOARD_CMD_REBOOT);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment