dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / arch / x86 / kernel / kdi / kdi_idthdl.s
blob90051be9c85212d158fcae1c937709db89405f33
1 /*
2 * CDDL HEADER START
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]
19 * CDDL HEADER END
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
33 * different number.
36 #include <sys/asm_linkage.h>
37 #include <sys/kdi_regs.h>
39 /* Nothing in this file is of interest to lint. */
41 /*
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"
58 this won't assemble
59 #endif
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) \
79 popq %rcx; \
80 popq %r11; \
81 pushq $trapno
83 #define TRAP_ERR(trapno) \
84 popq %rcx; \
85 popq %r11; \
86 pushq $0; \
87 pushq $trapno
89 #else
91 #define TRAP_NOERR(trapno) \
92 push $trapno
94 #define TRAP_ERR(trapno) \
95 push $0; \
96 push $trapno
98 #endif /* __xpv && __amd64 */
101 #define MKIVCT(n) \
102 ENTRY_NP(kdi_ivct##n##); \
103 TRAP_ERR(n); \
104 .align KDI_MSR_PATCHOFF; \
105 KDI_MSR_PATCH; \
106 jmp kdi_cmnint; \
107 SET_SIZE(kdi_ivct##n##)
109 #define MKTRAPHDLR(n) \
110 ENTRY_NP(kdi_trap##n); \
111 TRAP_ERR(n); \
112 .align KDI_MSR_PATCHOFF; \
113 KDI_MSR_PATCH; \
114 jmp kdi_cmnint; \
115 SET_SIZE(kdi_trap##n##)
117 #define MKTRAPERRHDLR(n) \
118 ENTRY_NP(kdi_traperr##n); \
119 TRAP_NOERR(n); \
120 .align KDI_MSR_PATCHOFF; \
121 KDI_MSR_PATCH; \
122 jmp kdi_cmnint; \
123 SET_SIZE(kdi_traperr##n)
125 #define MKNMIHDLR \
126 ENTRY_NP(kdi_int2); \
127 TRAP_NOERR(2); \
128 .align KDI_MSR_PATCHOFF; \
129 KDI_MSR_PATCH; \
130 jmp kdi_nmiint; \
131 SET_SIZE(kdi_int2)
133 #define MKINVALHDLR \
134 ENTRY_NP(kdi_invaltrap); \
135 TRAP_NOERR(255); \
136 .align KDI_MSR_PATCHOFF; \
137 KDI_MSR_PATCH; \
138 jmp kdi_cmnint; \
139 SET_SIZE(kdi_invaltrap)
142 * The handlers themselves
145 MKINVALHDLR
146 MKTRAPHDLR(0)
147 MKTRAPHDLR(1)
148 MKNMIHDLR/*2*/
149 MKTRAPHDLR(3)
150 MKTRAPHDLR(4)
151 MKTRAPHDLR(5)
152 MKTRAPHDLR(6)
153 MKTRAPHDLR(7)
154 MKTRAPHDLR(9)
155 MKTRAPHDLR(15)
156 MKTRAPHDLR(16)
157 MKTRAPHDLR(17)
158 MKTRAPHDLR(18)
159 MKTRAPHDLR(19)
160 MKTRAPHDLR(20)
162 MKTRAPERRHDLR(8)
163 MKTRAPERRHDLR(10)
164 MKTRAPERRHDLR(11)
165 MKTRAPERRHDLR(12)
166 MKTRAPERRHDLR(13)
167 MKTRAPERRHDLR(14)
169 .globl kdi_ivct_size
170 kdi_ivct_size:
171 .NWORD [kdi_ivct33-kdi_ivct32]
173 /* 10 billion and one interrupt handlers */
174 kdi_ivct_base:
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);