summaryrefslogtreecommitdiffhomepage
path: root/src/setjmp/nt64/longjmp.s
blob: 21e879b8b1dd0aa680c4a84255576f8b9e0f01ee (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
.text
.globl	__longjmp
.globl	_longjmp
.globl	longjmp

.def __longjmp; .scl 2; .type 32; .endef
.def _longjmp; .scl 2; .type 32; .endef
.def longjmp; .scl 2; .type 32; .endef

__longjmp:
_longjmp:
longjmp:
	test %edx, %edx		# is val zero?
	jne  1f			# no:  return val
	xor  $1,   %edx		# yes: return one

1:
	mov  %edx, %eax		# return value

2:
	mov  0x10(%rcx), %rbx	# restore regs
	mov  0x18(%rcx), %rbp
	mov  0x20(%rcx), %rdi
	mov  0x28(%rcx), %rsi
	mov  0x30(%rcx), %r12
	mov  0x38(%rcx), %r13
	mov  0x40(%rcx), %r14
	mov  0x48(%rcx), %r15

	mov  0x08(%rcx), %rsp	# saved stack pointer
	mov  (%rcx),     %rdx	# return address
	jmp  *%rdx		# return

	.section .got$longjmp
	.global __imp_longjmp
__imp_longjmp:
	.quad	longjmp
	.linkonce discard