toaruos/modules/crash.c

34 lines
756 B
C
Raw Permalink Normal View History

2014-06-07 23:51:01 -07: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 00:51:50 -07:00
#include <printf.h>
#include <mod/shell.h>
DEFINE_SHELL_FUNCTION(crash, "Dereference NULL.") {
2014-04-13 00:51:50 -07: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-18 22:57:07 -07:00
return 0;
}
static int crash_fini(void) {
2014-03-18 22:57:07 -07:00
return 0;
}
MODULE_DEF(crash, crash_init, crash_fini);
2014-03-18 20:11:56 -07:00
MODULE_DEPENDS(debugshell);