i86_subr.s revision 4df4bd6096e60a7062ad804cc29ac7cc4b03811a
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome * CDDL HEADER START
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome * The contents of this file are subject to the terms of the
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome * Common Development and Distribution License (the "License").
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome * You may not use this file except in compliance with the License.
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome * See the License for the specific language governing permissions
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome * and limitations under the License.
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome * When distributing Covered Code, include this CDDL HEADER in each
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome * If applicable, add the following below this CDDL HEADER, with the
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome * fields enclosed by brackets "[]" replaced with your own identifying
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome * information: Portions Copyright [yyyy] [name of copyright owner]
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome * CDDL HEADER END
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome * Use is subject to license terms.
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome * Copyright (c) 1990, 1991 UNIX System Laboratories, Inc.
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome * Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome * All Rights Reserved
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome#pragma ident "%Z%%M% %I% %E% SMI"
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome * General assembly language routines.
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome * It is the intent of this file to contain routines that are
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome * independent of the specific kernel architecture, and those that are
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome * common across kernel architectures.
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome * As architectures diverge, and implementations of specific
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome * architecture-dependent routines change, the routines should be moved
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome * from this file into the respective ../`arch -k`/subr.s file.
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome#else /* __lint */
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome#endif /* __lint */
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome * on_fault()
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome * Catch lofault faults. Like setjmp except it returns one
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome * if code following causes uncorrectable fault. Turned off
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome * by calling no_fault().
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome/* ARGSUSED */
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome{ return (0); }
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome#else /* __lint */
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome movq %rdi, T_ONFAULT(%rsi) /* jumpbuf in t_onfault */
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome movq %rdx, T_LOFAULT(%rsi) /* catch_fault in t_lofault */
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome movq T_ONFAULT(%rsi), %rdi /* address of save area */
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome movq %rax, T_ONFAULT(%rsi) /* turn off onfault */
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome movq %rax, T_LOFAULT(%rsi) /* turn off lofault */
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome movq %rax, T_ONFAULT(%rsi) /* turn off onfault */
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome movq %rax, T_LOFAULT(%rsi) /* turn off lofault */
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome movl %eax, T_ONFAULT(%edx) /* jumpbuf in t_onfault */
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome movl %ecx, T_LOFAULT(%edx) /* catch_fault in t_lofault */
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome movl T_ONFAULT(%edx), %ecx /* address of save area */
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome movl %eax, T_ONFAULT(%edx) /* turn off onfault */
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome movl %eax, T_LOFAULT(%edx) /* turn off lofault */
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome movl %eax, T_ONFAULT(%edx) /* turn off onfault */
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome movl %eax, T_LOFAULT(%edx) /* turn off lofault */
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome#endif /* __i386 */
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome#endif /* __lint */
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome * Default trampoline code for on_trap() (see <sys/ontrap.h>). We just
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome * do a longjmp(&curthread->t_ontrap->ot_jmpbuf) if this is ever called.
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome#else /* __lint */
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome#endif /* __i386 */
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome#endif /* __lint */
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome * Push a new element on to the t_ontrap stack. Refer to <sys/ontrap.h> for
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome * more information about the on_trap() mechanism. If the on_trap_data is the
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome * same as the topmost stack element, we just modify that element.
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome{ return (0); }
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome#else /* __lint */
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome leaq on_trap_trampoline(%rip), %rdx /* rdx = &on_trap_trampoline */
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome movq %rdx, OT_TRAMPOLINE(%rdi) /* ot_trampoline = rdx */
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome movq %rcx, OT_HANDLE(%rdi) /* ot_handle = NULL */
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome movq %gs:CPU_THREAD, %rdx /* rdx = curthread */
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome movq T_ONTRAP(%rdx), %rcx /* rcx = curthread->t_ontrap */
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome movq %rcx, OT_PREV(%rdi) /* ot_prev = t_ontrap */
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome movq %rdi, T_ONTRAP(%rdx) /* curthread->t_ontrap = otp */
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome leal on_trap_trampoline, %edx /* %edx = &on_trap_trampoline */
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome movl %edx, OT_TRAMPOLINE(%eax) /* ot_trampoline = %edx */
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome movl $0, OT_HANDLE(%eax) /* ot_handle = NULL */
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome movl %gs:CPU_THREAD, %edx /* %edx = curthread */
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome movl T_ONTRAP(%edx), %ecx /* %ecx = curthread->t_ontrap */
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome movl %ecx, OT_PREV(%eax) /* ot_prev = t_ontrap */
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome movl %eax, T_ONTRAP(%edx) /* curthread->t_ontrap = otp */
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome0: addl $OT_JMPBUF, %eax /* %eax = &ot_jmpbuf */
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome movl %eax, 4(%esp) /* put %eax back on the stack */
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome#endif /* __i386 */
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome#endif /* __lint */
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome * Setjmp and longjmp implement non-local gotos using state vectors
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome * type label_t.
afc2ba1deb75b323afde536f2dd18bcafdaa308dToomas Soome/* ARGSUSED */
#if LABEL_PC != 0
#if defined(__amd64)
#if defined(__lint)
caller(void)
#if defined(__amd64)
#if defined(__lint)
callee(void)
#if defined(__amd64)
#if defined(__lint)
getfp(void)
#if defined(__amd64)
#if defined(__lint)
#if defined(__amd64)
#if defined(__lint)
getcr0(void)
getcr2(void)
getcr3(void)
reload_cr3(void)
getcr4(void)
#if defined(__amd64)
getcr8(void)
#if defined(__amd64)
#if defined(__lint)
#if defined(__amd64)
#if defined(__lint)
tsc_read(void)
#if defined(__amd64)
#if defined(__lint)
#if defined(__amd64)
#if defined(__lint)
#if defined(__amd64)
#if defined(__lint)
#if defined(__amd64)
#ifdef DEBUG
#ifdef DEBUG
#ifdef DEBUG
.text
#if defined(__lint)
int spl0(void) { return (0); }
int spl6(void) { return (0); }
int spl7(void) { return (0); }
int spl8(void) { return (0); }
int splhigh(void) { return (0); }
int splhi(void) { return (0); }
int splzs(void) { return (0); }
#if defined(__amd64)
SETPRI(0)
#if defined(__i386)
#if defined(__lint)
getgs(void)
#if defined(__lint)
pc_reset(void)
efi_reset(void)
#if defined(__i386)
#if defined(__i386)
#if defined(__amd64)
#if defined(__lint)
#if defined(__amd64)
#if defined(__lint)
#if defined(__amd64)
#if defined(__lint)
#if defined(__amd64)
#if defined(__lint)
#if defined(__amd64)
#if defined(__lint)
#if defined(__amd64)
#if defined(__lint)
#if defined(__amd64)
#if defined(__lint)
#if defined(__amd64)
#if defined(__lint)
#if defined(__amd64)
#if defined(__lint)
#if defined(__amd64)
#if defined(__lint)
#if defined(__amd64)
#if defined(__lint)
#if defined(__amd64)
#if defined(__lint)
#if defined(__amd64)
#if defined(__lint)
int3(void)
int18(void)
int20(void)
int $T_BPTFLT
int $T_MCE
int $T_DBGENTR
#if defined(__lint)
#if defined(__amd64)
.scanloop:
.scandone:
.scanloop:
.scandone:
#if defined(__lint)
intr_clear(void)
clear_int_flag(void)
#if defined(__amd64)
#if defined(__lint)
struct cpu *
curcpup(void)
#if defined(__amd64)
#if defined(__lint)
#if defined(__amd64)
#if defined(__lint)
#if defined(__amd64)
#if defined(__lint)
#if defined(__amd64)
#if defined(__lint)
sti(void)
cli(void)
#if defined(__amd64)
#if defined(__lint)
dtrace_interrupt_disable(void)
#if defined(__amd64)
#if defined(__lint)
#if defined(__amd64)
#if defined(lint)
dtrace_membar_producer(void)
dtrace_membar_consumer(void)
#if defined(__lint)
threadp(void)
{ return ((kthread_id_t)0); }
#if defined(__amd64)
#if defined(__lint)
return (psum);
#if defined(__amd64)
#ifdef DEBUG
.only60:
.only56:
.only52:
.only48:
.only44:
.only40:
.only36:
.only32:
.only28:
.only24:
.only20:
.only16:
.only12:
.only8:
.only4:
.only0:
.only60:
.only56:
.only52:
.only48:
.only44:
.only40:
.only36:
.only32:
.only28:
.only24:
.only20:
.only16:
.only12:
.only8:
.only4:
.only0:
.data
#if defined(__lint)
#if defined(__amd64)
#if defined(notused)
#if defined(__lint)
#if defined(__lint)
#if defined(__amd64)
#if defined(__lint)
#if defined(__amd64)
#if defined(__lint)
#if defined(__amd64)
#if defined(__lint)
invalidate_cache(void)
#if defined(__amd64)
#if defined(__lint)
#if defined(__amd64)
rdmsr; \
.nocr4:
.skip:
#if defined(__lint)
#if defined(__amd64)
je 0f
je 0f
ret / return (0);
ret / return (0);
#if defined(__lint)
#if defined(__amd64)
je 0f
je 0f / goto 0f;
#if !defined(__GNUC_AS__)
#if !defined(__GNUC_AS__)
#if !defined(__GNUC_AS__)
#if defined(__lint)
hres_tick(void)
volatile int hres_lock;
.NWORD 0, 0
.long ADJ_SHIFT
#if defined(__amd64)
.CL1:
.CL2:
.CL3:
.CL1:
.CL2:
.CL3:
/ (max_hres_adj)
/ adj_hrestime()
/ long long adj;
/ if (hrestime_adj == 0)
/ adj = 0;
/ else if (hrestime_adj > 0) {
/ one_sec++;
.CL4:
.CL7:
.CL5:
.CL8:
#if defined(__lint)
#if defined(__lint)
#if defined(__lint)
#if defined(__amd64)
#ifdef DEBUG
jb 0f
#ifdef DEBUG
jb 0f
.equal:
#ifdef DEBUG
.text
#if defined(__lint)
index--;
return (index);
#if defined(__amd64)
#if defined(__lint)
#if defined(__i386)
#if defined(__lint)
#if defined(__amd64)
#if defined(__lint)
kmdb_enter(void)
#if defined(__amd64)
int $T_DBGENTR
int $T_DBGENTR
#if defined(__lint)
return_instr(void)
#if defined(__lint)
getflags(void)
#if defined(__amd64)
#if defined(__lint)
ftrace_interrupt_disable(void)
#if defined(__amd64)
#if defined(__lint)
#if defined(__amd64)