1 /* $NetBSD: cpufunc.S,v 1.13 2008/09/23 08:50:11 ad Exp $ */
4 * Copyright (c) 1998, 2007 The NetBSD Foundation, Inc.
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Charles M. Hannum, and by Andrew Doran.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
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.
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
33 * Functions to provide access to i386-specific instructions.
35 * These are shared with NetBSD/xen.
38 #include <machine/asm.h>
39 __KERNEL_RCSID(0, "$NetBSD: cpufunc.S,v 1.13 2008/09/23 08:50:11 ad Exp $");
43 #include <machine/specialreg.h>
44 #include <machine/segments.h>
94 ENTRY(x86_write_flags)
102 STRONG_ALIAS(x86_write_psl,x86_write_flags)
103 STRONG_ALIAS(x86_read_psl,x86_read_flags)
123 movl $OPTERON_MSR_PASSCODE, %edi
134 movl $OPTERON_MSR_PASSCODE, %edi
142 addl CPUVAR(CC_SKEW), %eax
143 adcl CPUVAR(CC_SKEW+4), %edx
149 addl CPUVAR(CC_SKEW), %eax
162 int $0x03 /* paranoid, not 'int3' */
168 movl %fs:(CPU_INFO_SELF), %eax
173 movl %fs:(CPU_INFO_CURLWP), %eax
177 ENTRY(cpu_set_curpri)
179 movl %eax, %fs:(CPU_INFO_CURPRIORITY)
183 ENTRY(__byte_swap_u32_variable)
187 END(__byte_swap_u32_variable)
189 ENTRY(__byte_swap_u16_variable)
193 END(__byte_swap_u16_variable)
198 * Flush instruction pipelines by doing an intersegment (far) return.
202 pushl $GSEL(GCODE_SEL, SEL_KPL)
207 /* Waits - set up stack frame. */
216 /* Waits - set up stack frame. */
230 monitor %eax, %ecx, %edx
234 /* Waits - set up stack frame. */
305 ENTRY(fp_divide_by_0)