diff --git a/kernel/core/mem.c b/kernel/core/mem.c index ecb0ed92..137f89fe 100644 --- a/kernel/core/mem.c +++ b/kernel/core/mem.c @@ -249,6 +249,10 @@ page_fault( int reserved = r->err_code & 0x8; int id = r->err_code & 0x10; + if (faulting_address == 0) { + kprintf("Null pointer dereference in the kernel.\n"); + } + kprintf("Page fault! (p:%d,rw:%d,user:%d,res:%d,id:%d) at 0x%x\n", present, rw, user, reserved, id, faulting_address); HALT_AND_CATCH_FIRE("Page fault"); } diff --git a/kernel/core/shell.c b/kernel/core/shell.c index f8d44e2b..62aa9a7b 100644 --- a/kernel/core/shell.c +++ b/kernel/core/shell.c @@ -43,6 +43,7 @@ start_shell() { char * save; pch = strtok_r(buffer," ",&save); cmd = pch; + if (!cmd) { continue; } char * argv[1024]; /* Command tokens (space-separated elements) */ int tokenid = 0; while (pch != NULL) {