Support doing kernel calltraces on another stack.

This commit is contained in:
Jonas 'Sortie' Termansen 2013-01-26 00:15:15 +01:00
parent ef53864d36
commit 7b3fd0f06f
4 changed files with 22 additions and 10 deletions

View File

@ -1,6 +1,6 @@
/*******************************************************************************
Copyright(C) Jonas 'Sortie' Termansen 2012.
Copyright(C) Jonas 'Sortie' Termansen 2012, 2013.
This file is part of Sortix.
@ -28,16 +28,16 @@
namespace Sortix {
namespace Calltrace {
extern "C" void calltrace();
extern "C" void calltrace(unsigned long ptr);
extern "C" void calltrace_print_function(size_t index, addr_t ip)
{
Log::PrintF("%zu: 0x%zx\n", index, ip);
}
void Perform()
void Perform(unsigned long ptr)
{
Log::PrintF("Calltrace:\n");
calltrace();
calltrace(ptr);
}
} // namespace Calltrace

View File

@ -1,6 +1,6 @@
/*******************************************************************************
Copyright(C) Jonas 'Sortie' Termansen 2012.
Copyright(C) Jonas 'Sortie' Termansen 2012, 2013.
This file is part of Sortix.
@ -27,7 +27,9 @@
namespace Sortix {
namespace Calltrace {
void Perform();
void Perform(unsigned long ptr = 0);
} // namespace Calltrace
} // namespace Sortix

View File

@ -1,6 +1,6 @@
/*******************************************************************************
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012.
Copyright(C) Jonas 'Sortie' Termansen 2012, 2013.
This file is part of Sortix.
@ -31,8 +31,13 @@ calltrace:
push %rbp
push %rbx
movq %rsp, %rbp
xorl %edi, %edi
push %rbx
movq %rdi, %rbx
testq %rbx, %rbx
jnz 1f
movq %rbp, %rbx
1:
xorl %edi, %edi
calltrace_unwind:
testq %rbx, %rbx

View File

@ -1,6 +1,6 @@
/*******************************************************************************
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012.
Copyright(C) Jonas 'Sortie' Termansen 2012, 2013.
This file is part of Sortix.
@ -31,8 +31,13 @@ calltrace:
push %ebp
push %ebx
movl %esp, %ebp
xorl %edi, %edi
push %ebx
movl 8(%ebp), %ebx
testl %ebx, %ebx
jnz 1f
movl %ebp, %ebx
1:
xorl %edi, %edi
calltrace_unwind:
testl %ebx, %ebx