commit 8a88776ba9dffa2d513f0ba2061b701284aea9c9
parent cfcfb58be3aec4ed781701486b35ead779f2f5c5
Author: Brian Swetland <swetland@frotz.net>
Date: Thu, 2 Jan 2014 14:02:23 -0800
make getcallerpcs() correctly obtain backtraces on x84
Have to grab rbp directly because arguments aren't necessarily on the stack.
Diffstat:
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git a/kernel/spinlock.c b/kernel/spinlock.c
@@ -70,7 +70,11 @@ getcallerpcs(void *v, uintp pcs[])
uintp *ebp;
int i;
+#if X64
+ asm volatile("mov %%rbp, %0" : "=r" (ebp));
+#else
ebp = (uintp*)v - 2;
+#endif
for(i = 0; i < 10; i++){
if(ebp == 0 || ebp < (uintp*)KERNBASE || ebp == (uintp*)0xffffffff)
break;