9927 refetch_read_once() would like a p please bob
[unleashed.git] / usr / src / uts / intel / asm / cpu.h
bloba96d8ab6b6791981384b20caa3ae3ee9b57688e4
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
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]
19 * CDDL HEADER END
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #ifndef _ASM_CPU_H
27 #define _ASM_CPU_H
29 #include <sys/ccompile.h>
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
35 #if !defined(__lint) && defined(__GNUC__)
37 #if defined(__i386) || defined(__amd64)
39 extern __GNU_INLINE void
40 ht_pause(void)
42 __asm__ __volatile__(
43 "pause");
47 * prefetch 64 bytes
49 * prefetch is an SSE extension which is not supported on
50 * older 32-bit processors, so define this as a no-op for now
53 extern __GNU_INLINE void
54 prefetch_read_many(void *addr)
56 #if defined(__amd64)
57 __asm__(
58 "prefetcht0 (%0);"
59 "prefetcht0 32(%0);"
60 : /* no output */
61 : "r" (addr));
62 #endif /* __amd64 */
65 extern __GNU_INLINE void
66 prefetch_read_once(void *addr)
68 #if defined(__amd64)
69 __asm__(
70 "prefetchnta (%0);"
71 "prefetchnta 32(%0);"
72 : /* no output */
73 : "r" (addr));
74 #endif /* __amd64 */
77 extern __GNU_INLINE void
78 prefetch_write_many(void *addr)
80 #if defined(__amd64)
81 __asm__(
82 "prefetcht0 (%0);"
83 "prefetcht0 32(%0);"
84 : /* no output */
85 : "r" (addr));
86 #endif /* __amd64 */
89 extern __GNU_INLINE void
90 prefetch_write_once(void *addr)
92 #if defined(__amd64)
93 __asm__(
94 "prefetcht0 (%0);"
95 "prefetcht0 32(%0);"
96 : /* no output */
97 : "r" (addr));
98 #endif /* __amd64 */
101 #if !defined(__xpv)
103 extern __GNU_INLINE void
104 cli(void)
106 __asm__ __volatile__(
107 "cli" : : : "memory");
110 extern __GNU_INLINE void
111 sti(void)
113 __asm__ __volatile__(
114 "sti");
117 extern __GNU_INLINE void
118 i86_halt(void)
120 __asm__ __volatile__(
121 "sti; hlt");
124 #endif /* !__xpv */
126 #endif /* __i386 || defined(__amd64) */
128 #if defined(__amd64)
130 extern __GNU_INLINE void
131 __set_ds(selector_t value)
133 __asm__ __volatile__(
134 "movw %0, %%ds"
135 : /* no output */
136 : "r" (value));
139 extern __GNU_INLINE void
140 __set_es(selector_t value)
142 __asm__ __volatile__(
143 "movw %0, %%es"
144 : /* no output */
145 : "r" (value));
148 extern __GNU_INLINE void
149 __set_fs(selector_t value)
151 __asm__ __volatile__(
152 "movw %0, %%fs"
153 : /* no output */
154 : "r" (value));
157 extern __GNU_INLINE void
158 __set_gs(selector_t value)
160 __asm__ __volatile__(
161 "movw %0, %%gs"
162 : /* no output */
163 : "r" (value));
166 #if !defined(__xpv)
168 extern __GNU_INLINE void
169 __swapgs(void)
171 __asm__ __volatile__(
172 "mfence; swapgs");
175 #endif /* !__xpv */
177 #endif /* __amd64 */
179 #endif /* !__lint && __GNUC__ */
181 #ifdef __cplusplus
183 #endif
185 #endif /* _ASM_CPU_H */