[kernel] Add get_grandcaller debug function

This should probably be replaced with a function taking the number of
steps back, but this is quick and useful.
This commit is contained in:
Justin C. Miller
2021-07-15 23:34:35 -07:00
parent edfc5ab8b4
commit 972a35bdef
2 changed files with 8 additions and 0 deletions

View File

@@ -10,6 +10,7 @@ extern "C" {
uintptr_t get_rsp(); uintptr_t get_rsp();
uintptr_t get_rip(); uintptr_t get_rip();
uintptr_t get_caller(); uintptr_t get_caller();
uintptr_t get_grandcaller();
uintptr_t get_frame(int frame); uintptr_t get_frame(int frame);
uintptr_t get_gsbase(); uintptr_t get_gsbase();
void _halt(); void _halt();

View File

@@ -14,6 +14,13 @@ get_caller:
mov rax, [rbp+8] mov rax, [rbp+8]
ret ret
global get_grandcaller
get_grandcaller:
; No prelude - don't touch rsp or rbp
mov rax, [rbp]
mov rax, [rax+8]
ret
global get_gsbase global get_gsbase
get_gsbase: get_gsbase:
rdgsbase rax rdgsbase rax