3 * Copyright (c) 1998 Kungliga Tekniska Högskolan
4 * (Royal Institute of Technology, Stockholm, Sweden).
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
18 * 3. All advertising materials mentioning features or use of this software
19 * must display the following acknowledgement:
20 * This product includes software developed by Kungliga Tekniska
21 * Högskolan and its contributors.
23 * 4. Neither the name of the Institute nor the names of its contributors
24 * may be used to endorse or promote products derived from this software
25 * without specific prior written permission.
27 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
28 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
31 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
32 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
42 /* LWP context switch for Fujitsu UXP/V */
44 #define registers 8 /* leave room for fp, and ra */
45 #define floats (registers + 12 * 4)
47 #define FRAMESIZE (floats + 15 * 8)
49 #define FRAMESIZE floats
53 void savecontext(int (*)(void), struct savearea*, void*);
61 or %gr1
, %gr0
, %gr2
& st %gr2
, %gr1
, 4
62 addi23
%gr1
, -FRAMESIZE
, %gr1
& st %gr3
, %gr2
, %gr0
65 /* XXX save more registers? */
66 st %gr4
, %gr1
, registers
+ 0
67 st %gr5
, %gr1
, registers
+ 4
68 st %gr6
, %gr1
, registers
+ 8
69 st %gr7
, %gr1
, registers
+ 12
70 st %gr8
, %gr1
, registers
+ 16
71 st %gr9
, %gr1
, registers
+ 20
72 st %gr10
, %gr1
, registers
+ 24
73 st %gr11
, %gr1
, registers
+ 28
74 st %gr12
, %gr1
, registers
+ 32
75 st %gr13
, %gr1
, registers
+ 36
76 st %gr14
, %gr1
, registers
+ 40
77 st %gr15
, %gr1
, registers
+ 44
80 /* save floting point registers */
81 st.d
%fr1
, %gr1
, floats
+ 0
82 st.d
%fr2
, %gr1
, floats
+ 8
83 st.d
%fr3
, %gr1
, floats
+ 16
84 st.d
%fr4
, %gr1
, floats
+ 24
85 st.d
%fr5
, %gr1
, floats
+ 32
86 st.d
%fr6
, %gr1
, floats
+ 40
87 st.d
%fr7
, %gr1
, floats
+ 48
88 st.d
%fr8
, %gr1
, floats
+ 56
89 st.d
%fr9
, %gr1
, floats
+ 64
90 st.d
%fr10
, %gr1
, floats
+ 72
91 st.d
%fr11
, %gr1
, floats
+ 80
92 st.d
%fr12
, %gr1
, floats
+ 88
93 st.d
%fr13
, %gr1
, floats
+ 96
94 st.d
%fr14
, %gr1
, floats
+ 104
95 st.d
%fr15
, %gr1
, floats
+ 112
100 seti PRE_Block
, %gr21
107 brc
%iccp.z
, samestack
109 /* switch to new stack */
115 /* is this necessary? */
119 .type savecontext,@function
120 .size savecontext,.-savecontext
123 void returnto(struct savearea*);
128 seti PRE_Block
, %gr17
132 /* restore registers */
133 ld %gr1
, registers
+ 0, %gr4
134 ld %gr1
, registers
+ 4, %gr5
135 ld %gr1
, registers
+ 8, %gr6
136 ld %gr1
, registers
+ 12, %gr7
137 ld %gr1
, registers
+ 16, %gr8
138 ld %gr1
, registers
+ 20, %gr9
139 ld %gr1
, registers
+ 24, %gr10
140 ld %gr1
, registers
+ 28, %gr11
141 ld %gr1
, registers
+ 32, %gr12
142 ld %gr1
, registers
+ 36, %gr13
143 ld %gr1
, registers
+ 40, %gr14
144 ld %gr1
, registers
+ 44, %gr15
147 /* restore floting point registers */
148 ld.d
%gr1
, floats
+ 0, %fr1
149 ld.d
%gr1
, floats
+ 8, %fr2
150 ld.d
%gr1
, floats
+ 16, %fr3
151 ld.d
%gr1
, floats
+ 24, %fr4
152 ld.d
%gr1
, floats
+ 32, %fr5
153 ld.d
%gr1
, floats
+ 40, %fr6
154 ld.d
%gr1
, floats
+ 48, %fr7
155 ld.d
%gr1
, floats
+ 56, %fr8
156 ld.d
%gr1
, floats
+ 64, %fr9
157 ld.d
%gr1
, floats
+ 72, %fr10
158 ld.d
%gr1
, floats
+ 80, %fr11
159 ld.d
%gr1
, floats
+ 88, %fr12
160 ld.d
%gr1
, floats
+ 96, %fr13
161 ld.d
%gr1
, floats
+ 104, %fr14
162 ld.d
%gr1
, floats
+ 112, %fr15
164 addi23
%gr1
, FRAMESIZE
, %gr1
170 .type returnto,@function
171 .size returnto,.-returnto