Files
jsix/src/kernel/debug.s
Justin C. Miller d63a30728c [kernel] Add get_caller function
Added a function to get the callsite of the current function invocation.
2020-08-22 16:34:58 -07:00

27 lines
354 B
ArmAsm

global get_rsp
get_rsp:
mov rax, rsp
ret
global get_rip
get_rip:
pop rax ; do the same thing as 'ret', except with 'jmp'
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
get_gsbase:
rdgsbase rax
ret
global _halt
_halt:
hlt
jmp _halt