1570af302Sopenharmony_ci	.global _longjmp
2570af302Sopenharmony_ci	.global longjmp
3570af302Sopenharmony_ci	.type   _longjmp,@function
4570af302Sopenharmony_ci	.type   longjmp,@function
5570af302Sopenharmony_ci_longjmp:
6570af302Sopenharmony_cilongjmp:
7570af302Sopenharmony_ci	/*
8570af302Sopenharmony_ci	 * void longjmp(jmp_buf env, int val);
9570af302Sopenharmony_ci	 * put val into return register and restore the env saved in setjmp
10570af302Sopenharmony_ci	 * if val(r4) is 0, put 1 there.
11570af302Sopenharmony_ci	 */
12570af302Sopenharmony_ci	/* 0) move old return address into r0 */
13570af302Sopenharmony_ci	lwz 0, 0(3)
14570af302Sopenharmony_ci	/* 1) put it into link reg */
15570af302Sopenharmony_ci	mtlr 0
16570af302Sopenharmony_ci	/* 2 ) restore stack ptr */
17570af302Sopenharmony_ci	lwz 1, 4(3)
18570af302Sopenharmony_ci	/* 3) restore control reg */
19570af302Sopenharmony_ci	lwz 0, 8(3)
20570af302Sopenharmony_ci	mtcr 0
21570af302Sopenharmony_ci	/* 4) restore r14-r31 */
22570af302Sopenharmony_ci	lwz 14, 12(3)
23570af302Sopenharmony_ci	lwz 15, 16(3)
24570af302Sopenharmony_ci	lwz 16, 20(3)
25570af302Sopenharmony_ci	lwz 17, 24(3)
26570af302Sopenharmony_ci	lwz 18, 28(3)
27570af302Sopenharmony_ci	lwz 19, 32(3)
28570af302Sopenharmony_ci	lwz 20, 36(3)
29570af302Sopenharmony_ci	lwz 21, 40(3)
30570af302Sopenharmony_ci	lwz 22, 44(3)
31570af302Sopenharmony_ci	lwz 23, 48(3)
32570af302Sopenharmony_ci	lwz 24, 52(3)
33570af302Sopenharmony_ci	lwz 25, 56(3)
34570af302Sopenharmony_ci	lwz 26, 60(3)
35570af302Sopenharmony_ci	lwz 27, 64(3)
36570af302Sopenharmony_ci	lwz 28, 68(3)
37570af302Sopenharmony_ci	lwz 29, 72(3)
38570af302Sopenharmony_ci	lwz 30, 76(3)
39570af302Sopenharmony_ci	lwz 31, 80(3)
40570af302Sopenharmony_ci#if defined(_SOFT_FLOAT) || defined(__NO_FPRS__)
41570af302Sopenharmony_ci	mflr 0
42570af302Sopenharmony_ci	bl 1f
43570af302Sopenharmony_ci	.hidden __hwcap
44570af302Sopenharmony_ci	.long __hwcap-.
45570af302Sopenharmony_ci1:	mflr 6
46570af302Sopenharmony_ci	lwz 5, 0(6)
47570af302Sopenharmony_ci	lwzx 6, 6, 5
48570af302Sopenharmony_ci	andis. 6, 6, 0x80
49570af302Sopenharmony_ci	beq 1f
50570af302Sopenharmony_ci	.long 0x11c35b01 /* evldd 14,88(3) */
51570af302Sopenharmony_ci	.long 0x11e36301 /* ... */
52570af302Sopenharmony_ci	.long 0x12036b01
53570af302Sopenharmony_ci	.long 0x12237301
54570af302Sopenharmony_ci	.long 0x12437b01
55570af302Sopenharmony_ci	.long 0x12638301
56570af302Sopenharmony_ci	.long 0x12838b01
57570af302Sopenharmony_ci	.long 0x12a39301
58570af302Sopenharmony_ci	.long 0x12c39b01
59570af302Sopenharmony_ci	.long 0x12e3a301
60570af302Sopenharmony_ci	.long 0x1303ab01
61570af302Sopenharmony_ci	.long 0x1323b301
62570af302Sopenharmony_ci	.long 0x1343bb01
63570af302Sopenharmony_ci	.long 0x1363c301
64570af302Sopenharmony_ci	.long 0x1383cb01
65570af302Sopenharmony_ci	.long 0x13a3d301
66570af302Sopenharmony_ci	.long 0x13c3db01
67570af302Sopenharmony_ci	.long 0x13e3e301 /* evldd 31,224(3) */
68570af302Sopenharmony_ci	.long 0x11a3eb01 /* evldd 13,232(3) */
69570af302Sopenharmony_ci1:	mtlr 0
70570af302Sopenharmony_ci#else
71570af302Sopenharmony_ci	lfd 14,88(3)
72570af302Sopenharmony_ci	lfd 15,96(3)
73570af302Sopenharmony_ci	lfd 16,104(3)
74570af302Sopenharmony_ci	lfd 17,112(3)
75570af302Sopenharmony_ci	lfd 18,120(3)
76570af302Sopenharmony_ci	lfd 19,128(3)
77570af302Sopenharmony_ci	lfd 20,136(3)
78570af302Sopenharmony_ci	lfd 21,144(3)
79570af302Sopenharmony_ci	lfd 22,152(3)
80570af302Sopenharmony_ci	lfd 23,160(3)
81570af302Sopenharmony_ci	lfd 24,168(3)
82570af302Sopenharmony_ci	lfd 25,176(3)
83570af302Sopenharmony_ci	lfd 26,184(3)
84570af302Sopenharmony_ci	lfd 27,192(3)
85570af302Sopenharmony_ci	lfd 28,200(3)
86570af302Sopenharmony_ci	lfd 29,208(3)
87570af302Sopenharmony_ci	lfd 30,216(3)
88570af302Sopenharmony_ci	lfd 31,224(3)
89570af302Sopenharmony_ci#endif
90570af302Sopenharmony_ci	/* 5) put val into return reg r3 */
91570af302Sopenharmony_ci	mr 3, 4
92570af302Sopenharmony_ci
93570af302Sopenharmony_ci	/* 6) check if return value is 0, make it 1 in that case */
94570af302Sopenharmony_ci	cmpwi cr7, 4, 0
95570af302Sopenharmony_ci	bne cr7, 1f
96570af302Sopenharmony_ci	li 3, 1
97570af302Sopenharmony_ci1:
98570af302Sopenharmony_ci	blr
99570af302Sopenharmony_ci
100