1 /* SPDX-License-Identifier: GPL-2.0-only */
4 * This file define some function used to swap value between memory
5 * and float register. This will be used in misaligned access exception
9 #if defined(__riscv_flen)
10 #if __riscv_flen >= 32
14 /* void read_f32(int regnum, uint32_t* v)
15 * regnum : which register want to read
16 * v : address to hold bits info of reading
30 .half .Lr32_f0 - .Lr32_t
31 .half .Lr32_f1 - .Lr32_t
32 .half .Lr32_f2 - .Lr32_t
33 .half .Lr32_f3 - .Lr32_t
34 .half .Lr32_f4 - .Lr32_t
35 .half .Lr32_f5 - .Lr32_t
36 .half .Lr32_f6 - .Lr32_t
37 .half .Lr32_f7 - .Lr32_t
38 .half .Lr32_f8 - .Lr32_t
39 .half .Lr32_f9 - .Lr32_t
40 .half .Lr32_f10 - .Lr32_t
41 .half .Lr32_f11 - .Lr32_t
42 .half .Lr32_f12 - .Lr32_t
43 .half .Lr32_f13 - .Lr32_t
44 .half .Lr32_f14 - .Lr32_t
45 .half .Lr32_f15 - .Lr32_t
46 .half .Lr32_f16 - .Lr32_t
47 .half .Lr32_f17 - .Lr32_t
48 .half .Lr32_f18 - .Lr32_t
49 .half .Lr32_f19 - .Lr32_t
50 .half .Lr32_f20 - .Lr32_t
51 .half .Lr32_f21 - .Lr32_t
52 .half .Lr32_f22 - .Lr32_t
53 .half .Lr32_f23 - .Lr32_t
54 .half .Lr32_f24 - .Lr32_t
55 .half .Lr32_f25 - .Lr32_t
56 .half .Lr32_f26 - .Lr32_t
57 .half .Lr32_f27 - .Lr32_t
58 .half .Lr32_f28 - .Lr32_t
59 .half .Lr32_f29 - .Lr32_t
60 .half .Lr32_f30 - .Lr32_t
61 .half .Lr32_f31 - .Lr32_t
62 #define read32(which) .Lr32_##which: fsw which, 0(a1); ret
96 /* void write_f32(int regnum, uint32_t* v)
97 * regnum: which register want to write
98 * v : address to hold bits info of writing
112 .half .Lw32_f0 - .Lw32_t
113 .half .Lw32_f1 - .Lw32_t
114 .half .Lw32_f2 - .Lw32_t
115 .half .Lw32_f3 - .Lw32_t
116 .half .Lw32_f4 - .Lw32_t
117 .half .Lw32_f5 - .Lw32_t
118 .half .Lw32_f6 - .Lw32_t
119 .half .Lw32_f7 - .Lw32_t
120 .half .Lw32_f8 - .Lw32_t
121 .half .Lw32_f9 - .Lw32_t
122 .half .Lw32_f10 - .Lw32_t
123 .half .Lw32_f11 - .Lw32_t
124 .half .Lw32_f12 - .Lw32_t
125 .half .Lw32_f13 - .Lw32_t
126 .half .Lw32_f14 - .Lw32_t
127 .half .Lw32_f15 - .Lw32_t
128 .half .Lw32_f16 - .Lw32_t
129 .half .Lw32_f17 - .Lw32_t
130 .half .Lw32_f18 - .Lw32_t
131 .half .Lw32_f19 - .Lw32_t
132 .half .Lw32_f20 - .Lw32_t
133 .half .Lw32_f21 - .Lw32_t
134 .half .Lw32_f22 - .Lw32_t
135 .half .Lw32_f23 - .Lw32_t
136 .half .Lw32_f24 - .Lw32_t
137 .half .Lw32_f25 - .Lw32_t
138 .half .Lw32_f26 - .Lw32_t
139 .half .Lw32_f27 - .Lw32_t
140 .half .Lw32_f28 - .Lw32_t
141 .half .Lw32_f29 - .Lw32_t
142 .half .Lw32_f30 - .Lw32_t
143 .half .Lw32_f31 - .Lw32_t
144 #define write32(which) .Lw32_##which: flw which, 0(a1); ret
177 #endif // __riscv_flen >= 32
179 #if __riscv_flen >= 64
183 /* void read_f64(int regnum, uint64_t* v)
184 * regnum : which register want to read
185 * v : address to hold bits info of reading
199 .half .Lr64_f0 - .Lr64_t
200 .half .Lr64_f1 - .Lr64_t
201 .half .Lr64_f2 - .Lr64_t
202 .half .Lr64_f3 - .Lr64_t
203 .half .Lr64_f4 - .Lr64_t
204 .half .Lr64_f5 - .Lr64_t
205 .half .Lr64_f6 - .Lr64_t
206 .half .Lr64_f7 - .Lr64_t
207 .half .Lr64_f8 - .Lr64_t
208 .half .Lr64_f9 - .Lr64_t
209 .half .Lr64_f10 - .Lr64_t
210 .half .Lr64_f11 - .Lr64_t
211 .half .Lr64_f12 - .Lr64_t
212 .half .Lr64_f13 - .Lr64_t
213 .half .Lr64_f14 - .Lr64_t
214 .half .Lr64_f15 - .Lr64_t
215 .half .Lr64_f16 - .Lr64_t
216 .half .Lr64_f17 - .Lr64_t
217 .half .Lr64_f18 - .Lr64_t
218 .half .Lr64_f19 - .Lr64_t
219 .half .Lr64_f20 - .Lr64_t
220 .half .Lr64_f21 - .Lr64_t
221 .half .Lr64_f22 - .Lr64_t
222 .half .Lr64_f23 - .Lr64_t
223 .half .Lr64_f24 - .Lr64_t
224 .half .Lr64_f25 - .Lr64_t
225 .half .Lr64_f26 - .Lr64_t
226 .half .Lr64_f27 - .Lr64_t
227 .half .Lr64_f28 - .Lr64_t
228 .half .Lr64_f29 - .Lr64_t
229 .half .Lr64_f30 - .Lr64_t
230 .half .Lr64_f31 - .Lr64_t
231 #define read64(which) .Lr64_##which: fsd which, 0(a1); ret
265 /* void write_f64(int regnum, uint64_t* v)
266 * regnum: which register want to write
267 * v : address to hold bits info of writing
281 .half .Lw64_f0 - .Lw64_t
282 .half .Lw64_f1 - .Lw64_t
283 .half .Lw64_f2 - .Lw64_t
284 .half .Lw64_f3 - .Lw64_t
285 .half .Lw64_f4 - .Lw64_t
286 .half .Lw64_f5 - .Lw64_t
287 .half .Lw64_f6 - .Lw64_t
288 .half .Lw64_f7 - .Lw64_t
289 .half .Lw64_f8 - .Lw64_t
290 .half .Lw64_f9 - .Lw64_t
291 .half .Lw64_f10 - .Lw64_t
292 .half .Lw64_f11 - .Lw64_t
293 .half .Lw64_f12 - .Lw64_t
294 .half .Lw64_f13 - .Lw64_t
295 .half .Lw64_f14 - .Lw64_t
296 .half .Lw64_f15 - .Lw64_t
297 .half .Lw64_f16 - .Lw64_t
298 .half .Lw64_f17 - .Lw64_t
299 .half .Lw64_f18 - .Lw64_t
300 .half .Lw64_f19 - .Lw64_t
301 .half .Lw64_f20 - .Lw64_t
302 .half .Lw64_f21 - .Lw64_t
303 .half .Lw64_f22 - .Lw64_t
304 .half .Lw64_f23 - .Lw64_t
305 .half .Lw64_f24 - .Lw64_t
306 .half .Lw64_f25 - .Lw64_t
307 .half .Lw64_f26 - .Lw64_t
308 .half .Lw64_f27 - .Lw64_t
309 .half .Lw64_f28 - .Lw64_t
310 .half .Lw64_f29 - .Lw64_t
311 .half .Lw64_f30 - .Lw64_t
312 .half .Lw64_f31 - .Lw64_t
313 #define write64(which) .Lw64_##which: fld which, 0(a1); ret
347 #endif // __riscv_flen >= 64
349 #endif // defined(__riscv_flen)