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]
22 * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
25 /* Copyright (c) 1990, 1991 UNIX System Laboratories, Inc. */
26 /* Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T */
27 /* All Rights Reserved */
29 /* Copyright (c) 1987, 1988 Microsoft Corporation */
30 /* All Rights Reserved */
32 #include <sys/asm_linkage.h>
33 #include <sys/asm_misc.h>
34 #include <sys/regset.h>
36 #include <sys/x86_archext.h>
40 #include <sys/types.h>
41 #include <sys/thread.h>
42 #include <sys/systm.h>
46 #include <sys/segments.h>
49 #include <sys/ftrace.h>
50 #include <sys/traptrace.h>
51 #include <sys/clock.h>
52 #include <sys/panic.h>
68 * Common register usage:
70 * %r12 trap trace pointer
72 ENTRY_NP2
(cmnint
, _interrupt
)
75 INTGATE_INIT_KERNEL_FLAGS
/* (set kernel rflags values) */
78 * At the end of TRACE_PTR %r12 points to the current TRAPTRACE entry
80 TRACE_PTR
(%r12, %rax
, %eax
, %rdx
, $TT_INTERRUPT
)
81 /* Uses labels 8 and 9 */
82 TRACE_REGS
(%r12, %rsp
, %rax
, %rbx
) /* Uses label 9 */
83 TRACE_STAMP
(%r12) /* Clobbers %eax, %edx, uses 9 */
90 LOADCPU
(%rbx
) /* &cpu */
91 movl CPU_PRI
(%rbx
), %r14d
/* old ipl */
92 movl $
255, TTR_IPL
(%r12)
94 movb
%dil
, TTR_PRI
(%r12)
95 movl CPU_BASE_SPL
(%rbx
), %edi
96 movb
%dil
, TTR_SPL
(%r12)
97 movb $
255, TTR_VECTOR
(%r12)
98 movq
%r12, %rsi
/* pass traptrace record pointer */
101 movq
%rsp
, %rdi
/* pass struct regs pointer */
102 call
*do_interrupt_common
104 jmp _sys_rtt_ints_disabled
110 #elif defined(__i386)
112 ENTRY_NP2
(cmnint
, _interrupt
)
115 INTGATE_INIT_KERNEL_FLAGS
118 * At the end of TRACE_PTR %esi points to the current TRAPTRACE entry
120 TRACE_PTR
(%esi
, %eax
, %eax
, %edx
, $TT_INTERRUPT
)
121 /* Uses labels 8 and 9 */
122 TRACE_REGS
(%esi
, %esp
, %eax
, %ebx
) /* Uses label 9 */
123 TRACE_STAMP
(%esi
) /* Clobbers %eax, %edx, uses 9 */
129 pushl
%esi
/* pass traptrace record pointer */
130 pushl
%ebp
/* pass struct regs pointer */
131 call
*do_interrupt_common
/* interrupt service routine */
132 addl $
8, %esp
/* pop args off of stack */
134 jmp _sys_rtt_ints_disabled
143 * Declare a uintptr_t which has the size of _interrupt to enable stack
144 * traceback code to know when a regs structure is on the stack.
146 .globl _interrupt_size
149 .NWORD . - _interrupt
150 .type _interrupt_size, @object
163 / If we
're here, we're being called from splx
() to fake
a soft
164 / interrupt
(note that interrupts are still disabled from splx
()).
165 / We execute this code when
a soft interrupt is posted at
166 / level higher than the CPU
's current spl; when spl is lowered in
167 / splx(), it will see the softint and jump here. We'll do exactly
168 / what
a trap would do
: push our flags
, %cs
, %eip
, error code
169 / and trap number
(T_SOFTINT
). The cmnint() code will see T_SOFTINT
170 / and branch to the dosoftint
() code.
175 * In 64-bit mode, iretq -always- pops all five regs
176 * Imitate the 16-byte auto-align of the stack, and the
177 * zero-ed out %ss value.
179 ENTRY_NP
(fakesoftint
)
182 pushq $KDS_SEL
/* %ss */
183 pushq
%r11 /* %rsp */
187 EVENT_MASK_TO_IE
(%rdi
, %r11)
190 pushq $KCS_SEL
/* %cs */
191 leaq fakesoftint_return
(%rip
), %r11
192 pushq
%r11 /* %rip */
194 pushq $T_SOFTINT
/* trap */
196 ALTENTRY
(fakesoftint_return
)
198 SET_SIZE
(fakesoftint_return
)
199 SET_SIZE
(fakesoftint
)
201 #elif defined(__i386)
203 ENTRY_NP
(fakesoftint
)
207 EVENT_MASK_TO_IE
(%edx
, %eax
)
211 pushl $fakesoftint_return
215 ALTENTRY
(fakesoftint_return
)
217 SET_SIZE
(fakesoftint_return
)
218 SET_SIZE
(fakesoftint
)