feat: added some comments to command.c

This commit is contained in:
2021-08-06 20:50:38 +02:00
parent 8152ad6e9a
commit ee4338fedd

View File

@@ -49,10 +49,10 @@ 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);
@@ -67,11 +67,11 @@ 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},
};
@@ -80,23 +80,30 @@ 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();
}