Print this page
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/test/os-tests/tests/xsave/xsave_asm64.S
+++ new/usr/src/test/os-tests/tests/xsave/xsave_asm64.S
1 1 /*
2 2 * This file and its contents are supplied under the terms of the
3 3 * Common Development and Distribution License ("CDDL"), version 1.0.
4 4 * You may only use this file in accordance with the terms of version
5 5 * 1.0 of the CDDL.
6 6 *
7 7 * A full copy of the text of the CDDL should have accompanied this
8 8 * source. A copy of the CDDL is also available via the Internet at
9 9 * http://www.illumos.org/license/CDDL.
10 10 */
11 11
12 12 /*
13 13 * Copyright 2023 Oxide Computer Company
14 14 */
15 15
16 16 .file "xsave_asm64.s"
17 17
18 18 /*
19 19 * Test utility routines that we need assembler for. 64-bit addition.
20 20 */
21 21
22 22 #include <sys/asm_linkage.h>
23 23 #include "xsave_util.h"
24 24
25 25 #define GET_FPU_XMM(src, i) \
26 26 leaq (i * XSU_ZMM_U32 * 4)(src), %rax; \
27 27 movdqu %xmm##i, (%rax)
28 28
29 29 #define GET_FPU_YMM(src, i) \
30 30 leaq (i * XSU_ZMM_U32 * 4)(src), %rax; \
31 31 vmovdqu %ymm##i, (%rax)
32 32
33 33 #define GET_FPU_ZMM(src, i) \
34 34 leaq (i * XSU_ZMM_U32 * 4)(src), %rax; \
35 35 vmovdqu64 %zmm##i, (%rax)
36 36
37 37 #define GET_MASK(src, i) \
38 38 leaq (0x800 + i * 8)(src), %rax; \
39 39 kmovq %k##i, (%rax)
40 40
41 41 /*
42 42 * void xsu_getfpu(xsu_fpu_t *data, uint32_t type)
43 43 *
44 44 * Our job is to get the entire contents of the FPU and save it into our
45 45 * data structure.
46 46 */
47 47 ENTRY(xsu_getfpu)
48 48 cmpl $XSU_XMM, %esi
49 49 je get_xmm
50 50 cmpl $XSU_YMM, %esi
51 51 je get_ymm
52 52 cmpl $XSU_ZMM, %esi
53 53 je get_zmm
54 54 call abort
55 55 get_xmm:
56 56 GET_FPU_XMM(%rdi, 0)
57 57 GET_FPU_XMM(%rdi, 1)
58 58 GET_FPU_XMM(%rdi, 2)
59 59 GET_FPU_XMM(%rdi, 3)
60 60 GET_FPU_XMM(%rdi, 4)
61 61 GET_FPU_XMM(%rdi, 5)
62 62 GET_FPU_XMM(%rdi, 6)
63 63 GET_FPU_XMM(%rdi, 7)
64 64 GET_FPU_XMM(%rdi, 8)
65 65 GET_FPU_XMM(%rdi, 9)
66 66 GET_FPU_XMM(%rdi, 10)
67 67 GET_FPU_XMM(%rdi, 11)
68 68 GET_FPU_XMM(%rdi, 12)
69 69 GET_FPU_XMM(%rdi, 13)
70 70 GET_FPU_XMM(%rdi, 14)
71 71 GET_FPU_XMM(%rdi, 15)
72 72 jmp get_done
73 73 get_ymm:
74 74 GET_FPU_YMM(%rdi, 0)
75 75 GET_FPU_YMM(%rdi, 1)
76 76 GET_FPU_YMM(%rdi, 2)
77 77 GET_FPU_YMM(%rdi, 3)
78 78 GET_FPU_YMM(%rdi, 4)
79 79 GET_FPU_YMM(%rdi, 5)
80 80 GET_FPU_YMM(%rdi, 6)
81 81 GET_FPU_YMM(%rdi, 7)
82 82 GET_FPU_YMM(%rdi, 8)
83 83 GET_FPU_YMM(%rdi, 9)
84 84 GET_FPU_YMM(%rdi, 10)
85 85 GET_FPU_YMM(%rdi, 11)
86 86 GET_FPU_YMM(%rdi, 12)
87 87 GET_FPU_YMM(%rdi, 13)
88 88 GET_FPU_YMM(%rdi, 14)
89 89 GET_FPU_YMM(%rdi, 15)
90 90 jmp get_done
91 91 get_zmm:
92 92 GET_FPU_ZMM(%rdi, 0)
93 93 GET_FPU_ZMM(%rdi, 1)
94 94 GET_FPU_ZMM(%rdi, 2)
95 95 GET_FPU_ZMM(%rdi, 3)
96 96 GET_FPU_ZMM(%rdi, 4)
97 97 GET_FPU_ZMM(%rdi, 5)
98 98 GET_FPU_ZMM(%rdi, 6)
99 99 GET_FPU_ZMM(%rdi, 7)
100 100 GET_FPU_ZMM(%rdi, 8)
101 101 GET_FPU_ZMM(%rdi, 9)
102 102 GET_FPU_ZMM(%rdi, 10)
103 103 GET_FPU_ZMM(%rdi, 11)
104 104 GET_FPU_ZMM(%rdi, 12)
105 105 GET_FPU_ZMM(%rdi, 13)
106 106 GET_FPU_ZMM(%rdi, 14)
107 107 GET_FPU_ZMM(%rdi, 15)
108 108 GET_FPU_ZMM(%rdi, 16)
109 109 GET_FPU_ZMM(%rdi, 17)
110 110 GET_FPU_ZMM(%rdi, 18)
111 111 GET_FPU_ZMM(%rdi, 19)
112 112 GET_FPU_ZMM(%rdi, 20)
113 113 GET_FPU_ZMM(%rdi, 21)
114 114 GET_FPU_ZMM(%rdi, 22)
115 115 GET_FPU_ZMM(%rdi, 23)
116 116 GET_FPU_ZMM(%rdi, 24)
117 117 GET_FPU_ZMM(%rdi, 25)
118 118 GET_FPU_ZMM(%rdi, 25)
119 119 GET_FPU_ZMM(%rdi, 26)
120 120 GET_FPU_ZMM(%rdi, 27)
121 121 GET_FPU_ZMM(%rdi, 28)
122 122 GET_FPU_ZMM(%rdi, 29)
123 123 GET_FPU_ZMM(%rdi, 30)
124 124 GET_FPU_ZMM(%rdi, 31)
125 125 GET_MASK(%rdi, 0)
126 126 GET_MASK(%rdi, 1)
127 127 GET_MASK(%rdi, 2)
128 128 GET_MASK(%rdi, 3)
129 129 GET_MASK(%rdi, 4)
130 130 GET_MASK(%rdi, 5)
131 131 GET_MASK(%rdi, 6)
132 132 GET_MASK(%rdi, 7)
133 133 get_done:
134 134 ret
135 135 SET_SIZE(xsu_getfpu)
136 136
137 137 #define SET_FPU_XMM(src, i) \
138 138 leaq (i * XSU_ZMM_U32 * 4)(src), %rax; \
139 139 movdqu (%rax), %xmm##i
140 140
141 141 #define SET_FPU_YMM(src, i) \
142 142 leaq (i * XSU_ZMM_U32 * 4)(src), %rax; \
143 143 vmovdqu (%rax), %ymm##i
144 144
145 145 #define SET_FPU_ZMM(src, i) \
146 146 leaq (i * XSU_ZMM_U32 * 4)(src), %rax; \
147 147 vmovdqu64 (%rax), %zmm##i
148 148
149 149 #define SET_MASK(src, i) \
150 150 leaq (0x800 + i * 8)(src), %rax; \
151 151 kmovq (%rax), %k##i
152 152
153 153 /*
154 154 * void xsu_setfpu(const xsu_fpu_t *data, uint32_t type)
155 155 *
156 156 * Our job is to override the contents of the FPU with this structure
157 157 * that we've been given. The type indicates how much of it to use.
158 158 */
159 159 ENTRY(xsu_setfpu)
160 160 cmpl $XSU_XMM, %esi
161 161 je set_xmm
162 162 cmpl $XSU_YMM, %esi
163 163 je set_ymm
164 164 cmpl $XSU_ZMM, %esi
165 165 je set_zmm
166 166 call abort
167 167 set_xmm:
168 168 SET_FPU_XMM(%rdi, 0)
169 169 SET_FPU_XMM(%rdi, 1)
170 170 SET_FPU_XMM(%rdi, 2)
171 171 SET_FPU_XMM(%rdi, 3)
172 172 SET_FPU_XMM(%rdi, 4)
173 173 SET_FPU_XMM(%rdi, 5)
174 174 SET_FPU_XMM(%rdi, 6)
175 175 SET_FPU_XMM(%rdi, 7)
176 176 SET_FPU_XMM(%rdi, 8)
177 177 SET_FPU_XMM(%rdi, 9)
178 178 SET_FPU_XMM(%rdi, 10)
179 179 SET_FPU_XMM(%rdi, 11)
180 180 SET_FPU_XMM(%rdi, 12)
181 181 SET_FPU_XMM(%rdi, 13)
182 182 SET_FPU_XMM(%rdi, 14)
183 183 SET_FPU_XMM(%rdi, 15)
184 184 jmp set_done
185 185 set_ymm:
186 186 SET_FPU_YMM(%rdi, 0)
187 187 SET_FPU_YMM(%rdi, 1)
188 188 SET_FPU_YMM(%rdi, 2)
189 189 SET_FPU_YMM(%rdi, 3)
190 190 SET_FPU_YMM(%rdi, 4)
191 191 SET_FPU_YMM(%rdi, 5)
192 192 SET_FPU_YMM(%rdi, 6)
193 193 SET_FPU_YMM(%rdi, 7)
194 194 SET_FPU_YMM(%rdi, 8)
195 195 SET_FPU_YMM(%rdi, 9)
196 196 SET_FPU_YMM(%rdi, 10)
197 197 SET_FPU_YMM(%rdi, 11)
198 198 SET_FPU_YMM(%rdi, 12)
199 199 SET_FPU_YMM(%rdi, 13)
200 200 SET_FPU_YMM(%rdi, 14)
201 201 SET_FPU_YMM(%rdi, 15)
202 202 jmp set_done
203 203 set_zmm:
204 204 SET_FPU_ZMM(%rdi, 0)
205 205 SET_FPU_ZMM(%rdi, 1)
206 206 SET_FPU_ZMM(%rdi, 2)
207 207 SET_FPU_ZMM(%rdi, 3)
208 208 SET_FPU_ZMM(%rdi, 4)
209 209 SET_FPU_ZMM(%rdi, 5)
210 210 SET_FPU_ZMM(%rdi, 6)
211 211 SET_FPU_ZMM(%rdi, 7)
212 212 SET_FPU_ZMM(%rdi, 8)
213 213 SET_FPU_ZMM(%rdi, 9)
214 214 SET_FPU_ZMM(%rdi, 10)
215 215 SET_FPU_ZMM(%rdi, 11)
216 216 SET_FPU_ZMM(%rdi, 12)
217 217 SET_FPU_ZMM(%rdi, 13)
218 218 SET_FPU_ZMM(%rdi, 14)
219 219 SET_FPU_ZMM(%rdi, 15)
220 220 SET_FPU_ZMM(%rdi, 16)
221 221 SET_FPU_ZMM(%rdi, 17)
222 222 SET_FPU_ZMM(%rdi, 18)
223 223 SET_FPU_ZMM(%rdi, 19)
224 224 SET_FPU_ZMM(%rdi, 20)
225 225 SET_FPU_ZMM(%rdi, 21)
226 226 SET_FPU_ZMM(%rdi, 22)
227 227 SET_FPU_ZMM(%rdi, 23)
228 228 SET_FPU_ZMM(%rdi, 24)
229 229 SET_FPU_ZMM(%rdi, 25)
230 230 SET_FPU_ZMM(%rdi, 25)
231 231 SET_FPU_ZMM(%rdi, 26)
232 232 SET_FPU_ZMM(%rdi, 27)
233 233 SET_FPU_ZMM(%rdi, 28)
234 234 SET_FPU_ZMM(%rdi, 29)
235 235 SET_FPU_ZMM(%rdi, 30)
236 236 SET_FPU_ZMM(%rdi, 31)
237 237 SET_MASK(%rdi, 0)
238 238 SET_MASK(%rdi, 1)
239 239 SET_MASK(%rdi, 2)
240 240 SET_MASK(%rdi, 3)
241 241 SET_MASK(%rdi, 4)
242 242 SET_MASK(%rdi, 5)
243 243 SET_MASK(%rdi, 6)
244 244 SET_MASK(%rdi, 7)
245 245 set_done:
246 246 ret
247 247 SET_SIZE(xsu_setfpu)
|
↓ open down ↓ |
247 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX