1/* Copyright (c) 2005 Aldy Hernandez <aldyh@redhat.com> */
2# setjmp/longjmp for mt.
3#
4# The jmpbuf looks like this:
5#
6# Register	jmpbuf offset
7# R0		---		--
8# R1		0x4		 4
9# R2		0x8		 8
10# R3		0xc		12
11# R4		0x10		16
12# R5		0x14		20
13# R6		0x18		24
14# R7		0x1c		28
15# R8		0x20		32
16# R9		----		--
17# R10		----		--
18# R11		0x2c		44
19# R12		0x30		48
20# R13		0x34		52
21# R14		0x38		56
22# R15		0x3c		60
23#
24# R1 contains the pointer to jmpbuf
25	.text
26	.global	setjmp
27	.type	setjmp ,@function
28setjmp:
29
30	stw	r1, r1, #4
31	or	r0, r0, r0
32	stw	r2, r1, #8
33	or	r0, r0, r0
34	stw	r3, r1, #12
35	or	r0, r0, r0
36	stw	r4, r1, #16
37	or	r0, r0, r0
38	stw	r5, r1, #20
39	or	r0, r0, r0
40	stw	r6, r1, #24
41	or	r0, r0, r0
42	stw	r7, r1, #28
43	or	r0, r0, r0
44	stw	r8, r1, #32
45	or	r0, r0, r0
46	stw	r11, r1, #44
47	or	r0, r0, r0
48	stw	r12, r1, #48
49	or	r0, r0, r0
50	stw	r13, r1, #52
51	or	r0, r0, r0
52	stw	r14, r1, #56
53	or	r0, r0, r0
54	stw	r15, r1, #60
55
56	jal	r0, r14
57	addi	r11, r0, #0
58.Lend1:
59	.size	setjmp,.Lend1-setjmp
60
61	.global	longjmp
62	.type	longjmp,@function
63longjmp:
64	or	r9, r1, r1
65	or	r11, r2, r2
66	ldw	r1, r1, #4
67	or	r0, r0, r0
68	ldw	r2, r1, #8
69	or	r0, r0, r0
70	ldw	r3, r1, #12
71	or	r0, r0, r0
72	ldw	r4, r1, #16
73	or	r0, r0, r0
74	ldw	r5, r1, #20
75	or	r0, r0, r0
76	ldw	r6, r1, #24
77	or	r0, r0, r0
78	ldw	r7, r1, #28
79	or	r0, r0, r0
80	ldw	r8, r1, #32
81	or	r0, r0, r0
82
83
84	ldw	r12, r1, #48
85	or	r0, r0, r0
86	ldw	r13, r1, #52
87	or	r0, r0, r0
88	ldw	r14, r1, #56
89	or	r0, r0, r0
90	ldw	r15, r1, #60
91
92	brne	r0, r11, .L01
93	or	r0, r0, r0
94
95	addi	r11, r0, #1
96.L01:
97	jal	r0, r14
98	or	r0, r0, r0
99.Lend2:
100	.size	longjmp,.Lend2-longjmp2
101