cpufunc.S revision 1.1.14.2 1 /* $NetBSD: cpufunc.S,v 1.1.14.2 2007/11/06 23:17:52 matt Exp $ */
2
3 /*-
4 * Copyright (c) 2007 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Andrew Doran.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * 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 the NetBSD
21 * Foundation, Inc. and its contributors.
22 * 4. Neither the name of The NetBSD Foundation nor the names of its
23 * contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE.
37 */
38
39 #include <machine/asm.h>
40
41 NENTRY(x86_read_psl)
42 pushfl
43 popl %eax
44 ret
45
46 NENTRY(x86_write_psl)
47 movl 4(%esp), %eax
48 pushl %eax
49 popfl
50 ret
51
52 NENTRY(x86_disable_intr)
53 cli
54 ret
55
56 NENTRY(x86_enable_intr)
57 sti
58 ret
59
60 NENTRY(inb)
61 movl 4(%esp), %edx
62 xorl %eax, %eax
63 inb %dx, %al
64 ret
65
66 NENTRY(insb)
67 pushl %edi
68 movl 8(%esp), %edx
69 movl 12(%esp), %edi
70 movl 16(%esp), %ecx
71 cld
72 rep
73 insb
74 popl %edi
75 ret
76
77 NENTRY(inw)
78 movl 4(%esp), %edx
79 xorl %eax, %eax
80 inw %dx, %ax
81 ret
82
83 NENTRY(insw)
84 pushl %edi
85 movl 8(%esp), %edx
86 movl 12(%esp), %edi
87 movl 16(%esp), %ecx
88 cld
89 rep
90 insw
91 popl %edi
92 ret
93
94 NENTRY(inl)
95 movl 4(%esp), %edx
96 inl %dx, %eax
97 ret
98
99 NENTRY(insl)
100 pushl %edi
101 movl 8(%esp), %edx
102 movl 12(%esp), %edi
103 movl 16(%esp), %ecx
104 cld
105 rep
106 insl
107 popl %edi
108 ret
109
110 NENTRY(outb)
111 movl 4(%esp), %edx
112 movl 8(%esp), %eax
113 outb %al, %dx
114 ret
115
116 NENTRY(outsb)
117 pushl %esi
118 movl 8(%esp), %edx
119 movl 12(%esp), %esi
120 movl 16(%esp), %ecx
121 cld
122 rep
123 outsb
124 popl %esi
125 ret
126
127 NENTRY(outw)
128 movl 4(%esp), %edx
129 movl 8(%esp), %eax
130 outw %ax, %dx
131 ret
132
133 NENTRY(outsw)
134 pushl %esi
135 movl 8(%esp), %edx
136 movl 12(%esp), %esi
137 movl 16(%esp), %ecx
138 cld
139 rep
140 outsw
141 popl %esi
142 ret
143
144 NENTRY(outl)
145 movl 4(%esp), %edx
146 movl 8(%esp), %eax
147 outl %eax, %dx
148 ret
149
150 NENTRY(outsl)
151 pushl %esi
152 movl 8(%esp), %edx
153 movl 12(%esp), %esi
154 movl 16(%esp), %ecx
155 cld
156 rep
157 outsl
158 popl %esi
159 ret
160