diff options
author | Marvin Borner | 2021-03-14 16:12:44 +0100 |
---|---|---|
committer | GitHub | 2021-03-14 16:12:44 +0100 |
commit | 268f3ccdb90ab4b9bd70ca176478797aae97ca05 (patch) | |
tree | 2dbc3e52d90dab4aae8021773f09b6b72a74b8cb /libc/print.c | |
parent | 4309322f9d2b3e31421a3cc5399ab1f4368e0652 (diff) | |
parent | 6dec7db5158447b66f31a3f786ce2916cab83cec (diff) |
Added memory management using paging
This was quite a roller-coaster and most things are slower now, but it works and is way more secure. I still need to implement things like shared memory for the WM/GUI system but other than that everything is supported.
Diffstat (limited to 'libc/print.c')
-rw-r--r-- | libc/print.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/libc/print.c b/libc/print.c index 91ecf8f..1c577e5 100644 --- a/libc/print.c +++ b/libc/print.c @@ -214,9 +214,23 @@ int print(const char *str) return strlen(str); } +void print_trace(u32 count) +{ + struct frame { + struct frame *ebp; + u32 eip; + } * stk; + __asm__ volatile("movl %%ebp, %0;" : "=r"(stk)); + print("EBP\tEIP\n"); + for (u32 i = 0; stk && i < count; i++) { + printf("0x%x\t0x%x\n", stk->ebp, stk->eip); + stk = stk->ebp; + } +} + #endif -void panic(const char *format, ...) +NORETURN void panic(const char *format, ...) { char buf[1024] = { 0 }; va_list ap; @@ -224,6 +238,7 @@ void panic(const char *format, ...) vsprintf(buf, format, ap); va_end(ap); #ifdef kernel + print("--- DON'T PANIC! ---\n"); print(buf); loop(); #else |