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]
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
28 / Inline functions for i386 kernels.
29 / Shared between all x86 platform variants.
33 / return current thread pointer
35 / NOTE: the "0x10" should be replaced by the computed value of the
36 / offset of "cpu_thread" from the beginning of the struct cpu.
37 / Including "assym.h" does not work, however, since that stuff
38 / is PSM-specific and is only visible to the 'unix' build anyway.
39 / Same with current cpu pointer, where "0xc" should be replaced
40 / by the computed value of the offset of "cpu_self".
41 / Ugh -- what a disaster.
48 / return current cpu pointer
62 / convert ipl to spl. This is the identity function for i86
69 / Networking byte order functions (too bad, Intel has the wrong byte order)
108 * multiply two long numbers and yield a u_longlong_t result
109 * Provided to manipulate hrtime_t values.
118 * Unlock hres_lock and increment the count value. (See clock.h)
120 .inline unlock_hres_lock, 0
132 .inline atomic_andb,8
140 * atomic inc/dec operations.
141 * void atomic_inc16(uint16_t *addr) { ++*addr; }
142 * void atomic_dec16(uint16_t *addr) { --*addr; }
144 .inline atomic_inc16,4
150 .inline atomic_dec16,4
157 * Call the pause instruction. To the Pentium 4 Xeon processor, it acts as
158 * a hint that the code sequence is a busy spin-wait loop. Without a pause
159 * instruction in these loops, the P4 Xeon processor may suffer a severe
160 * penalty when exiting the loop because the processor detects a possible
161 * memory violation. Inserting the pause instruction significantly reduces
162 * the likelihood of a memory order violation, improving performance.
163 * The pause instruction is a NOP on all other IA-32 processors.
166 rep / our compiler doesn't support "pause" yet,
167 nop / so we're using "F3 90" opcode directly
173 * prefetch is an SSE extension which is not supported on older 32-bit processors
174 * so define this as a no-op for now
177 .inline prefetch_read_many,4
180 / prefetcht0 32(%eax)
183 .inline prefetch_read_once,4
186 / prefetchnta 32(%eax)
189 .inline prefetch_write_many,4
192 / prefetcht0 32(%eax)
195 .inline prefetch_write_once,4
198 / prefetcht0 32(%eax)