1/*
2Copyright (c) 1990 The Regents of the University of California.
3All rights reserved.
4
5Redistribution and use in source and binary forms are permitted
6provided that the above copyright notice and this paragraph are
7duplicated in all such forms and that any documentation,
8and/or other materials related to such
9distribution and use acknowledge that the software was developed
10by the University of California, Berkeley.  The name of the
11University may not be used to endorse or promote products derived
12from this software without specific prior written permission.
13THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16 */
17/* This is a simple version of setjmp and longjmp.
18
19   Ian Lance Taylor, Cygnus Support, 15 July 1993.  */
20
21/* We need to save the address of the return instruction, which is in
22   r1, as well as general register r14 through r25.  If we are
23   compiling for the 88110 with the extended register file, we also
24   need to save registers x22 through x29.  The jmp_buf should be 52
25   bytes long in the one case, 84 bytes in the other.  */
26
27/* int setjmp (jmp_buf);  */
28	globl	_setjmp
29_setjmp:
30	st	r1,r2,0
31	st.d	r14,r2,4
32	st.d	r16,r2,12
33	st.d	r18,r2,20
34	st.d	r20,r2,28
35	st.d	r22,r2,36
36	st.d	r24,r2,44
37#ifdef __m88110__
38	/* These instructions are just a guess, and gas doesn't
39	   support them anyhow.  */
40	st.d	x22,r2,52
41	st.d	x24,r2,60
42	st.d	x26,r2,68
43	st.d	x28,r2,76
44#endif
45	jmp	r1
46
47	global	_longjmp
48_longjmp:
49	ld	r1,r2,0
50	ld.d	r14,r2,4
51	ld.d	r16,r2,12
52	ld.d	r18,r2,20
53	ld.d	r20,r2,28
54	ld.d	r22,r2,36
55	ld.d	r24,r2,44
56#ifdef __m88110__
57	/* These instructions are just a guess, and gas doesn't
58	   support them anyhow.  */
59	ld.d	x22,r2,52
60	ld.d	x24,r2,60
61	ld.d	x26,r2,68
62	ld.d	x28,r2,76
63#endif
64	jmp	r1
65