1	.global _longjmp
2	.global longjmp
3	.type   _longjmp,@function
4	.type   longjmp,@function
5_longjmp:
6longjmp:
7	# 0) move old return address into the link register
8	ld   0,  0*8(3)
9	mtlr 0
10	# 1) restore cr
11	ld   0,  1*8(3)
12	mtcr 0
13	# 2) restore r1-r2 (SP and TOC)
14	ld   1,  2*8(3)
15	ld   2,  3*8(3)
16	# 3) restore r14-r31
17	ld  14,  4*8(3)
18	ld  15,  5*8(3)
19	ld  16,  6*8(3)
20	ld  17,  7*8(3)
21	ld  18,  8*8(3)
22	ld  19,  9*8(3)
23	ld  20, 10*8(3)
24	ld  21, 11*8(3)
25	ld  22, 12*8(3)
26	ld  23, 13*8(3)
27	ld  24, 14*8(3)
28	ld  25, 15*8(3)
29	ld  26, 16*8(3)
30	ld  27, 17*8(3)
31	ld  28, 18*8(3)
32	ld  29, 19*8(3)
33	ld  30, 20*8(3)
34	ld  31, 21*8(3)
35	# 4) restore floating point registers f14-f31
36	lfd 14, 22*8(3)
37	lfd 15, 23*8(3)
38	lfd 16, 24*8(3)
39	lfd 17, 25*8(3)
40	lfd 18, 26*8(3)
41	lfd 19, 27*8(3)
42	lfd 20, 28*8(3)
43	lfd 21, 29*8(3)
44	lfd 22, 30*8(3)
45	lfd 23, 31*8(3)
46	lfd 24, 32*8(3)
47	lfd 25, 33*8(3)
48	lfd 26, 34*8(3)
49	lfd 27, 35*8(3)
50	lfd 28, 36*8(3)
51	lfd 29, 37*8(3)
52	lfd 30, 38*8(3)
53	lfd 31, 39*8(3)
54
55	# 5) restore vector registers v20-v31
56	addi 3, 3, 40*8
57	lvx 20, 0, 3 ; addi 3, 3, 16
58	lvx 21, 0, 3 ; addi 3, 3, 16
59	lvx 22, 0, 3 ; addi 3, 3, 16
60	lvx 23, 0, 3 ; addi 3, 3, 16
61	lvx 24, 0, 3 ; addi 3, 3, 16
62	lvx 25, 0, 3 ; addi 3, 3, 16
63	lvx 26, 0, 3 ; addi 3, 3, 16
64	lvx 27, 0, 3 ; addi 3, 3, 16
65	lvx 28, 0, 3 ; addi 3, 3, 16
66	lvx 29, 0, 3 ; addi 3, 3, 16
67	lvx 30, 0, 3 ; addi 3, 3, 16
68	lvx 31, 0, 3
69
70	# 6) return r4 ? r4 : 1
71	mr    3,   4
72	cmpwi cr7, 4, 0
73	bne   cr7, 1f
74	li    3,   1
751:
76	blr
77
78