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