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#include <picolibc.h>
18
19	.file "setjmp.S"
20
21	.section .text
22	.align 1
23	.global _setjmp
24#ifdef __AM33__
25#ifdef __AM33_2__
26	.am33_2
27#else
28	.am33
29#endif
30#endif
31_setjmp:
32        mov d0,a0
33        mov d2,(0,a0)
34        mov d3,(4,a0)
35	mov mdr,d1
36	mov d1,(8,a0)
37        mov a2,(12,a0)
38        mov a3,(16,a0)
39	mov sp,a1
40	mov a1,(20,a0)
41#ifdef __AM33__
42	add 24,a0
43	mov r4,(a0+)
44	mov r5,(a0+)
45	mov r6,(a0+)
46	mov r7,(a0+)
47#ifdef __AM33_2__
48	fmov fs4,(a0+)
49	fmov fs5,(a0+)
50	fmov fs6,(a0+)
51	fmov fs7,(a0+)
52	fmov fs8,(a0+)
53	fmov fs9,(a0+)
54	fmov fs10,(a0+)
55	fmov fs11,(a0+)
56	fmov fs12,(a0+)
57	fmov fs13,(a0+)
58	fmov fs14,(a0+)
59	fmov fs15,(a0+)
60	fmov fs16,(a0+)
61	fmov fs17,(a0+)
62	fmov fs18,(a0+)
63	fmov fs19,(a0+)
64#endif
65#endif
66        sub d0,d0
67	rets
68
69	.global _longjmp
70_longjmp:
71	mov d0,a0
72	mov (8,a0),d2
73	mov d2,mdr
74        mov (0,a0),d2
75        mov (4,a0),d3
76        mov (12,a0),a2
77        mov (16,a0),a3
78	mov (20,a0),a1
79	mov a1,sp
80#ifdef __AM33__
81	add 24,a0
82	mov (a0+),r4
83	mov (a0+),r5
84	mov (a0+),r6
85	mov (a0+),r7
86#ifdef __AM33_2__
87	fmov (a0+),fs4
88	fmov (a0+),fs5
89	fmov (a0+),fs6
90	fmov (a0+),fs7
91	fmov (a0+),fs8
92	fmov (a0+),fs9
93	fmov (a0+),fs10
94	fmov (a0+),fs11
95	fmov (a0+),fs12
96	fmov (a0+),fs13
97	fmov (a0+),fs14
98	fmov (a0+),fs15
99	fmov (a0+),fs16
100	fmov (a0+),fs17
101	fmov (a0+),fs18
102	fmov (a0+),fs19
103#endif
104#endif
105	cmp 0,d1
106	bne L1
107	mov 1,d1
108L1:
109	mov d1,d0
110	retf [],0
111