summaryrefslogtreecommitdiff
path: root/newlib/libc/machine/m88k/setjmp.S
blob: 24d44b6b10f1507bba9989042da200115545a2c1 (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
/* This is a simple version of setjmp and longjmp.

   Ian Lance Taylor, Cygnus Support, 15 July 1993.  */

/* We need to save the address of the return instruction, which is in
   r1, as well as general register r14 through r25.  If we are
   compiling for the 88110 with the extended register file, we also
   need to save registers x22 through x29.  The jmp_buf should be 52
   bytes long in the one case, 84 bytes in the other.  */

/* int setjmp (jmp_buf);  */
	globl	_setjmp
_setjmp:
	st	r1,r2,0
	st.d	r14,r2,4
	st.d	r16,r2,12
	st.d	r18,r2,20
	st.d	r20,r2,28
	st.d	r22,r2,36
	st.d	r24,r2,44
#ifdef __m88110__
	/* These instructions are just a guess, and gas doesn't
	   support them anyhow.  */
	st.d	x22,r2,52
	st.d	x24,r2,60
	st.d	x26,r2,68
	st.d	x28,r2,76
#endif
	jmp	r1

	global	_longjmp
_longjmp:
	ld	r1,r2,0
	ld.d	r14,r2,4
	ld.d	r16,r2,12
	ld.d	r18,r2,20
	ld.d	r20,r2,28
	ld.d	r22,r2,36
	ld.d	r24,r2,44
#ifdef __m88110__
	/* These instructions are just a guess, and gas doesn't
	   support them anyhow.  */
	ld.d	x22,r2,52
	ld.d	x24,r2,60
	ld.d	x26,r2,68
	ld.d	x28,r2,76
#endif
	jmp	r1