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