24 lines
323 B
ArmAsm
24 lines
323 B
ArmAsm
// int setjmp(jmp_buf env)
|
|
.global setjmp
|
|
setjmp:
|
|
leaq 8(%rsp), %rax
|
|
movq %rax, 0(%rdi)
|
|
|
|
movq (%rsp), %rax
|
|
movq %rax, 8(%rdi)
|
|
|
|
xorq %rax, %rax
|
|
|
|
ret
|
|
|
|
// void longjmp(jmp_buf env, int val)
|
|
.global longjmp
|
|
longjmp:
|
|
movq $1, %rax
|
|
testq %rsi, %rsi
|
|
cmovnzq %rsi, %rax
|
|
|
|
movq 0(%rdi), %rsp
|
|
movq 8(%rdi), %rcx
|
|
jmp *%rcx
|