-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: stacktraces Signed-off-by: Ry <ry.diffusion@proton.me> * ignore: add compile_commands.json Signed-off-by: Ry <ry.diffusion@proton.me> * chore: Removing unused code Signed-off-by: RedsonBr140 <redson@riseup.net> * chore: Remove i386 stacktrace Signed-off-by: RedsonBr140 <redson@riseup.net> --------- Signed-off-by: Ry <ry.diffusion@proton.me> Signed-off-by: RedsonBr140 <redson@riseup.net> Co-authored-by: RedsonBr140 <redson@riseup.net>
- Loading branch information
1 parent
e1f8757
commit c482891
Showing
10 changed files
with
54 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,4 +80,6 @@ dkms.conf | |
*.iso | ||
|
||
## Bochs | ||
bx_enh_dbg.ini | ||
bx_enh_dbg.ini | ||
|
||
compile_commands.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#pragma once | ||
|
||
#ifndef GIT_VERSION | ||
#define GIT_VERSION "UNKNOWN" | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,3 +15,4 @@ reloadSegments: | |
mov gs, ax | ||
mov ss, ax | ||
ret | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
#pragma once | ||
|
||
void panic(char *message); | ||
/** | ||
@brief Panics the kernel | ||
@param message The message to put in kernel panic, must be non null. | ||
*/ | ||
__attribute__((noreturn)) void panic(char message[static 1]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#pragma once | ||
#define DUMP_STACK_ENTRIES_MAX 20 | ||
|
||
/** | ||
@brief Dumps the stack into console | ||
*/ | ||
void dumpStack(void); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include <Kernel/Stack.h> | ||
#include <LibK/stdio.h> | ||
#include <stdint.h> | ||
|
||
#if defined(__x86_64__) | ||
void dumpStack(void) { | ||
kprintf("Stacktrace:\n"); | ||
uint64_t rbp = 0; | ||
|
||
__asm__ volatile("mov %%rbp, %0" : "=r"(rbp)); | ||
|
||
for (uint64_t frame = 0; rbp && frame < DUMP_STACK_ENTRIES_MAX; ++frame) { | ||
kprintf(" [%p]\n", rbp); | ||
rbp += sizeof(void *); | ||
} | ||
} | ||
#else | ||
void dumpStack(void) { kprintf("Stacktrace unavaliable.\n"); } | ||
#endif |