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