diff --git a/kernel/command.c b/kernel/command.c index da9911e..b03cc26 100644 --- a/kernel/command.c +++ b/kernel/command.c @@ -49,15 +49,15 @@ void help(const char *args); void shutdown(const char *args); -void explode(const char *args); - #ifdef ENABLE_SELF_TEST +void explode(const char *args); + void exec_self_test(const char *args); void smash(const char *args); -void slingurl(const char* args); +void slingurl(const char *args); #endif @@ -67,36 +67,43 @@ cmd_handler cmd_handlers[] = { {"print", print}, {"ide", ide}, {"shutdown", shutdown}, - {"explode", explode}, {"slingurl", slingurl}, #ifdef ENABLE_SELF_TEST {"self-test", exec_self_test}, {"smash", smash}, + {"explode", explode}, #endif {NULL, NULL}, }; -void slingurl(const char* args) { +void slingurl(const char *args) { slingurl_decompose(args); } +#ifdef ENABLE_SELF_TEST + void smash(const char *args) { + // smash the stack, should trigger the stack protector char data[16]; memset(data, 'A', 32); } void exec_self_test(const char *args) { + // unit tests self_test(); } void explode(const char *args) { + // trigger a divide by zero exception uint32_t x = 0; uint32_t y = 0; __asm__("div %%ebx" : "=a" (x), "=b" (y)); } +#endif + void shutdown(const char *args) { power_shutdown(); }