summaryrefslogtreecommitdiffstats
path: root/usr/klibc/arch/alpha/setjmp.S
blob: ed604bdc6c1c7d67ba395580db0c764c9a7cd62f (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#
# setjmp.S
#

#
# The jmp_buf looks like:
#
#	s0..5
#	fp
#	ra
#	gp
#	sp
#

#include <machine/asm.h>

	.text
	.align	3
	.type	setjmp,@function
	.ent	setjmp, 0
	.globl	setjmp
setjmp:
	lda	v0,   0(zero)
	stq	s0,   0(a0)
	stq	s1,   8(a0)
	stq	s2,  16(a0)
	stq	s3,  24(a0)
	stq	s4,  32(a0)
	stq	s5,  40(a0)
	stq	fp,  48(a0)
	stq	ra,  56(a0)
	stq	gp,  64(a0)
	stq	sp,  72(a0)
	stt	$f2,  80(a0)
	stt	$f3,  88(a0)
	stt	$f4,  96(a0)
	stt	$f5, 104(a0)
	stt	$f6, 112(a0)
	stt	$f7, 120(a0)
	stt	$f8, 128(a0)
	stt	$f9, 136(a0)
	ret	zero,(ra),1

	.size setjmp,.-setjmp
	.end setjmp

	.type	longjmp,@function
	.ent	longjmp, 0
	.globl	longjmp
longjmp:
	mov	a1, v0
	ldq	s0,   0(a0)
	ldq	s1,   8(a0)
	ldq	s2,  16(a0)
	ldq	s3,  24(a0)
	ldq	s4,  32(a0)
	ldq	s5,  40(a0)
	ldq	fp,  48(a0)
	ldq	ra,  56(a0)
	ldq	gp,  64(a0)
	ldq	sp,  72(a0)
	ldt	$f2,  80(a0)
	ldt	$f3,  88(a0)
	ldt	$f4,  96(a0)
	ldt	$f5, 104(a0)
	ldt	$f6, 112(a0)
	ldt	$f7, 120(a0)
	ldt	$f8, 128(a0)
	ldt	$f9, 136(a0)
	/* We're bound to get a mispredict here, but at least give us
	   a chance to get the return stack back in sync... */
	ret	zero,(ra),1

	.size longjmp,.-longjmp
	.end longjmp