boot monitor: introduce a 'reset' command that causes the cpu to

reset (triple fault).
This commit is contained in:
Ben Gras 2010-06-02 13:23:15 +00:00
parent 7bfa47476c
commit 495970a17c
2 changed files with 14 additions and 3 deletions

View file

@ -715,12 +715,12 @@ static void initialize(void)
/* Reserved names: */ /* Reserved names: */
enum resnames { enum resnames {
R_NULL, R_BOOT, R_CTTY, R_DELAY, R_ECHO, R_EXIT, R_HELP, R_NULL, R_BOOT, R_CTTY, R_DELAY, R_ECHO, R_EXIT, R_HELP,
R_LS, R_MENU, R_OFF, R_SAVE, R_SET, R_TRAP, R_UNSET R_LS, R_MENU, R_OFF, R_SAVE, R_SET, R_TRAP, R_UNSET, R_RESET
}; };
static char resnames[][6] = { static char resnames[][6] = {
"", "boot", "ctty", "delay", "echo", "exit", "help", "", "boot", "ctty", "delay", "echo", "exit", "help",
"ls", "menu", "off", "save", "set", "trap", "unset", "ls", "menu", "off", "save", "set", "trap", "unset", "reset",
}; };
/* Using this for all null strings saves a lot of memory. */ /* Using this for all null strings saves a lot of memory. */
@ -731,7 +731,7 @@ static enum resnames reserved(const char *s)
{ {
enum resnames r; enum resnames r;
for (r= R_BOOT; r <= R_UNSET; r++) { for (r= R_BOOT; r <= R_RESET; r++) {
if (strcmp(s, resnames[r]) == 0) return r; if (strcmp(s, resnames[r]) == 0) return r;
} }
return R_NULL; return R_NULL;
@ -1877,6 +1877,7 @@ static void execute(void)
case R_EXIT: exit(0); case R_EXIT: exit(0);
case R_OFF: off(); ok= 1; break; case R_OFF: off(); ok= 1; break;
case R_CTTY: ctty(nil); ok= 1; break; case R_CTTY: ctty(nil); ok= 1; break;
case R_RESET: reset(); ok= 1; break;
} }
/* Command to check bootparams: */ /* Command to check bootparams: */
@ -2029,6 +2030,9 @@ void main(int argc, char **argv)
} }
exit(0); exit(0);
} }
reset() { }
#endif /* UNIX */ #endif /* UNIX */
/* /*

View file

@ -1454,6 +1454,11 @@ _scan_keyboard:
outb 0x61 outb 0x61
ret ret
.define _reset
_reset:
lidt idt_zero
int 0x3
.data .data
.ascii "(null)\0" ! Just in case someone follows a null pointer .ascii "(null)\0" ! Just in case someone follows a null pointer
.align 2 .align 2
@ -1461,6 +1466,8 @@ c60: .data2 60 ! Constants for MUL and DIV
c1024: .data2 1024 c1024: .data2 1024
c1080: .data2 1080 c1080: .data2 1080
c19663: .data2 19663 c19663: .data2 19663
idt_zero:
.data4 0,0
! Global descriptor tables. ! Global descriptor tables.
UNSET = 0 ! Must be computed UNSET = 0 ! Must be computed