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/* These are predefined by new versions of GNU cpp.  */
18
19#include <picolibc.h>
20
21#ifndef __USER_LABEL_PREFIX__
22#define __USER_LABEL_PREFIX__ _
23#endif
24
25/* ANSI concatenation macros.  */
26
27#define CONCAT1(a, b) CONCAT2(a, b)
28#define CONCAT2(a, b) a ## b
29
30/* Use the right prefix for global labels.  */
31
32#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
33
34	.global SYM (setjmp)
35	.global SYM (_setjmp)
36	.global SYM (longjmp)
37
38	.section  .text,"x"
39	.align 4
40SYM (_setjmp):
41SYM (setjmp):
42	st.d	0(r2),r20
43	st.d	8(r2),r22
44	st.d	16(r2),r24
45	st.d	24(r2),r26
46	st.d	32(r2),r28
47	st.d	40(r2),r30
48	st	48(r2),r1
49	jsr	r31(r0),r0
50	 addu	0,r0,r2
51
52	.section  .text,"x"
53	.align 4
54SYM (longjmp):
55	ld.d	0(r2),r20
56	ld.d	8(r2),r22
57	ld.d	16(r2),r24
58	ld.d	24(r2),r26
59	ld.d	32(r2),r28
60	ld.d	40(r2),r30
61	bcnd	L1,r4,ne0.w
62	 ld	48(r2),r1
63
64	jsr	r31(r0),r0
65	 addu	1,r0,r2
66L1:
67	jsr	r31(r0),r0
68	 addu	r4,r0,r2
69