Add reboot command to debugger

This commit is contained in:
Ali Mashtizadeh 2014-07-13 17:05:19 -07:00
parent 24cb178868
commit eb6efaa773
3 changed files with 14 additions and 0 deletions

View File

@ -56,3 +56,13 @@ Debug_Registers(int argc, const char *argv[])
tf->r13, tf->r14, tf->r15);
}
void
Debug_Reboot(int argc, const char *argv[])
{
/*
* Triple fault the core by loading a non-canonical address into CR3. We
* should use ACPI, or even the keyboard controller if it exists.
*/
write_cr3(0x8000000000000000ULL);
}

View File

@ -4,6 +4,7 @@
// Platform Functions
void Debug_Registers(int argc, const char *argv[]);
void Debug_Reboot(int argc, const char *argv[]);
uintptr_t db_disasm(uintptr_t loc, bool altfmt);
// Generic Functions

View File

@ -170,6 +170,7 @@ Debug_Help(int argc, const char *argv[])
{
PHELP("disasm", "Disassemble");
PHELP("dump", "Dump a region of memory");
PHELP("reboot", "Reboot computer");
PHELP("registers", "Show CPU registers");
PHELP("help", "Display the list of commands");
}
@ -262,6 +263,8 @@ Debug_Prompt()
Debug_Registers(argc, (const char **)argv);
} else if (strcmp(argv[0], "disasm") == 0) {
Debug_Disasm(argc, (const char **)argv);
} else if (strcmp(argv[0], "reboot") == 0) {
Debug_Reboot(argc, (const char **)argv);
} else if (strcmp(argv[0], "echo") == 0) {
Debug_Echo(argc, (const char **)argv);
} else if (strcmp(argv[0], "") != 0) {