summaryrefslogtreecommitdiffhomepage
path: root/src/signal/nt64/sigsetjmp.s
blob: 77ce4f605442f1b325ddf787b71e3fb5954f1075 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
.text
.globl	__sigsetjmp
.globl	sigsetjmp

.def __sigsetjmp; .scl 2; .type 32; .endef
.def sigsetjmp; .scl 2; .type 32; .endef

__sigsetjmp:
sigsetjmp:
	test  %rdx,%rdx		# save signal mask?
	jnz   1f		# yes: save mask
	jmp   setjmp		# no:  setjmp

1:
				# typedef unsigned long __jmp_buf[10];
				#
				# typedef struct __jmp_buf_tag {
				#	__jmp_buf __jb;
				#	unsigned long __fl;
				# 	unsigned long __ss[16];
				# }
				#

	popq  0x68(%rcx) 	# save return address to .__ss[2]
	movq  %rbx,0x70(%rcx)	# save rbx (arbitrary choice) to .__ss[3]
	movq  %rcx,%rbx		# save pointer to __jmp_buf to rbx

	call  __setjmp

	pushq 0x68(%rbx) 	# push previously saved return address
	movq  %rbx,%rcx 	# save pointer to __jmp_buf to rcx (arg 0)
	movl  %eax,%edx		# save setjmp return value to rdx (arg 1)
	movq  0x70(%rcx),%rbx	# restore rbx from .__ss[3]


	jmp __sigsetjmp_tail	# defer to __sigsetjmp_tail


	.section .got$sigsetjmp,"r"
	.global __imp_sigsetjmp
__imp_sigsetjmp:
	.quad	sigsetjmp
	.linkonce discard