10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 #include <sys/asm_linkage.h>
28 #include <sys/asm_misc.h>
29
30 #if defined(__lint)
31
32 #include "dboot_asm.h"
33
34 /* ARGSUSED */
35 uint32_t
36 get_cpuid_edx(uint32_t *eax)
37 { return (0); }
38
39 /* ARGSUSED */
40 void
41 outb(int port, uint8_t value)
42 {}
43
44 /* ARGSUSED */
45 uint8_t
46 inb(int port)
47 { return (0); }
48
49 #else /* __lint */
50
51 #if defined(__amd64)
52
53 /*
54 * do a cpuid instruction, returning the eax/edx values
55 *
56 * uint32_t get_cpuid_edx(uint32_t *eax)
57 */
58 ENTRY_NP(get_cpuid_edx)
59 pushq %rbx
60 movl (%rdi), %eax
61 cpuid
62 movl %eax, (%rdi)
63 movl %edx, %eax
64 popq %rbx
65 ret
66 SET_SIZE(get_cpuid_edx)
67
68 /*
69 * void outb(int port, uint8_t value)
70 */
123 SET_SIZE(outb)
124
125 /*
126 * uint8_t inb(int port)
127 */
128 ENTRY_NP(inb)
129 movl 4(%esp), %edx
130 inb (%dx)
131 andl $0xff, %eax
132 ret
133 SET_SIZE(inb)
134
135 ENTRY(htonl)
136 movl 4(%esp), %eax
137 bswap %eax
138 ret
139 SET_SIZE(htonl)
140
141 #endif /* __i386 */
142
143 #endif /* __lint */
|
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 #include <sys/asm_linkage.h>
28 #include <sys/asm_misc.h>
29
30 #if defined(__amd64)
31
32 /*
33 * do a cpuid instruction, returning the eax/edx values
34 *
35 * uint32_t get_cpuid_edx(uint32_t *eax)
36 */
37 ENTRY_NP(get_cpuid_edx)
38 pushq %rbx
39 movl (%rdi), %eax
40 cpuid
41 movl %eax, (%rdi)
42 movl %edx, %eax
43 popq %rbx
44 ret
45 SET_SIZE(get_cpuid_edx)
46
47 /*
48 * void outb(int port, uint8_t value)
49 */
102 SET_SIZE(outb)
103
104 /*
105 * uint8_t inb(int port)
106 */
107 ENTRY_NP(inb)
108 movl 4(%esp), %edx
109 inb (%dx)
110 andl $0xff, %eax
111 ret
112 SET_SIZE(inb)
113
114 ENTRY(htonl)
115 movl 4(%esp), %eax
116 bswap %eax
117 ret
118 SET_SIZE(htonl)
119
120 #endif /* __i386 */
121
|