| @@ -1,156 +1,152 @@ | | | @@ -1,156 +1,152 @@ |
1 | /* $NetBSD: cpufunc.S,v 1.3 2008/10/22 08:42:38 ad Exp $ */ | | 1 | /* $NetBSD: cpufunc.S,v 1.4 2011/06/08 16:03:42 joerg Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2007 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 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 Andrew Doran. | | 8 | * 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 | #include <machine/asm.h> | | 32 | #include <machine/asm.h> |
33 | | | 33 | |
34 | NENTRY(x86_read_psl) | | 34 | NENTRY(x86_read_psl) |
35 | pushfl | | 35 | pushfl |
36 | popl %eax | | 36 | popl %eax |
37 | ret | | 37 | ret |
38 | | | 38 | |
39 | NENTRY(x86_write_psl) | | 39 | NENTRY(x86_write_psl) |
40 | movl 4(%esp), %eax | | 40 | movl 4(%esp), %eax |
41 | pushl %eax | | 41 | pushl %eax |
42 | popfl | | 42 | popfl |
43 | ret | | 43 | ret |
44 | | | 44 | |
45 | NENTRY(x86_disable_intr) | | 45 | NENTRY(x86_disable_intr) |
46 | cli | | 46 | cli |
47 | ret | | 47 | ret |
48 | | | 48 | |
49 | NENTRY(x86_enable_intr) | | 49 | NENTRY(x86_enable_intr) |
50 | sti | | 50 | sti |
51 | ret | | 51 | ret |
52 | | | 52 | |
53 | NENTRY(inb) | | 53 | NENTRY(inb) |
54 | movl 4(%esp), %edx | | 54 | movl 4(%esp), %edx |
55 | xorl %eax, %eax | | 55 | xorl %eax, %eax |
56 | inb %dx, %al | | 56 | inb %dx, %al |
57 | ret | | 57 | ret |
58 | | | 58 | |
59 | NENTRY(insb) | | 59 | NENTRY(insb) |
60 | pushl %edi | | 60 | pushl %edi |
61 | movl 8(%esp), %edx | | 61 | movl 8(%esp), %edx |
62 | movl 12(%esp), %edi | | 62 | movl 12(%esp), %edi |
63 | movl 16(%esp), %ecx | | 63 | movl 16(%esp), %ecx |
64 | cld | | 64 | cld |
65 | rep | | 65 | rep |
66 | insb | | 66 | insb |
67 | popl %edi | | 67 | popl %edi |
68 | ret | | 68 | ret |
69 | | | 69 | |
70 | NENTRY(inw) | | 70 | NENTRY(inw) |
71 | movl 4(%esp), %edx | | 71 | movl 4(%esp), %edx |
72 | xorl %eax, %eax | | 72 | xorl %eax, %eax |
73 | inw %dx, %ax | | 73 | inw %dx, %ax |
74 | ret | | 74 | ret |
75 | | | 75 | |
76 | NENTRY(insw) | | 76 | NENTRY(insw) |
77 | pushl %edi | | 77 | pushl %edi |
78 | movl 8(%esp), %edx | | 78 | movl 8(%esp), %edx |
79 | movl 12(%esp), %edi | | 79 | movl 12(%esp), %edi |
80 | movl 16(%esp), %ecx | | 80 | movl 16(%esp), %ecx |
81 | cld | | 81 | cld |
82 | rep | | 82 | rep |
83 | insw | | 83 | insw |
84 | popl %edi | | 84 | popl %edi |
85 | ret | | 85 | ret |
86 | | | 86 | |
87 | NENTRY(inl) | | 87 | NENTRY(inl) |
88 | movl 4(%esp), %edx | | 88 | movl 4(%esp), %edx |
89 | inl %dx, %eax | | 89 | inl %dx, %eax |
90 | ret | | 90 | ret |
91 | | | 91 | |
92 | NENTRY(insl) | | 92 | NENTRY(insl) |
93 | pushl %edi | | 93 | pushl %edi |
94 | movl 8(%esp), %edx | | 94 | movl 8(%esp), %edx |
95 | movl 12(%esp), %edi | | 95 | movl 12(%esp), %edi |
96 | movl 16(%esp), %ecx | | 96 | movl 16(%esp), %ecx |
97 | cld | | 97 | cld |
98 | rep | | 98 | rep |
99 | insl | | 99 | insl |
100 | popl %edi | | 100 | popl %edi |
101 | ret | | 101 | ret |
102 | | | 102 | |
103 | NENTRY(outb) | | 103 | NENTRY(outb) |
104 | movl 4(%esp), %edx | | 104 | movl 4(%esp), %edx |
105 | movl 8(%esp), %eax | | 105 | movl 8(%esp), %eax |
106 | outb %al, %dx | | 106 | outb %al, %dx |
107 | ret | | 107 | ret |
108 | | | 108 | |
109 | NENTRY(outsb) | | 109 | NENTRY(outsb) |
110 | pushl %esi | | 110 | pushl %esi |
111 | movl 8(%esp), %edx | | 111 | movl 8(%esp), %edx |
112 | movl 12(%esp), %esi | | 112 | movl 12(%esp), %esi |
113 | movl 16(%esp), %ecx | | 113 | movl 16(%esp), %ecx |
114 | cld | | 114 | cld |
115 | rep | | 115 | rep |
116 | outsb | | 116 | outsb |
117 | popl %esi | | 117 | popl %esi |
118 | ret | | 118 | ret |
119 | | | 119 | |
120 | NENTRY(outw) | | 120 | NENTRY(outw) |
121 | movl 4(%esp), %edx | | 121 | movl 4(%esp), %edx |
122 | movl 8(%esp), %eax | | 122 | movl 8(%esp), %eax |
123 | outw %ax, %dx | | 123 | outw %ax, %dx |
124 | ret | | 124 | ret |
125 | | | 125 | |
126 | NENTRY(outsw) | | 126 | NENTRY(outsw) |
127 | pushl %esi | | 127 | pushl %esi |
128 | movl 8(%esp), %edx | | 128 | movl 8(%esp), %edx |
129 | movl 12(%esp), %esi | | 129 | movl 12(%esp), %esi |
130 | movl 16(%esp), %ecx | | 130 | movl 16(%esp), %ecx |
131 | cld | | 131 | cld |
132 | rep | | 132 | rep |
133 | outsw | | 133 | outsw |
134 | popl %esi | | 134 | popl %esi |
135 | ret | | 135 | ret |
136 | | | 136 | |
137 | NENTRY(outl) | | 137 | NENTRY(outl) |
138 | movl 4(%esp), %edx | | 138 | movl 4(%esp), %edx |
139 | movl 8(%esp), %eax | | 139 | movl 8(%esp), %eax |
140 | outl %eax, %dx | | 140 | outl %eax, %dx |
141 | ret | | 141 | ret |
142 | | | 142 | |
143 | NENTRY(outsl) | | 143 | NENTRY(outsl) |
144 | pushl %esi | | 144 | pushl %esi |
145 | movl 8(%esp), %edx | | 145 | movl 8(%esp), %edx |
146 | movl 12(%esp), %esi | | 146 | movl 12(%esp), %esi |
147 | movl 16(%esp), %ecx | | 147 | movl 16(%esp), %ecx |
148 | cld | | 148 | cld |
149 | rep | | 149 | rep |
150 | outsl | | 150 | outsl |
151 | popl %esi | | 151 | popl %esi |
152 | ret | | 152 | ret |
153 | | | | |
154 | NENTRY(wbinvd) | | | |
155 | wbinvd | | | |
156 | ret | | | |