mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 08:24:32 -08:00
This should probably be replaced with a function taking the number of steps back, but this is quick and useful.
34 lines
473 B
ArmAsm
34 lines
473 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_grandcaller
|
|
get_grandcaller:
|
|
; No prelude - don't touch rsp or rbp
|
|
mov rax, [rbp]
|
|
mov rax, [rax+8]
|
|
ret
|
|
|
|
global get_gsbase
|
|
get_gsbase:
|
|
rdgsbase rax
|
|
ret
|
|
|
|
global _halt
|
|
_halt:
|
|
hlt
|
|
jmp _halt
|
|
|