xref: /DragonStub/lib/x86_64/setjmp.S (revision 39ce220cb6fde14bedf2ef61695f3d20726e41ef)
1	.text
2	.globl	setjmp
3#ifndef __MINGW32__
4	.type setjmp, @function
5#else
6	.def setjmp; .scl 2; .type 32; .endef
7#endif
8setjmp:
9	pop	%rsi
10	movq	%rbx,0x00(%rdi)
11	movq	%rsp,0x08(%rdi)
12	push	%rsi
13	movq	%rbp,0x10(%rdi)
14	movq	%r12,0x18(%rdi)
15	movq	%r13,0x20(%rdi)
16	movq	%r14,0x28(%rdi)
17	movq	%r15,0x30(%rdi)
18	movq	%rsi,0x38(%rdi)
19	xor	%rax,%rax
20	ret
21
22	.globl	longjmp
23#ifndef __MINGW32__
24	.type	longjmp, @function
25#else
26	.def longjmp; .scl 2; .type 32; .endef
27#endif
28longjmp:
29	movl	%esi, %eax
30	movq	0x00(%rdi), %rbx
31	movq	0x08(%rdi), %rsp
32	movq	0x10(%rdi), %rbp
33	movq	0x18(%rdi), %r12
34	movq	0x20(%rdi), %r13
35	movq	0x28(%rdi), %r14
36	movq	0x30(%rdi), %r15
37	xor	%rdx,%rdx
38	mov	$1,%rcx
39	cmp	%rax,%rdx
40	cmove	%rcx,%rax
41	jmp	*0x38(%rdi)
42