2024-08-07 17:03:26 +03:00
|
|
|
// 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
|
2024-09-10 16:21:20 +03:00
|
|
|
.size setjmp, . - setjmp
|
2024-08-07 17:03:26 +03:00
|
|
|
|
|
|
|
// 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
|
2024-09-10 16:21:20 +03:00
|
|
|
.size longjmp, . - longjmp
|