ulib setjmp() and longjmp()

This commit is contained in:
2025-10-18 10:01:57 +02:00
parent e1a850a8f8
commit 76faf0581d
4 changed files with 63 additions and 0 deletions

33
ulib/jump/jump.S Normal file
View File

@ -0,0 +1,33 @@
// https://patchwork.ozlabs.org/project/uboot/patch/c315e41d155612260223ef75afa06bd728a3e705.1529433258.git.ivan.gorinov@intel.com/
.global setjmp
setjmp:
pop %rcx
movq %rcx, (%rdi)
movq %rsp, 8(%rdi)
movq %rbp, 16(%rdi)
movq %rbx, 24(%rdi)
movq %r12, 32(%rdi)
movq %r13, 40(%rdi)
movq %r14, 48(%rdi)
movq %r15, 56(%rdi)
xorq %rax, %rax
jmpq *%rcx
.global longjmp
longjmp:
movq (%rdi), %rcx
movq 8(%rdi), %rsp
movq 16(%rdi), %rbp
movq 24(%rdi), %rbx
movq 32(%rdi), %r12
movq 40(%rdi), %r13
movq 48(%rdi), %r14
movq 56(%rdi), %r15
movq %rsi, %rax
testq %rax, %rax
jnz 1f
incq %rax
1:
jmpq *%rcx