1/* Copyright (c) 1995, 2002 Red Hat Incorporated.
2 * All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 *    Redistributions of source code must retain the above copyright
8 *    notice, this list of conditions and the following disclaimer.
9 *
10 *    Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in the
12 *    documentation and/or other materials provided with the distribution.
13 *
14 *    The name of Red Hat Incorporated may not be used to endorse
15 *    or promote products derived from this software without specific
16 *    prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED.  IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY
22 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30/* Note I don't know an easy way to get the FP version into the
31   traditional C library and the non-FP version into the soft-float
32   library.  Maybe we'll have to have -msoft-float trigger something
33   like -DSOFT_FLOAT if this issue ever arises.  */
34
35#include <picolibc.h>
36
37#include "DEFS.h"
38
39#if 0
40	.SPACE $PRIVATE$
41	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
42	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
43	.SPACE $TEXT$
44	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
45	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
46	.IMPORT $global$,DATA
47	.IMPORT $$dyncall,MILLICODE
48; gcc_compiled.:
49#endif
50	TEXT_SEGMENT
51
52	.align 4
53	.EXPORT setjmp,ENTRY,PRIV_LEV=3,ARGW0=GR,RTNVAL=GR
54setjmp
55	.PROC
56	.CALLINFO FRAME=64,NO_CALLS,SAVE_SP,ENTRY_GR=3
57	.ENTRY
58	stwm  %r30,4(%r26)
59	stwm  %r2,4(%r26)
60	stwm  %r3,4(%r26)
61	stwm  %r4,4(%r26)
62	stwm  %r5,4(%r26)
63	stwm  %r6,4(%r26)
64	stwm  %r7,4(%r26)
65	stwm  %r8,4(%r26)
66	stwm  %r9,4(%r26)
67	stwm  %r10,4(%r26)
68	stwm  %r11,4(%r26)
69	stwm  %r12,4(%r26)
70	stwm  %r13,4(%r26)
71	stwm  %r14,4(%r26)
72	stwm  %r15,4(%r26)
73	stwm  %r16,4(%r26)
74	stwm  %r17,4(%r26)
75	stwm  %r18,4(%r26)
76	stwm  %r27,4(%r26)
77#ifdef FP
78	; jmp_buf may only have a 4 byte alignment, so handle FP stores
79	; very carefully.
80	fstds %fr12,-16(%r30)
81	ldw -16(%r30),%r28
82	stwm  %r28,4(%r26)
83	ldw -12(%r30),%r28
84	stwm  %r28,4(%r26)
85	fstds %fr13,-16(%r30)
86	ldw -16(%r30),%r28
87	stwm  %r28,4(%r26)
88	ldw -12(%r30),%r28
89	stwm  %r28,4(%r26)
90	fstds %fr14,-16(%r30)
91	ldw -16(%r30),%r28
92	stwm  %r28,4(%r26)
93	ldw -12(%r30),%r28
94	stwm  %r28,4(%r26)
95	fstds %fr15,-16(%r30)
96	ldw -16(%r30),%r28
97	stwm  %r28,4(%r26)
98	ldw -12(%r30),%r28
99	stwm  %r28,4(%r26)
100#endif
101
102	bv 0(%r2)
103	copy %r0,%r28
104	.EXIT
105	.PROCEND
106	.align 4
107	.EXPORT longjmp,ENTRY,PRIV_LEV=3,ARGW0=GR,ARGW1=GR,RTNVAL=GR
108longjmp
109	.PROC
110	.CALLINFO FRAME=64,NO_CALLS,SAVE_SP,ENTRY_GR=3
111	.ENTRY
112	ldwm 4(%r26),%r30
113	ldwm 4(%r26),%r2
114	ldwm 4(%r26),%r3
115	ldwm 4(%r26),%r4
116	ldwm 4(%r26),%r5
117	ldwm 4(%r26),%r6
118	ldwm 4(%r26),%r7
119	ldwm 4(%r26),%r8
120	ldwm 4(%r26),%r9
121	ldwm 4(%r26),%r10
122	ldwm 4(%r26),%r11
123	ldwm 4(%r26),%r12
124	ldwm 4(%r26),%r13
125	ldwm 4(%r26),%r14
126	ldwm 4(%r26),%r15
127	ldwm 4(%r26),%r16
128	ldwm 4(%r26),%r17
129	ldwm 4(%r26),%r18
130	ldwm 4(%r26),%r27
131#ifdef FP
132	ldwm 4(%r26),%r28
133	stw %r28,-16(%r30)
134	ldwm 4(%r26),%r28
135	stw %r28,-12(%r30)
136	fldds -16(%r30),%fr12
137	ldwm 4(%r26),%r28
138	stw %r28,-16(%r30)
139	ldwm 4(%r26),%r28
140	stw %r28,-12(%r30)
141	fldds -16(%r30),%fr13
142	ldwm 4(%r26),%r28
143	stw %r28,-16(%r30)
144	ldwm 4(%r26),%r28
145	stw %r28,-12(%r30)
146	fldds -16(%r30),%fr14
147	ldwm 4(%r26),%r28
148	stw %r28,-16(%r30)
149	ldwm 4(%r26),%r28
150	stw %r28,-12(%r30)
151	fldds -16(%r30),%fr15
152#endif
153	comclr,<> %r0,%r25,%r0
154	ldi 1,%r25
155	bv 0(%r2)
156	copy %r25,%r28
157	.EXIT
158	.PROCEND
159