toaruos/modules/crash.c

34 lines
756 B
C
Raw Normal View History

2014-06-08 10:51:01 +04:00
/* vim: tabstop=4 shiftwidth=4 noexpandtab
* This file is part of ToaruOS and is released under the terms
* of the NCSA / University of Illinois License - see LICENSE.md
* Copyright (C) 2014 Kevin Lange
*/
#include <module.h>
2014-04-13 11:51:50 +04:00
#include <printf.h>
#include <mod/shell.h>
DEFINE_SHELL_FUNCTION(crash, "Dereference NULL.") {
2014-04-13 11:51:50 +04:00
fprintf(tty, "*0x0 = %x\n", *((int *)0x00));
*((int *)0x0) = 0x42;
fprintf(tty, "*0x0 = %x\n", *((int *)0x00));
return 0;
}
DEFINE_SHELL_FUNCTION(assert_false, "assert(0)") {
assert(0);
return 0;
}
static int crash_init(void) {
BIND_SHELL_FUNCTION(crash);
BIND_SHELL_FUNCTION(assert_false);
2014-03-19 09:57:07 +04:00
return 0;
}
static int crash_fini(void) {
2014-03-19 09:57:07 +04:00
return 0;
}
MODULE_DEF(crash, crash_init, crash_fini);
2014-03-19 07:11:56 +04:00
MODULE_DEPENDS(debugshell);