Kernel: Move dump_stacktrace() to arch folder
It uses mov instruction which has different register on x86/x86-64
This commit is contained in:
parent
9e092c80c0
commit
bb051604a1
|
@ -0,0 +1,24 @@
|
|||
#include <kernel/Panic.h>
|
||||
|
||||
namespace Kernel
|
||||
{
|
||||
|
||||
void dump_stacktrace()
|
||||
{
|
||||
struct stackframe
|
||||
{
|
||||
stackframe* ebp;
|
||||
uint32_t eip;
|
||||
};
|
||||
|
||||
stackframe* frame;
|
||||
asm volatile("movl %%ebp, %0" : "=r"(frame));
|
||||
BAN::Formatter::println(Serial::serial_putc, "\e[36mStack trace:");
|
||||
while (frame)
|
||||
{
|
||||
BAN::Formatter::println(Serial::serial_putc, " {}", (void*)frame->eip);
|
||||
frame = frame->ebp;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -10,4 +10,6 @@ $(ARCHDIR)/CPUID.o \
|
|||
$(ARCHDIR)/GDT.o \
|
||||
$(ARCHDIR)/IDT.o \
|
||||
$(ARCHDIR)/MMU.o \
|
||||
$(ARCHDIR)/Panic.o \
|
||||
$(ARCHDIR)/VESA.o \
|
||||
|
|
@ -9,23 +9,7 @@
|
|||
namespace Kernel
|
||||
{
|
||||
|
||||
static void dump_stacktrace()
|
||||
{
|
||||
struct stackframe
|
||||
{
|
||||
stackframe* ebp;
|
||||
uint32_t eip;
|
||||
};
|
||||
|
||||
stackframe* frame;
|
||||
asm volatile("movl %%ebp, %0" : "=r"(frame));
|
||||
BAN::Formatter::println(Serial::serial_putc, "\e[36mStack trace:");
|
||||
while (frame)
|
||||
{
|
||||
BAN::Formatter::println(Serial::serial_putc, " 0x{8H}", frame->eip);
|
||||
frame = frame->ebp;
|
||||
}
|
||||
}
|
||||
void dump_stacktrace();
|
||||
|
||||
template<typename... Args>
|
||||
__attribute__((__noreturn__))
|
||||
|
|
Loading…
Reference in New Issue