1570af302Sopenharmony_ci.set	noreorder
2570af302Sopenharmony_ci.global	sigsetjmp
3570af302Sopenharmony_ci.global	__sigsetjmp
4570af302Sopenharmony_ci.type	sigsetjmp,@function
5570af302Sopenharmony_ci.type	__sigsetjmp,@function
6570af302Sopenharmony_cisigsetjmp:
7570af302Sopenharmony_ci__sigsetjmp:
8570af302Sopenharmony_ci	lui	$3, %hi(%neg(%gp_rel(sigsetjmp)))
9570af302Sopenharmony_ci	addiu	$3, $3, %lo(%neg(%gp_rel(sigsetjmp)))
10570af302Sopenharmony_ci
11570af302Sopenharmony_ci	# comparing save mask with 0, if equals to 0 then
12570af302Sopenharmony_ci	# sigsetjmp is equal to setjmp.
13570af302Sopenharmony_ci	beq	$5, $0, 1f
14570af302Sopenharmony_ci	addu	$3, $3, $25
15570af302Sopenharmony_ci	sd	$ra, 160($4)
16570af302Sopenharmony_ci	sd	$16, 168($4)
17570af302Sopenharmony_ci
18570af302Sopenharmony_ci	# save base of got so that we can use it later
19570af302Sopenharmony_ci	# once we return from 'longjmp'
20570af302Sopenharmony_ci	sd	$3, 176($4)
21570af302Sopenharmony_ci	lw	$25, %got_disp(setjmp)($3)
22570af302Sopenharmony_ci	jalr	$25
23570af302Sopenharmony_ci	move	$16, $4
24570af302Sopenharmony_ci
25570af302Sopenharmony_ci	move	$5, $2		# Return from 'setjmp' or 'longjmp'
26570af302Sopenharmony_ci	move	$4, $16		# Restore the pointer-to-sigjmp_buf
27570af302Sopenharmony_ci	ld	$ra, 160($4)	# Restore ra of sigsetjmp
28570af302Sopenharmony_ci	ld	$16, 168($4)	# Restore $16 of sigsetjmp
29570af302Sopenharmony_ci	ld	$3, 176($4)	# Restore base of got
30570af302Sopenharmony_ci
31570af302Sopenharmony_ci.hidden	__sigsetjmp_tail
32570af302Sopenharmony_ci	lw	$25, %got_disp(__sigsetjmp_tail)($3)
33570af302Sopenharmony_ci	jr	$25
34570af302Sopenharmony_ci	nop
35570af302Sopenharmony_ci1:
36570af302Sopenharmony_ci	lw	$25, %got_disp(setjmp)($3)
37570af302Sopenharmony_ci	jr	$25
38570af302Sopenharmony_ci	nop
39