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 2007 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #pragma ident "%Z%%M% %I% %E% SMI"
29 * Companion to kdi_idt.c - the implementation of the trap and interrupt
30 * handlers. For the most part, these handlers do the same thing - they
31 * push a trap number onto the stack, followed by a jump to kdi_cmnint.
32 * Each trap and interrupt has its own handler because each one pushes a
36 #include <sys/asm_linkage.h>
37 #include <sys/kdi_regs.h>
39 /* Nothing in this file is of interest to lint. */
42 * The default ASM_ENTRY_ALIGN (16) wastes far too much space. Pay no
43 * attention to the fleet of nop's we're adding to each handler.
45 #undef ASM_ENTRY_ALIGN
46 #define ASM_ENTRY_ALIGN 8
49 * We need the .align in ENTRY_NP (defined to be ASM_ENTRY_ALIGN) to match our
50 * manual .align (KDI_MSR_PATCHOFF) in order to ensure that the space reserved
51 * at the beginning of the handler for code is exactly KDI_MSR_PATCHOFF bytes
52 * long. Note that the #error below isn't supported by the preprocessor invoked
53 * by as(1), and won't stop the build, but it'll emit a noticeable error message
54 * which won't escape the filters.
56 #if ASM_ENTRY_ALIGN != KDI_MSR_PATCHOFF
57 #error "ASM_ENTRY_ALIGN != KDI_MSR_PATCHOFF"
62 * kdi_idt_patch will, on certain processors, replace the patch points below
63 * with MSR-clearing code. kdi_id_patch has intimate knowledge of the size of
64 * the nop hole, as well as the structure of the handlers. Do not change
65 * anything here without also changing kdi_idt_patch.
69 * Generic trap and interrupt handlers.
72 #if defined(__xpv) && defined(__amd64)
75 * The hypervisor places r11 and rcx on the stack.
78 #define TRAP_NOERR(trapno) \
83 #define TRAP_ERR(trapno) \
91 #define TRAP_NOERR(trapno) \
94 #define TRAP_ERR(trapno) \
98 #endif /* __xpv && __amd64 */
102 ENTRY_NP(kdi_ivct##n##); \
104 .align KDI_MSR_PATCHOFF; \
107 SET_SIZE(kdi_ivct##n##)
109 #define MKTRAPHDLR(n) \
110 ENTRY_NP(kdi_trap##n); \
112 .align KDI_MSR_PATCHOFF; \
115 SET_SIZE(kdi_trap##n##)
117 #define MKTRAPERRHDLR(n) \
118 ENTRY_NP(kdi_traperr##n); \
120 .align KDI_MSR_PATCHOFF; \
123 SET_SIZE(kdi_traperr##n)
126 ENTRY_NP(kdi_int2); \
128 .align KDI_MSR_PATCHOFF; \
133 #define MKINVALHDLR \
134 ENTRY_NP(kdi_invaltrap); \
136 .align KDI_MSR_PATCHOFF; \
139 SET_SIZE(kdi_invaltrap)
142 * The handlers themselves
171 .NWORD [kdi_ivct33-kdi_ivct32]
173 /* 10 billion and one interrupt handlers */
175 MKIVCT(32); MKIVCT(33); MKIVCT(34); MKIVCT(35);
176 MKIVCT(36); MKIVCT(37); MKIVCT(38); MKIVCT(39);
177 MKIVCT(40); MKIVCT(41); MKIVCT(42); MKIVCT(43);
178 MKIVCT(44); MKIVCT(45); MKIVCT(46); MKIVCT(47);
179 MKIVCT(48); MKIVCT(49); MKIVCT(50); MKIVCT(51);
180 MKIVCT(52); MKIVCT(53); MKIVCT(54); MKIVCT(55);
181 MKIVCT(56); MKIVCT(57); MKIVCT(58); MKIVCT(59);
182 MKIVCT(60); MKIVCT(61); MKIVCT(62); MKIVCT(63);
183 MKIVCT(64); MKIVCT(65); MKIVCT(66); MKIVCT(67);
184 MKIVCT(68); MKIVCT(69); MKIVCT(70); MKIVCT(71);
185 MKIVCT(72); MKIVCT(73); MKIVCT(74); MKIVCT(75);
186 MKIVCT(76); MKIVCT(77); MKIVCT(78); MKIVCT(79);
187 MKIVCT(80); MKIVCT(81); MKIVCT(82); MKIVCT(83);
188 MKIVCT(84); MKIVCT(85); MKIVCT(86); MKIVCT(87);
189 MKIVCT(88); MKIVCT(89); MKIVCT(90); MKIVCT(91);
190 MKIVCT(92); MKIVCT(93); MKIVCT(94); MKIVCT(95);
191 MKIVCT(96); MKIVCT(97); MKIVCT(98); MKIVCT(99);
192 MKIVCT(100); MKIVCT(101); MKIVCT(102); MKIVCT(103);
193 MKIVCT(104); MKIVCT(105); MKIVCT(106); MKIVCT(107);
194 MKIVCT(108); MKIVCT(109); MKIVCT(110); MKIVCT(111);
195 MKIVCT(112); MKIVCT(113); MKIVCT(114); MKIVCT(115);
196 MKIVCT(116); MKIVCT(117); MKIVCT(118); MKIVCT(119);
197 MKIVCT(120); MKIVCT(121); MKIVCT(122); MKIVCT(123);
198 MKIVCT(124); MKIVCT(125); MKIVCT(126); MKIVCT(127);
199 MKIVCT(128); MKIVCT(129); MKIVCT(130); MKIVCT(131);
200 MKIVCT(132); MKIVCT(133); MKIVCT(134); MKIVCT(135);
201 MKIVCT(136); MKIVCT(137); MKIVCT(138); MKIVCT(139);
202 MKIVCT(140); MKIVCT(141); MKIVCT(142); MKIVCT(143);
203 MKIVCT(144); MKIVCT(145); MKIVCT(146); MKIVCT(147);
204 MKIVCT(148); MKIVCT(149); MKIVCT(150); MKIVCT(151);
205 MKIVCT(152); MKIVCT(153); MKIVCT(154); MKIVCT(155);
206 MKIVCT(156); MKIVCT(157); MKIVCT(158); MKIVCT(159);
207 MKIVCT(160); MKIVCT(161); MKIVCT(162); MKIVCT(163);
208 MKIVCT(164); MKIVCT(165); MKIVCT(166); MKIVCT(167);
209 MKIVCT(168); MKIVCT(169); MKIVCT(170); MKIVCT(171);
210 MKIVCT(172); MKIVCT(173); MKIVCT(174); MKIVCT(175);
211 MKIVCT(176); MKIVCT(177); MKIVCT(178); MKIVCT(179);
212 MKIVCT(180); MKIVCT(181); MKIVCT(182); MKIVCT(183);
213 MKIVCT(184); MKIVCT(185); MKIVCT(186); MKIVCT(187);
214 MKIVCT(188); MKIVCT(189); MKIVCT(190); MKIVCT(191);
215 MKIVCT(192); MKIVCT(193); MKIVCT(194); MKIVCT(195);
216 MKIVCT(196); MKIVCT(197); MKIVCT(198); MKIVCT(199);
217 MKIVCT(200); MKIVCT(201); MKIVCT(202); MKIVCT(203);
218 MKIVCT(204); MKIVCT(205); MKIVCT(206); MKIVCT(207);
219 MKIVCT(208); MKIVCT(209); MKIVCT(210); MKIVCT(211);
220 MKIVCT(212); MKIVCT(213); MKIVCT(214); MKIVCT(215);
221 MKIVCT(216); MKIVCT(217); MKIVCT(218); MKIVCT(219);
222 MKIVCT(220); MKIVCT(221); MKIVCT(222); MKIVCT(223);
223 MKIVCT(224); MKIVCT(225); MKIVCT(226); MKIVCT(227);
224 MKIVCT(228); MKIVCT(229); MKIVCT(230); MKIVCT(231);
225 MKIVCT(232); MKIVCT(233); MKIVCT(234); MKIVCT(235);
226 MKIVCT(236); MKIVCT(237); MKIVCT(238); MKIVCT(239);
227 MKIVCT(240); MKIVCT(241); MKIVCT(242); MKIVCT(243);
228 MKIVCT(244); MKIVCT(245); MKIVCT(246); MKIVCT(247);
229 MKIVCT(248); MKIVCT(249); MKIVCT(250); MKIVCT(251);
230 MKIVCT(252); MKIVCT(253); MKIVCT(254); MKIVCT(255);