mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 08:24:32 -08:00
[kernel] Add get_caller function
Added a function to get the callsite of the current function invocation.
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
extern "C" {
|
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_frame(int frame);
|
uintptr_t get_frame(int frame);
|
||||||
uintptr_t get_gsbase();
|
uintptr_t get_gsbase();
|
||||||
void _halt();
|
void _halt();
|
||||||
|
|||||||
@@ -8,6 +8,12 @@ get_rip:
|
|||||||
pop rax ; do the same thing as 'ret', except with 'jmp'
|
pop rax ; do the same thing as 'ret', except with 'jmp'
|
||||||
jmp rax ; with the return address still in rax
|
jmp rax ; with the return address still in rax
|
||||||
|
|
||||||
|
global get_caller
|
||||||
|
get_caller:
|
||||||
|
; No prelude - don't touch rsp or rbp
|
||||||
|
mov rax, [rbp+8]
|
||||||
|
ret
|
||||||
|
|
||||||
global get_gsbase
|
global get_gsbase
|
||||||
get_gsbase:
|
get_gsbase:
|
||||||
rdgsbase rax
|
rdgsbase rax
|
||||||
|
|||||||
Reference in New Issue
Block a user