diff options
Diffstat (limited to 'arch/i386')
-rw-r--r-- | arch/i386/kernel/stack_trace.s | 31 | ||||
-rw-r--r-- | arch/i386/make.config | 1 |
2 files changed, 32 insertions, 0 deletions
diff --git a/arch/i386/kernel/stack_trace.s b/arch/i386/kernel/stack_trace.s new file mode 100644 index 0000000..fbd77ed --- /dev/null +++ b/arch/i386/kernel/stack_trace.s @@ -0,0 +1,31 @@ +.section .text + +.global walk_stack +.type walk_stack, @function +walk_stack: + pushl %ebp + movl %esp, %ebp + + pushl %edi + movl -4(%ebp), %edi + pushl %ebx + movl -8(%ebp), %ebx + + xorl %eax, %eax + movl 8(%esp), %ebx + movl 16(%esp), %edi + movl 20(%esp), %ecx +walk: + testl %ebx, %ebx + jz done + movl 4(%ebx), %edx + movl 0(%ebx), %ebx + movl %edx, (%edi) + addl $4, %edi + inc %eax + loop walk +done: + popl %ebx + popl %edi + popl %ebp + ret diff --git a/arch/i386/make.config b/arch/i386/make.config index 82d0733..557f01a 100644 --- a/arch/i386/make.config +++ b/arch/i386/make.config @@ -7,6 +7,7 @@ KERNEL_ARCH_OBJS=$(ARCHDIR)/boot/boot.o \ $(ARCHDIR)/kernel/idt.o \ $(ARCHDIR)/kernel/gdt.o \ $(ARCHDIR)/kernel/isr.o \ + $(ARCHDIR)/kernel/stack_trace.o \ $(ARCHDIR)/kernel/multiboot.o \ $(ARCHDIR)/kernel/serial.o \ $(ARCHDIR)/kernel/pic.o \ |