| @@ -1,503 +1,506 @@ | | | @@ -1,503 +1,506 @@ |
1 | /* $NetBSD: cpufunc.S,v 1.12 2008/05/25 15:56:12 chs Exp $ */ | | 1 | /* $NetBSD: cpufunc.S,v 1.13 2008/09/23 08:50:11 ad Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 1998, 2007 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 1998, 2007 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Charles M. Hannum, and by Andrew Doran. | | 8 | * by Charles M. Hannum, and by Andrew Doran. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
15 | * 2. Redistributions in binary form must reproduce the above copyright | | 15 | * 2. Redistributions in binary form must reproduce the above copyright |
16 | * notice, this list of conditions and the following disclaimer in the | | 16 | * notice, this list of conditions and the following disclaimer in the |
17 | * documentation and/or other materials provided with the distribution. | | 17 | * documentation and/or other materials provided with the distribution. |
18 | * | | 18 | * |
19 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | | 19 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS |
20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | | 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
29 | * POSSIBILITY OF SUCH DAMAGE. | | 29 | * POSSIBILITY OF SUCH DAMAGE. |
30 | */ | | 30 | */ |
31 | | | 31 | |
32 | /* | | 32 | /* |
33 | * Functions to provide access to i386-specific instructions. | | 33 | * Functions to provide access to i386-specific instructions. |
34 | * | | 34 | * |
35 | * These are shared with NetBSD/xen. | | 35 | * These are shared with NetBSD/xen. |
36 | */ | | 36 | */ |
37 | | | 37 | |
38 | #include <machine/asm.h> | | 38 | #include <machine/asm.h> |
39 | __KERNEL_RCSID(0, "$NetBSD: cpufunc.S,v 1.12 2008/05/25 15:56:12 chs Exp $"); | | 39 | __KERNEL_RCSID(0, "$NetBSD: cpufunc.S,v 1.13 2008/09/23 08:50:11 ad Exp $"); |
40 | | | 40 | |
41 | #include "opt_xen.h" | | 41 | #include "opt_xen.h" |
42 | | | 42 | |
43 | #include <machine/specialreg.h> | | 43 | #include <machine/specialreg.h> |
44 | #include <machine/segments.h> | | 44 | #include <machine/segments.h> |
45 | | | 45 | |
46 | #include "assym.h" | | 46 | #include "assym.h" |
47 | | | 47 | |
48 | /* Small and slow, so align less. */ | | 48 | /* Small and slow, so align less. */ |
49 | #undef _ALIGN_TEXT | | 49 | #undef _ALIGN_TEXT |
50 | #define _ALIGN_TEXT .align 8 | | 50 | #define _ALIGN_TEXT .align 8 |
51 | | | 51 | |
52 | ENTRY(x86_lfence) | | 52 | ENTRY(x86_lfence) |
53 | lock | | 53 | lock |
54 | addl $0, -4(%esp) | | 54 | addl $0, -4(%esp) |
55 | ret | | 55 | ret |
56 | END(x86_lfence) | | 56 | END(x86_lfence) |
57 | | | 57 | |
58 | ENTRY(x86_sfence) | | 58 | ENTRY(x86_sfence) |
59 | lock | | 59 | lock |
60 | addl $0, -4(%esp) | | 60 | addl $0, -4(%esp) |
61 | ret | | 61 | ret |
62 | END(x86_sfence) | | 62 | END(x86_sfence) |
63 | | | 63 | |
64 | ENTRY(x86_mfence) | | 64 | ENTRY(x86_mfence) |
65 | lock | | 65 | lock |
66 | addl $0, -4(%esp) | | 66 | addl $0, -4(%esp) |
67 | ret | | 67 | ret |
68 | END(x86_mfence) | | 68 | END(x86_mfence) |
69 | | | 69 | |
70 | ENTRY(lidt) | | 70 | ENTRY(lidt) |
71 | movl 4(%esp), %eax | | 71 | movl 4(%esp), %eax |
72 | lidt (%eax) | | 72 | lidt (%eax) |
73 | ret | | 73 | ret |
74 | END(lidt) | | 74 | END(lidt) |
75 | | | 75 | |
76 | ENTRY(rcr3) | | 76 | ENTRY(rcr3) |
77 | movl %cr3, %eax | | 77 | movl %cr3, %eax |
78 | ret | | 78 | ret |
79 | END(rcr3) | | 79 | END(rcr3) |
80 | | | 80 | |
81 | ENTRY(lcr4) | | 81 | ENTRY(lcr4) |
82 | movl 4(%esp), %eax | | 82 | movl 4(%esp), %eax |
83 | movl %eax, %cr4 | | 83 | movl %eax, %cr4 |
84 | ret | | 84 | ret |
85 | END(lcr4) | | 85 | END(lcr4) |
86 | | | 86 | |
87 | ENTRY(rcr4) | | 87 | ENTRY(rcr4) |
88 | movl %cr4, %eax | | 88 | movl %cr4, %eax |
89 | ret | | 89 | ret |
90 | END(rcr4) | | 90 | END(rcr4) |
91 | | | 91 | |
92 | ENTRY(x86_read_flags) | | 92 | ENTRY(x86_read_flags) |
93 | pushfl | | 93 | pushfl |
94 | popl %eax | | 94 | popl %eax |
95 | ret | | 95 | ret |
96 | END(x86_read_flags) | | 96 | END(x86_read_flags) |
97 | | | 97 | |
98 | ENTRY(x86_write_flags) | | 98 | ENTRY(x86_write_flags) |
99 | movl 4(%esp), %eax | | 99 | movl 4(%esp), %eax |
100 | pushl %eax | | 100 | pushl %eax |
101 | popfl | | 101 | popfl |
102 | ret | | 102 | ret |
103 | END(x86_write_flags) | | 103 | END(x86_write_flags) |
104 | | | 104 | |
105 | #ifndef XEN | | 105 | #ifndef XEN |
106 | STRONG_ALIAS(x86_write_psl,x86_write_flags) | | 106 | STRONG_ALIAS(x86_write_psl,x86_write_flags) |
107 | STRONG_ALIAS(x86_read_psl,x86_read_flags) | | 107 | STRONG_ALIAS(x86_read_psl,x86_read_flags) |
108 | #endif /* XEN */ | | 108 | #endif /* XEN */ |
109 | | | 109 | |
110 | ENTRY(rdmsr) | | 110 | ENTRY(rdmsr) |
111 | movl 4(%esp), %ecx | | 111 | movl 4(%esp), %ecx |
112 | rdmsr | | 112 | rdmsr |
113 | ret | | 113 | ret |
114 | END(rdmsr) | | 114 | END(rdmsr) |
115 | | | 115 | |
116 | ENTRY(wrmsr) | | 116 | ENTRY(wrmsr) |
117 | movl 4(%esp), %ecx | | 117 | movl 4(%esp), %ecx |
118 | movl 8(%esp), %eax | | 118 | movl 8(%esp), %eax |
119 | movl 12(%esp), %edx | | 119 | movl 12(%esp), %edx |
120 | wrmsr | | 120 | wrmsr |
121 | ret | | 121 | ret |
122 | END(wrmsr) | | 122 | END(wrmsr) |
123 | | | 123 | |
124 | ENTRY(rdmsr_locked) | | 124 | ENTRY(rdmsr_locked) |
125 | movl 4(%esp), %ecx | | 125 | movl 4(%esp), %ecx |
126 | pushl %edi | | 126 | pushl %edi |
127 | movl $OPTERON_MSR_PASSCODE, %edi | | 127 | movl $OPTERON_MSR_PASSCODE, %edi |
128 | rdmsr | | 128 | rdmsr |
129 | popl %edi | | 129 | popl %edi |
130 | ret | | 130 | ret |
131 | END(rdmsr_locked) | | 131 | END(rdmsr_locked) |
132 | | | 132 | |
133 | ENTRY(wrmsr_locked) | | 133 | ENTRY(wrmsr_locked) |
134 | movl 4(%esp), %ecx | | 134 | movl 4(%esp), %ecx |
135 | movl 8(%esp), %eax | | 135 | movl 8(%esp), %eax |
136 | movl 12(%esp), %edx | | 136 | movl 12(%esp), %edx |
137 | pushl %edi | | 137 | pushl %edi |
138 | movl $OPTERON_MSR_PASSCODE, %edi | | 138 | movl $OPTERON_MSR_PASSCODE, %edi |
139 | wrmsr | | 139 | wrmsr |
140 | popl %edi | | 140 | popl %edi |
141 | ret | | 141 | ret |
142 | END(wrmsr_locked) | | 142 | END(wrmsr_locked) |
143 | | | 143 | |
144 | ENTRY(cpu_counter) | | 144 | ENTRY(cpu_counter) |
145 | rdtsc | | 145 | rdtsc |
146 | addl CPUVAR(CC_SKEW), %eax | | 146 | addl CPUVAR(CC_SKEW), %eax |
147 | adcl CPUVAR(CC_SKEW+4), %edx | | 147 | adcl CPUVAR(CC_SKEW+4), %edx |
148 | ret | | 148 | ret |
149 | END(cpu_counter) | | 149 | END(cpu_counter) |
150 | | | 150 | |
151 | ENTRY(cpu_counter32) | | 151 | ENTRY(cpu_counter32) |
152 | rdtsc | | 152 | rdtsc |
153 | addl CPUVAR(CC_SKEW), %eax | | 153 | addl CPUVAR(CC_SKEW), %eax |
154 | ret | | 154 | ret |
155 | END(cpu_counter32) | | 155 | END(cpu_counter32) |
156 | | | 156 | |
157 | ENTRY(rdpmc) | | 157 | ENTRY(rdpmc) |
158 | movl 4(%esp), %ecx | | 158 | movl 4(%esp), %ecx |
159 | rdpmc | | 159 | rdpmc |
160 | ret | | 160 | ret |
161 | END(rdpmc) | | 161 | END(rdpmc) |
162 | | | 162 | |
163 | ENTRY(breakpoint) | | 163 | ENTRY(breakpoint) |
164 | pushl %ebp | | 164 | pushl %ebp |
165 | movl %esp, %ebp | | 165 | movl %esp, %ebp |
166 | int $0x03 /* paranoid, not 'int3' */ | | 166 | int $0x03 /* paranoid, not 'int3' */ |
167 | popl %ebp | | 167 | popl %ebp |
168 | ret | | 168 | ret |
169 | END(breakpoint) | | 169 | END(breakpoint) |
170 | | | 170 | |
171 | ENTRY(x86_atomic_testset_ul) | | 171 | ENTRY(x86_atomic_testset_ul) |
172 | movl 4(%esp), %ecx | | 172 | movl 4(%esp), %ecx |
173 | movl 8(%esp), %eax | | 173 | movl 8(%esp), %eax |
174 | xchgl %eax, (%ecx) | | 174 | xchgl %eax, (%ecx) |
175 | ret | | 175 | ret |
176 | END(x86_atomic_testset_ul) | | 176 | END(x86_atomic_testset_ul) |
177 | | | 177 | |
178 | ENTRY(x86_atomic_testset_i) | | 178 | ENTRY(x86_atomic_testset_i) |
179 | movl 4(%esp), %ecx | | 179 | movl 4(%esp), %ecx |
180 | movl 8(%esp), %eax | | 180 | movl 8(%esp), %eax |
181 | xchgl %eax, (%ecx) | | 181 | xchgl %eax, (%ecx) |
182 | ret | | 182 | ret |
183 | END(x86_atomic_testset_i) | | 183 | END(x86_atomic_testset_i) |
184 | | | 184 | |
185 | ENTRY(x86_atomic_testset_b) | | 185 | ENTRY(x86_atomic_testset_b) |
186 | movl 4(%esp), %ecx | | 186 | movl 4(%esp), %ecx |
187 | movl 8(%esp), %eax | | 187 | movl 8(%esp), %eax |
188 | xchgb %al, (%ecx) | | 188 | xchgb %al, (%ecx) |
189 | andl $0xff, %eax | | 189 | andl $0xff, %eax |
190 | ret | | 190 | ret |
191 | END(x86_atomic_testset_b) | | 191 | END(x86_atomic_testset_b) |
192 | | | 192 | |
193 | ENTRY(x86_atomic_setbits_l) | | 193 | ENTRY(x86_atomic_setbits_l) |
194 | movl 4(%esp), %ecx | | 194 | movl 4(%esp), %ecx |
195 | movl 8(%esp), %eax | | 195 | movl 8(%esp), %eax |
196 | lock | | 196 | lock |
197 | orl %eax, (%ecx) | | 197 | orl %eax, (%ecx) |
198 | ret | | 198 | ret |
199 | END(x86_atomic_setbits_l) | | 199 | END(x86_atomic_setbits_l) |
200 | | | 200 | |
201 | ENTRY(x86_atomic_clearbits_l) | | 201 | ENTRY(x86_atomic_clearbits_l) |
202 | movl 4(%esp), %ecx | | 202 | movl 4(%esp), %ecx |
203 | movl 8(%esp), %eax | | 203 | movl 8(%esp), %eax |
204 | notl %eax | | 204 | notl %eax |
205 | lock | | 205 | lock |
206 | andl %eax, (%ecx) | | 206 | andl %eax, (%ecx) |
207 | ret | | 207 | ret |
208 | END(x86_atomic_clearbits_l) | | 208 | END(x86_atomic_clearbits_l) |
209 | | | 209 | |
210 | ENTRY(x86_curcpu) | | 210 | ENTRY(x86_curcpu) |
211 | movl %fs:(CPU_INFO_SELF), %eax | | 211 | movl %fs:(CPU_INFO_SELF), %eax |
212 | ret | | 212 | ret |
213 | END(x86_curcpu) | | 213 | END(x86_curcpu) |
214 | | | 214 | |
215 | ENTRY(x86_curlwp) | | 215 | ENTRY(x86_curlwp) |
216 | movl %fs:(CPU_INFO_CURLWP), %eax | | 216 | movl %fs:(CPU_INFO_CURLWP), %eax |
217 | ret | | 217 | ret |
218 | END(x86_curlwp) | | 218 | END(x86_curlwp) |
219 | | | 219 | |
220 | ENTRY(cpu_set_curpri) | | 220 | ENTRY(cpu_set_curpri) |
221 | movl 4(%esp), %eax | | 221 | movl 4(%esp), %eax |
222 | movl %eax, %fs:(CPU_INFO_CURPRIORITY) | | 222 | movl %eax, %fs:(CPU_INFO_CURPRIORITY) |
223 | ret | | 223 | ret |
224 | END(cpu_set_curpri) | | 224 | END(cpu_set_curpri) |
225 | | | 225 | |
226 | ENTRY(__byte_swap_u32_variable) | | 226 | ENTRY(__byte_swap_u32_variable) |
227 | movl 4(%esp), %eax | | 227 | movl 4(%esp), %eax |
228 | bswapl %eax | | 228 | bswapl %eax |
229 | ret | | 229 | ret |
230 | END(__byte_swap_u32_variable) | | 230 | END(__byte_swap_u32_variable) |
231 | | | 231 | |
232 | ENTRY(__byte_swap_u16_variable) | | 232 | ENTRY(__byte_swap_u16_variable) |
233 | movl 4(%esp), %eax | | 233 | movl 4(%esp), %eax |
234 | xchgb %al, %ah | | 234 | xchgb %al, %ah |
235 | ret | | 235 | ret |
236 | END(__byte_swap_u16_variable) | | 236 | END(__byte_swap_u16_variable) |
237 | | | 237 | |
238 | /* | | 238 | /* |
239 | * void x86_flush() | | 239 | * void x86_flush() |
240 | * | | 240 | * |
241 | * Flush instruction pipelines by doing an intersegment (far) return. | | 241 | * Flush instruction pipelines by doing an intersegment (far) return. |
242 | */ | | 242 | */ |
243 | ENTRY(x86_flush) | | 243 | ENTRY(x86_flush) |
244 | popl %eax | | 244 | popl %eax |
245 | pushl $GSEL(GCODE_SEL, SEL_KPL) | | 245 | pushl $GSEL(GCODE_SEL, SEL_KPL) |
246 | pushl %eax | | 246 | pushl %eax |
247 | lret | | 247 | lret |
248 | END(x86_flush) | | 248 | END(x86_flush) |
249 | | | 249 | |
250 | /* Waits - set up stack frame. */ | | 250 | /* Waits - set up stack frame. */ |
251 | ENTRY(x86_hlt) | | 251 | ENTRY(x86_hlt) |
252 | pushl %ebp | | 252 | pushl %ebp |
253 | movl %esp, %ebp | | 253 | movl %esp, %ebp |
254 | hlt | | 254 | hlt |
255 | leave | | 255 | leave |
256 | ret | | 256 | ret |
257 | END(x86_hlt) | | 257 | END(x86_hlt) |
258 | | | 258 | |
259 | /* Waits - set up stack frame. */ | | 259 | /* Waits - set up stack frame. */ |
260 | ENTRY(x86_stihlt) | | 260 | ENTRY(x86_stihlt) |
261 | pushl %ebp | | 261 | pushl %ebp |
262 | movl %esp, %ebp | | 262 | movl %esp, %ebp |
263 | sti | | 263 | sti |
264 | hlt | | 264 | hlt |
265 | leave | | 265 | leave |
266 | ret | | 266 | ret |
267 | END(x86_stihlt) | | 267 | END(x86_stihlt) |
268 | | | 268 | |
269 | ENTRY(x86_monitor) | | 269 | ENTRY(x86_monitor) |
270 | movl 4(%esp), %eax | | 270 | movl 4(%esp), %eax |
271 | movl 8(%esp), %ecx | | 271 | movl 8(%esp), %ecx |
272 | movl 12(%esp), %edx | | 272 | movl 12(%esp), %edx |
273 | monitor %eax, %ecx, %edx | | 273 | monitor %eax, %ecx, %edx |
274 | ret | | 274 | ret |
275 | END(x86_monitor) | | 275 | END(x86_monitor) |
276 | | | 276 | |
277 | /* Waits - set up stack frame. */ | | 277 | /* Waits - set up stack frame. */ |
278 | ENTRY(x86_mwait) | | 278 | ENTRY(x86_mwait) |
279 | pushl %ebp | | 279 | pushl %ebp |
280 | movl %esp, %ebp | | 280 | movl %esp, %ebp |
281 | movl 8(%ebp), %eax | | 281 | movl 8(%ebp), %eax |
282 | movl 12(%ebp), %ecx | | 282 | movl 12(%ebp), %ecx |
283 | mwait %eax, %ecx | | 283 | mwait %eax, %ecx |
284 | leave | | 284 | leave |
285 | ret | | 285 | ret |
286 | END(x86_mwait) | | 286 | END(x86_mwait) |
287 | | | 287 | |
288 | ENTRY(x86_pause) | | 288 | ENTRY(x86_pause) |
289 | pause | | 289 | pause |
290 | ret | | 290 | ret |
291 | END(x86_pause) | | 291 | END(x86_pause) |
292 | | | 292 | |
293 | ENTRY(x86_cpuid2) | | 293 | ENTRY(x86_cpuid2) |
294 | pushl %ebx | | 294 | pushl %ebx |
295 | pushl %edi | | 295 | pushl %edi |
296 | movl 12(%esp), %eax | | 296 | movl 12(%esp), %eax |
297 | movl 16(%esp), %ecx | | 297 | movl 16(%esp), %ecx |
298 | movl 20(%esp), %edi | | 298 | movl 20(%esp), %edi |
299 | cpuid | | 299 | cpuid |
300 | movl %eax, 0(%edi) | | 300 | movl %eax, 0(%edi) |
301 | movl %ebx, 4(%edi) | | 301 | movl %ebx, 4(%edi) |
302 | movl %ecx, 8(%edi) | | 302 | movl %ecx, 8(%edi) |
303 | movl %edx, 12(%edi) | | 303 | movl %edx, 12(%edi) |
304 | popl %edi | | 304 | popl %edi |
305 | popl %ebx | | 305 | popl %ebx |
306 | ret | | 306 | ret |
307 | END(x86_cpuid2) | | 307 | END(x86_cpuid2) |
308 | | | 308 | |
309 | ENTRY(x86_getss) | | 309 | ENTRY(x86_getss) |
310 | movl %ss, %eax | | 310 | movl %ss, %eax |
311 | ret | | 311 | ret |
312 | END(x86_getss) | | 312 | END(x86_getss) |
313 | | | 313 | |
314 | ENTRY(fldcw) | | 314 | ENTRY(fldcw) |
315 | movl 4(%esp), %eax | | 315 | movl 4(%esp), %eax |
316 | fldcw (%eax) | | 316 | fldcw (%eax) |
317 | ret | | 317 | ret |
318 | END(fldcw) | | 318 | END(fldcw) |
319 | | | 319 | |
320 | ENTRY(fnclex) | | 320 | ENTRY(fnclex) |
321 | fnclex | | 321 | fnclex |
322 | ret | | 322 | ret |
323 | END(fnclex) | | 323 | END(fnclex) |
324 | | | 324 | |
325 | ENTRY(fninit) | | 325 | ENTRY(fninit) |
326 | fninit | | 326 | fninit |
327 | ret | | 327 | ret |
328 | END(fninit) | | 328 | END(fninit) |
329 | | | 329 | |
330 | ENTRY(fnsave) | | 330 | ENTRY(fnsave) |
331 | movl 4(%esp), %eax | | 331 | movl 4(%esp), %eax |
332 | fnsave (%eax) | | 332 | fnsave (%eax) |
333 | ret | | 333 | ret |
334 | END(fnsave) | | 334 | END(fnsave) |
335 | | | 335 | |
336 | ENTRY(fnstcw) | | 336 | ENTRY(fnstcw) |
337 | movl 4(%esp), %eax | | 337 | movl 4(%esp), %eax |
338 | fnstcw (%eax) | | 338 | fnstcw (%eax) |
339 | ret | | 339 | ret |
340 | END(fnstcw) | | 340 | END(fnstcw) |
341 | | | 341 | |
342 | ENTRY(fnstsw) | | 342 | ENTRY(fnstsw) |
343 | movl 4(%esp), %eax | | 343 | movl 4(%esp), %eax |
344 | fnstsw (%eax) | | 344 | fnstsw (%eax) |
345 | ret | | 345 | ret |
346 | END(fnstsw) | | 346 | END(fnstsw) |
347 | | | 347 | |
348 | ENTRY(fp_divide_by_0) | | 348 | ENTRY(fp_divide_by_0) |
349 | fldz | | 349 | fldz |
350 | fld1 | | 350 | fld1 |
351 | fdiv %st, %st(1) | | 351 | fdiv %st, %st(1) |
352 | fwait | | 352 | fwait |
353 | ret | | 353 | ret |
354 | END(fp_divide_by_0) | | 354 | END(fp_divide_by_0) |
355 | | | 355 | |
356 | ENTRY(frstor) | | 356 | ENTRY(frstor) |
357 | movl 4(%esp), %eax | | 357 | movl 4(%esp), %eax |
358 | frstor (%eax) | | 358 | frstor (%eax) |
359 | ret | | 359 | ret |
360 | END(frstor) | | 360 | END(frstor) |
361 | | | 361 | |
362 | ENTRY(fwait) | | 362 | ENTRY(fwait) |
363 | fwait | | 363 | fwait |
364 | ret | | 364 | ret |
365 | END(fwait) | | 365 | END(fwait) |
366 | | | 366 | |
367 | ENTRY(clts) | | 367 | ENTRY(clts) |
368 | clts | | 368 | clts |
369 | ret | | 369 | ret |
370 | END(clts) | | 370 | END(clts) |
371 | | | 371 | |
372 | ENTRY(stts) | | 372 | ENTRY(stts) |
373 | movl %cr0, %eax | | 373 | movl %cr0, %eax |
| | | 374 | testl $CR0_TS, %eax |
| | | 375 | jnz 1f |
374 | orl $CR0_TS, %eax | | 376 | orl $CR0_TS, %eax |
375 | movl %eax, %cr0 | | 377 | movl %eax, %cr0 |
| | | 378 | 1: |
376 | ret | | 379 | ret |
377 | END(stts) | | 380 | END(stts) |
378 | | | 381 | |
379 | ENTRY(fxsave) | | 382 | ENTRY(fxsave) |
380 | movl 4(%esp), %eax | | 383 | movl 4(%esp), %eax |
381 | fxsave (%eax) | | 384 | fxsave (%eax) |
382 | ret | | 385 | ret |
383 | END(fxsave) | | 386 | END(fxsave) |
384 | | | 387 | |
385 | ENTRY(fxrstor) | | 388 | ENTRY(fxrstor) |
386 | movl 4(%esp), %eax | | 389 | movl 4(%esp), %eax |
387 | fxrstor (%eax) | | 390 | fxrstor (%eax) |
388 | ret | | 391 | ret |
389 | END(fxrstor) | | 392 | END(fxrstor) |
390 | | | 393 | |
391 | ENTRY(fldummy) | | 394 | ENTRY(fldummy) |
392 | movl 4(%esp), %eax | | 395 | movl 4(%esp), %eax |
393 | ffree %st(7) | | 396 | ffree %st(7) |
394 | fld (%eax) | | 397 | fld (%eax) |
395 | ret | | 398 | ret |
396 | END(fldummy) | | 399 | END(fldummy) |
397 | | | 400 | |
398 | ENTRY(inb) | | 401 | ENTRY(inb) |
399 | movl 4(%esp), %edx | | 402 | movl 4(%esp), %edx |
400 | xorl %eax, %eax | | 403 | xorl %eax, %eax |
401 | inb %dx, %al | | 404 | inb %dx, %al |
402 | ret | | 405 | ret |
403 | END(inb) | | 406 | END(inb) |
404 | | | 407 | |
405 | ENTRY(insb) | | 408 | ENTRY(insb) |
406 | pushl %edi | | 409 | pushl %edi |
407 | movl 8(%esp), %edx | | 410 | movl 8(%esp), %edx |
408 | movl 12(%esp), %edi | | 411 | movl 12(%esp), %edi |
409 | movl 16(%esp), %ecx | | 412 | movl 16(%esp), %ecx |
410 | rep | | 413 | rep |
411 | insb | | 414 | insb |
412 | popl %edi | | 415 | popl %edi |
413 | ret | | 416 | ret |
414 | END(insb) | | 417 | END(insb) |
415 | | | 418 | |
416 | ENTRY(inw) | | 419 | ENTRY(inw) |
417 | movl 4(%esp), %edx | | 420 | movl 4(%esp), %edx |
418 | xorl %eax, %eax | | 421 | xorl %eax, %eax |
419 | inw %dx, %ax | | 422 | inw %dx, %ax |
420 | ret | | 423 | ret |
421 | END(inw) | | 424 | END(inw) |
422 | | | 425 | |
423 | ENTRY(insw) | | 426 | ENTRY(insw) |
424 | pushl %edi | | 427 | pushl %edi |
425 | movl 8(%esp), %edx | | 428 | movl 8(%esp), %edx |
426 | movl 12(%esp), %edi | | 429 | movl 12(%esp), %edi |
427 | movl 16(%esp), %ecx | | 430 | movl 16(%esp), %ecx |
428 | rep | | 431 | rep |
429 | insw | | 432 | insw |
430 | popl %edi | | 433 | popl %edi |
431 | ret | | 434 | ret |
432 | END(insw) | | 435 | END(insw) |
433 | | | 436 | |
434 | ENTRY(inl) | | 437 | ENTRY(inl) |
435 | movl 4(%esp), %edx | | 438 | movl 4(%esp), %edx |
436 | inl %dx, %eax | | 439 | inl %dx, %eax |
437 | ret | | 440 | ret |
438 | END(inl) | | 441 | END(inl) |
439 | | | 442 | |
440 | ENTRY(insl) | | 443 | ENTRY(insl) |
441 | pushl %edi | | 444 | pushl %edi |
442 | movl 8(%esp), %edx | | 445 | movl 8(%esp), %edx |
443 | movl 12(%esp), %edi | | 446 | movl 12(%esp), %edi |
444 | movl 16(%esp), %ecx | | 447 | movl 16(%esp), %ecx |
445 | rep | | 448 | rep |
446 | insl | | 449 | insl |
447 | popl %edi | | 450 | popl %edi |
448 | ret | | 451 | ret |
449 | END(insl) | | 452 | END(insl) |
450 | | | 453 | |
451 | ENTRY(outb) | | 454 | ENTRY(outb) |
452 | movl 4(%esp), %edx | | 455 | movl 4(%esp), %edx |
453 | movl 8(%esp), %eax | | 456 | movl 8(%esp), %eax |
454 | outb %al, %dx | | 457 | outb %al, %dx |
455 | ret | | 458 | ret |
456 | END(outb) | | 459 | END(outb) |
457 | | | 460 | |
458 | ENTRY(outsb) | | 461 | ENTRY(outsb) |
459 | pushl %esi | | 462 | pushl %esi |
460 | movl 8(%esp), %edx | | 463 | movl 8(%esp), %edx |
461 | movl 12(%esp), %esi | | 464 | movl 12(%esp), %esi |
462 | movl 16(%esp), %ecx | | 465 | movl 16(%esp), %ecx |
463 | rep | | 466 | rep |
464 | outsb | | 467 | outsb |
465 | popl %esi | | 468 | popl %esi |
466 | ret | | 469 | ret |
467 | END(outsb) | | 470 | END(outsb) |
468 | | | 471 | |
469 | ENTRY(outw) | | 472 | ENTRY(outw) |
470 | movl 4(%esp), %edx | | 473 | movl 4(%esp), %edx |
471 | movl 8(%esp), %eax | | 474 | movl 8(%esp), %eax |
472 | outw %ax, %dx | | 475 | outw %ax, %dx |
473 | ret | | 476 | ret |
474 | END(outw) | | 477 | END(outw) |
475 | | | 478 | |
476 | ENTRY(outsw) | | 479 | ENTRY(outsw) |
477 | pushl %esi | | 480 | pushl %esi |
478 | movl 8(%esp), %edx | | 481 | movl 8(%esp), %edx |
479 | movl 12(%esp), %esi | | 482 | movl 12(%esp), %esi |
480 | movl 16(%esp), %ecx | | 483 | movl 16(%esp), %ecx |
481 | rep | | 484 | rep |
482 | outsw | | 485 | outsw |
483 | popl %esi | | 486 | popl %esi |
484 | ret | | 487 | ret |
485 | END(outsw) | | 488 | END(outsw) |
486 | | | 489 | |
487 | ENTRY(outl) | | 490 | ENTRY(outl) |
488 | movl 4(%esp), %edx | | 491 | movl 4(%esp), %edx |
489 | movl 8(%esp), %eax | | 492 | movl 8(%esp), %eax |
490 | outl %eax, %dx | | 493 | outl %eax, %dx |
491 | ret | | 494 | ret |
492 | END(outl) | | 495 | END(outl) |
493 | | | 496 | |
494 | ENTRY(outsl) | | 497 | ENTRY(outsl) |
495 | pushl %esi | | 498 | pushl %esi |
496 | movl 8(%esp), %edx | | 499 | movl 8(%esp), %edx |
497 | movl 12(%esp), %esi | | 500 | movl 12(%esp), %esi |
498 | movl 16(%esp), %ecx | | 501 | movl 16(%esp), %ecx |
499 | rep | | 502 | rep |
500 | outsl | | 503 | outsl |
501 | popl %esi | | 504 | popl %esi |
502 | ret | | 505 | ret |
503 | END(outsl) | | 506 | END(outsl) |