Tue Aug 15 09:08:39 2017 UTC ()
Rename intrddb -> intrddbipi, like i386.


(maxv)
diff -r1.26 -r1.27 src/sys/arch/amd64/amd64/db_interface.c
diff -r1.50 -r1.51 src/sys/arch/amd64/amd64/vector.S
diff -r1.61 -r1.62 src/sys/arch/x86/x86/lapic.c

cvs diff -r1.26 -r1.27 src/sys/arch/amd64/amd64/db_interface.c (switch to unified diff)

--- src/sys/arch/amd64/amd64/db_interface.c 2017/08/15 06:57:53 1.26
+++ src/sys/arch/amd64/amd64/db_interface.c 2017/08/15 09:08:39 1.27
@@ -1,324 +1,324 @@ @@ -1,324 +1,324 @@
1/* $NetBSD: db_interface.c,v 1.26 2017/08/15 06:57:53 maxv Exp $ */ 1/* $NetBSD: db_interface.c,v 1.27 2017/08/15 09:08:39 maxv Exp $ */
2 2
3/* 3/*
4 * Mach Operating System 4 * Mach Operating System
5 * Copyright (c) 1991,1990 Carnegie Mellon University 5 * Copyright (c) 1991,1990 Carnegie Mellon University
6 * All Rights Reserved. 6 * All Rights Reserved.
7 * 7 *
8 * Permission to use, copy, modify and distribute this software and its 8 * Permission to use, copy, modify and distribute this software and its
9 * documentation is hereby granted, provided that both the copyright 9 * documentation is hereby granted, provided that both the copyright
10 * notice and this permission notice appear in all copies of the 10 * notice and this permission notice appear in all copies of the
11 * software, derivative works or modified versions, and any portions 11 * software, derivative works or modified versions, and any portions
12 * thereof, and that both notices appear in supporting documentation. 12 * thereof, and that both notices appear in supporting documentation.
13 * 13 *
14 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 14 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
15 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR 15 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
16 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 16 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
17 * 17 *
18 * Carnegie Mellon requests users of this software to return to 18 * Carnegie Mellon requests users of this software to return to
19 * 19 *
20 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 20 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
21 * School of Computer Science 21 * School of Computer Science
22 * Carnegie Mellon University 22 * Carnegie Mellon University
23 * Pittsburgh PA 15213-3890 23 * Pittsburgh PA 15213-3890
24 * 24 *
25 * any improvements or extensions that they make and grant Carnegie the 25 * any improvements or extensions that they make and grant Carnegie the
26 * rights to redistribute these changes. 26 * rights to redistribute these changes.
27 * 27 *
28 * db_interface.c,v 2.4 1991/02/05 17:11:13 mrt (CMU) 28 * db_interface.c,v 2.4 1991/02/05 17:11:13 mrt (CMU)
29 */ 29 */
30 30
31/* 31/*
32 * Interface to new debugger. 32 * Interface to new debugger.
33 */ 33 */
34 34
35#include <sys/cdefs.h> 35#include <sys/cdefs.h>
36__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.26 2017/08/15 06:57:53 maxv Exp $"); 36__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.27 2017/08/15 09:08:39 maxv Exp $");
37 37
38#include "opt_ddb.h" 38#include "opt_ddb.h"
39#include "opt_multiprocessor.h" 39#include "opt_multiprocessor.h"
40 40
41#include "lapic.h" 41#include "lapic.h"
42 42
43#include <sys/param.h> 43#include <sys/param.h>
44#include <sys/proc.h> 44#include <sys/proc.h>
45#include <sys/reboot.h> 45#include <sys/reboot.h>
46#include <sys/systm.h> 46#include <sys/systm.h>
47#include <sys/atomic.h> 47#include <sys/atomic.h>
48#include <sys/cpu.h> 48#include <sys/cpu.h>
49 49
50#include <dev/cons.h> 50#include <dev/cons.h>
51 51
52#include <machine/cpufunc.h> 52#include <machine/cpufunc.h>
53#include <machine/db_machdep.h> 53#include <machine/db_machdep.h>
54#include <machine/cpuvar.h> 54#include <machine/cpuvar.h>
55#include <machine/i82093var.h> 55#include <machine/i82093var.h>
56#include <machine/i82489reg.h> 56#include <machine/i82489reg.h>
57#include <machine/i82489var.h> 57#include <machine/i82489var.h>
58 58
59#include <ddb/db_sym.h> 59#include <ddb/db_sym.h>
60#include <ddb/db_command.h> 60#include <ddb/db_command.h>
61#include <ddb/db_extern.h> 61#include <ddb/db_extern.h>
62#include <ddb/db_access.h> 62#include <ddb/db_access.h>
63#include <ddb/db_output.h> 63#include <ddb/db_output.h>
64#include <ddb/ddbvar.h> 64#include <ddb/ddbvar.h>
65 65
66extern const char *const trap_type[]; 66extern const char *const trap_type[];
67extern int trap_types; 67extern int trap_types;
68 68
69int db_active = 0; 69int db_active = 0;
70db_regs_t ddb_regs; /* register state */ 70db_regs_t ddb_regs; /* register state */
71db_regs_t *ddb_regp = NULL; 71db_regs_t *ddb_regp = NULL;
72 72
73void db_mach_cpu (db_expr_t, bool, db_expr_t, const char *); 73void db_mach_cpu (db_expr_t, bool, db_expr_t, const char *);
74 74
75const struct db_command db_machine_command_table[] = { 75const struct db_command db_machine_command_table[] = {
76#ifdef MULTIPROCESSOR 76#ifdef MULTIPROCESSOR
77 { DDB_ADD_CMD("cpu", db_mach_cpu, 0, 77 { DDB_ADD_CMD("cpu", db_mach_cpu, 0,
78 "switch to another cpu", "cpu-no", NULL) }, 78 "switch to another cpu", "cpu-no", NULL) },
79#endif 79#endif
80 { DDB_ADD_CMD(NULL, NULL, 0, NULL, NULL, NULL) }, 80 { DDB_ADD_CMD(NULL, NULL, 0, NULL, NULL, NULL) },
81}; 81};
82 82
83void kdbprinttrap(int, int); 83void kdbprinttrap(int, int);
84#ifdef MULTIPROCESSOR 84#ifdef MULTIPROCESSOR
85extern void ddb_ipi(struct trapframe); 85extern void ddb_ipi(struct trapframe);
86static void ddb_suspend(struct trapframe *); 86static void ddb_suspend(struct trapframe *);
87#ifndef XEN 87#ifndef XEN
88int ddb_vec; 88int ddb_vec;
89#endif /* XEN */ 89#endif /* XEN */
90static bool ddb_mp_online; 90static bool ddb_mp_online;
91#endif 91#endif
92 92
93#define NOCPU -1 93#define NOCPU -1
94 94
95int ddb_cpu = NOCPU; 95int ddb_cpu = NOCPU;
96 96
97typedef void (vector)(void); 97typedef void (vector)(void);
98extern vector Xintrddb, Xx2apic_intrddb; 98extern vector Xintrddbipi, Xx2apic_intrddbipi;
99 99
100void 100void
101db_machine_init(void) 101db_machine_init(void)
102{ 102{
103 103
104#ifdef MULTIPROCESSOR 104#ifdef MULTIPROCESSOR
105#ifndef XEN 105#ifndef XEN
106 vector *handler = &Xintrddb; 106 vector *handler = &Xintrddbipi;
107#if NLAPIC > 0 107#if NLAPIC > 0
108 if (lapic_is_x2apic()) 108 if (lapic_is_x2apic())
109 handler = &Xx2apic_intrddb; 109 handler = &Xx2apic_intrddbipi;
110#endif 110#endif
111 ddb_vec = idt_vec_alloc(0xf0, 0xff); 111 ddb_vec = idt_vec_alloc(0xf0, 0xff);
112 setgate(&idt[ddb_vec], handler, 1, SDT_SYS386IGT, SEL_KPL, 112 setgate(&idt[ddb_vec], handler, 1, SDT_SYS386IGT, SEL_KPL,
113 GSEL(GCODE_SEL, SEL_KPL)); 113 GSEL(GCODE_SEL, SEL_KPL));
114#else 114#else
115 /* Initialised as part of xen_ipi_init() */ 115 /* Initialised as part of xen_ipi_init() */
116#endif /* XEN */ 116#endif /* XEN */
117#endif 117#endif
118} 118}
119 119
120#ifdef MULTIPROCESSOR 120#ifdef MULTIPROCESSOR
121 121
122__cpu_simple_lock_t db_lock; 122__cpu_simple_lock_t db_lock;
123 123
124static int 124static int
125db_suspend_others(void) 125db_suspend_others(void)
126{ 126{
127 int cpu_me = cpu_number(); 127 int cpu_me = cpu_number();
128 int win; 128 int win;
129 129
130#ifndef XEN 130#ifndef XEN
131 if (ddb_vec == 0) 131 if (ddb_vec == 0)
132 return 1; 132 return 1;
133#endif /* XEN */ 133#endif /* XEN */
134 134
135 __cpu_simple_lock(&db_lock); 135 __cpu_simple_lock(&db_lock);
136 if (ddb_cpu == NOCPU) 136 if (ddb_cpu == NOCPU)
137 ddb_cpu = cpu_me; 137 ddb_cpu = cpu_me;
138 win = (ddb_cpu == cpu_me); 138 win = (ddb_cpu == cpu_me);
139 __cpu_simple_unlock(&db_lock); 139 __cpu_simple_unlock(&db_lock);
140 if (win) { 140 if (win) {
141#ifdef XEN 141#ifdef XEN
142 xen_broadcast_ipi(XEN_IPI_DDB); 142 xen_broadcast_ipi(XEN_IPI_DDB);
143#else 143#else
144 x86_ipi(ddb_vec, LAPIC_DEST_ALLEXCL, LAPIC_DLMODE_FIXED); 144 x86_ipi(ddb_vec, LAPIC_DEST_ALLEXCL, LAPIC_DLMODE_FIXED);
145#endif /* XEN */ 145#endif /* XEN */
146 } 146 }
147 ddb_mp_online = x86_mp_online; 147 ddb_mp_online = x86_mp_online;
148 x86_mp_online = false; 148 x86_mp_online = false;
149 return win; 149 return win;
150} 150}
151 151
152static void 152static void
153db_resume_others(void) 153db_resume_others(void)
154{ 154{
155 CPU_INFO_ITERATOR cii; 155 CPU_INFO_ITERATOR cii;
156 struct cpu_info *ci; 156 struct cpu_info *ci;
157 157
158 x86_mp_online = ddb_mp_online; 158 x86_mp_online = ddb_mp_online;
159 __cpu_simple_lock(&db_lock); 159 __cpu_simple_lock(&db_lock);
160 ddb_cpu = NOCPU; 160 ddb_cpu = NOCPU;
161 __cpu_simple_unlock(&db_lock); 161 __cpu_simple_unlock(&db_lock);
162 162
163 for (CPU_INFO_FOREACH(cii, ci)) { 163 for (CPU_INFO_FOREACH(cii, ci)) {
164 if (ci->ci_flags & CPUF_PAUSE) 164 if (ci->ci_flags & CPUF_PAUSE)
165 atomic_and_32(&ci->ci_flags, ~CPUF_PAUSE); 165 atomic_and_32(&ci->ci_flags, ~CPUF_PAUSE);
166 } 166 }
167} 167}
168 168
169#endif 169#endif
170 170
171/* 171/*
172 * Print trap reason. 172 * Print trap reason.
173 */ 173 */
174void 174void
175kdbprinttrap(int type, int code) 175kdbprinttrap(int type, int code)
176{ 176{
177 db_printf("kernel: "); 177 db_printf("kernel: ");
178 if (type >= trap_types || type < 0) 178 if (type >= trap_types || type < 0)
179 db_printf("type %d", type); 179 db_printf("type %d", type);
180 else 180 else
181 db_printf("%s", trap_type[type]); 181 db_printf("%s", trap_type[type]);
182 db_printf(" trap, code=%x\n", code); 182 db_printf(" trap, code=%x\n", code);
183} 183}
184 184
185/* 185/*
186 * kdb_trap - field a TRACE or BPT trap 186 * kdb_trap - field a TRACE or BPT trap
187 */ 187 */
188int 188int
189kdb_trap(int type, int code, db_regs_t *regs) 189kdb_trap(int type, int code, db_regs_t *regs)
190{ 190{
191 int s; 191 int s;
192 db_regs_t dbreg; 192 db_regs_t dbreg;
193 193
194 switch (type) { 194 switch (type) {
195 case T_NMI: /* NMI */ 195 case T_NMI: /* NMI */
196 printf("NMI ... going to debugger\n"); 196 printf("NMI ... going to debugger\n");
197 /*FALLTHROUGH*/ 197 /*FALLTHROUGH*/
198 case T_BPTFLT: /* breakpoint */ 198 case T_BPTFLT: /* breakpoint */
199 case T_TRCTRAP: /* single_step */ 199 case T_TRCTRAP: /* single_step */
200 case -1: /* keyboard interrupt */ 200 case -1: /* keyboard interrupt */
201 break; 201 break;
202 default: 202 default:
203 if (!db_onpanic && db_recover == 0) 203 if (!db_onpanic && db_recover == 0)
204 return (0); 204 return (0);
205 205
206 kdbprinttrap(type, code); 206 kdbprinttrap(type, code);
207 if (db_recover != 0) { 207 if (db_recover != 0) {
208 db_error("Faulted in DDB; continuing...\n"); 208 db_error("Faulted in DDB; continuing...\n");
209 /*NOTREACHED*/ 209 /*NOTREACHED*/
210 } 210 }
211 } 211 }
212 212
213#ifdef MULTIPROCESSOR 213#ifdef MULTIPROCESSOR
214 if (!db_suspend_others()) { 214 if (!db_suspend_others()) {
215 ddb_suspend(regs); 215 ddb_suspend(regs);
216 } else { 216 } else {
217 curcpu()->ci_ddb_regs = &dbreg; 217 curcpu()->ci_ddb_regs = &dbreg;
218 ddb_regp = &dbreg; 218 ddb_regp = &dbreg;
219#endif 219#endif
220 220
221 ddb_regs = *regs; 221 ddb_regs = *regs;
222 222
223 ddb_regs.tf_cs &= 0xffff; 223 ddb_regs.tf_cs &= 0xffff;
224 ddb_regs.tf_ds &= 0xffff; 224 ddb_regs.tf_ds &= 0xffff;
225 ddb_regs.tf_es &= 0xffff; 225 ddb_regs.tf_es &= 0xffff;
226 ddb_regs.tf_fs &= 0xffff; 226 ddb_regs.tf_fs &= 0xffff;
227 ddb_regs.tf_gs &= 0xffff; 227 ddb_regs.tf_gs &= 0xffff;
228 ddb_regs.tf_ss &= 0xffff; 228 ddb_regs.tf_ss &= 0xffff;
229 229
230 s = splhigh(); 230 s = splhigh();
231 db_active++; 231 db_active++;
232 cnpollc(true); 232 cnpollc(true);
233 db_trap(type, code); 233 db_trap(type, code);
234 cnpollc(false); 234 cnpollc(false);
235 db_active--; 235 db_active--;
236 splx(s); 236 splx(s);
237#ifdef MULTIPROCESSOR 237#ifdef MULTIPROCESSOR
238 db_resume_others(); 238 db_resume_others();
239 } 239 }
240#endif 240#endif
241 ddb_regp = &dbreg; 241 ddb_regp = &dbreg;
242 242
243 *regs = ddb_regs; 243 *regs = ddb_regs;
244 244
245 return (1); 245 return (1);
246} 246}
247 247
248void 248void
249cpu_Debugger(void) 249cpu_Debugger(void)
250{ 250{
251 breakpoint(); 251 breakpoint();
252} 252}
253 253
254#ifdef MULTIPROCESSOR 254#ifdef MULTIPROCESSOR
255 255
256/* 256/*
257 * Called when we receive a debugger IPI (inter-processor interrupt). 257 * Called when we receive a debugger IPI (inter-processor interrupt).
258 * As with trap() in trap.c, this function is called from an assembly 258 * As with trap() in trap.c, this function is called from an assembly
259 * language IDT gate entry routine which prepares a suitable stack frame, 259 * language IDT gate entry routine which prepares a suitable stack frame,
260 * and restores this frame after the exception has been processed. Note 260 * and restores this frame after the exception has been processed. Note
261 * that the effect is as if the arguments were passed call by reference. 261 * that the effect is as if the arguments were passed call by reference.
262 */ 262 */
263 263
264void 264void
265ddb_ipi(struct trapframe frame) 265ddb_ipi(struct trapframe frame)
266{ 266{
267 267
268 ddb_suspend(&frame); 268 ddb_suspend(&frame);
269} 269}
270 270
271static void 271static void
272ddb_suspend(struct trapframe *frame) 272ddb_suspend(struct trapframe *frame)
273{ 273{
274 volatile struct cpu_info *ci = curcpu(); 274 volatile struct cpu_info *ci = curcpu();
275 db_regs_t regs; 275 db_regs_t regs;
276 276
277 regs = *frame; 277 regs = *frame;
278 278
279 ci->ci_ddb_regs = &regs; 279 ci->ci_ddb_regs = &regs;
280 280
281 atomic_or_32(&ci->ci_flags, CPUF_PAUSE); 281 atomic_or_32(&ci->ci_flags, CPUF_PAUSE);
282 282
283 while (ci->ci_flags & CPUF_PAUSE) 283 while (ci->ci_flags & CPUF_PAUSE)
284 ; 284 ;
285 ci->ci_ddb_regs = 0; 285 ci->ci_ddb_regs = 0;
286 tlbflushg(); 286 tlbflushg();
287} 287}
288 288
289 289
290extern void cpu_debug_dump(void); /* XXX */ 290extern void cpu_debug_dump(void); /* XXX */
291 291
292void 292void
293db_mach_cpu(db_expr_t addr, bool have_addr, db_expr_t count, const char *modif) 293db_mach_cpu(db_expr_t addr, bool have_addr, db_expr_t count, const char *modif)
294{ 294{
295 struct cpu_info *ci; 295 struct cpu_info *ci;
296 if (!have_addr) { 296 if (!have_addr) {
297 cpu_debug_dump(); 297 cpu_debug_dump();
298 return; 298 return;
299 } 299 }
300 300
301 if (addr < 0) { 301 if (addr < 0) {
302 db_printf("%ld: CPU out of range\n", addr); 302 db_printf("%ld: CPU out of range\n", addr);
303 return; 303 return;
304 } 304 }
305 ci = cpu_lookup(addr); 305 ci = cpu_lookup(addr);
306 if (ci == NULL) { 306 if (ci == NULL) {
307 db_printf("CPU %ld not configured\n", addr); 307 db_printf("CPU %ld not configured\n", addr);
308 return; 308 return;
309 } 309 }
310 if (ci != curcpu()) { 310 if (ci != curcpu()) {
311 if (!(ci->ci_flags & CPUF_PAUSE)) { 311 if (!(ci->ci_flags & CPUF_PAUSE)) {
312 db_printf("CPU %ld not paused\n", addr); 312 db_printf("CPU %ld not paused\n", addr);
313 return; 313 return;
314 } 314 }
315 } 315 }
316 if (ci->ci_ddb_regs == 0) { 316 if (ci->ci_ddb_regs == 0) {
317 db_printf("CPU %ld has no saved regs\n", addr); 317 db_printf("CPU %ld has no saved regs\n", addr);
318 return; 318 return;
319 } 319 }
320 db_printf("using CPU %ld", addr); 320 db_printf("using CPU %ld", addr);
321 ddb_regp = ci->ci_ddb_regs; 321 ddb_regp = ci->ci_ddb_regs;
322} 322}
323 323
324#endif 324#endif

cvs diff -r1.50 -r1.51 src/sys/arch/amd64/amd64/vector.S (switch to unified diff)

--- src/sys/arch/amd64/amd64/vector.S 2017/07/16 14:02:48 1.50
+++ src/sys/arch/amd64/amd64/vector.S 2017/08/15 09:08:39 1.51
@@ -1,976 +1,976 @@ @@ -1,976 +1,976 @@
1/* $NetBSD: vector.S,v 1.50 2017/07/16 14:02:48 cherry Exp $ */ 1/* $NetBSD: vector.S,v 1.51 2017/08/15 09:08:39 maxv Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1998, 2007, 2008 The NetBSD Foundation, Inc. 4 * Copyright (c) 1998, 2007, 2008 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Charles M. Hannum and by Andrew Doran. 8 * by Charles M. Hannum and by Andrew Doran.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright 15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the 16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution. 17 * documentation and/or other materials provided with the distribution.
18 * 18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 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 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 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 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 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 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 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32/* 32/*
33 * Copyright (c) 2001 Wasabi Systems, Inc. 33 * Copyright (c) 2001 Wasabi Systems, Inc.
34 * All rights reserved. 34 * All rights reserved.
35 * 35 *
36 * Written by Frank van der Linden for Wasabi Systems, Inc. 36 * Written by Frank van der Linden for Wasabi Systems, Inc.
37 * 37 *
38 * Redistribution and use in source and binary forms, with or without 38 * Redistribution and use in source and binary forms, with or without
39 * modification, are permitted provided that the following conditions 39 * modification, are permitted provided that the following conditions
40 * are met: 40 * are met:
41 * 1. Redistributions of source code must retain the above copyright 41 * 1. Redistributions of source code must retain the above copyright
42 * notice, this list of conditions and the following disclaimer. 42 * notice, this list of conditions and the following disclaimer.
43 * 2. Redistributions in binary form must reproduce the above copyright 43 * 2. Redistributions in binary form must reproduce the above copyright
44 * notice, this list of conditions and the following disclaimer in the 44 * notice, this list of conditions and the following disclaimer in the
45 * documentation and/or other materials provided with the distribution. 45 * documentation and/or other materials provided with the distribution.
46 * 3. All advertising materials mentioning features or use of this software 46 * 3. All advertising materials mentioning features or use of this software
47 * must display the following acknowledgement: 47 * must display the following acknowledgement:
48 * This product includes software developed for the NetBSD Project by 48 * This product includes software developed for the NetBSD Project by
49 * Wasabi Systems, Inc. 49 * Wasabi Systems, Inc.
50 * 4. The name of Wasabi Systems, Inc. may not be used to endorse 50 * 4. The name of Wasabi Systems, Inc. may not be used to endorse
51 * or promote products derived from this software without specific prior 51 * or promote products derived from this software without specific prior
52 * written permission. 52 * written permission.
53 * 53 *
54 * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND 54 * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
55 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 55 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
56 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 56 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
57 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC 57 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
58 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 58 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
59 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 59 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
60 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 60 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
61 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 61 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
62 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 62 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
63 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 63 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
64 * POSSIBILITY OF SUCH DAMAGE. 64 * POSSIBILITY OF SUCH DAMAGE.
65 */ 65 */
66 66
67#include <machine/asm.h> 67#include <machine/asm.h>
68 68
69#include "opt_ddb.h" 69#include "opt_ddb.h"
70#include "opt_multiprocessor.h" 70#include "opt_multiprocessor.h"
71#include "opt_xen.h" 71#include "opt_xen.h"
72#include "opt_dtrace.h" 72#include "opt_dtrace.h"
73 73
74#define ALIGN_TEXT .align 16,0x90 74#define ALIGN_TEXT .align 16,0x90
75 75
76#include <machine/i8259.h> 76#include <machine/i8259.h>
77#include <machine/i82093reg.h> 77#include <machine/i82093reg.h>
78#include <machine/i82489reg.h> 78#include <machine/i82489reg.h>
79#include <machine/frameasm.h> 79#include <machine/frameasm.h>
80#include <machine/segments.h> 80#include <machine/segments.h>
81#include <machine/trap.h> 81#include <machine/trap.h>
82#include <machine/specialreg.h> 82#include <machine/specialreg.h>
83 83
84#include "ioapic.h" 84#include "ioapic.h"
85#include "lapic.h" 85#include "lapic.h"
86#include "assym.h" 86#include "assym.h"
87 87
88#include "amd64_trap.S" 88#include "amd64_trap.S"
89 89
90/*****************************************************************************/ 90/*****************************************************************************/
91 91
92#define __HAVE_GENERIC_SOFT_INTERRUPTS /* XXX */ 92#define __HAVE_GENERIC_SOFT_INTERRUPTS /* XXX */
93 93
94/* 94/*
95 * Macros for interrupt entry, call to handler, and exit. 95 * Macros for interrupt entry, call to handler, and exit.
96 * 96 *
97 * XXX 97 * XXX
98 * The interrupt frame is set up to look like a trap frame. This may be a 98 * The interrupt frame is set up to look like a trap frame. This may be a
99 * waste. The only handler which needs a frame is the clock handler, and it 99 * waste. The only handler which needs a frame is the clock handler, and it
100 * only needs a few bits. Xdoreti() needs a trap frame for handling ASTs, but 100 * only needs a few bits. Xdoreti() needs a trap frame for handling ASTs, but
101 * it could easily convert the frame on demand. 101 * it could easily convert the frame on demand.
102 * 102 *
103 * The direct costs of setting up a trap frame are two pushq's (error code and 103 * The direct costs of setting up a trap frame are two pushq's (error code and
104 * trap number), an addl to get rid of these, and pushing and popping the 104 * trap number), an addl to get rid of these, and pushing and popping the
105 * callee-saved registers %esi, %edi, %ebx, and %ebp twice. 105 * callee-saved registers %esi, %edi, %ebx, and %ebp twice.
106 * 106 *
107 * If the interrupt frame is made more flexible, INTR can push %eax first and 107 * If the interrupt frame is made more flexible, INTR can push %eax first and
108 * decide the ipending case with less overhead, e.g., by avoiding loading the 108 * decide the ipending case with less overhead, e.g., by avoiding loading the
109 * segment registers. 109 * segment registers.
110 */ 110 */
111 111
112#if NLAPIC > 0 112#if NLAPIC > 0
113#ifdef MULTIPROCESSOR 113#ifdef MULTIPROCESSOR
114IDTVEC(recurse_lapic_ipi) 114IDTVEC(recurse_lapic_ipi)
115 INTR_RECURSE_HWFRAME 115 INTR_RECURSE_HWFRAME
116 pushq $0 116 pushq $0
117 pushq $T_ASTFLT 117 pushq $T_ASTFLT
118 INTRENTRY 118 INTRENTRY
119 jmp 1f 119 jmp 1f
120IDTVEC_END(recurse_lapic_ipi) 120IDTVEC_END(recurse_lapic_ipi)
121IDTVEC(intr_x2apic_ipi) 121IDTVEC(intr_x2apic_ipi)
122 pushq $0 122 pushq $0
123 pushq $T_ASTFLT 123 pushq $T_ASTFLT
124 INTRENTRY 124 INTRENTRY
125 movl $(MSR_X2APIC_BASE + MSR_X2APIC_EOI),%ecx 125 movl $(MSR_X2APIC_BASE + MSR_X2APIC_EOI),%ecx
126 xorl %eax,%eax 126 xorl %eax,%eax
127 xorl %edx,%edx 127 xorl %edx,%edx
128 wrmsr 128 wrmsr
129 movl CPUVAR(ILEVEL),%ebx 129 movl CPUVAR(ILEVEL),%ebx
130 cmpl $IPL_HIGH,%ebx 130 cmpl $IPL_HIGH,%ebx
131 jae 2f 131 jae 2f
132 jmp 1f 132 jmp 1f
133IDTVEC_END(intr_x2apic_ipi) 133IDTVEC_END(intr_x2apic_ipi)
134IDTVEC(intr_lapic_ipi) 134IDTVEC(intr_lapic_ipi)
135 pushq $0 135 pushq $0
136 pushq $T_ASTFLT 136 pushq $T_ASTFLT
137 INTRENTRY 137 INTRENTRY
138 movq _C_LABEL(local_apic_va),%rbx 138 movq _C_LABEL(local_apic_va),%rbx
139 movl $0,LAPIC_EOI(%rbx) 139 movl $0,LAPIC_EOI(%rbx)
140 movl CPUVAR(ILEVEL),%ebx 140 movl CPUVAR(ILEVEL),%ebx
141 cmpl $IPL_HIGH,%ebx 141 cmpl $IPL_HIGH,%ebx
142 jae 2f 142 jae 2f
143IDTVEC_END(intr_lapic_ipi) 143IDTVEC_END(intr_lapic_ipi)
144IDTVEC(resume_lapic_ipi) 144IDTVEC(resume_lapic_ipi)
1451: 1451:
146 incl CPUVAR(IDEPTH) 146 incl CPUVAR(IDEPTH)
147 movl $IPL_HIGH,CPUVAR(ILEVEL) 147 movl $IPL_HIGH,CPUVAR(ILEVEL)
148 sti 148 sti
149 pushq %rbx 149 pushq %rbx
150 call _C_LABEL(x86_ipi_handler) 150 call _C_LABEL(x86_ipi_handler)
151 jmp _C_LABEL(Xdoreti) 151 jmp _C_LABEL(Xdoreti)
1522: 1522:
153 orl $(1 << LIR_IPI),CPUVAR(IPENDING) 153 orl $(1 << LIR_IPI),CPUVAR(IPENDING)
154 INTRFASTEXIT 154 INTRFASTEXIT
155IDTVEC_END(resume_lapic_ipi) 155IDTVEC_END(resume_lapic_ipi)
156 156
157#if defined(DDB) 157#if defined(DDB)
158IDTVEC(intrddb) 158IDTVEC(intrddbipi)
1591: 1591:
160 pushq $0 160 pushq $0
161 pushq $T_BPTFLT 161 pushq $T_BPTFLT
162 INTRENTRY 162 INTRENTRY
163 movl $0xf,%eax 163 movl $0xf,%eax
164 movq %rax,%cr8 164 movq %rax,%cr8
165 movq _C_LABEL(local_apic_va),%rbx 165 movq _C_LABEL(local_apic_va),%rbx
166 movl $0,LAPIC_EOI(%rbx) 166 movl $0,LAPIC_EOI(%rbx)
167 sti 167 sti
168 call _C_LABEL(ddb_ipi) 168 call _C_LABEL(ddb_ipi)
169 xorl %eax,%eax 169 xorl %eax,%eax
170 movq %rax,%cr8 170 movq %rax,%cr8
171 INTRFASTEXIT 171 INTRFASTEXIT
172IDTVEC_END(intrddb) 172IDTVEC_END(intrddbipi)
173 173
174IDTVEC(x2apic_intrddb) 174IDTVEC(x2apic_intrddbipi)
1751: 1751:
176 pushq $0 176 pushq $0
177 pushq $T_BPTFLT 177 pushq $T_BPTFLT
178 INTRENTRY 178 INTRENTRY
179 movl $0xf,%eax 179 movl $0xf,%eax
180 movq %rax,%cr8 180 movq %rax,%cr8
181 movl $(MSR_X2APIC_BASE + MSR_X2APIC_EOI),%ecx 181 movl $(MSR_X2APIC_BASE + MSR_X2APIC_EOI),%ecx
182 xorl %eax,%eax 182 xorl %eax,%eax
183 xorl %edx,%edx 183 xorl %edx,%edx
184 wrmsr 184 wrmsr
185 sti 185 sti
186 call _C_LABEL(ddb_ipi) 186 call _C_LABEL(ddb_ipi)
187 xorl %eax,%eax 187 xorl %eax,%eax
188 movq %rax,%cr8 188 movq %rax,%cr8
189 INTRFASTEXIT 189 INTRFASTEXIT
190IDTVEC_END(x2apic_intrddb) 190IDTVEC_END(x2apic_intrddbipi)
191#endif /* DDB */ 191#endif /* DDB */
192#endif /* MULTIPROCESSOR */ 192#endif /* MULTIPROCESSOR */
193 193
194 /* 194 /*
195 * Interrupt from the local APIC timer. 195 * Interrupt from the local APIC timer.
196 */ 196 */
197IDTVEC(recurse_lapic_ltimer) 197IDTVEC(recurse_lapic_ltimer)
198 INTR_RECURSE_HWFRAME 198 INTR_RECURSE_HWFRAME
199 pushq $0 199 pushq $0
200 pushq $T_ASTFLT 200 pushq $T_ASTFLT
201 INTRENTRY 201 INTRENTRY
202 jmp 1f 202 jmp 1f
203IDTVEC_END(recurse_lapic_ltimer) 203IDTVEC_END(recurse_lapic_ltimer)
204IDTVEC(intr_x2apic_ltimer) 204IDTVEC(intr_x2apic_ltimer)
205 pushq $0 205 pushq $0
206 pushq $T_ASTFLT 206 pushq $T_ASTFLT
207 INTRENTRY 207 INTRENTRY
208 movl $(MSR_X2APIC_BASE + MSR_X2APIC_EOI),%ecx 208 movl $(MSR_X2APIC_BASE + MSR_X2APIC_EOI),%ecx
209 xorl %eax,%eax 209 xorl %eax,%eax
210 xorl %edx,%edx 210 xorl %edx,%edx
211 wrmsr 211 wrmsr
212 movl CPUVAR(ILEVEL),%ebx 212 movl CPUVAR(ILEVEL),%ebx
213 cmpl $IPL_CLOCK,%ebx 213 cmpl $IPL_CLOCK,%ebx
214 jae 2f 214 jae 2f
215 jmp 1f 215 jmp 1f
216IDTVEC_END(intr_x2apic_ltimer) 216IDTVEC_END(intr_x2apic_ltimer)
217IDTVEC(intr_lapic_ltimer) 217IDTVEC(intr_lapic_ltimer)
218 pushq $0 218 pushq $0
219 pushq $T_ASTFLT 219 pushq $T_ASTFLT
220 INTRENTRY 220 INTRENTRY
221 movq _C_LABEL(local_apic_va),%rbx 221 movq _C_LABEL(local_apic_va),%rbx
222 movl $0,LAPIC_EOI(%rbx) 222 movl $0,LAPIC_EOI(%rbx)
223 movl CPUVAR(ILEVEL),%ebx 223 movl CPUVAR(ILEVEL),%ebx
224 cmpl $IPL_CLOCK,%ebx 224 cmpl $IPL_CLOCK,%ebx
225 jae 2f 225 jae 2f
226IDTVEC_END(intr_lapic_ltimer) 226IDTVEC_END(intr_lapic_ltimer)
227IDTVEC(resume_lapic_ltimer) 227IDTVEC(resume_lapic_ltimer)
2281: 2281:
229 incl CPUVAR(IDEPTH) 229 incl CPUVAR(IDEPTH)
230 movl $IPL_CLOCK,CPUVAR(ILEVEL) 230 movl $IPL_CLOCK,CPUVAR(ILEVEL)
231 sti 231 sti
232 pushq %rbx 232 pushq %rbx
233 movq %rsp,%rsi 233 movq %rsp,%rsi
234 xorq %rdi,%rdi 234 xorq %rdi,%rdi
235 call _C_LABEL(lapic_clockintr) 235 call _C_LABEL(lapic_clockintr)
236 jmp _C_LABEL(Xdoreti) 236 jmp _C_LABEL(Xdoreti)
2372: 2372:
238 orl $(1 << LIR_TIMER),CPUVAR(IPENDING) 238 orl $(1 << LIR_TIMER),CPUVAR(IPENDING)
239 INTRFASTEXIT 239 INTRFASTEXIT
240IDTVEC_END(resume_lapic_ltimer) 240IDTVEC_END(resume_lapic_ltimer)
241#endif /* NLAPIC > 0 */ 241#endif /* NLAPIC > 0 */
242 242
243#ifndef XEN 243#ifndef XEN
244/* 244/*
245 * TLB shootdown handler. 245 * TLB shootdown handler.
246 */ 246 */
247IDTVEC(intr_lapic_tlb) 247IDTVEC(intr_lapic_tlb)
248 pushq $0 248 pushq $0
249 pushq $T_ASTFLT 249 pushq $T_ASTFLT
250 INTRENTRY 250 INTRENTRY
251 movq _C_LABEL(local_apic_va),%rax 251 movq _C_LABEL(local_apic_va),%rax
252 movl $0,LAPIC_EOI(%rax) 252 movl $0,LAPIC_EOI(%rax)
253 callq _C_LABEL(pmap_tlb_intr) 253 callq _C_LABEL(pmap_tlb_intr)
254 INTRFASTEXIT 254 INTRFASTEXIT
255IDTVEC_END(intr_lapic_tlb) 255IDTVEC_END(intr_lapic_tlb)
256 256
257IDTVEC(intr_x2apic_tlb) 257IDTVEC(intr_x2apic_tlb)
258 pushq $0 258 pushq $0
259 pushq $T_ASTFLT 259 pushq $T_ASTFLT
260 INTRENTRY 260 INTRENTRY
261 movl $(MSR_X2APIC_BASE + MSR_X2APIC_EOI),%ecx 261 movl $(MSR_X2APIC_BASE + MSR_X2APIC_EOI),%ecx
262 xorl %eax,%eax 262 xorl %eax,%eax
263 xorl %edx,%edx 263 xorl %edx,%edx
264 wrmsr 264 wrmsr
265 callq _C_LABEL(pmap_tlb_intr) 265 callq _C_LABEL(pmap_tlb_intr)
266 INTRFASTEXIT 266 INTRFASTEXIT
267IDTVEC_END(intr_x2apic_tlb) 267IDTVEC_END(intr_x2apic_tlb)
268 268
269#endif /* !XEN */ 269#endif /* !XEN */
270 270
271#define voidop(num) 271#define voidop(num)
272 272
273#ifndef XEN 273#ifndef XEN
274 274
275/* 275/*
276 * This macro defines the generic stub code. Its arguments modifiy it 276 * This macro defines the generic stub code. Its arguments modifiy it
277 * for specific PICs. 277 * for specific PICs.
278 */ 278 */
279 279
280#define INTRSTUB(name, num, early_ack, late_ack, mask, unmask, level_mask) \ 280#define INTRSTUB(name, num, early_ack, late_ack, mask, unmask, level_mask) \
281IDTVEC(recurse_ ## name ## num) ;\ 281IDTVEC(recurse_ ## name ## num) ;\
282 INTR_RECURSE_HWFRAME ;\ 282 INTR_RECURSE_HWFRAME ;\
283 subq $8,%rsp ;\ 283 subq $8,%rsp ;\
284 pushq $T_ASTFLT /* trap # for doing ASTs */ ;\ 284 pushq $T_ASTFLT /* trap # for doing ASTs */ ;\
285 INTRENTRY ;\ 285 INTRENTRY ;\
286IDTVEC(resume_ ## name ## num) \ 286IDTVEC(resume_ ## name ## num) \
287 movq $IREENT_MAGIC,TF_ERR(%rsp) ;\ 287 movq $IREENT_MAGIC,TF_ERR(%rsp) ;\
288 movl %ebx,%r13d ;\ 288 movl %ebx,%r13d ;\
289 movq CPUVAR(ISOURCES) + (num) * 8,%r14 ;\ 289 movq CPUVAR(ISOURCES) + (num) * 8,%r14 ;\
290 movl IS_MAXLEVEL(%r14),%ebx ;\ 290 movl IS_MAXLEVEL(%r14),%ebx ;\
291 jmp 1f ;\ 291 jmp 1f ;\
292IDTVEC(intr_ ## name ## num) ;\ 292IDTVEC(intr_ ## name ## num) ;\
293 pushq $0 /* dummy error code */ ;\ 293 pushq $0 /* dummy error code */ ;\
294 pushq $T_ASTFLT /* trap # for doing ASTs */ ;\ 294 pushq $T_ASTFLT /* trap # for doing ASTs */ ;\
295 INTRENTRY ;\ 295 INTRENTRY ;\
296 movq CPUVAR(ISOURCES) + (num) * 8,%r14 ;\ 296 movq CPUVAR(ISOURCES) + (num) * 8,%r14 ;\
297 mask(num) /* mask it in hardware */ ;\ 297 mask(num) /* mask it in hardware */ ;\
298 early_ack(num) /* and allow other intrs */ ;\ 298 early_ack(num) /* and allow other intrs */ ;\
299 testq %r14,%r14 ;\ 299 testq %r14,%r14 ;\
300 jz 9f /* stray */ ;\ 300 jz 9f /* stray */ ;\
301 movl IS_MAXLEVEL(%r14),%ebx ;\ 301 movl IS_MAXLEVEL(%r14),%ebx ;\
302 movl CPUVAR(ILEVEL),%r13d ;\ 302 movl CPUVAR(ILEVEL),%r13d ;\
303 cmpl %ebx,%r13d ;\ 303 cmpl %ebx,%r13d ;\
304 jae 10f /* currently masked; hold it */ ;\ 304 jae 10f /* currently masked; hold it */ ;\
305 incq CPUVAR(NINTR) /* statistical info */ ;\ 305 incq CPUVAR(NINTR) /* statistical info */ ;\
306 incq IS_EVCNT(%r14) ;\ 306 incq IS_EVCNT(%r14) ;\
3071: \ 3071: \
308 pushq %r13 /* save for Xdoreti */ ;\ 308 pushq %r13 /* save for Xdoreti */ ;\
309 movl %ebx,CPUVAR(ILEVEL) ;\ 309 movl %ebx,CPUVAR(ILEVEL) ;\
310 sti ;\ 310 sti ;\
311 incl CPUVAR(IDEPTH) ;\ 311 incl CPUVAR(IDEPTH) ;\
312 movq IS_HANDLERS(%r14),%rbx ;\ 312 movq IS_HANDLERS(%r14),%rbx ;\
3136: \ 3136: \
314 movl IH_LEVEL(%rbx),%r12d ;\ 314 movl IH_LEVEL(%rbx),%r12d ;\
315 cmpl %r13d,%r12d ;\ 315 cmpl %r13d,%r12d ;\
316 jle 7f ;\ 316 jle 7f ;\
317 movq %rsp,%rsi ;\ 317 movq %rsp,%rsi ;\
318 movq IH_ARG(%rbx),%rdi ;\ 318 movq IH_ARG(%rbx),%rdi ;\
319 movl %r12d,CPUVAR(ILEVEL) ;\ 319 movl %r12d,CPUVAR(ILEVEL) ;\
320 call *IH_FUN(%rbx) /* call it */ ;\ 320 call *IH_FUN(%rbx) /* call it */ ;\
321 movq IH_NEXT(%rbx),%rbx /* next handler in chain */ ;\ 321 movq IH_NEXT(%rbx),%rbx /* next handler in chain */ ;\
322 testq %rbx,%rbx ;\ 322 testq %rbx,%rbx ;\
323 jnz 6b ;\ 323 jnz 6b ;\
3245: \ 3245: \
325 cli ;\ 325 cli ;\
326 unmask(num) /* unmask it in hardware */ ;\ 326 unmask(num) /* unmask it in hardware */ ;\
327 late_ack(num) ;\ 327 late_ack(num) ;\
328 sti ;\ 328 sti ;\
329 jmp _C_LABEL(Xdoreti) /* lower spl and do ASTs */ ;\ 329 jmp _C_LABEL(Xdoreti) /* lower spl and do ASTs */ ;\
3307: \ 3307: \
331 cli ;\ 331 cli ;\
332 orl $(1 << num),CPUVAR(IPENDING) ;\ 332 orl $(1 << num),CPUVAR(IPENDING) ;\
333 level_mask(num) ;\ 333 level_mask(num) ;\
334 late_ack(num) ;\ 334 late_ack(num) ;\
335 sti ;\ 335 sti ;\
336 jmp _C_LABEL(Xdoreti) /* lower spl and do ASTs */ ;\ 336 jmp _C_LABEL(Xdoreti) /* lower spl and do ASTs */ ;\
33710: \ 33710: \
338 cli ;\ 338 cli ;\
339 orl $(1 << num),CPUVAR(IPENDING) ;\ 339 orl $(1 << num),CPUVAR(IPENDING) ;\
340 level_mask(num) ;\ 340 level_mask(num) ;\
341 late_ack(num) ;\ 341 late_ack(num) ;\
342 INTRFASTEXIT ;\ 342 INTRFASTEXIT ;\
3439: \ 3439: \
344 unmask(num) ;\ 344 unmask(num) ;\
345 late_ack(num) ;\ 345 late_ack(num) ;\
346 INTRFASTEXIT 346 INTRFASTEXIT
347 347
348#define ICUADDR IO_ICU1 348#define ICUADDR IO_ICU1
349 349
350INTRSTUB(legacy,0,i8259_asm_ack1,voidop,i8259_asm_mask,i8259_asm_unmask, 350INTRSTUB(legacy,0,i8259_asm_ack1,voidop,i8259_asm_mask,i8259_asm_unmask,
351 voidop) 351 voidop)
352INTRSTUB(legacy,1,i8259_asm_ack1,voidop,i8259_asm_mask,i8259_asm_unmask, 352INTRSTUB(legacy,1,i8259_asm_ack1,voidop,i8259_asm_mask,i8259_asm_unmask,
353 voidop) 353 voidop)
354INTRSTUB(legacy,2,i8259_asm_ack1,voidop,i8259_asm_mask,i8259_asm_unmask, 354INTRSTUB(legacy,2,i8259_asm_ack1,voidop,i8259_asm_mask,i8259_asm_unmask,
355 voidop) 355 voidop)
356INTRSTUB(legacy,3,i8259_asm_ack1,voidop,i8259_asm_mask,i8259_asm_unmask, 356INTRSTUB(legacy,3,i8259_asm_ack1,voidop,i8259_asm_mask,i8259_asm_unmask,
357 voidop) 357 voidop)
358INTRSTUB(legacy,4,i8259_asm_ack1,voidop,i8259_asm_mask,i8259_asm_unmask, 358INTRSTUB(legacy,4,i8259_asm_ack1,voidop,i8259_asm_mask,i8259_asm_unmask,
359 voidop) 359 voidop)
360INTRSTUB(legacy,5,i8259_asm_ack1,voidop,i8259_asm_mask,i8259_asm_unmask, 360INTRSTUB(legacy,5,i8259_asm_ack1,voidop,i8259_asm_mask,i8259_asm_unmask,
361 voidop) 361 voidop)
362INTRSTUB(legacy,6,i8259_asm_ack1,voidop,i8259_asm_mask,i8259_asm_unmask, 362INTRSTUB(legacy,6,i8259_asm_ack1,voidop,i8259_asm_mask,i8259_asm_unmask,
363 voidop) 363 voidop)
364INTRSTUB(legacy,7,i8259_asm_ack1,voidop,i8259_asm_mask,i8259_asm_unmask, 364INTRSTUB(legacy,7,i8259_asm_ack1,voidop,i8259_asm_mask,i8259_asm_unmask,
365 voidop) 365 voidop)
366#undef ICUADDR 366#undef ICUADDR
367#define ICUADDR IO_ICU2 367#define ICUADDR IO_ICU2
368 368
369INTRSTUB(legacy,8,i8259_asm_ack2,voidop,i8259_asm_mask,i8259_asm_unmask, 369INTRSTUB(legacy,8,i8259_asm_ack2,voidop,i8259_asm_mask,i8259_asm_unmask,
370 voidop) 370 voidop)
371INTRSTUB(legacy,9,i8259_asm_ack2,voidop,i8259_asm_mask,i8259_asm_unmask, 371INTRSTUB(legacy,9,i8259_asm_ack2,voidop,i8259_asm_mask,i8259_asm_unmask,
372 voidop) 372 voidop)
373INTRSTUB(legacy,10,i8259_asm_ack2,voidop,i8259_asm_mask,i8259_asm_unmask, 373INTRSTUB(legacy,10,i8259_asm_ack2,voidop,i8259_asm_mask,i8259_asm_unmask,
374 voidop) 374 voidop)
375INTRSTUB(legacy,11,i8259_asm_ack2,voidop,i8259_asm_mask,i8259_asm_unmask, 375INTRSTUB(legacy,11,i8259_asm_ack2,voidop,i8259_asm_mask,i8259_asm_unmask,
376 voidop) 376 voidop)
377INTRSTUB(legacy,12,i8259_asm_ack2,voidop,i8259_asm_mask,i8259_asm_unmask, 377INTRSTUB(legacy,12,i8259_asm_ack2,voidop,i8259_asm_mask,i8259_asm_unmask,
378 voidop) 378 voidop)
379INTRSTUB(legacy,13,i8259_asm_ack2,voidop,i8259_asm_mask,i8259_asm_unmask, 379INTRSTUB(legacy,13,i8259_asm_ack2,voidop,i8259_asm_mask,i8259_asm_unmask,
380 voidop) 380 voidop)
381INTRSTUB(legacy,14,i8259_asm_ack2,voidop,i8259_asm_mask,i8259_asm_unmask, 381INTRSTUB(legacy,14,i8259_asm_ack2,voidop,i8259_asm_mask,i8259_asm_unmask,
382 voidop) 382 voidop)
383INTRSTUB(legacy,15,i8259_asm_ack2,voidop,i8259_asm_mask,i8259_asm_unmask, 383INTRSTUB(legacy,15,i8259_asm_ack2,voidop,i8259_asm_mask,i8259_asm_unmask,
384 voidop) 384 voidop)
385 385
386#if NIOAPIC > 0 386#if NIOAPIC > 0
387 387
388INTRSTUB(ioapic_edge,0,voidop,ioapic_asm_ack,voidop,voidop,voidop) 388INTRSTUB(ioapic_edge,0,voidop,ioapic_asm_ack,voidop,voidop,voidop)
389INTRSTUB(ioapic_edge,1,voidop,ioapic_asm_ack,voidop,voidop,voidop) 389INTRSTUB(ioapic_edge,1,voidop,ioapic_asm_ack,voidop,voidop,voidop)
390INTRSTUB(ioapic_edge,2,voidop,ioapic_asm_ack,voidop,voidop,voidop) 390INTRSTUB(ioapic_edge,2,voidop,ioapic_asm_ack,voidop,voidop,voidop)
391INTRSTUB(ioapic_edge,3,voidop,ioapic_asm_ack,voidop,voidop,voidop) 391INTRSTUB(ioapic_edge,3,voidop,ioapic_asm_ack,voidop,voidop,voidop)
392INTRSTUB(ioapic_edge,4,voidop,ioapic_asm_ack,voidop,voidop,voidop) 392INTRSTUB(ioapic_edge,4,voidop,ioapic_asm_ack,voidop,voidop,voidop)
393INTRSTUB(ioapic_edge,5,voidop,ioapic_asm_ack,voidop,voidop,voidop) 393INTRSTUB(ioapic_edge,5,voidop,ioapic_asm_ack,voidop,voidop,voidop)
394INTRSTUB(ioapic_edge,6,voidop,ioapic_asm_ack,voidop,voidop,voidop) 394INTRSTUB(ioapic_edge,6,voidop,ioapic_asm_ack,voidop,voidop,voidop)
395INTRSTUB(ioapic_edge,7,voidop,ioapic_asm_ack,voidop,voidop,voidop) 395INTRSTUB(ioapic_edge,7,voidop,ioapic_asm_ack,voidop,voidop,voidop)
396INTRSTUB(ioapic_edge,8,voidop,ioapic_asm_ack,voidop,voidop,voidop) 396INTRSTUB(ioapic_edge,8,voidop,ioapic_asm_ack,voidop,voidop,voidop)
397INTRSTUB(ioapic_edge,9,voidop,ioapic_asm_ack,voidop,voidop,voidop) 397INTRSTUB(ioapic_edge,9,voidop,ioapic_asm_ack,voidop,voidop,voidop)
398INTRSTUB(ioapic_edge,10,voidop,ioapic_asm_ack,voidop,voidop,voidop) 398INTRSTUB(ioapic_edge,10,voidop,ioapic_asm_ack,voidop,voidop,voidop)
399INTRSTUB(ioapic_edge,11,voidop,ioapic_asm_ack,voidop,voidop,voidop) 399INTRSTUB(ioapic_edge,11,voidop,ioapic_asm_ack,voidop,voidop,voidop)
400INTRSTUB(ioapic_edge,12,voidop,ioapic_asm_ack,voidop,voidop,voidop) 400INTRSTUB(ioapic_edge,12,voidop,ioapic_asm_ack,voidop,voidop,voidop)
401INTRSTUB(ioapic_edge,13,voidop,ioapic_asm_ack,voidop,voidop,voidop) 401INTRSTUB(ioapic_edge,13,voidop,ioapic_asm_ack,voidop,voidop,voidop)
402INTRSTUB(ioapic_edge,14,voidop,ioapic_asm_ack,voidop,voidop,voidop) 402INTRSTUB(ioapic_edge,14,voidop,ioapic_asm_ack,voidop,voidop,voidop)
403INTRSTUB(ioapic_edge,15,voidop,ioapic_asm_ack,voidop,voidop,voidop) 403INTRSTUB(ioapic_edge,15,voidop,ioapic_asm_ack,voidop,voidop,voidop)
404INTRSTUB(ioapic_edge,16,voidop,ioapic_asm_ack,voidop,voidop,voidop) 404INTRSTUB(ioapic_edge,16,voidop,ioapic_asm_ack,voidop,voidop,voidop)
405INTRSTUB(ioapic_edge,17,voidop,ioapic_asm_ack,voidop,voidop,voidop) 405INTRSTUB(ioapic_edge,17,voidop,ioapic_asm_ack,voidop,voidop,voidop)
406INTRSTUB(ioapic_edge,18,voidop,ioapic_asm_ack,voidop,voidop,voidop) 406INTRSTUB(ioapic_edge,18,voidop,ioapic_asm_ack,voidop,voidop,voidop)
407INTRSTUB(ioapic_edge,19,voidop,ioapic_asm_ack,voidop,voidop,voidop) 407INTRSTUB(ioapic_edge,19,voidop,ioapic_asm_ack,voidop,voidop,voidop)
408INTRSTUB(ioapic_edge,20,voidop,ioapic_asm_ack,voidop,voidop,voidop) 408INTRSTUB(ioapic_edge,20,voidop,ioapic_asm_ack,voidop,voidop,voidop)
409INTRSTUB(ioapic_edge,21,voidop,ioapic_asm_ack,voidop,voidop,voidop) 409INTRSTUB(ioapic_edge,21,voidop,ioapic_asm_ack,voidop,voidop,voidop)
410INTRSTUB(ioapic_edge,22,voidop,ioapic_asm_ack,voidop,voidop,voidop) 410INTRSTUB(ioapic_edge,22,voidop,ioapic_asm_ack,voidop,voidop,voidop)
411INTRSTUB(ioapic_edge,23,voidop,ioapic_asm_ack,voidop,voidop,voidop) 411INTRSTUB(ioapic_edge,23,voidop,ioapic_asm_ack,voidop,voidop,voidop)
412INTRSTUB(ioapic_edge,24,voidop,ioapic_asm_ack,voidop,voidop,voidop) 412INTRSTUB(ioapic_edge,24,voidop,ioapic_asm_ack,voidop,voidop,voidop)
413INTRSTUB(ioapic_edge,25,voidop,ioapic_asm_ack,voidop,voidop,voidop) 413INTRSTUB(ioapic_edge,25,voidop,ioapic_asm_ack,voidop,voidop,voidop)
414INTRSTUB(ioapic_edge,26,voidop,ioapic_asm_ack,voidop,voidop,voidop) 414INTRSTUB(ioapic_edge,26,voidop,ioapic_asm_ack,voidop,voidop,voidop)
415INTRSTUB(ioapic_edge,27,voidop,ioapic_asm_ack,voidop,voidop,voidop) 415INTRSTUB(ioapic_edge,27,voidop,ioapic_asm_ack,voidop,voidop,voidop)
416INTRSTUB(ioapic_edge,28,voidop,ioapic_asm_ack,voidop,voidop,voidop) 416INTRSTUB(ioapic_edge,28,voidop,ioapic_asm_ack,voidop,voidop,voidop)
417INTRSTUB(ioapic_edge,29,voidop,ioapic_asm_ack,voidop,voidop,voidop) 417INTRSTUB(ioapic_edge,29,voidop,ioapic_asm_ack,voidop,voidop,voidop)
418INTRSTUB(ioapic_edge,30,voidop,ioapic_asm_ack,voidop,voidop,voidop) 418INTRSTUB(ioapic_edge,30,voidop,ioapic_asm_ack,voidop,voidop,voidop)
419INTRSTUB(ioapic_edge,31,voidop,ioapic_asm_ack,voidop,voidop,voidop) 419INTRSTUB(ioapic_edge,31,voidop,ioapic_asm_ack,voidop,voidop,voidop)
420 420
421INTRSTUB(ioapic_level,0,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 421INTRSTUB(ioapic_level,0,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
422INTRSTUB(ioapic_level,1,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 422INTRSTUB(ioapic_level,1,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
423INTRSTUB(ioapic_level,2,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 423INTRSTUB(ioapic_level,2,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
424INTRSTUB(ioapic_level,3,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 424INTRSTUB(ioapic_level,3,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
425INTRSTUB(ioapic_level,4,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 425INTRSTUB(ioapic_level,4,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
426INTRSTUB(ioapic_level,5,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 426INTRSTUB(ioapic_level,5,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
427INTRSTUB(ioapic_level,6,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 427INTRSTUB(ioapic_level,6,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
428INTRSTUB(ioapic_level,7,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 428INTRSTUB(ioapic_level,7,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
429INTRSTUB(ioapic_level,8,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 429INTRSTUB(ioapic_level,8,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
430INTRSTUB(ioapic_level,9,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 430INTRSTUB(ioapic_level,9,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
431INTRSTUB(ioapic_level,10,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 431INTRSTUB(ioapic_level,10,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
432INTRSTUB(ioapic_level,11,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 432INTRSTUB(ioapic_level,11,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
433INTRSTUB(ioapic_level,12,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 433INTRSTUB(ioapic_level,12,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
434INTRSTUB(ioapic_level,13,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 434INTRSTUB(ioapic_level,13,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
435INTRSTUB(ioapic_level,14,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 435INTRSTUB(ioapic_level,14,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
436INTRSTUB(ioapic_level,15,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 436INTRSTUB(ioapic_level,15,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
437INTRSTUB(ioapic_level,16,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 437INTRSTUB(ioapic_level,16,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
438INTRSTUB(ioapic_level,17,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 438INTRSTUB(ioapic_level,17,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
439INTRSTUB(ioapic_level,18,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 439INTRSTUB(ioapic_level,18,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
440INTRSTUB(ioapic_level,19,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 440INTRSTUB(ioapic_level,19,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
441INTRSTUB(ioapic_level,20,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 441INTRSTUB(ioapic_level,20,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
442INTRSTUB(ioapic_level,21,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 442INTRSTUB(ioapic_level,21,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
443INTRSTUB(ioapic_level,22,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 443INTRSTUB(ioapic_level,22,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
444INTRSTUB(ioapic_level,23,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 444INTRSTUB(ioapic_level,23,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
445INTRSTUB(ioapic_level,24,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 445INTRSTUB(ioapic_level,24,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
446INTRSTUB(ioapic_level,25,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 446INTRSTUB(ioapic_level,25,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
447INTRSTUB(ioapic_level,26,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 447INTRSTUB(ioapic_level,26,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
448INTRSTUB(ioapic_level,27,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 448INTRSTUB(ioapic_level,27,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
449INTRSTUB(ioapic_level,28,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 449INTRSTUB(ioapic_level,28,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
450INTRSTUB(ioapic_level,29,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 450INTRSTUB(ioapic_level,29,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
451INTRSTUB(ioapic_level,30,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 451INTRSTUB(ioapic_level,30,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
452INTRSTUB(ioapic_level,31,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 452INTRSTUB(ioapic_level,31,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
453 453
454INTRSTUB(x2apic_edge,0,voidop,x2apic_asm_ack,voidop,voidop,voidop) 454INTRSTUB(x2apic_edge,0,voidop,x2apic_asm_ack,voidop,voidop,voidop)
455INTRSTUB(x2apic_edge,1,voidop,x2apic_asm_ack,voidop,voidop,voidop) 455INTRSTUB(x2apic_edge,1,voidop,x2apic_asm_ack,voidop,voidop,voidop)
456INTRSTUB(x2apic_edge,2,voidop,x2apic_asm_ack,voidop,voidop,voidop) 456INTRSTUB(x2apic_edge,2,voidop,x2apic_asm_ack,voidop,voidop,voidop)
457INTRSTUB(x2apic_edge,3,voidop,x2apic_asm_ack,voidop,voidop,voidop) 457INTRSTUB(x2apic_edge,3,voidop,x2apic_asm_ack,voidop,voidop,voidop)
458INTRSTUB(x2apic_edge,4,voidop,x2apic_asm_ack,voidop,voidop,voidop) 458INTRSTUB(x2apic_edge,4,voidop,x2apic_asm_ack,voidop,voidop,voidop)
459INTRSTUB(x2apic_edge,5,voidop,x2apic_asm_ack,voidop,voidop,voidop) 459INTRSTUB(x2apic_edge,5,voidop,x2apic_asm_ack,voidop,voidop,voidop)
460INTRSTUB(x2apic_edge,6,voidop,x2apic_asm_ack,voidop,voidop,voidop) 460INTRSTUB(x2apic_edge,6,voidop,x2apic_asm_ack,voidop,voidop,voidop)
461INTRSTUB(x2apic_edge,7,voidop,x2apic_asm_ack,voidop,voidop,voidop) 461INTRSTUB(x2apic_edge,7,voidop,x2apic_asm_ack,voidop,voidop,voidop)
462INTRSTUB(x2apic_edge,8,voidop,x2apic_asm_ack,voidop,voidop,voidop) 462INTRSTUB(x2apic_edge,8,voidop,x2apic_asm_ack,voidop,voidop,voidop)
463INTRSTUB(x2apic_edge,9,voidop,x2apic_asm_ack,voidop,voidop,voidop) 463INTRSTUB(x2apic_edge,9,voidop,x2apic_asm_ack,voidop,voidop,voidop)
464INTRSTUB(x2apic_edge,10,voidop,x2apic_asm_ack,voidop,voidop,voidop) 464INTRSTUB(x2apic_edge,10,voidop,x2apic_asm_ack,voidop,voidop,voidop)
465INTRSTUB(x2apic_edge,11,voidop,x2apic_asm_ack,voidop,voidop,voidop) 465INTRSTUB(x2apic_edge,11,voidop,x2apic_asm_ack,voidop,voidop,voidop)
466INTRSTUB(x2apic_edge,12,voidop,x2apic_asm_ack,voidop,voidop,voidop) 466INTRSTUB(x2apic_edge,12,voidop,x2apic_asm_ack,voidop,voidop,voidop)
467INTRSTUB(x2apic_edge,13,voidop,x2apic_asm_ack,voidop,voidop,voidop) 467INTRSTUB(x2apic_edge,13,voidop,x2apic_asm_ack,voidop,voidop,voidop)
468INTRSTUB(x2apic_edge,14,voidop,x2apic_asm_ack,voidop,voidop,voidop) 468INTRSTUB(x2apic_edge,14,voidop,x2apic_asm_ack,voidop,voidop,voidop)
469INTRSTUB(x2apic_edge,15,voidop,x2apic_asm_ack,voidop,voidop,voidop) 469INTRSTUB(x2apic_edge,15,voidop,x2apic_asm_ack,voidop,voidop,voidop)
470INTRSTUB(x2apic_edge,16,voidop,x2apic_asm_ack,voidop,voidop,voidop) 470INTRSTUB(x2apic_edge,16,voidop,x2apic_asm_ack,voidop,voidop,voidop)
471INTRSTUB(x2apic_edge,17,voidop,x2apic_asm_ack,voidop,voidop,voidop) 471INTRSTUB(x2apic_edge,17,voidop,x2apic_asm_ack,voidop,voidop,voidop)
472INTRSTUB(x2apic_edge,18,voidop,x2apic_asm_ack,voidop,voidop,voidop) 472INTRSTUB(x2apic_edge,18,voidop,x2apic_asm_ack,voidop,voidop,voidop)
473INTRSTUB(x2apic_edge,19,voidop,x2apic_asm_ack,voidop,voidop,voidop) 473INTRSTUB(x2apic_edge,19,voidop,x2apic_asm_ack,voidop,voidop,voidop)
474INTRSTUB(x2apic_edge,20,voidop,x2apic_asm_ack,voidop,voidop,voidop) 474INTRSTUB(x2apic_edge,20,voidop,x2apic_asm_ack,voidop,voidop,voidop)
475INTRSTUB(x2apic_edge,21,voidop,x2apic_asm_ack,voidop,voidop,voidop) 475INTRSTUB(x2apic_edge,21,voidop,x2apic_asm_ack,voidop,voidop,voidop)
476INTRSTUB(x2apic_edge,22,voidop,x2apic_asm_ack,voidop,voidop,voidop) 476INTRSTUB(x2apic_edge,22,voidop,x2apic_asm_ack,voidop,voidop,voidop)
477INTRSTUB(x2apic_edge,23,voidop,x2apic_asm_ack,voidop,voidop,voidop) 477INTRSTUB(x2apic_edge,23,voidop,x2apic_asm_ack,voidop,voidop,voidop)
478INTRSTUB(x2apic_edge,24,voidop,x2apic_asm_ack,voidop,voidop,voidop) 478INTRSTUB(x2apic_edge,24,voidop,x2apic_asm_ack,voidop,voidop,voidop)
479INTRSTUB(x2apic_edge,25,voidop,x2apic_asm_ack,voidop,voidop,voidop) 479INTRSTUB(x2apic_edge,25,voidop,x2apic_asm_ack,voidop,voidop,voidop)
480INTRSTUB(x2apic_edge,26,voidop,x2apic_asm_ack,voidop,voidop,voidop) 480INTRSTUB(x2apic_edge,26,voidop,x2apic_asm_ack,voidop,voidop,voidop)
481INTRSTUB(x2apic_edge,27,voidop,x2apic_asm_ack,voidop,voidop,voidop) 481INTRSTUB(x2apic_edge,27,voidop,x2apic_asm_ack,voidop,voidop,voidop)
482INTRSTUB(x2apic_edge,28,voidop,x2apic_asm_ack,voidop,voidop,voidop) 482INTRSTUB(x2apic_edge,28,voidop,x2apic_asm_ack,voidop,voidop,voidop)
483INTRSTUB(x2apic_edge,29,voidop,x2apic_asm_ack,voidop,voidop,voidop) 483INTRSTUB(x2apic_edge,29,voidop,x2apic_asm_ack,voidop,voidop,voidop)
484INTRSTUB(x2apic_edge,30,voidop,x2apic_asm_ack,voidop,voidop,voidop) 484INTRSTUB(x2apic_edge,30,voidop,x2apic_asm_ack,voidop,voidop,voidop)
485INTRSTUB(x2apic_edge,31,voidop,x2apic_asm_ack,voidop,voidop,voidop) 485INTRSTUB(x2apic_edge,31,voidop,x2apic_asm_ack,voidop,voidop,voidop)
486 486
487INTRSTUB(x2apic_level,0,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 487INTRSTUB(x2apic_level,0,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
488INTRSTUB(x2apic_level,1,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 488INTRSTUB(x2apic_level,1,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
489INTRSTUB(x2apic_level,2,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 489INTRSTUB(x2apic_level,2,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
490INTRSTUB(x2apic_level,3,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 490INTRSTUB(x2apic_level,3,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
491INTRSTUB(x2apic_level,4,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 491INTRSTUB(x2apic_level,4,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
492INTRSTUB(x2apic_level,5,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 492INTRSTUB(x2apic_level,5,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
493INTRSTUB(x2apic_level,6,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 493INTRSTUB(x2apic_level,6,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
494INTRSTUB(x2apic_level,7,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 494INTRSTUB(x2apic_level,7,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
495INTRSTUB(x2apic_level,8,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 495INTRSTUB(x2apic_level,8,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
496INTRSTUB(x2apic_level,9,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 496INTRSTUB(x2apic_level,9,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
497INTRSTUB(x2apic_level,10,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 497INTRSTUB(x2apic_level,10,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
498INTRSTUB(x2apic_level,11,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 498INTRSTUB(x2apic_level,11,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
499INTRSTUB(x2apic_level,12,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 499INTRSTUB(x2apic_level,12,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
500INTRSTUB(x2apic_level,13,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 500INTRSTUB(x2apic_level,13,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
501INTRSTUB(x2apic_level,14,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 501INTRSTUB(x2apic_level,14,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
502INTRSTUB(x2apic_level,15,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 502INTRSTUB(x2apic_level,15,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
503INTRSTUB(x2apic_level,16,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 503INTRSTUB(x2apic_level,16,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
504INTRSTUB(x2apic_level,17,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 504INTRSTUB(x2apic_level,17,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
505INTRSTUB(x2apic_level,18,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 505INTRSTUB(x2apic_level,18,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
506INTRSTUB(x2apic_level,19,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 506INTRSTUB(x2apic_level,19,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
507INTRSTUB(x2apic_level,20,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 507INTRSTUB(x2apic_level,20,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
508INTRSTUB(x2apic_level,21,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 508INTRSTUB(x2apic_level,21,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
509INTRSTUB(x2apic_level,22,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 509INTRSTUB(x2apic_level,22,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
510INTRSTUB(x2apic_level,23,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 510INTRSTUB(x2apic_level,23,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
511INTRSTUB(x2apic_level,24,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 511INTRSTUB(x2apic_level,24,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
512INTRSTUB(x2apic_level,25,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 512INTRSTUB(x2apic_level,25,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
513INTRSTUB(x2apic_level,26,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 513INTRSTUB(x2apic_level,26,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
514INTRSTUB(x2apic_level,27,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 514INTRSTUB(x2apic_level,27,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
515INTRSTUB(x2apic_level,28,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 515INTRSTUB(x2apic_level,28,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
516INTRSTUB(x2apic_level,29,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 516INTRSTUB(x2apic_level,29,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
517INTRSTUB(x2apic_level,30,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 517INTRSTUB(x2apic_level,30,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
518INTRSTUB(x2apic_level,31,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) 518INTRSTUB(x2apic_level,31,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
519 519
520#endif 520#endif
521 521
522 .type _C_LABEL(i8259_stubs), @object 522 .type _C_LABEL(i8259_stubs), @object
523LABEL(i8259_stubs) 523LABEL(i8259_stubs)
524 .quad _C_LABEL(Xintr_legacy0), _C_LABEL(Xrecurse_legacy0) 524 .quad _C_LABEL(Xintr_legacy0), _C_LABEL(Xrecurse_legacy0)
525 .quad _C_LABEL(Xresume_legacy0) 525 .quad _C_LABEL(Xresume_legacy0)
526 .quad _C_LABEL(Xintr_legacy1), _C_LABEL(Xrecurse_legacy1) 526 .quad _C_LABEL(Xintr_legacy1), _C_LABEL(Xrecurse_legacy1)
527 .quad _C_LABEL(Xresume_legacy1) 527 .quad _C_LABEL(Xresume_legacy1)
528 .quad _C_LABEL(Xintr_legacy2), _C_LABEL(Xrecurse_legacy2) 528 .quad _C_LABEL(Xintr_legacy2), _C_LABEL(Xrecurse_legacy2)
529 .quad _C_LABEL(Xresume_legacy2) 529 .quad _C_LABEL(Xresume_legacy2)
530 .quad _C_LABEL(Xintr_legacy3), _C_LABEL(Xrecurse_legacy3) 530 .quad _C_LABEL(Xintr_legacy3), _C_LABEL(Xrecurse_legacy3)
531 .quad _C_LABEL(Xresume_legacy3) 531 .quad _C_LABEL(Xresume_legacy3)
532 .quad _C_LABEL(Xintr_legacy4), _C_LABEL(Xrecurse_legacy4) 532 .quad _C_LABEL(Xintr_legacy4), _C_LABEL(Xrecurse_legacy4)
533 .quad _C_LABEL(Xresume_legacy4) 533 .quad _C_LABEL(Xresume_legacy4)
534 .quad _C_LABEL(Xintr_legacy5), _C_LABEL(Xrecurse_legacy5) 534 .quad _C_LABEL(Xintr_legacy5), _C_LABEL(Xrecurse_legacy5)
535 .quad _C_LABEL(Xresume_legacy5) 535 .quad _C_LABEL(Xresume_legacy5)
536 .quad _C_LABEL(Xintr_legacy6), _C_LABEL(Xrecurse_legacy6) 536 .quad _C_LABEL(Xintr_legacy6), _C_LABEL(Xrecurse_legacy6)
537 .quad _C_LABEL(Xresume_legacy6) 537 .quad _C_LABEL(Xresume_legacy6)
538 .quad _C_LABEL(Xintr_legacy7), _C_LABEL(Xrecurse_legacy7) 538 .quad _C_LABEL(Xintr_legacy7), _C_LABEL(Xrecurse_legacy7)
539 .quad _C_LABEL(Xresume_legacy7) 539 .quad _C_LABEL(Xresume_legacy7)
540 .quad _C_LABEL(Xintr_legacy8), _C_LABEL(Xrecurse_legacy8) 540 .quad _C_LABEL(Xintr_legacy8), _C_LABEL(Xrecurse_legacy8)
541 .quad _C_LABEL(Xresume_legacy8) 541 .quad _C_LABEL(Xresume_legacy8)
542 .quad _C_LABEL(Xintr_legacy9), _C_LABEL(Xrecurse_legacy9) 542 .quad _C_LABEL(Xintr_legacy9), _C_LABEL(Xrecurse_legacy9)
543 .quad _C_LABEL(Xresume_legacy9) 543 .quad _C_LABEL(Xresume_legacy9)
544 .quad _C_LABEL(Xintr_legacy10), _C_LABEL(Xrecurse_legacy10) 544 .quad _C_LABEL(Xintr_legacy10), _C_LABEL(Xrecurse_legacy10)
545 .quad _C_LABEL(Xresume_legacy10) 545 .quad _C_LABEL(Xresume_legacy10)
546 .quad _C_LABEL(Xintr_legacy11), _C_LABEL(Xrecurse_legacy11) 546 .quad _C_LABEL(Xintr_legacy11), _C_LABEL(Xrecurse_legacy11)
547 .quad _C_LABEL(Xresume_legacy11) 547 .quad _C_LABEL(Xresume_legacy11)
548 .quad _C_LABEL(Xintr_legacy12), _C_LABEL(Xrecurse_legacy12) 548 .quad _C_LABEL(Xintr_legacy12), _C_LABEL(Xrecurse_legacy12)
549 .quad _C_LABEL(Xresume_legacy12) 549 .quad _C_LABEL(Xresume_legacy12)
550 .quad _C_LABEL(Xintr_legacy13), _C_LABEL(Xrecurse_legacy13) 550 .quad _C_LABEL(Xintr_legacy13), _C_LABEL(Xrecurse_legacy13)
551 .quad _C_LABEL(Xresume_legacy13) 551 .quad _C_LABEL(Xresume_legacy13)
552 .quad _C_LABEL(Xintr_legacy14), _C_LABEL(Xrecurse_legacy14) 552 .quad _C_LABEL(Xintr_legacy14), _C_LABEL(Xrecurse_legacy14)
553 .quad _C_LABEL(Xresume_legacy14) 553 .quad _C_LABEL(Xresume_legacy14)
554 .quad _C_LABEL(Xintr_legacy15), _C_LABEL(Xrecurse_legacy15) 554 .quad _C_LABEL(Xintr_legacy15), _C_LABEL(Xrecurse_legacy15)
555 .quad _C_LABEL(Xresume_legacy15) 555 .quad _C_LABEL(Xresume_legacy15)
556END(i8259_stubs) 556END(i8259_stubs)
557 557
558#if NIOAPIC > 0 558#if NIOAPIC > 0
559 .type _C_LABEL(ioapic_edge_stubs), @object 559 .type _C_LABEL(ioapic_edge_stubs), @object
560LABEL(ioapic_edge_stubs) 560LABEL(ioapic_edge_stubs)
561 .quad _C_LABEL(Xintr_ioapic_edge0), _C_LABEL(Xrecurse_ioapic_edge0) 561 .quad _C_LABEL(Xintr_ioapic_edge0), _C_LABEL(Xrecurse_ioapic_edge0)
562 .quad _C_LABEL(Xresume_ioapic_edge0) 562 .quad _C_LABEL(Xresume_ioapic_edge0)
563 .quad _C_LABEL(Xintr_ioapic_edge1), _C_LABEL(Xrecurse_ioapic_edge1) 563 .quad _C_LABEL(Xintr_ioapic_edge1), _C_LABEL(Xrecurse_ioapic_edge1)
564 .quad _C_LABEL(Xresume_ioapic_edge1) 564 .quad _C_LABEL(Xresume_ioapic_edge1)
565 .quad _C_LABEL(Xintr_ioapic_edge2), _C_LABEL(Xrecurse_ioapic_edge2) 565 .quad _C_LABEL(Xintr_ioapic_edge2), _C_LABEL(Xrecurse_ioapic_edge2)
566 .quad _C_LABEL(Xresume_ioapic_edge2) 566 .quad _C_LABEL(Xresume_ioapic_edge2)
567 .quad _C_LABEL(Xintr_ioapic_edge3), _C_LABEL(Xrecurse_ioapic_edge3) 567 .quad _C_LABEL(Xintr_ioapic_edge3), _C_LABEL(Xrecurse_ioapic_edge3)
568 .quad _C_LABEL(Xresume_ioapic_edge3) 568 .quad _C_LABEL(Xresume_ioapic_edge3)
569 .quad _C_LABEL(Xintr_ioapic_edge4), _C_LABEL(Xrecurse_ioapic_edge4) 569 .quad _C_LABEL(Xintr_ioapic_edge4), _C_LABEL(Xrecurse_ioapic_edge4)
570 .quad _C_LABEL(Xresume_ioapic_edge4) 570 .quad _C_LABEL(Xresume_ioapic_edge4)
571 .quad _C_LABEL(Xintr_ioapic_edge5), _C_LABEL(Xrecurse_ioapic_edge5) 571 .quad _C_LABEL(Xintr_ioapic_edge5), _C_LABEL(Xrecurse_ioapic_edge5)
572 .quad _C_LABEL(Xresume_ioapic_edge5) 572 .quad _C_LABEL(Xresume_ioapic_edge5)
573 .quad _C_LABEL(Xintr_ioapic_edge6), _C_LABEL(Xrecurse_ioapic_edge6) 573 .quad _C_LABEL(Xintr_ioapic_edge6), _C_LABEL(Xrecurse_ioapic_edge6)
574 .quad _C_LABEL(Xresume_ioapic_edge6) 574 .quad _C_LABEL(Xresume_ioapic_edge6)
575 .quad _C_LABEL(Xintr_ioapic_edge7), _C_LABEL(Xrecurse_ioapic_edge7) 575 .quad _C_LABEL(Xintr_ioapic_edge7), _C_LABEL(Xrecurse_ioapic_edge7)
576 .quad _C_LABEL(Xresume_ioapic_edge7) 576 .quad _C_LABEL(Xresume_ioapic_edge7)
577 .quad _C_LABEL(Xintr_ioapic_edge8), _C_LABEL(Xrecurse_ioapic_edge8) 577 .quad _C_LABEL(Xintr_ioapic_edge8), _C_LABEL(Xrecurse_ioapic_edge8)
578 .quad _C_LABEL(Xresume_ioapic_edge8) 578 .quad _C_LABEL(Xresume_ioapic_edge8)
579 .quad _C_LABEL(Xintr_ioapic_edge9), _C_LABEL(Xrecurse_ioapic_edge9) 579 .quad _C_LABEL(Xintr_ioapic_edge9), _C_LABEL(Xrecurse_ioapic_edge9)
580 .quad _C_LABEL(Xresume_ioapic_edge9) 580 .quad _C_LABEL(Xresume_ioapic_edge9)
581 .quad _C_LABEL(Xintr_ioapic_edge10), _C_LABEL(Xrecurse_ioapic_edge10) 581 .quad _C_LABEL(Xintr_ioapic_edge10), _C_LABEL(Xrecurse_ioapic_edge10)
582 .quad _C_LABEL(Xresume_ioapic_edge10) 582 .quad _C_LABEL(Xresume_ioapic_edge10)
583 .quad _C_LABEL(Xintr_ioapic_edge11), _C_LABEL(Xrecurse_ioapic_edge11) 583 .quad _C_LABEL(Xintr_ioapic_edge11), _C_LABEL(Xrecurse_ioapic_edge11)
584 .quad _C_LABEL(Xresume_ioapic_edge11) 584 .quad _C_LABEL(Xresume_ioapic_edge11)
585 .quad _C_LABEL(Xintr_ioapic_edge12), _C_LABEL(Xrecurse_ioapic_edge12) 585 .quad _C_LABEL(Xintr_ioapic_edge12), _C_LABEL(Xrecurse_ioapic_edge12)
586 .quad _C_LABEL(Xresume_ioapic_edge12) 586 .quad _C_LABEL(Xresume_ioapic_edge12)
587 .quad _C_LABEL(Xintr_ioapic_edge13), _C_LABEL(Xrecurse_ioapic_edge13) 587 .quad _C_LABEL(Xintr_ioapic_edge13), _C_LABEL(Xrecurse_ioapic_edge13)
588 .quad _C_LABEL(Xresume_ioapic_edge13) 588 .quad _C_LABEL(Xresume_ioapic_edge13)
589 .quad _C_LABEL(Xintr_ioapic_edge14), _C_LABEL(Xrecurse_ioapic_edge14) 589 .quad _C_LABEL(Xintr_ioapic_edge14), _C_LABEL(Xrecurse_ioapic_edge14)
590 .quad _C_LABEL(Xresume_ioapic_edge14) 590 .quad _C_LABEL(Xresume_ioapic_edge14)
591 .quad _C_LABEL(Xintr_ioapic_edge15), _C_LABEL(Xrecurse_ioapic_edge15) 591 .quad _C_LABEL(Xintr_ioapic_edge15), _C_LABEL(Xrecurse_ioapic_edge15)
592 .quad _C_LABEL(Xresume_ioapic_edge15) 592 .quad _C_LABEL(Xresume_ioapic_edge15)
593 .quad _C_LABEL(Xintr_ioapic_edge16), _C_LABEL(Xrecurse_ioapic_edge16) 593 .quad _C_LABEL(Xintr_ioapic_edge16), _C_LABEL(Xrecurse_ioapic_edge16)
594 .quad _C_LABEL(Xresume_ioapic_edge16) 594 .quad _C_LABEL(Xresume_ioapic_edge16)
595 .quad _C_LABEL(Xintr_ioapic_edge17), _C_LABEL(Xrecurse_ioapic_edge17) 595 .quad _C_LABEL(Xintr_ioapic_edge17), _C_LABEL(Xrecurse_ioapic_edge17)
596 .quad _C_LABEL(Xresume_ioapic_edge17) 596 .quad _C_LABEL(Xresume_ioapic_edge17)
597 .quad _C_LABEL(Xintr_ioapic_edge18), _C_LABEL(Xrecurse_ioapic_edge18) 597 .quad _C_LABEL(Xintr_ioapic_edge18), _C_LABEL(Xrecurse_ioapic_edge18)
598 .quad _C_LABEL(Xresume_ioapic_edge18) 598 .quad _C_LABEL(Xresume_ioapic_edge18)
599 .quad _C_LABEL(Xintr_ioapic_edge19), _C_LABEL(Xrecurse_ioapic_edge19) 599 .quad _C_LABEL(Xintr_ioapic_edge19), _C_LABEL(Xrecurse_ioapic_edge19)
600 .quad _C_LABEL(Xresume_ioapic_edge19) 600 .quad _C_LABEL(Xresume_ioapic_edge19)
601 .quad _C_LABEL(Xintr_ioapic_edge20), _C_LABEL(Xrecurse_ioapic_edge20) 601 .quad _C_LABEL(Xintr_ioapic_edge20), _C_LABEL(Xrecurse_ioapic_edge20)
602 .quad _C_LABEL(Xresume_ioapic_edge20) 602 .quad _C_LABEL(Xresume_ioapic_edge20)
603 .quad _C_LABEL(Xintr_ioapic_edge21), _C_LABEL(Xrecurse_ioapic_edge21) 603 .quad _C_LABEL(Xintr_ioapic_edge21), _C_LABEL(Xrecurse_ioapic_edge21)
604 .quad _C_LABEL(Xresume_ioapic_edge21) 604 .quad _C_LABEL(Xresume_ioapic_edge21)
605 .quad _C_LABEL(Xintr_ioapic_edge22), _C_LABEL(Xrecurse_ioapic_edge22) 605 .quad _C_LABEL(Xintr_ioapic_edge22), _C_LABEL(Xrecurse_ioapic_edge22)
606 .quad _C_LABEL(Xresume_ioapic_edge22) 606 .quad _C_LABEL(Xresume_ioapic_edge22)
607 .quad _C_LABEL(Xintr_ioapic_edge23), _C_LABEL(Xrecurse_ioapic_edge23) 607 .quad _C_LABEL(Xintr_ioapic_edge23), _C_LABEL(Xrecurse_ioapic_edge23)
608 .quad _C_LABEL(Xresume_ioapic_edge23) 608 .quad _C_LABEL(Xresume_ioapic_edge23)
609 .quad _C_LABEL(Xintr_ioapic_edge24), _C_LABEL(Xrecurse_ioapic_edge24) 609 .quad _C_LABEL(Xintr_ioapic_edge24), _C_LABEL(Xrecurse_ioapic_edge24)
610 .quad _C_LABEL(Xresume_ioapic_edge24) 610 .quad _C_LABEL(Xresume_ioapic_edge24)
611 .quad _C_LABEL(Xintr_ioapic_edge25), _C_LABEL(Xrecurse_ioapic_edge25) 611 .quad _C_LABEL(Xintr_ioapic_edge25), _C_LABEL(Xrecurse_ioapic_edge25)
612 .quad _C_LABEL(Xresume_ioapic_edge25) 612 .quad _C_LABEL(Xresume_ioapic_edge25)
613 .quad _C_LABEL(Xintr_ioapic_edge26), _C_LABEL(Xrecurse_ioapic_edge26) 613 .quad _C_LABEL(Xintr_ioapic_edge26), _C_LABEL(Xrecurse_ioapic_edge26)
614 .quad _C_LABEL(Xresume_ioapic_edge26) 614 .quad _C_LABEL(Xresume_ioapic_edge26)
615 .quad _C_LABEL(Xintr_ioapic_edge27), _C_LABEL(Xrecurse_ioapic_edge27) 615 .quad _C_LABEL(Xintr_ioapic_edge27), _C_LABEL(Xrecurse_ioapic_edge27)
616 .quad _C_LABEL(Xresume_ioapic_edge27) 616 .quad _C_LABEL(Xresume_ioapic_edge27)
617 .quad _C_LABEL(Xintr_ioapic_edge28), _C_LABEL(Xrecurse_ioapic_edge28) 617 .quad _C_LABEL(Xintr_ioapic_edge28), _C_LABEL(Xrecurse_ioapic_edge28)
618 .quad _C_LABEL(Xresume_ioapic_edge28) 618 .quad _C_LABEL(Xresume_ioapic_edge28)
619 .quad _C_LABEL(Xintr_ioapic_edge29), _C_LABEL(Xrecurse_ioapic_edge29) 619 .quad _C_LABEL(Xintr_ioapic_edge29), _C_LABEL(Xrecurse_ioapic_edge29)
620 .quad _C_LABEL(Xresume_ioapic_edge29) 620 .quad _C_LABEL(Xresume_ioapic_edge29)
621 .quad _C_LABEL(Xintr_ioapic_edge30), _C_LABEL(Xrecurse_ioapic_edge30) 621 .quad _C_LABEL(Xintr_ioapic_edge30), _C_LABEL(Xrecurse_ioapic_edge30)
622 .quad _C_LABEL(Xresume_ioapic_edge30) 622 .quad _C_LABEL(Xresume_ioapic_edge30)
623 .quad _C_LABEL(Xintr_ioapic_edge31), _C_LABEL(Xrecurse_ioapic_edge31) 623 .quad _C_LABEL(Xintr_ioapic_edge31), _C_LABEL(Xrecurse_ioapic_edge31)
624 .quad _C_LABEL(Xresume_ioapic_edge31) 624 .quad _C_LABEL(Xresume_ioapic_edge31)
625END(ioapic_edge_stubs) 625END(ioapic_edge_stubs)
626 626
627 .type _C_LABEL(ioapic_level_stubs), @object 627 .type _C_LABEL(ioapic_level_stubs), @object
628LABEL(ioapic_level_stubs) 628LABEL(ioapic_level_stubs)
629 .quad _C_LABEL(Xintr_ioapic_level0), _C_LABEL(Xrecurse_ioapic_level0) 629 .quad _C_LABEL(Xintr_ioapic_level0), _C_LABEL(Xrecurse_ioapic_level0)
630 .quad _C_LABEL(Xresume_ioapic_level0) 630 .quad _C_LABEL(Xresume_ioapic_level0)
631 .quad _C_LABEL(Xintr_ioapic_level1), _C_LABEL(Xrecurse_ioapic_level1) 631 .quad _C_LABEL(Xintr_ioapic_level1), _C_LABEL(Xrecurse_ioapic_level1)
632 .quad _C_LABEL(Xresume_ioapic_level1) 632 .quad _C_LABEL(Xresume_ioapic_level1)
633 .quad _C_LABEL(Xintr_ioapic_level2), _C_LABEL(Xrecurse_ioapic_level2) 633 .quad _C_LABEL(Xintr_ioapic_level2), _C_LABEL(Xrecurse_ioapic_level2)
634 .quad _C_LABEL(Xresume_ioapic_level2) 634 .quad _C_LABEL(Xresume_ioapic_level2)
635 .quad _C_LABEL(Xintr_ioapic_level3), _C_LABEL(Xrecurse_ioapic_level3) 635 .quad _C_LABEL(Xintr_ioapic_level3), _C_LABEL(Xrecurse_ioapic_level3)
636 .quad _C_LABEL(Xresume_ioapic_level3) 636 .quad _C_LABEL(Xresume_ioapic_level3)
637 .quad _C_LABEL(Xintr_ioapic_level4), _C_LABEL(Xrecurse_ioapic_level4) 637 .quad _C_LABEL(Xintr_ioapic_level4), _C_LABEL(Xrecurse_ioapic_level4)
638 .quad _C_LABEL(Xresume_ioapic_level4) 638 .quad _C_LABEL(Xresume_ioapic_level4)
639 .quad _C_LABEL(Xintr_ioapic_level5), _C_LABEL(Xrecurse_ioapic_level5) 639 .quad _C_LABEL(Xintr_ioapic_level5), _C_LABEL(Xrecurse_ioapic_level5)
640 .quad _C_LABEL(Xresume_ioapic_level5) 640 .quad _C_LABEL(Xresume_ioapic_level5)
641 .quad _C_LABEL(Xintr_ioapic_level6), _C_LABEL(Xrecurse_ioapic_level6) 641 .quad _C_LABEL(Xintr_ioapic_level6), _C_LABEL(Xrecurse_ioapic_level6)
642 .quad _C_LABEL(Xresume_ioapic_level6) 642 .quad _C_LABEL(Xresume_ioapic_level6)
643 .quad _C_LABEL(Xintr_ioapic_level7), _C_LABEL(Xrecurse_ioapic_level7) 643 .quad _C_LABEL(Xintr_ioapic_level7), _C_LABEL(Xrecurse_ioapic_level7)
644 .quad _C_LABEL(Xresume_ioapic_level7) 644 .quad _C_LABEL(Xresume_ioapic_level7)
645 .quad _C_LABEL(Xintr_ioapic_level8), _C_LABEL(Xrecurse_ioapic_level8) 645 .quad _C_LABEL(Xintr_ioapic_level8), _C_LABEL(Xrecurse_ioapic_level8)
646 .quad _C_LABEL(Xresume_ioapic_level8) 646 .quad _C_LABEL(Xresume_ioapic_level8)
647 .quad _C_LABEL(Xintr_ioapic_level9), _C_LABEL(Xrecurse_ioapic_level9) 647 .quad _C_LABEL(Xintr_ioapic_level9), _C_LABEL(Xrecurse_ioapic_level9)
648 .quad _C_LABEL(Xresume_ioapic_level9) 648 .quad _C_LABEL(Xresume_ioapic_level9)
649 .quad _C_LABEL(Xintr_ioapic_level10), _C_LABEL(Xrecurse_ioapic_level10) 649 .quad _C_LABEL(Xintr_ioapic_level10), _C_LABEL(Xrecurse_ioapic_level10)
650 .quad _C_LABEL(Xresume_ioapic_level10) 650 .quad _C_LABEL(Xresume_ioapic_level10)
651 .quad _C_LABEL(Xintr_ioapic_level11), _C_LABEL(Xrecurse_ioapic_level11) 651 .quad _C_LABEL(Xintr_ioapic_level11), _C_LABEL(Xrecurse_ioapic_level11)
652 .quad _C_LABEL(Xresume_ioapic_level11) 652 .quad _C_LABEL(Xresume_ioapic_level11)
653 .quad _C_LABEL(Xintr_ioapic_level12), _C_LABEL(Xrecurse_ioapic_level12) 653 .quad _C_LABEL(Xintr_ioapic_level12), _C_LABEL(Xrecurse_ioapic_level12)
654 .quad _C_LABEL(Xresume_ioapic_level12) 654 .quad _C_LABEL(Xresume_ioapic_level12)
655 .quad _C_LABEL(Xintr_ioapic_level13), _C_LABEL(Xrecurse_ioapic_level13) 655 .quad _C_LABEL(Xintr_ioapic_level13), _C_LABEL(Xrecurse_ioapic_level13)
656 .quad _C_LABEL(Xresume_ioapic_level13) 656 .quad _C_LABEL(Xresume_ioapic_level13)
657 .quad _C_LABEL(Xintr_ioapic_level14), _C_LABEL(Xrecurse_ioapic_level14) 657 .quad _C_LABEL(Xintr_ioapic_level14), _C_LABEL(Xrecurse_ioapic_level14)
658 .quad _C_LABEL(Xresume_ioapic_level14) 658 .quad _C_LABEL(Xresume_ioapic_level14)
659 .quad _C_LABEL(Xintr_ioapic_level15), _C_LABEL(Xrecurse_ioapic_level15) 659 .quad _C_LABEL(Xintr_ioapic_level15), _C_LABEL(Xrecurse_ioapic_level15)
660 .quad _C_LABEL(Xresume_ioapic_level15) 660 .quad _C_LABEL(Xresume_ioapic_level15)
661 .quad _C_LABEL(Xintr_ioapic_level16), _C_LABEL(Xrecurse_ioapic_level16) 661 .quad _C_LABEL(Xintr_ioapic_level16), _C_LABEL(Xrecurse_ioapic_level16)
662 .quad _C_LABEL(Xresume_ioapic_level16) 662 .quad _C_LABEL(Xresume_ioapic_level16)
663 .quad _C_LABEL(Xintr_ioapic_level17), _C_LABEL(Xrecurse_ioapic_level17) 663 .quad _C_LABEL(Xintr_ioapic_level17), _C_LABEL(Xrecurse_ioapic_level17)
664 .quad _C_LABEL(Xresume_ioapic_level17) 664 .quad _C_LABEL(Xresume_ioapic_level17)
665 .quad _C_LABEL(Xintr_ioapic_level18), _C_LABEL(Xrecurse_ioapic_level18) 665 .quad _C_LABEL(Xintr_ioapic_level18), _C_LABEL(Xrecurse_ioapic_level18)
666 .quad _C_LABEL(Xresume_ioapic_level18) 666 .quad _C_LABEL(Xresume_ioapic_level18)
667 .quad _C_LABEL(Xintr_ioapic_level19), _C_LABEL(Xrecurse_ioapic_level19) 667 .quad _C_LABEL(Xintr_ioapic_level19), _C_LABEL(Xrecurse_ioapic_level19)
668 .quad _C_LABEL(Xresume_ioapic_level19) 668 .quad _C_LABEL(Xresume_ioapic_level19)
669 .quad _C_LABEL(Xintr_ioapic_level20), _C_LABEL(Xrecurse_ioapic_level20) 669 .quad _C_LABEL(Xintr_ioapic_level20), _C_LABEL(Xrecurse_ioapic_level20)
670 .quad _C_LABEL(Xresume_ioapic_level20) 670 .quad _C_LABEL(Xresume_ioapic_level20)
671 .quad _C_LABEL(Xintr_ioapic_level21), _C_LABEL(Xrecurse_ioapic_level21) 671 .quad _C_LABEL(Xintr_ioapic_level21), _C_LABEL(Xrecurse_ioapic_level21)
672 .quad _C_LABEL(Xresume_ioapic_level21) 672 .quad _C_LABEL(Xresume_ioapic_level21)
673 .quad _C_LABEL(Xintr_ioapic_level22), _C_LABEL(Xrecurse_ioapic_level22) 673 .quad _C_LABEL(Xintr_ioapic_level22), _C_LABEL(Xrecurse_ioapic_level22)
674 .quad _C_LABEL(Xresume_ioapic_level22) 674 .quad _C_LABEL(Xresume_ioapic_level22)
675 .quad _C_LABEL(Xintr_ioapic_level23), _C_LABEL(Xrecurse_ioapic_level23) 675 .quad _C_LABEL(Xintr_ioapic_level23), _C_LABEL(Xrecurse_ioapic_level23)
676 .quad _C_LABEL(Xresume_ioapic_level23) 676 .quad _C_LABEL(Xresume_ioapic_level23)
677 .quad _C_LABEL(Xintr_ioapic_level24), _C_LABEL(Xrecurse_ioapic_level24) 677 .quad _C_LABEL(Xintr_ioapic_level24), _C_LABEL(Xrecurse_ioapic_level24)
678 .quad _C_LABEL(Xresume_ioapic_level24) 678 .quad _C_LABEL(Xresume_ioapic_level24)
679 .quad _C_LABEL(Xintr_ioapic_level25), _C_LABEL(Xrecurse_ioapic_level25) 679 .quad _C_LABEL(Xintr_ioapic_level25), _C_LABEL(Xrecurse_ioapic_level25)
680 .quad _C_LABEL(Xresume_ioapic_level25) 680 .quad _C_LABEL(Xresume_ioapic_level25)
681 .quad _C_LABEL(Xintr_ioapic_level26), _C_LABEL(Xrecurse_ioapic_level26) 681 .quad _C_LABEL(Xintr_ioapic_level26), _C_LABEL(Xrecurse_ioapic_level26)
682 .quad _C_LABEL(Xresume_ioapic_level26) 682 .quad _C_LABEL(Xresume_ioapic_level26)
683 .quad _C_LABEL(Xintr_ioapic_level27), _C_LABEL(Xrecurse_ioapic_level27) 683 .quad _C_LABEL(Xintr_ioapic_level27), _C_LABEL(Xrecurse_ioapic_level27)
684 .quad _C_LABEL(Xresume_ioapic_level27) 684 .quad _C_LABEL(Xresume_ioapic_level27)
685 .quad _C_LABEL(Xintr_ioapic_level28), _C_LABEL(Xrecurse_ioapic_level28) 685 .quad _C_LABEL(Xintr_ioapic_level28), _C_LABEL(Xrecurse_ioapic_level28)
686 .quad _C_LABEL(Xresume_ioapic_level28) 686 .quad _C_LABEL(Xresume_ioapic_level28)
687 .quad _C_LABEL(Xintr_ioapic_level29), _C_LABEL(Xrecurse_ioapic_level29) 687 .quad _C_LABEL(Xintr_ioapic_level29), _C_LABEL(Xrecurse_ioapic_level29)
688 .quad _C_LABEL(Xresume_ioapic_level29) 688 .quad _C_LABEL(Xresume_ioapic_level29)
689 .quad _C_LABEL(Xintr_ioapic_level30), _C_LABEL(Xrecurse_ioapic_level30) 689 .quad _C_LABEL(Xintr_ioapic_level30), _C_LABEL(Xrecurse_ioapic_level30)
690 .quad _C_LABEL(Xresume_ioapic_level30) 690 .quad _C_LABEL(Xresume_ioapic_level30)
691 .quad _C_LABEL(Xintr_ioapic_level31), _C_LABEL(Xrecurse_ioapic_level31) 691 .quad _C_LABEL(Xintr_ioapic_level31), _C_LABEL(Xrecurse_ioapic_level31)
692 .quad _C_LABEL(Xresume_ioapic_level31) 692 .quad _C_LABEL(Xresume_ioapic_level31)
693END(ioapic_level_stubs) 693END(ioapic_level_stubs)
694 694
695 .type _C_LABEL(x2apic_edge_stubs), @object 695 .type _C_LABEL(x2apic_edge_stubs), @object
696LABEL(x2apic_edge_stubs) 696LABEL(x2apic_edge_stubs)
697 .quad _C_LABEL(Xintr_x2apic_edge0), _C_LABEL(Xrecurse_x2apic_edge0) 697 .quad _C_LABEL(Xintr_x2apic_edge0), _C_LABEL(Xrecurse_x2apic_edge0)
698 .quad _C_LABEL(Xresume_x2apic_edge0) 698 .quad _C_LABEL(Xresume_x2apic_edge0)
699 .quad _C_LABEL(Xintr_x2apic_edge1), _C_LABEL(Xrecurse_x2apic_edge1) 699 .quad _C_LABEL(Xintr_x2apic_edge1), _C_LABEL(Xrecurse_x2apic_edge1)
700 .quad _C_LABEL(Xresume_x2apic_edge1) 700 .quad _C_LABEL(Xresume_x2apic_edge1)
701 .quad _C_LABEL(Xintr_x2apic_edge2), _C_LABEL(Xrecurse_x2apic_edge2) 701 .quad _C_LABEL(Xintr_x2apic_edge2), _C_LABEL(Xrecurse_x2apic_edge2)
702 .quad _C_LABEL(Xresume_x2apic_edge2) 702 .quad _C_LABEL(Xresume_x2apic_edge2)
703 .quad _C_LABEL(Xintr_x2apic_edge3), _C_LABEL(Xrecurse_x2apic_edge3) 703 .quad _C_LABEL(Xintr_x2apic_edge3), _C_LABEL(Xrecurse_x2apic_edge3)
704 .quad _C_LABEL(Xresume_x2apic_edge3) 704 .quad _C_LABEL(Xresume_x2apic_edge3)
705 .quad _C_LABEL(Xintr_x2apic_edge4), _C_LABEL(Xrecurse_x2apic_edge4) 705 .quad _C_LABEL(Xintr_x2apic_edge4), _C_LABEL(Xrecurse_x2apic_edge4)
706 .quad _C_LABEL(Xresume_x2apic_edge4) 706 .quad _C_LABEL(Xresume_x2apic_edge4)
707 .quad _C_LABEL(Xintr_x2apic_edge5), _C_LABEL(Xrecurse_x2apic_edge5) 707 .quad _C_LABEL(Xintr_x2apic_edge5), _C_LABEL(Xrecurse_x2apic_edge5)
708 .quad _C_LABEL(Xresume_x2apic_edge5) 708 .quad _C_LABEL(Xresume_x2apic_edge5)
709 .quad _C_LABEL(Xintr_x2apic_edge6), _C_LABEL(Xrecurse_x2apic_edge6) 709 .quad _C_LABEL(Xintr_x2apic_edge6), _C_LABEL(Xrecurse_x2apic_edge6)
710 .quad _C_LABEL(Xresume_x2apic_edge6) 710 .quad _C_LABEL(Xresume_x2apic_edge6)
711 .quad _C_LABEL(Xintr_x2apic_edge7), _C_LABEL(Xrecurse_x2apic_edge7) 711 .quad _C_LABEL(Xintr_x2apic_edge7), _C_LABEL(Xrecurse_x2apic_edge7)
712 .quad _C_LABEL(Xresume_x2apic_edge7) 712 .quad _C_LABEL(Xresume_x2apic_edge7)
713 .quad _C_LABEL(Xintr_x2apic_edge8), _C_LABEL(Xrecurse_x2apic_edge8) 713 .quad _C_LABEL(Xintr_x2apic_edge8), _C_LABEL(Xrecurse_x2apic_edge8)
714 .quad _C_LABEL(Xresume_x2apic_edge8) 714 .quad _C_LABEL(Xresume_x2apic_edge8)
715 .quad _C_LABEL(Xintr_x2apic_edge9), _C_LABEL(Xrecurse_x2apic_edge9) 715 .quad _C_LABEL(Xintr_x2apic_edge9), _C_LABEL(Xrecurse_x2apic_edge9)
716 .quad _C_LABEL(Xresume_x2apic_edge9) 716 .quad _C_LABEL(Xresume_x2apic_edge9)
717 .quad _C_LABEL(Xintr_x2apic_edge10), _C_LABEL(Xrecurse_x2apic_edge10) 717 .quad _C_LABEL(Xintr_x2apic_edge10), _C_LABEL(Xrecurse_x2apic_edge10)
718 .quad _C_LABEL(Xresume_x2apic_edge10) 718 .quad _C_LABEL(Xresume_x2apic_edge10)
719 .quad _C_LABEL(Xintr_x2apic_edge11), _C_LABEL(Xrecurse_x2apic_edge11) 719 .quad _C_LABEL(Xintr_x2apic_edge11), _C_LABEL(Xrecurse_x2apic_edge11)
720 .quad _C_LABEL(Xresume_x2apic_edge11) 720 .quad _C_LABEL(Xresume_x2apic_edge11)
721 .quad _C_LABEL(Xintr_x2apic_edge12), _C_LABEL(Xrecurse_x2apic_edge12) 721 .quad _C_LABEL(Xintr_x2apic_edge12), _C_LABEL(Xrecurse_x2apic_edge12)
722 .quad _C_LABEL(Xresume_x2apic_edge12) 722 .quad _C_LABEL(Xresume_x2apic_edge12)
723 .quad _C_LABEL(Xintr_x2apic_edge13), _C_LABEL(Xrecurse_x2apic_edge13) 723 .quad _C_LABEL(Xintr_x2apic_edge13), _C_LABEL(Xrecurse_x2apic_edge13)
724 .quad _C_LABEL(Xresume_x2apic_edge13) 724 .quad _C_LABEL(Xresume_x2apic_edge13)
725 .quad _C_LABEL(Xintr_x2apic_edge14), _C_LABEL(Xrecurse_x2apic_edge14) 725 .quad _C_LABEL(Xintr_x2apic_edge14), _C_LABEL(Xrecurse_x2apic_edge14)
726 .quad _C_LABEL(Xresume_x2apic_edge14) 726 .quad _C_LABEL(Xresume_x2apic_edge14)
727 .quad _C_LABEL(Xintr_x2apic_edge15), _C_LABEL(Xrecurse_x2apic_edge15) 727 .quad _C_LABEL(Xintr_x2apic_edge15), _C_LABEL(Xrecurse_x2apic_edge15)
728 .quad _C_LABEL(Xresume_x2apic_edge15) 728 .quad _C_LABEL(Xresume_x2apic_edge15)
729 .quad _C_LABEL(Xintr_x2apic_edge16), _C_LABEL(Xrecurse_x2apic_edge16) 729 .quad _C_LABEL(Xintr_x2apic_edge16), _C_LABEL(Xrecurse_x2apic_edge16)
730 .quad _C_LABEL(Xresume_x2apic_edge16) 730 .quad _C_LABEL(Xresume_x2apic_edge16)
731 .quad _C_LABEL(Xintr_x2apic_edge17), _C_LABEL(Xrecurse_x2apic_edge17) 731 .quad _C_LABEL(Xintr_x2apic_edge17), _C_LABEL(Xrecurse_x2apic_edge17)
732 .quad _C_LABEL(Xresume_x2apic_edge17) 732 .quad _C_LABEL(Xresume_x2apic_edge17)
733 .quad _C_LABEL(Xintr_x2apic_edge18), _C_LABEL(Xrecurse_x2apic_edge18) 733 .quad _C_LABEL(Xintr_x2apic_edge18), _C_LABEL(Xrecurse_x2apic_edge18)
734 .quad _C_LABEL(Xresume_x2apic_edge18) 734 .quad _C_LABEL(Xresume_x2apic_edge18)
735 .quad _C_LABEL(Xintr_x2apic_edge19), _C_LABEL(Xrecurse_x2apic_edge19) 735 .quad _C_LABEL(Xintr_x2apic_edge19), _C_LABEL(Xrecurse_x2apic_edge19)
736 .quad _C_LABEL(Xresume_x2apic_edge19) 736 .quad _C_LABEL(Xresume_x2apic_edge19)
737 .quad _C_LABEL(Xintr_x2apic_edge20), _C_LABEL(Xrecurse_x2apic_edge20) 737 .quad _C_LABEL(Xintr_x2apic_edge20), _C_LABEL(Xrecurse_x2apic_edge20)
738 .quad _C_LABEL(Xresume_x2apic_edge20) 738 .quad _C_LABEL(Xresume_x2apic_edge20)
739 .quad _C_LABEL(Xintr_x2apic_edge21), _C_LABEL(Xrecurse_x2apic_edge21) 739 .quad _C_LABEL(Xintr_x2apic_edge21), _C_LABEL(Xrecurse_x2apic_edge21)
740 .quad _C_LABEL(Xresume_x2apic_edge21) 740 .quad _C_LABEL(Xresume_x2apic_edge21)
741 .quad _C_LABEL(Xintr_x2apic_edge22), _C_LABEL(Xrecurse_x2apic_edge22) 741 .quad _C_LABEL(Xintr_x2apic_edge22), _C_LABEL(Xrecurse_x2apic_edge22)
742 .quad _C_LABEL(Xresume_x2apic_edge22) 742 .quad _C_LABEL(Xresume_x2apic_edge22)
743 .quad _C_LABEL(Xintr_x2apic_edge23), _C_LABEL(Xrecurse_x2apic_edge23) 743 .quad _C_LABEL(Xintr_x2apic_edge23), _C_LABEL(Xrecurse_x2apic_edge23)
744 .quad _C_LABEL(Xresume_x2apic_edge23) 744 .quad _C_LABEL(Xresume_x2apic_edge23)
745 .quad _C_LABEL(Xintr_x2apic_edge24), _C_LABEL(Xrecurse_x2apic_edge24) 745 .quad _C_LABEL(Xintr_x2apic_edge24), _C_LABEL(Xrecurse_x2apic_edge24)
746 .quad _C_LABEL(Xresume_x2apic_edge24) 746 .quad _C_LABEL(Xresume_x2apic_edge24)
747 .quad _C_LABEL(Xintr_x2apic_edge25), _C_LABEL(Xrecurse_x2apic_edge25) 747 .quad _C_LABEL(Xintr_x2apic_edge25), _C_LABEL(Xrecurse_x2apic_edge25)
748 .quad _C_LABEL(Xresume_x2apic_edge25) 748 .quad _C_LABEL(Xresume_x2apic_edge25)
749 .quad _C_LABEL(Xintr_x2apic_edge26), _C_LABEL(Xrecurse_x2apic_edge26) 749 .quad _C_LABEL(Xintr_x2apic_edge26), _C_LABEL(Xrecurse_x2apic_edge26)
750 .quad _C_LABEL(Xresume_x2apic_edge26) 750 .quad _C_LABEL(Xresume_x2apic_edge26)
751 .quad _C_LABEL(Xintr_x2apic_edge27), _C_LABEL(Xrecurse_x2apic_edge27) 751 .quad _C_LABEL(Xintr_x2apic_edge27), _C_LABEL(Xrecurse_x2apic_edge27)
752 .quad _C_LABEL(Xresume_x2apic_edge27) 752 .quad _C_LABEL(Xresume_x2apic_edge27)
753 .quad _C_LABEL(Xintr_x2apic_edge28), _C_LABEL(Xrecurse_x2apic_edge28) 753 .quad _C_LABEL(Xintr_x2apic_edge28), _C_LABEL(Xrecurse_x2apic_edge28)
754 .quad _C_LABEL(Xresume_x2apic_edge28) 754 .quad _C_LABEL(Xresume_x2apic_edge28)
755 .quad _C_LABEL(Xintr_x2apic_edge29), _C_LABEL(Xrecurse_x2apic_edge29) 755 .quad _C_LABEL(Xintr_x2apic_edge29), _C_LABEL(Xrecurse_x2apic_edge29)
756 .quad _C_LABEL(Xresume_x2apic_edge29) 756 .quad _C_LABEL(Xresume_x2apic_edge29)
757 .quad _C_LABEL(Xintr_x2apic_edge30), _C_LABEL(Xrecurse_x2apic_edge30) 757 .quad _C_LABEL(Xintr_x2apic_edge30), _C_LABEL(Xrecurse_x2apic_edge30)
758 .quad _C_LABEL(Xresume_x2apic_edge30) 758 .quad _C_LABEL(Xresume_x2apic_edge30)
759 .quad _C_LABEL(Xintr_x2apic_edge31), _C_LABEL(Xrecurse_x2apic_edge31) 759 .quad _C_LABEL(Xintr_x2apic_edge31), _C_LABEL(Xrecurse_x2apic_edge31)
760 .quad _C_LABEL(Xresume_x2apic_edge31) 760 .quad _C_LABEL(Xresume_x2apic_edge31)
761END(x2apic_edge_stubs) 761END(x2apic_edge_stubs)
762 762
763 .type _C_LABEL(x2apic_level_stubs), @object 763 .type _C_LABEL(x2apic_level_stubs), @object
764LABEL(x2apic_level_stubs) 764LABEL(x2apic_level_stubs)
765 .quad _C_LABEL(Xintr_x2apic_level0), _C_LABEL(Xrecurse_x2apic_level0) 765 .quad _C_LABEL(Xintr_x2apic_level0), _C_LABEL(Xrecurse_x2apic_level0)
766 .quad _C_LABEL(Xresume_x2apic_level0) 766 .quad _C_LABEL(Xresume_x2apic_level0)
767 .quad _C_LABEL(Xintr_x2apic_level1), _C_LABEL(Xrecurse_x2apic_level1) 767 .quad _C_LABEL(Xintr_x2apic_level1), _C_LABEL(Xrecurse_x2apic_level1)
768 .quad _C_LABEL(Xresume_x2apic_level1) 768 .quad _C_LABEL(Xresume_x2apic_level1)
769 .quad _C_LABEL(Xintr_x2apic_level2), _C_LABEL(Xrecurse_x2apic_level2) 769 .quad _C_LABEL(Xintr_x2apic_level2), _C_LABEL(Xrecurse_x2apic_level2)
770 .quad _C_LABEL(Xresume_x2apic_level2) 770 .quad _C_LABEL(Xresume_x2apic_level2)
771 .quad _C_LABEL(Xintr_x2apic_level3), _C_LABEL(Xrecurse_x2apic_level3) 771 .quad _C_LABEL(Xintr_x2apic_level3), _C_LABEL(Xrecurse_x2apic_level3)
772 .quad _C_LABEL(Xresume_x2apic_level3) 772 .quad _C_LABEL(Xresume_x2apic_level3)
773 .quad _C_LABEL(Xintr_x2apic_level4), _C_LABEL(Xrecurse_x2apic_level4) 773 .quad _C_LABEL(Xintr_x2apic_level4), _C_LABEL(Xrecurse_x2apic_level4)
774 .quad _C_LABEL(Xresume_x2apic_level4) 774 .quad _C_LABEL(Xresume_x2apic_level4)
775 .quad _C_LABEL(Xintr_x2apic_level5), _C_LABEL(Xrecurse_x2apic_level5) 775 .quad _C_LABEL(Xintr_x2apic_level5), _C_LABEL(Xrecurse_x2apic_level5)
776 .quad _C_LABEL(Xresume_x2apic_level5) 776 .quad _C_LABEL(Xresume_x2apic_level5)
777 .quad _C_LABEL(Xintr_x2apic_level6), _C_LABEL(Xrecurse_x2apic_level6) 777 .quad _C_LABEL(Xintr_x2apic_level6), _C_LABEL(Xrecurse_x2apic_level6)
778 .quad _C_LABEL(Xresume_x2apic_level6) 778 .quad _C_LABEL(Xresume_x2apic_level6)
779 .quad _C_LABEL(Xintr_x2apic_level7), _C_LABEL(Xrecurse_x2apic_level7) 779 .quad _C_LABEL(Xintr_x2apic_level7), _C_LABEL(Xrecurse_x2apic_level7)
780 .quad _C_LABEL(Xresume_x2apic_level7) 780 .quad _C_LABEL(Xresume_x2apic_level7)
781 .quad _C_LABEL(Xintr_x2apic_level8), _C_LABEL(Xrecurse_x2apic_level8) 781 .quad _C_LABEL(Xintr_x2apic_level8), _C_LABEL(Xrecurse_x2apic_level8)
782 .quad _C_LABEL(Xresume_x2apic_level8) 782 .quad _C_LABEL(Xresume_x2apic_level8)
783 .quad _C_LABEL(Xintr_x2apic_level9), _C_LABEL(Xrecurse_x2apic_level9) 783 .quad _C_LABEL(Xintr_x2apic_level9), _C_LABEL(Xrecurse_x2apic_level9)
784 .quad _C_LABEL(Xresume_x2apic_level9) 784 .quad _C_LABEL(Xresume_x2apic_level9)
785 .quad _C_LABEL(Xintr_x2apic_level10), _C_LABEL(Xrecurse_x2apic_level10) 785 .quad _C_LABEL(Xintr_x2apic_level10), _C_LABEL(Xrecurse_x2apic_level10)
786 .quad _C_LABEL(Xresume_x2apic_level10) 786 .quad _C_LABEL(Xresume_x2apic_level10)
787 .quad _C_LABEL(Xintr_x2apic_level11), _C_LABEL(Xrecurse_x2apic_level11) 787 .quad _C_LABEL(Xintr_x2apic_level11), _C_LABEL(Xrecurse_x2apic_level11)
788 .quad _C_LABEL(Xresume_x2apic_level11) 788 .quad _C_LABEL(Xresume_x2apic_level11)
789 .quad _C_LABEL(Xintr_x2apic_level12), _C_LABEL(Xrecurse_x2apic_level12) 789 .quad _C_LABEL(Xintr_x2apic_level12), _C_LABEL(Xrecurse_x2apic_level12)
790 .quad _C_LABEL(Xresume_x2apic_level12) 790 .quad _C_LABEL(Xresume_x2apic_level12)
791 .quad _C_LABEL(Xintr_x2apic_level13), _C_LABEL(Xrecurse_x2apic_level13) 791 .quad _C_LABEL(Xintr_x2apic_level13), _C_LABEL(Xrecurse_x2apic_level13)
792 .quad _C_LABEL(Xresume_x2apic_level13) 792 .quad _C_LABEL(Xresume_x2apic_level13)
793 .quad _C_LABEL(Xintr_x2apic_level14), _C_LABEL(Xrecurse_x2apic_level14) 793 .quad _C_LABEL(Xintr_x2apic_level14), _C_LABEL(Xrecurse_x2apic_level14)
794 .quad _C_LABEL(Xresume_x2apic_level14) 794 .quad _C_LABEL(Xresume_x2apic_level14)
795 .quad _C_LABEL(Xintr_x2apic_level15), _C_LABEL(Xrecurse_x2apic_level15) 795 .quad _C_LABEL(Xintr_x2apic_level15), _C_LABEL(Xrecurse_x2apic_level15)
796 .quad _C_LABEL(Xresume_x2apic_level15) 796 .quad _C_LABEL(Xresume_x2apic_level15)
797 .quad _C_LABEL(Xintr_x2apic_level16), _C_LABEL(Xrecurse_x2apic_level16) 797 .quad _C_LABEL(Xintr_x2apic_level16), _C_LABEL(Xrecurse_x2apic_level16)
798 .quad _C_LABEL(Xresume_x2apic_level16) 798 .quad _C_LABEL(Xresume_x2apic_level16)
799 .quad _C_LABEL(Xintr_x2apic_level17), _C_LABEL(Xrecurse_x2apic_level17) 799 .quad _C_LABEL(Xintr_x2apic_level17), _C_LABEL(Xrecurse_x2apic_level17)
800 .quad _C_LABEL(Xresume_x2apic_level17) 800 .quad _C_LABEL(Xresume_x2apic_level17)
801 .quad _C_LABEL(Xintr_x2apic_level18), _C_LABEL(Xrecurse_x2apic_level18) 801 .quad _C_LABEL(Xintr_x2apic_level18), _C_LABEL(Xrecurse_x2apic_level18)
802 .quad _C_LABEL(Xresume_x2apic_level18) 802 .quad _C_LABEL(Xresume_x2apic_level18)
803 .quad _C_LABEL(Xintr_x2apic_level19), _C_LABEL(Xrecurse_x2apic_level19) 803 .quad _C_LABEL(Xintr_x2apic_level19), _C_LABEL(Xrecurse_x2apic_level19)
804 .quad _C_LABEL(Xresume_x2apic_level19) 804 .quad _C_LABEL(Xresume_x2apic_level19)
805 .quad _C_LABEL(Xintr_x2apic_level20), _C_LABEL(Xrecurse_x2apic_level20) 805 .quad _C_LABEL(Xintr_x2apic_level20), _C_LABEL(Xrecurse_x2apic_level20)
806 .quad _C_LABEL(Xresume_x2apic_level20) 806 .quad _C_LABEL(Xresume_x2apic_level20)
807 .quad _C_LABEL(Xintr_x2apic_level21), _C_LABEL(Xrecurse_x2apic_level21) 807 .quad _C_LABEL(Xintr_x2apic_level21), _C_LABEL(Xrecurse_x2apic_level21)
808 .quad _C_LABEL(Xresume_x2apic_level21) 808 .quad _C_LABEL(Xresume_x2apic_level21)
809 .quad _C_LABEL(Xintr_x2apic_level22), _C_LABEL(Xrecurse_x2apic_level22) 809 .quad _C_LABEL(Xintr_x2apic_level22), _C_LABEL(Xrecurse_x2apic_level22)
810 .quad _C_LABEL(Xresume_x2apic_level22) 810 .quad _C_LABEL(Xresume_x2apic_level22)
811 .quad _C_LABEL(Xintr_x2apic_level23), _C_LABEL(Xrecurse_x2apic_level23) 811 .quad _C_LABEL(Xintr_x2apic_level23), _C_LABEL(Xrecurse_x2apic_level23)
812 .quad _C_LABEL(Xresume_x2apic_level23) 812 .quad _C_LABEL(Xresume_x2apic_level23)
813 .quad _C_LABEL(Xintr_x2apic_level24), _C_LABEL(Xrecurse_x2apic_level24) 813 .quad _C_LABEL(Xintr_x2apic_level24), _C_LABEL(Xrecurse_x2apic_level24)
814 .quad _C_LABEL(Xresume_x2apic_level24) 814 .quad _C_LABEL(Xresume_x2apic_level24)
815 .quad _C_LABEL(Xintr_x2apic_level25), _C_LABEL(Xrecurse_x2apic_level25) 815 .quad _C_LABEL(Xintr_x2apic_level25), _C_LABEL(Xrecurse_x2apic_level25)
816 .quad _C_LABEL(Xresume_x2apic_level25) 816 .quad _C_LABEL(Xresume_x2apic_level25)
817 .quad _C_LABEL(Xintr_x2apic_level26), _C_LABEL(Xrecurse_x2apic_level26) 817 .quad _C_LABEL(Xintr_x2apic_level26), _C_LABEL(Xrecurse_x2apic_level26)
818 .quad _C_LABEL(Xresume_x2apic_level26) 818 .quad _C_LABEL(Xresume_x2apic_level26)
819 .quad _C_LABEL(Xintr_x2apic_level27), _C_LABEL(Xrecurse_x2apic_level27) 819 .quad _C_LABEL(Xintr_x2apic_level27), _C_LABEL(Xrecurse_x2apic_level27)
820 .quad _C_LABEL(Xresume_x2apic_level27) 820 .quad _C_LABEL(Xresume_x2apic_level27)
821 .quad _C_LABEL(Xintr_x2apic_level28), _C_LABEL(Xrecurse_x2apic_level28) 821 .quad _C_LABEL(Xintr_x2apic_level28), _C_LABEL(Xrecurse_x2apic_level28)
822 .quad _C_LABEL(Xresume_x2apic_level28) 822 .quad _C_LABEL(Xresume_x2apic_level28)
823 .quad _C_LABEL(Xintr_x2apic_level29), _C_LABEL(Xrecurse_x2apic_level29) 823 .quad _C_LABEL(Xintr_x2apic_level29), _C_LABEL(Xrecurse_x2apic_level29)
824 .quad _C_LABEL(Xresume_x2apic_level29) 824 .quad _C_LABEL(Xresume_x2apic_level29)
825 .quad _C_LABEL(Xintr_x2apic_level30), _C_LABEL(Xrecurse_x2apic_level30) 825 .quad _C_LABEL(Xintr_x2apic_level30), _C_LABEL(Xrecurse_x2apic_level30)
826 .quad _C_LABEL(Xresume_x2apic_level30) 826 .quad _C_LABEL(Xresume_x2apic_level30)
827 .quad _C_LABEL(Xintr_x2apic_level31), _C_LABEL(Xrecurse_x2apic_level31) 827 .quad _C_LABEL(Xintr_x2apic_level31), _C_LABEL(Xrecurse_x2apic_level31)
828 .quad _C_LABEL(Xresume_x2apic_level31) 828 .quad _C_LABEL(Xresume_x2apic_level31)
829END(x2apic_level_stubs) 829END(x2apic_level_stubs)
830#endif 830#endif
831 831
832#endif /* !defined(XEN) */ 832#endif /* !defined(XEN) */
833 833
834#if defined(XEN) 834#if defined(XEN)
835/* Resume/recurse procedures for spl() */ 835/* Resume/recurse procedures for spl() */
836#define XENINTRSTUB(name, num, early_ack, late_ack, mask, unmask, level_mask) \ 836#define XENINTRSTUB(name, num, early_ack, late_ack, mask, unmask, level_mask) \
837IDTVEC(recurse_ ## name ## num) ;\ 837IDTVEC(recurse_ ## name ## num) ;\
838 INTR_RECURSE_HWFRAME ;\ 838 INTR_RECURSE_HWFRAME ;\
839 subq $8,%rsp ;\ 839 subq $8,%rsp ;\
840 pushq $T_ASTFLT /* trap # for doing ASTs */ ;\ 840 pushq $T_ASTFLT /* trap # for doing ASTs */ ;\
841 INTRENTRY ;\ 841 INTRENTRY ;\
842IDTVEC(resume_ ## name ## num) \ 842IDTVEC(resume_ ## name ## num) \
843 movq $IREENT_MAGIC,TF_ERR(%rsp) ;\ 843 movq $IREENT_MAGIC,TF_ERR(%rsp) ;\
844 movl %ebx,%r13d ;\ 844 movl %ebx,%r13d ;\
845 movq CPUVAR(ISOURCES) + (num) * 8,%r14 ;\ 845 movq CPUVAR(ISOURCES) + (num) * 8,%r14 ;\
8461: \ 8461: \
847 pushq %r13 ;\ 847 pushq %r13 ;\
848 movl $num,CPUVAR(ILEVEL) ;\ 848 movl $num,CPUVAR(ILEVEL) ;\
849 STI(si) ;\ 849 STI(si) ;\
850 incl CPUVAR(IDEPTH) ;\ 850 incl CPUVAR(IDEPTH) ;\
851 movq IS_HANDLERS(%r14),%rbx ;\ 851 movq IS_HANDLERS(%r14),%rbx ;\
8526: \ 8526: \
853 movq IH_ARG(%rbx),%rdi ;\ 853 movq IH_ARG(%rbx),%rdi ;\
854 movq %rsp,%rsi ;\ 854 movq %rsp,%rsi ;\
855 call *IH_FUN(%rbx) /* call it */ ;\ 855 call *IH_FUN(%rbx) /* call it */ ;\
856 movq IH_NEXT(%rbx),%rbx /* next handler in chain */ ;\ 856 movq IH_NEXT(%rbx),%rbx /* next handler in chain */ ;\
857 testq %rbx,%rbx ;\ 857 testq %rbx,%rbx ;\
858 jnz 6b ;\ 858 jnz 6b ;\
8595: \ 8595: \
860 CLI(si) ;\ 860 CLI(si) ;\
861 unmask(num) /* unmask it in hardware */ ;\ 861 unmask(num) /* unmask it in hardware */ ;\
862 late_ack(num) ;\ 862 late_ack(num) ;\
863 STI(si) ;\ 863 STI(si) ;\
864 jmp _C_LABEL(Xdoreti) /* lower spl and do ASTs */ ;\ 864 jmp _C_LABEL(Xdoreti) /* lower spl and do ASTs */ ;\
865 865
866/* The unmask func for Xen events */ 866/* The unmask func for Xen events */
867#define hypervisor_asm_unmask(num) \ 867#define hypervisor_asm_unmask(num) \
868 movq $num,%rdi ;\ 868 movq $num,%rdi ;\
869 call _C_LABEL(hypervisor_enable_ipl) 869 call _C_LABEL(hypervisor_enable_ipl)
870 870
871XENINTRSTUB(xenev,0,voidop,voidop,voidop,hypervisor_asm_unmask,voidop) 871XENINTRSTUB(xenev,0,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
872XENINTRSTUB(xenev,1,voidop,voidop,voidop,hypervisor_asm_unmask,voidop) 872XENINTRSTUB(xenev,1,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
873XENINTRSTUB(xenev,2,voidop,voidop,voidop,hypervisor_asm_unmask,voidop) 873XENINTRSTUB(xenev,2,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
874XENINTRSTUB(xenev,3,voidop,voidop,voidop,hypervisor_asm_unmask,voidop) 874XENINTRSTUB(xenev,3,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
875XENINTRSTUB(xenev,4,voidop,voidop,voidop,hypervisor_asm_unmask,voidop) 875XENINTRSTUB(xenev,4,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
876XENINTRSTUB(xenev,5,voidop,voidop,voidop,hypervisor_asm_unmask,voidop) 876XENINTRSTUB(xenev,5,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
877XENINTRSTUB(xenev,6,voidop,voidop,voidop,hypervisor_asm_unmask,voidop) 877XENINTRSTUB(xenev,6,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
878XENINTRSTUB(xenev,7,voidop,voidop,voidop,hypervisor_asm_unmask,voidop) 878XENINTRSTUB(xenev,7,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
879XENINTRSTUB(xenev,8,voidop,voidop,voidop,hypervisor_asm_unmask,voidop) 879XENINTRSTUB(xenev,8,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
880XENINTRSTUB(xenev,9,voidop,voidop,voidop,hypervisor_asm_unmask,voidop) 880XENINTRSTUB(xenev,9,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
881XENINTRSTUB(xenev,10,voidop,voidop,voidop,hypervisor_asm_unmask,voidop) 881XENINTRSTUB(xenev,10,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
882XENINTRSTUB(xenev,11,voidop,voidop,voidop,hypervisor_asm_unmask,voidop) 882XENINTRSTUB(xenev,11,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
883XENINTRSTUB(xenev,12,voidop,voidop,voidop,hypervisor_asm_unmask,voidop) 883XENINTRSTUB(xenev,12,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
884XENINTRSTUB(xenev,13,voidop,voidop,voidop,hypervisor_asm_unmask,voidop) 884XENINTRSTUB(xenev,13,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
885XENINTRSTUB(xenev,14,voidop,voidop,voidop,hypervisor_asm_unmask,voidop) 885XENINTRSTUB(xenev,14,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
886XENINTRSTUB(xenev,15,voidop,voidop,voidop,hypervisor_asm_unmask,voidop) 886XENINTRSTUB(xenev,15,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
887XENINTRSTUB(xenev,16,voidop,voidop,voidop,hypervisor_asm_unmask,voidop) 887XENINTRSTUB(xenev,16,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
888XENINTRSTUB(xenev,17,voidop,voidop,voidop,hypervisor_asm_unmask,voidop) 888XENINTRSTUB(xenev,17,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
889XENINTRSTUB(xenev,18,voidop,voidop,voidop,hypervisor_asm_unmask,voidop) 889XENINTRSTUB(xenev,18,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
890XENINTRSTUB(xenev,19,voidop,voidop,voidop,hypervisor_asm_unmask,voidop) 890XENINTRSTUB(xenev,19,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
891XENINTRSTUB(xenev,20,voidop,voidop,voidop,hypervisor_asm_unmask,voidop) 891XENINTRSTUB(xenev,20,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
892XENINTRSTUB(xenev,21,voidop,voidop,voidop,hypervisor_asm_unmask,voidop) 892XENINTRSTUB(xenev,21,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
893XENINTRSTUB(xenev,22,voidop,voidop,voidop,hypervisor_asm_unmask,voidop) 893XENINTRSTUB(xenev,22,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
894XENINTRSTUB(xenev,23,voidop,voidop,voidop,hypervisor_asm_unmask,voidop) 894XENINTRSTUB(xenev,23,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
895XENINTRSTUB(xenev,24,voidop,voidop,voidop,hypervisor_asm_unmask,voidop) 895XENINTRSTUB(xenev,24,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
896XENINTRSTUB(xenev,25,voidop,voidop,voidop,hypervisor_asm_unmask,voidop) 896XENINTRSTUB(xenev,25,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
897XENINTRSTUB(xenev,26,voidop,voidop,voidop,hypervisor_asm_unmask,voidop) 897XENINTRSTUB(xenev,26,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
898XENINTRSTUB(xenev,27,voidop,voidop,voidop,hypervisor_asm_unmask,voidop) 898XENINTRSTUB(xenev,27,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
899XENINTRSTUB(xenev,28,voidop,voidop,voidop,hypervisor_asm_unmask,voidop) 899XENINTRSTUB(xenev,28,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
900XENINTRSTUB(xenev,29,voidop,voidop,voidop,hypervisor_asm_unmask,voidop) 900XENINTRSTUB(xenev,29,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
901XENINTRSTUB(xenev,30,voidop,voidop,voidop,hypervisor_asm_unmask,voidop) 901XENINTRSTUB(xenev,30,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
902XENINTRSTUB(xenev,31,voidop,voidop,voidop,hypervisor_asm_unmask,voidop) 902XENINTRSTUB(xenev,31,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
903 903
904LABEL(xenev_stubs) 904LABEL(xenev_stubs)
905 .quad _C_LABEL(Xrecurse_xenev0), _C_LABEL(Xresume_xenev0) 905 .quad _C_LABEL(Xrecurse_xenev0), _C_LABEL(Xresume_xenev0)
906 .quad _C_LABEL(Xrecurse_xenev1) ,_C_LABEL(Xresume_xenev1) 906 .quad _C_LABEL(Xrecurse_xenev1) ,_C_LABEL(Xresume_xenev1)
907 .quad _C_LABEL(Xrecurse_xenev2) ,_C_LABEL(Xresume_xenev2) 907 .quad _C_LABEL(Xrecurse_xenev2) ,_C_LABEL(Xresume_xenev2)
908 .quad _C_LABEL(Xrecurse_xenev3) ,_C_LABEL(Xresume_xenev3) 908 .quad _C_LABEL(Xrecurse_xenev3) ,_C_LABEL(Xresume_xenev3)
909 .quad _C_LABEL(Xrecurse_xenev4) ,_C_LABEL(Xresume_xenev4) 909 .quad _C_LABEL(Xrecurse_xenev4) ,_C_LABEL(Xresume_xenev4)
910 .quad _C_LABEL(Xrecurse_xenev5) ,_C_LABEL(Xresume_xenev5) 910 .quad _C_LABEL(Xrecurse_xenev5) ,_C_LABEL(Xresume_xenev5)
911 .quad _C_LABEL(Xrecurse_xenev6) ,_C_LABEL(Xresume_xenev6) 911 .quad _C_LABEL(Xrecurse_xenev6) ,_C_LABEL(Xresume_xenev6)
912 .quad _C_LABEL(Xrecurse_xenev7) ,_C_LABEL(Xresume_xenev7) 912 .quad _C_LABEL(Xrecurse_xenev7) ,_C_LABEL(Xresume_xenev7)
913 .quad _C_LABEL(Xrecurse_xenev8) ,_C_LABEL(Xresume_xenev8) 913 .quad _C_LABEL(Xrecurse_xenev8) ,_C_LABEL(Xresume_xenev8)
914 .quad _C_LABEL(Xrecurse_xenev9) ,_C_LABEL(Xresume_xenev9) 914 .quad _C_LABEL(Xrecurse_xenev9) ,_C_LABEL(Xresume_xenev9)
915 .quad _C_LABEL(Xrecurse_xenev10), _C_LABEL(Xresume_xenev10) 915 .quad _C_LABEL(Xrecurse_xenev10), _C_LABEL(Xresume_xenev10)
916 .quad _C_LABEL(Xrecurse_xenev11), _C_LABEL(Xresume_xenev11) 916 .quad _C_LABEL(Xrecurse_xenev11), _C_LABEL(Xresume_xenev11)
917 .quad _C_LABEL(Xrecurse_xenev12), _C_LABEL(Xresume_xenev12) 917 .quad _C_LABEL(Xrecurse_xenev12), _C_LABEL(Xresume_xenev12)
918 .quad _C_LABEL(Xrecurse_xenev13), _C_LABEL(Xresume_xenev13) 918 .quad _C_LABEL(Xrecurse_xenev13), _C_LABEL(Xresume_xenev13)
919 .quad _C_LABEL(Xrecurse_xenev14), _C_LABEL(Xresume_xenev14) 919 .quad _C_LABEL(Xrecurse_xenev14), _C_LABEL(Xresume_xenev14)
920 .quad _C_LABEL(Xrecurse_xenev15), _C_LABEL(Xresume_xenev15) 920 .quad _C_LABEL(Xrecurse_xenev15), _C_LABEL(Xresume_xenev15)
921 .quad _C_LABEL(Xrecurse_xenev16), _C_LABEL(Xresume_xenev16) 921 .quad _C_LABEL(Xrecurse_xenev16), _C_LABEL(Xresume_xenev16)
922 .quad _C_LABEL(Xrecurse_xenev17), _C_LABEL(Xresume_xenev17) 922 .quad _C_LABEL(Xrecurse_xenev17), _C_LABEL(Xresume_xenev17)
923 .quad _C_LABEL(Xrecurse_xenev18), _C_LABEL(Xresume_xenev18) 923 .quad _C_LABEL(Xrecurse_xenev18), _C_LABEL(Xresume_xenev18)
924 .quad _C_LABEL(Xrecurse_xenev19), _C_LABEL(Xresume_xenev19) 924 .quad _C_LABEL(Xrecurse_xenev19), _C_LABEL(Xresume_xenev19)
925 .quad _C_LABEL(Xrecurse_xenev20), _C_LABEL(Xresume_xenev20) 925 .quad _C_LABEL(Xrecurse_xenev20), _C_LABEL(Xresume_xenev20)
926 .quad _C_LABEL(Xrecurse_xenev21), _C_LABEL(Xresume_xenev21) 926 .quad _C_LABEL(Xrecurse_xenev21), _C_LABEL(Xresume_xenev21)
927 .quad _C_LABEL(Xrecurse_xenev22), _C_LABEL(Xresume_xenev22) 927 .quad _C_LABEL(Xrecurse_xenev22), _C_LABEL(Xresume_xenev22)
928 .quad _C_LABEL(Xrecurse_xenev23), _C_LABEL(Xresume_xenev23) 928 .quad _C_LABEL(Xrecurse_xenev23), _C_LABEL(Xresume_xenev23)
929 .quad _C_LABEL(Xrecurse_xenev24), _C_LABEL(Xresume_xenev24) 929 .quad _C_LABEL(Xrecurse_xenev24), _C_LABEL(Xresume_xenev24)
930 .quad _C_LABEL(Xrecurse_xenev25), _C_LABEL(Xresume_xenev25) 930 .quad _C_LABEL(Xrecurse_xenev25), _C_LABEL(Xresume_xenev25)
931 .quad _C_LABEL(Xrecurse_xenev26), _C_LABEL(Xresume_xenev26) 931 .quad _C_LABEL(Xrecurse_xenev26), _C_LABEL(Xresume_xenev26)
932 .quad _C_LABEL(Xrecurse_xenev27), _C_LABEL(Xresume_xenev27) 932 .quad _C_LABEL(Xrecurse_xenev27), _C_LABEL(Xresume_xenev27)
933 .quad _C_LABEL(Xrecurse_xenev28), _C_LABEL(Xresume_xenev28) 933 .quad _C_LABEL(Xrecurse_xenev28), _C_LABEL(Xresume_xenev28)
934 .quad _C_LABEL(Xrecurse_xenev29), _C_LABEL(Xresume_xenev29) 934 .quad _C_LABEL(Xrecurse_xenev29), _C_LABEL(Xresume_xenev29)
935 .quad _C_LABEL(Xrecurse_xenev30), _C_LABEL(Xresume_xenev30) 935 .quad _C_LABEL(Xrecurse_xenev30), _C_LABEL(Xresume_xenev30)
936 .quad _C_LABEL(Xrecurse_xenev31), _C_LABEL(Xresume_xenev31) 936 .quad _C_LABEL(Xrecurse_xenev31), _C_LABEL(Xresume_xenev31)
937END(xenev_stubs) 937END(xenev_stubs)
938 938
939/* 939/*
940 * Xen callbacks 940 * Xen callbacks
941 */ 941 */
942 942
943/* Hypervisor callback */ 943/* Hypervisor callback */
944NENTRY(hypervisor_callback) 944NENTRY(hypervisor_callback)
945 movq (%rsp),%rcx 945 movq (%rsp),%rcx
946 movq 8(%rsp),%r11 946 movq 8(%rsp),%r11
947 addq $16,%rsp 947 addq $16,%rsp
948 pushq $0 /* Dummy error code */ 948 pushq $0 /* Dummy error code */
949 pushq $T_ASTFLT 949 pushq $T_ASTFLT
950 INTRENTRY 950 INTRENTRY
951 /* sti?? */ 951 /* sti?? */
952 movq %rsp,%rdi 952 movq %rsp,%rdi
953 subq $8,%rdi; /* don't forget if_ppl */ 953 subq $8,%rdi; /* don't forget if_ppl */
954 call do_hypervisor_callback 954 call do_hypervisor_callback
955 testb $SEL_RPL,TF_CS(%rsp) 955 testb $SEL_RPL,TF_CS(%rsp)
956 jnz doreti_checkast 956 jnz doreti_checkast
9571: 9571:
958 INTRFASTEXIT 958 INTRFASTEXIT
959END(hypervisor_callback) 959END(hypervisor_callback)
960 960
961/* Panic? */ 961/* Panic? */
962NENTRY(failsafe_callback) 962NENTRY(failsafe_callback)
963 movq (%rsp),%rcx 963 movq (%rsp),%rcx
964 movq 8(%rsp),%r11 964 movq 8(%rsp),%r11
965 addq $16,%rsp 965 addq $16,%rsp
966 pushq $0 966 pushq $0
967 pushq $T_ASTFLT 967 pushq $T_ASTFLT
968 INTRENTRY 968 INTRENTRY
969 movq %rsp,%rdi 969 movq %rsp,%rdi
970 subq $8,%rdi; /* don't forget if_ppl */ 970 subq $8,%rdi; /* don't forget if_ppl */
971 call xen_failsafe_handler 971 call xen_failsafe_handler
972 INTRFASTEXIT 972 INTRFASTEXIT
973/* jmp HYPERVISOR_iret */ 973/* jmp HYPERVISOR_iret */
974END(failsafe_callback) 974END(failsafe_callback)
975 975
976#endif /* !XEN */ 976#endif /* !XEN */

cvs diff -r1.61 -r1.62 src/sys/arch/x86/x86/lapic.c (switch to unified diff)

--- src/sys/arch/x86/x86/lapic.c 2017/08/11 06:18:29 1.61
+++ src/sys/arch/x86/x86/lapic.c 2017/08/15 09:08:39 1.62
@@ -1,937 +1,937 @@ @@ -1,937 +1,937 @@
1/* $NetBSD: lapic.c,v 1.61 2017/08/11 06:18:29 maxv Exp $ */ 1/* $NetBSD: lapic.c,v 1.62 2017/08/15 09:08:39 maxv Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2000, 2008 The NetBSD Foundation, Inc. 4 * Copyright (c) 2000, 2008 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by RedBack Networks Inc. 8 * by RedBack Networks Inc.
9 * 9 *
10 * Author: Bill Sommerfeld 10 * Author: Bill Sommerfeld
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions 13 * modification, are permitted provided that the following conditions
14 * are met: 14 * are met:
15 * 1. Redistributions of source code must retain the above copyright 15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer. 16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright 17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the 18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution. 19 * documentation and/or other materials provided with the distribution.
20 * 20 *
21 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 21 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
22 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 22 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
23 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 23 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 24 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE. 31 * POSSIBILITY OF SUCH DAMAGE.
32 */ 32 */
33 33
34#include <sys/cdefs.h> 34#include <sys/cdefs.h>
35__KERNEL_RCSID(0, "$NetBSD: lapic.c,v 1.61 2017/08/11 06:18:29 maxv Exp $"); 35__KERNEL_RCSID(0, "$NetBSD: lapic.c,v 1.62 2017/08/15 09:08:39 maxv Exp $");
36 36
37#include "acpica.h" 37#include "acpica.h"
38#include "ioapic.h" 38#include "ioapic.h"
39#include "opt_acpi.h" 39#include "opt_acpi.h"
40#include "opt_ddb.h" 40#include "opt_ddb.h"
41#include "opt_mpbios.h" /* for MPDEBUG */ 41#include "opt_mpbios.h" /* for MPDEBUG */
42#include "opt_multiprocessor.h" 42#include "opt_multiprocessor.h"
43#include "opt_ntp.h" 43#include "opt_ntp.h"
44 44
45#include <sys/param.h> 45#include <sys/param.h>
46#include <sys/proc.h> 46#include <sys/proc.h>
47#include <sys/systm.h> 47#include <sys/systm.h>
48#include <sys/device.h> 48#include <sys/device.h>
49#include <sys/timetc.h> 49#include <sys/timetc.h>
50 50
51#include <uvm/uvm_extern.h> 51#include <uvm/uvm_extern.h>
52 52
53#include <dev/ic/i8253reg.h> 53#include <dev/ic/i8253reg.h>
54 54
55#include <machine/cpu.h> 55#include <machine/cpu.h>
56#include <machine/cpu_counter.h> 56#include <machine/cpu_counter.h>
57#include <machine/cpufunc.h> 57#include <machine/cpufunc.h>
58#include <machine/cpuvar.h> 58#include <machine/cpuvar.h>
59#include <machine/pmap.h> 59#include <machine/pmap.h>
60#include <machine/vmparam.h> 60#include <machine/vmparam.h>
61#include <machine/mpacpi.h> 61#include <machine/mpacpi.h>
62#include <machine/mpbiosvar.h> 62#include <machine/mpbiosvar.h>
63#include <machine/pcb.h> 63#include <machine/pcb.h>
64#include <machine/specialreg.h> 64#include <machine/specialreg.h>
65#include <machine/segments.h> 65#include <machine/segments.h>
66#include <x86/x86/tsc.h> 66#include <x86/x86/tsc.h>
67#include <x86/i82093var.h> 67#include <x86/i82093var.h>
68 68
69#include <machine/apicvar.h> 69#include <machine/apicvar.h>
70#include <machine/i82489reg.h> 70#include <machine/i82489reg.h>
71#include <machine/i82489var.h> 71#include <machine/i82489var.h>
72 72
73#if NACPICA > 0 73#if NACPICA > 0
74#include <dev/acpi/acpica.h> 74#include <dev/acpi/acpica.h>
75#include <dev/acpi/acpivar.h> 75#include <dev/acpi/acpivar.h>
76#endif 76#endif
77 77
78#ifdef DDB 78#ifdef DDB
79#include <machine/db_machdep.h> 79#include <machine/db_machdep.h>
80#ifdef MULTIPROCESSOR 80#ifdef MULTIPROCESSOR
81#ifdef __x86_64__ 81#ifdef __x86_64__
82typedef void (vector)(void); 82typedef void (vector)(void);
83extern vector Xx2apic_intrddb; 83extern vector Xx2apic_intrddbipi;
84extern int ddb_vec; 84extern int ddb_vec;
85#endif 85#endif
86#endif 86#endif
87#endif 87#endif
88 88
89#include <x86/x86/vmtreg.h> /* for vmt_hvcall() */ 89#include <x86/x86/vmtreg.h> /* for vmt_hvcall() */
90#include <x86/x86/vmtvar.h> /* for vmt_hvcall() */ 90#include <x86/x86/vmtvar.h> /* for vmt_hvcall() */
91 91
92/* Referenced from vector.S */ 92/* Referenced from vector.S */
93void lapic_clockintr(void *, struct intrframe *); 93void lapic_clockintr(void *, struct intrframe *);
94 94
95static void lapic_delay(unsigned int); 95static void lapic_delay(unsigned int);
96static uint32_t lapic_gettick(void); 96static uint32_t lapic_gettick(void);
97static void lapic_setup_bsp(paddr_t); 97static void lapic_setup_bsp(paddr_t);
98static void lapic_map(paddr_t); 98static void lapic_map(paddr_t);
99 99
100static void lapic_hwmask(struct pic *, int); 100static void lapic_hwmask(struct pic *, int);
101static void lapic_hwunmask(struct pic *, int); 101static void lapic_hwunmask(struct pic *, int);
102static void lapic_setup(struct pic *, struct cpu_info *, int, int, int); 102static void lapic_setup(struct pic *, struct cpu_info *, int, int, int);
103/* Make it public to call via ddb */ 103/* Make it public to call via ddb */
104void lapic_dump(void); 104void lapic_dump(void);
105 105
106struct pic local_pic = { 106struct pic local_pic = {
107 .pic_name = "lapic", 107 .pic_name = "lapic",
108 .pic_type = PIC_LAPIC, 108 .pic_type = PIC_LAPIC,
109 .pic_lock = __SIMPLELOCK_UNLOCKED, 109 .pic_lock = __SIMPLELOCK_UNLOCKED,
110 .pic_hwmask = lapic_hwmask, 110 .pic_hwmask = lapic_hwmask,
111 .pic_hwunmask = lapic_hwunmask, 111 .pic_hwunmask = lapic_hwunmask,
112 .pic_addroute = lapic_setup, 112 .pic_addroute = lapic_setup,
113 .pic_delroute = lapic_setup, 113 .pic_delroute = lapic_setup,
114}; 114};
115 115
116static int i82489_ipi(int vec, int target, int dl); 116static int i82489_ipi(int vec, int target, int dl);
117static int x2apic_ipi(int vec, int target, int dl); 117static int x2apic_ipi(int vec, int target, int dl);
118int (*x86_ipi)(int, int, int) = i82489_ipi; 118int (*x86_ipi)(int, int, int) = i82489_ipi;
119 119
120bool x2apic_mode __read_mostly; 120bool x2apic_mode __read_mostly;
121#ifdef LAPIC_ENABLE_X2APIC 121#ifdef LAPIC_ENABLE_X2APIC
122bool x2apic_enable = true; 122bool x2apic_enable = true;
123#else 123#else
124bool x2apic_enable = false; 124bool x2apic_enable = false;
125#endif 125#endif
126 126
127static uint32_t 127static uint32_t
128i82489_readreg(u_int reg) 128i82489_readreg(u_int reg)
129{ 129{
130 return *((volatile uint32_t *)(local_apic_va + reg)); 130 return *((volatile uint32_t *)(local_apic_va + reg));
131} 131}
132 132
133static void 133static void
134i82489_writereg(u_int reg, uint32_t val) 134i82489_writereg(u_int reg, uint32_t val)
135{ 135{
136 *((volatile uint32_t *)(local_apic_va + reg)) = val; 136 *((volatile uint32_t *)(local_apic_va + reg)) = val;
137} 137}
138 138
139static uint32_t 139static uint32_t
140i82489_cpu_number(void) 140i82489_cpu_number(void)
141{ 141{
142 return i82489_readreg(LAPIC_ID) >> LAPIC_ID_SHIFT; 142 return i82489_readreg(LAPIC_ID) >> LAPIC_ID_SHIFT;
143} 143}
144 144
145static uint32_t 145static uint32_t
146x2apic_readreg(u_int reg) 146x2apic_readreg(u_int reg)
147{ 147{
148 return rdmsr(MSR_X2APIC_BASE + (reg >> 4)); 148 return rdmsr(MSR_X2APIC_BASE + (reg >> 4));
149} 149}
150 150
151static void 151static void
152x2apic_writereg(u_int reg, uint32_t val) 152x2apic_writereg(u_int reg, uint32_t val)
153{ 153{
154 x86_mfence(); 154 x86_mfence();
155 wrmsr(MSR_X2APIC_BASE + (reg >> 4), val); 155 wrmsr(MSR_X2APIC_BASE + (reg >> 4), val);
156} 156}
157 157
158static void 158static void
159x2apic_writereg64(u_int reg, uint64_t val) 159x2apic_writereg64(u_int reg, uint64_t val)
160{ 160{
161 KDASSERT(reg == LAPIC_ICRLO); 161 KDASSERT(reg == LAPIC_ICRLO);
162 x86_mfence(); 162 x86_mfence();
163 wrmsr(MSR_X2APIC_BASE + (reg >> 4), val); 163 wrmsr(MSR_X2APIC_BASE + (reg >> 4), val);
164} 164}
165 165
166static void 166static void
167x2apic_write_icr(uint32_t hi, uint32_t lo) 167x2apic_write_icr(uint32_t hi, uint32_t lo)
168{ 168{
169 x2apic_writereg64(LAPIC_ICRLO, ((uint64_t)hi << 32) | lo); 169 x2apic_writereg64(LAPIC_ICRLO, ((uint64_t)hi << 32) | lo);
170} 170}
171 171
172static uint32_t 172static uint32_t
173x2apic_cpu_number(void) 173x2apic_cpu_number(void)
174{ 174{
175 return x2apic_readreg(LAPIC_ID); 175 return x2apic_readreg(LAPIC_ID);
176} 176}
177 177
178uint32_t 178uint32_t
179lapic_readreg(u_int reg) 179lapic_readreg(u_int reg)
180{ 180{
181 if (x2apic_mode) 181 if (x2apic_mode)
182 return x2apic_readreg(reg); 182 return x2apic_readreg(reg);
183 return i82489_readreg(reg); 183 return i82489_readreg(reg);
184} 184}
185 185
186void 186void
187lapic_writereg(u_int reg, uint32_t val) 187lapic_writereg(u_int reg, uint32_t val)
188{ 188{
189 if (x2apic_mode) 189 if (x2apic_mode)
190 x2apic_writereg(reg, val); 190 x2apic_writereg(reg, val);
191 else 191 else
192 i82489_writereg(reg, val); 192 i82489_writereg(reg, val);
193} 193}
194 194
195void 195void
196lapic_write_tpri(uint32_t val) 196lapic_write_tpri(uint32_t val)
197{ 197{
198 198
199 val &= LAPIC_TPRI_MASK; 199 val &= LAPIC_TPRI_MASK;
200#ifdef i386 200#ifdef i386
201 lapic_writereg(LAPIC_TPRI, val); 201 lapic_writereg(LAPIC_TPRI, val);
202#else 202#else
203 lcr8(val >> 4); 203 lcr8(val >> 4);
204#endif 204#endif
205} 205}
206 206
207void 207void
208lapic_eoi(void) 208lapic_eoi(void)
209{ 209{
210 lapic_writereg(LAPIC_EOI, 0); 210 lapic_writereg(LAPIC_EOI, 0);
211} 211}
212 212
213uint32_t 213uint32_t
214lapic_cpu_number(void) 214lapic_cpu_number(void)
215{ 215{
216 if (x2apic_mode) 216 if (x2apic_mode)
217 return x2apic_cpu_number(); 217 return x2apic_cpu_number();
218 return i82489_cpu_number(); 218 return i82489_cpu_number();
219} 219}
220 220
221static void 221static void
222lapic_enable_x2apic(void) 222lapic_enable_x2apic(void)
223{ 223{
224 uint64_t apicbase; 224 uint64_t apicbase;
225 225
226 apicbase = rdmsr(MSR_APICBASE); 226 apicbase = rdmsr(MSR_APICBASE);
227 if (!ISSET(apicbase, APICBASE_EN)) { 227 if (!ISSET(apicbase, APICBASE_EN)) {
228 apicbase |= APICBASE_EN; 228 apicbase |= APICBASE_EN;
229 wrmsr(MSR_APICBASE, apicbase); 229 wrmsr(MSR_APICBASE, apicbase);
230 } 230 }
231 apicbase |= APICBASE_EXTD; 231 apicbase |= APICBASE_EXTD;
232 wrmsr(MSR_APICBASE, apicbase); 232 wrmsr(MSR_APICBASE, apicbase);
233} 233}
234 234
235bool 235bool
236lapic_is_x2apic(void) 236lapic_is_x2apic(void)
237{ 237{
238 uint64_t msr; 238 uint64_t msr;
239 239
240 if (!ISSET(cpu_feature[0], CPUID_APIC) || 240 if (!ISSET(cpu_feature[0], CPUID_APIC) ||
241 rdmsr_safe(MSR_APICBASE, &msr) == EFAULT) 241 rdmsr_safe(MSR_APICBASE, &msr) == EFAULT)
242 return false; 242 return false;
243 return (msr & (APICBASE_EN | APICBASE_EXTD)) == 243 return (msr & (APICBASE_EN | APICBASE_EXTD)) ==
244 (APICBASE_EN | APICBASE_EXTD); 244 (APICBASE_EN | APICBASE_EXTD);
245} 245}
246 246
247/* 247/*
248 * Initialize the local APIC on the BSP. 248 * Initialize the local APIC on the BSP.
249 */ 249 */
250static void 250static void
251lapic_setup_bsp(paddr_t lapic_base) 251lapic_setup_bsp(paddr_t lapic_base)
252{ 252{
253 u_int regs[4]; 253 u_int regs[4];
254 const char *reason = NULL; 254 const char *reason = NULL;
255 const char *hw_vendor; 255 const char *hw_vendor;
256 bool bios_x2apic; 256 bool bios_x2apic;
257 257
258 if (ISSET(cpu_feature[1], CPUID2_X2APIC)) { 258 if (ISSET(cpu_feature[1], CPUID2_X2APIC)) {
259#if NACPICA > 0 259#if NACPICA > 0
260 if (acpi_present) { 260 if (acpi_present) {
261 ACPI_TABLE_DMAR *dmar; 261 ACPI_TABLE_DMAR *dmar;
262 ACPI_STATUS status; 262 ACPI_STATUS status;
263 263
264 /* 264 /*
265 * Automatically detect several configurations where 265 * Automatically detect several configurations where
266 * x2APIC mode is known to cause troubles. User can 266 * x2APIC mode is known to cause troubles. User can
267 * override the setting with hw.x2apic_enable tunable. 267 * override the setting with hw.x2apic_enable tunable.
268 */ 268 */
269 status = AcpiGetTable(ACPI_SIG_DMAR, 1, 269 status = AcpiGetTable(ACPI_SIG_DMAR, 1,
270 (ACPI_TABLE_HEADER **)&dmar); 270 (ACPI_TABLE_HEADER **)&dmar);
271 if (ACPI_SUCCESS(status)) { 271 if (ACPI_SUCCESS(status)) {
272 if (ISSET(dmar->Flags, ACPI_DMAR_X2APIC_OPT_OUT)) { 272 if (ISSET(dmar->Flags, ACPI_DMAR_X2APIC_OPT_OUT)) {
273 reason = "by DMAR table"; 273 reason = "by DMAR table";
274 } 274 }
275 AcpiPutTable(&dmar->Header); 275 AcpiPutTable(&dmar->Header);
276 } 276 }
277 } 277 }
278#endif /* NACPICA > 0 */ 278#endif /* NACPICA > 0 */
279 if (vm_guest == VM_GUEST_VMWARE) { 279 if (vm_guest == VM_GUEST_VMWARE) {
280 vmt_hvcall(VM_CMD_GET_VCPU_INFO, regs); 280 vmt_hvcall(VM_CMD_GET_VCPU_INFO, regs);
281 if (ISSET(regs[0], VCPUINFO_VCPU_RESERVED) || 281 if (ISSET(regs[0], VCPUINFO_VCPU_RESERVED) ||
282 !ISSET(regs[0], VCPUINFO_LEGACY_X2APIC)) 282 !ISSET(regs[0], VCPUINFO_LEGACY_X2APIC))
283 reason = "inside VMWare without intr redirection"; 283 reason = "inside VMWare without intr redirection";
284 } else if (vm_guest == VM_GUEST_XEN) { 284 } else if (vm_guest == VM_GUEST_XEN) {
285 reason = "due to running under XEN"; 285 reason = "due to running under XEN";
286 } else if (vm_guest == VM_GUEST_NO && 286 } else if (vm_guest == VM_GUEST_NO &&
287 CPUID_TO_FAMILY(curcpu()->ci_signature) == 6 && 287 CPUID_TO_FAMILY(curcpu()->ci_signature) == 6 &&
288 CPUID_TO_MODEL(curcpu()->ci_signature) == 0x2a) { 288 CPUID_TO_MODEL(curcpu()->ci_signature) == 0x2a) {
289 hw_vendor = pmf_get_platform("board-vendor"); 289 hw_vendor = pmf_get_platform("board-vendor");
290 if (hw_vendor != NULL) { 290 if (hw_vendor != NULL) {
291 /* 291 /*
292 * It seems that some Lenovo and ASUS 292 * It seems that some Lenovo and ASUS
293 * SandyBridge-based notebook BIOSes have a bug 293 * SandyBridge-based notebook BIOSes have a bug
294 * which prevents booting AP in x2APIC mode. 294 * which prevents booting AP in x2APIC mode.
295 * Since the only way to detect mobile CPU is 295 * Since the only way to detect mobile CPU is
296 * to check northbridge pci id, which cannot be done 296 * to check northbridge pci id, which cannot be done
297 * that early, disable x2APIC for all Lenovo and ASUS 297 * that early, disable x2APIC for all Lenovo and ASUS
298 * SandyBridge machines. 298 * SandyBridge machines.
299 */ 299 */
300 if (strcmp(hw_vendor, "LENOVO") == 0 || 300 if (strcmp(hw_vendor, "LENOVO") == 0 ||
301 strcmp(hw_vendor, "ASUSTeK Computer Inc.") == 0) { 301 strcmp(hw_vendor, "ASUSTeK Computer Inc.") == 0) {
302 reason = 302 reason =
303 "for a suspected SandyBridge BIOS bug"; 303 "for a suspected SandyBridge BIOS bug";
304 } 304 }
305 } 305 }
306 } 306 }
307 bios_x2apic = lapic_is_x2apic(); 307 bios_x2apic = lapic_is_x2apic();
308 if (reason != NULL && bios_x2apic) { 308 if (reason != NULL && bios_x2apic) {
309 aprint_verbose("x2APIC should be disabled %s but " 309 aprint_verbose("x2APIC should be disabled %s but "
310 "already enabled by BIOS; enabling.\n", reason); 310 "already enabled by BIOS; enabling.\n", reason);
311 reason = NULL; 311 reason = NULL;
312 } 312 }
313 if (reason == NULL) 313 if (reason == NULL)
314 x2apic_mode = true; 314 x2apic_mode = true;
315 else 315 else
316 aprint_verbose("x2APIC available but disabled %s\n", reason); 316 aprint_verbose("x2APIC available but disabled %s\n", reason);
317 if (x2apic_enable != x2apic_mode) { 317 if (x2apic_enable != x2apic_mode) {
318 if (bios_x2apic && !x2apic_enable) 318 if (bios_x2apic && !x2apic_enable)
319 aprint_verbose("x2APIC disabled by user and " 319 aprint_verbose("x2APIC disabled by user and "
320 "enabled by BIOS; ignoring user setting.\n"); 320 "enabled by BIOS; ignoring user setting.\n");
321 else 321 else
322 x2apic_mode = x2apic_enable; 322 x2apic_mode = x2apic_enable;
323 } 323 }
324 } 324 }
325 if (x2apic_mode) { 325 if (x2apic_mode) {
326 x86_ipi = x2apic_ipi; 326 x86_ipi = x2apic_ipi;
327#if NIOAPIC > 0 327#if NIOAPIC > 0
328 struct ioapic_softc *ioapic; 328 struct ioapic_softc *ioapic;
329 for (ioapic = ioapics; ioapic != NULL; ioapic = ioapic->sc_next) { 329 for (ioapic = ioapics; ioapic != NULL; ioapic = ioapic->sc_next) {
330 ioapic->sc_pic.pic_edge_stubs = x2apic_edge_stubs; 330 ioapic->sc_pic.pic_edge_stubs = x2apic_edge_stubs;
331 ioapic->sc_pic.pic_level_stubs = x2apic_level_stubs; 331 ioapic->sc_pic.pic_level_stubs = x2apic_level_stubs;
332 } 332 }
333#endif 333#endif
334#if defined(DDB) && defined(MULTIPROCESSOR) 334#if defined(DDB) && defined(MULTIPROCESSOR)
335#ifdef __x86_64__ 335#ifdef __x86_64__
336 setgate(&idt[ddb_vec], &Xx2apic_intrddb, 1, SDT_SYS386IGT, SEL_KPL, 336 setgate(&idt[ddb_vec], &Xx2apic_intrddbipi, 1, SDT_SYS386IGT,
337 GSEL(GCODE_SEL, SEL_KPL)); 337 SEL_KPL, GSEL(GCODE_SEL, SEL_KPL));
338#else 338#else
339 /* Set DDB IPI handler in cpu_set_tss_gates() when cpu0 is attached. */ 339 /* Set DDB IPI handler in cpu_set_tss_gates() when cpu0 is attached. */
340#endif 340#endif
341#endif 341#endif
342 342
343 x86_disable_intr(); 343 x86_disable_intr();
344 lapic_enable_x2apic(); 344 lapic_enable_x2apic();
345#ifdef MULTIPROCESSOR 345#ifdef MULTIPROCESSOR
346 cpu_init_first(); /* catch up to changed cpu_number() */ 346 cpu_init_first(); /* catch up to changed cpu_number() */
347#endif 347#endif
348 lapic_write_tpri(0); 348 lapic_write_tpri(0);
349 x86_enable_intr(); 349 x86_enable_intr();
350 } else 350 } else
351 lapic_map(lapic_base); 351 lapic_map(lapic_base);
352} 352}
353 353
354static void 354static void
355lapic_map(paddr_t lapic_base) 355lapic_map(paddr_t lapic_base)
356{ 356{
357 pt_entry_t *pte; 357 pt_entry_t *pte;
358 vaddr_t va = local_apic_va; 358 vaddr_t va = local_apic_va;
359 359
360 /* 360 /*
361 * If the CPU has an APIC MSR, use it and ignore the supplied value: 361 * If the CPU has an APIC MSR, use it and ignore the supplied value:
362 * some ACPI implementations have been observed to pass bad values. 362 * some ACPI implementations have been observed to pass bad values.
363 * Additionally, ensure that the lapic is enabled as we are committed 363 * Additionally, ensure that the lapic is enabled as we are committed
364 * to using it at this point. Be conservative and assume that the MSR 364 * to using it at this point. Be conservative and assume that the MSR
365 * is not present on the Pentium (is it?). 365 * is not present on the Pentium (is it?).
366 */ 366 */
367 if (CPUID_TO_FAMILY(curcpu()->ci_signature) >= 6) { 367 if (CPUID_TO_FAMILY(curcpu()->ci_signature) >= 6) {
368 lapic_base = (paddr_t)rdmsr(MSR_APICBASE); 368 lapic_base = (paddr_t)rdmsr(MSR_APICBASE);
369 if ((lapic_base & APICBASE_PHYSADDR) == 0) { 369 if ((lapic_base & APICBASE_PHYSADDR) == 0) {
370 lapic_base |= LAPIC_BASE; 370 lapic_base |= LAPIC_BASE;
371 } 371 }
372 wrmsr(MSR_APICBASE, lapic_base | APICBASE_EN); 372 wrmsr(MSR_APICBASE, lapic_base | APICBASE_EN);
373 lapic_base &= APICBASE_PHYSADDR; 373 lapic_base &= APICBASE_PHYSADDR;
374 } 374 }
375 375
376 x86_disable_intr(); 376 x86_disable_intr();
377 377
378 /* 378 /*
379 * Map local apic. If we have a local apic, it's safe to assume 379 * Map local apic. If we have a local apic, it's safe to assume
380 * we're on a 486 or better and can use invlpg and non-cacheable PTE's 380 * we're on a 486 or better and can use invlpg and non-cacheable PTE's
381 * 381 *
382 * Whap the PTE "by hand" rather than calling pmap_kenter_pa because 382 * Whap the PTE "by hand" rather than calling pmap_kenter_pa because
383 * the latter will attempt to invoke TLB shootdown code just as we 383 * the latter will attempt to invoke TLB shootdown code just as we
384 * might have changed the value of cpu_number().. 384 * might have changed the value of cpu_number()..
385 */ 385 */
386 386
387 pte = kvtopte(va); 387 pte = kvtopte(va);
388 *pte = lapic_base | PG_RW | PG_V | PG_N | pmap_pg_g | pmap_pg_nx; 388 *pte = lapic_base | PG_RW | PG_V | PG_N | pmap_pg_g | pmap_pg_nx;
389 invlpg(va); 389 invlpg(va);
390 390
391#ifdef MULTIPROCESSOR 391#ifdef MULTIPROCESSOR
392 cpu_init_first(); /* catch up to changed cpu_number() */ 392 cpu_init_first(); /* catch up to changed cpu_number() */
393#endif 393#endif
394 394
395 lapic_write_tpri(0); 395 lapic_write_tpri(0);
396 x86_enable_intr(); 396 x86_enable_intr();
397} 397}
398 398
399/* 399/*
400 * enable local apic 400 * enable local apic
401 */ 401 */
402void 402void
403lapic_enable(void) 403lapic_enable(void)
404{ 404{
405 lapic_writereg(LAPIC_SVR, LAPIC_SVR_ENABLE | LAPIC_SPURIOUS_VECTOR); 405 lapic_writereg(LAPIC_SVR, LAPIC_SVR_ENABLE | LAPIC_SPURIOUS_VECTOR);
406} 406}
407 407
408void 408void
409lapic_set_lvt(void) 409lapic_set_lvt(void)
410{ 410{
411 struct cpu_info *ci = curcpu(); 411 struct cpu_info *ci = curcpu();
412 int i; 412 int i;
413 struct mp_intr_map *mpi; 413 struct mp_intr_map *mpi;
414 uint32_t lint0, lint1; 414 uint32_t lint0, lint1;
415 415
416#ifdef MULTIPROCESSOR 416#ifdef MULTIPROCESSOR
417 if (mp_verbose) { 417 if (mp_verbose) {
418 apic_format_redir(device_xname(ci->ci_dev), "prelint", 0, 0, 418 apic_format_redir(device_xname(ci->ci_dev), "prelint", 0, 0,
419 lapic_readreg(LAPIC_LVINT0)); 419 lapic_readreg(LAPIC_LVINT0));
420 apic_format_redir(device_xname(ci->ci_dev), "prelint", 1, 0, 420 apic_format_redir(device_xname(ci->ci_dev), "prelint", 1, 0,
421 lapic_readreg(LAPIC_LVINT1)); 421 lapic_readreg(LAPIC_LVINT1));
422 } 422 }
423#endif 423#endif
424 424
425 /* 425 /*
426 * If an I/O APIC has been attached, assume that it is used instead of 426 * If an I/O APIC has been attached, assume that it is used instead of
427 * the 8259A for interrupt delivery. Otherwise request the LAPIC to 427 * the 8259A for interrupt delivery. Otherwise request the LAPIC to
428 * get external interrupts via LINT0 for the primary CPU. 428 * get external interrupts via LINT0 for the primary CPU.
429 */ 429 */
430 lint0 = LAPIC_LVT_DM_EXTINT; 430 lint0 = LAPIC_LVT_DM_EXTINT;
431 if (nioapics > 0 || !CPU_IS_PRIMARY(curcpu())) 431 if (nioapics > 0 || !CPU_IS_PRIMARY(curcpu()))
432 lint0 |= LAPIC_LVT_MASKED; 432 lint0 |= LAPIC_LVT_MASKED;
433 lapic_writereg(LAPIC_LVINT0, lint0); 433 lapic_writereg(LAPIC_LVINT0, lint0);
434 434
435 /* 435 /*
436 * Non Maskable Interrupts are to be delivered to the primary CPU. 436 * Non Maskable Interrupts are to be delivered to the primary CPU.
437 */ 437 */
438 lint1 = LAPIC_LVT_DM_NMI; 438 lint1 = LAPIC_LVT_DM_NMI;
439 if (!CPU_IS_PRIMARY(curcpu())) 439 if (!CPU_IS_PRIMARY(curcpu()))
440 lint1 |= LAPIC_LVT_MASKED; 440 lint1 |= LAPIC_LVT_MASKED;
441 lapic_writereg(LAPIC_LVINT1, lint1); 441 lapic_writereg(LAPIC_LVINT1, lint1);
442 442
443 for (i = 0; i < mp_nintr; i++) { 443 for (i = 0; i < mp_nintr; i++) {
444 mpi = &mp_intrs[i]; 444 mpi = &mp_intrs[i];
445 if (mpi->ioapic == NULL && (mpi->cpu_id == MPS_ALL_APICS || 445 if (mpi->ioapic == NULL && (mpi->cpu_id == MPS_ALL_APICS ||
446 mpi->cpu_id == ci->ci_cpuid)) { 446 mpi->cpu_id == ci->ci_cpuid)) {
447 if (mpi->ioapic_pin > 1) 447 if (mpi->ioapic_pin > 1)
448 aprint_error_dev(ci->ci_dev, 448 aprint_error_dev(ci->ci_dev,
449 "%s: WARNING: bad pin value %d\n", 449 "%s: WARNING: bad pin value %d\n",
450 __func__, mpi->ioapic_pin); 450 __func__, mpi->ioapic_pin);
451 if (mpi->ioapic_pin == 0) 451 if (mpi->ioapic_pin == 0)
452 lapic_writereg(LAPIC_LVINT0, mpi->redir); 452 lapic_writereg(LAPIC_LVINT0, mpi->redir);
453 else 453 else
454 lapic_writereg(LAPIC_LVINT1, mpi->redir); 454 lapic_writereg(LAPIC_LVINT1, mpi->redir);
455 } 455 }
456 } 456 }
457 457
458#ifdef MULTIPROCESSOR 458#ifdef MULTIPROCESSOR
459 if (mp_verbose) 459 if (mp_verbose)
460 lapic_dump(); 460 lapic_dump();
461#endif 461#endif
462} 462}
463 463
464/* 464/*
465 * Initialize fixed idt vectors for use by local apic. 465 * Initialize fixed idt vectors for use by local apic.
466 */ 466 */
467void 467void
468lapic_boot_init(paddr_t lapic_base) 468lapic_boot_init(paddr_t lapic_base)
469{ 469{
470 470
471 lapic_setup_bsp(lapic_base); 471 lapic_setup_bsp(lapic_base);
472 472
473#ifdef MULTIPROCESSOR 473#ifdef MULTIPROCESSOR
474 idt_vec_reserve(LAPIC_IPI_VECTOR); 474 idt_vec_reserve(LAPIC_IPI_VECTOR);
475 idt_vec_set(LAPIC_IPI_VECTOR, x2apic_mode ? Xintr_x2apic_ipi : Xintr_lapic_ipi); 475 idt_vec_set(LAPIC_IPI_VECTOR, x2apic_mode ? Xintr_x2apic_ipi : Xintr_lapic_ipi);
476 idt_vec_reserve(LAPIC_TLB_VECTOR); 476 idt_vec_reserve(LAPIC_TLB_VECTOR);
477 idt_vec_set(LAPIC_TLB_VECTOR, x2apic_mode ? Xintr_x2apic_tlb : Xintr_lapic_tlb); 477 idt_vec_set(LAPIC_TLB_VECTOR, x2apic_mode ? Xintr_x2apic_tlb : Xintr_lapic_tlb);
478#endif 478#endif
479 idt_vec_reserve(LAPIC_SPURIOUS_VECTOR); 479 idt_vec_reserve(LAPIC_SPURIOUS_VECTOR);
480 idt_vec_set(LAPIC_SPURIOUS_VECTOR, Xintrspurious); 480 idt_vec_set(LAPIC_SPURIOUS_VECTOR, Xintrspurious);
481 481
482 idt_vec_reserve(LAPIC_TIMER_VECTOR); 482 idt_vec_reserve(LAPIC_TIMER_VECTOR);
483 idt_vec_set(LAPIC_TIMER_VECTOR, x2apic_mode ? Xintr_x2apic_ltimer : 483 idt_vec_set(LAPIC_TIMER_VECTOR, x2apic_mode ? Xintr_x2apic_ltimer :
484 Xintr_lapic_ltimer); 484 Xintr_lapic_ltimer);
485} 485}
486 486
487static uint32_t 487static uint32_t
488lapic_gettick(void) 488lapic_gettick(void)
489{ 489{
490 return lapic_readreg(LAPIC_CCR_TIMER); 490 return lapic_readreg(LAPIC_CCR_TIMER);
491} 491}
492 492
493#include <sys/kernel.h> /* for hz */ 493#include <sys/kernel.h> /* for hz */
494 494
495int lapic_timer = 0; 495int lapic_timer = 0;
496uint32_t lapic_tval; 496uint32_t lapic_tval;
497 497
498/* 498/*
499 * this gets us up to a 4GHz busclock.... 499 * this gets us up to a 4GHz busclock....
500 */ 500 */
501uint32_t lapic_per_second; 501uint32_t lapic_per_second;
502uint32_t lapic_frac_usec_per_cycle; 502uint32_t lapic_frac_usec_per_cycle;
503uint64_t lapic_frac_cycle_per_usec; 503uint64_t lapic_frac_cycle_per_usec;
504uint32_t lapic_delaytab[26]; 504uint32_t lapic_delaytab[26];
505 505
506static u_int 506static u_int
507lapic_get_timecount(struct timecounter *tc) 507lapic_get_timecount(struct timecounter *tc)
508{ 508{
509 struct cpu_info *ci; 509 struct cpu_info *ci;
510 uint32_t cur_timer; 510 uint32_t cur_timer;
511 int s; 511 int s;
512 512
513 s = splhigh(); 513 s = splhigh();
514 ci = curcpu(); 514 ci = curcpu();
515 515
516 /* 516 /*
517 * Check for a race against the clockinterrupt. 517 * Check for a race against the clockinterrupt.
518 * The update of ci_lapic_counter is blocked by splhigh() and 518 * The update of ci_lapic_counter is blocked by splhigh() and
519 * the check for a pending clockinterrupt compensates for that. 519 * the check for a pending clockinterrupt compensates for that.
520 * 520 *
521 * If the current tick is almost the Initial Counter, explicitly 521 * If the current tick is almost the Initial Counter, explicitly
522 * check for the pending interrupt bit as the interrupt delivery 522 * check for the pending interrupt bit as the interrupt delivery
523 * could be asynchronious and compensate as well. 523 * could be asynchronious and compensate as well.
524 * 524 *
525 * This can't be done without splhigh() as the calling code might 525 * This can't be done without splhigh() as the calling code might
526 * have masked the clockinterrupt already. 526 * have masked the clockinterrupt already.
527 * 527 *
528 * This code assumes that clockinterrupts are not missed. 528 * This code assumes that clockinterrupts are not missed.
529 */ 529 */
530 cur_timer = lapic_gettick(); 530 cur_timer = lapic_gettick();
531 if (cur_timer >= lapic_tval - 1) { 531 if (cur_timer >= lapic_tval - 1) {
532 uint16_t reg = LAPIC_IRR + LAPIC_TIMER_VECTOR / 32 * 16; 532 uint16_t reg = LAPIC_IRR + LAPIC_TIMER_VECTOR / 32 * 16;
533 533
534 if (lapic_readreg(reg) & (1 << (LAPIC_TIMER_VECTOR % 32))) { 534 if (lapic_readreg(reg) & (1 << (LAPIC_TIMER_VECTOR % 32))) {
535 cur_timer -= lapic_tval; 535 cur_timer -= lapic_tval;
536 } 536 }
537 } else if (ci->ci_istate.ipending & (1 << LIR_TIMER)) 537 } else if (ci->ci_istate.ipending & (1 << LIR_TIMER))
538 cur_timer = lapic_gettick() - lapic_tval; 538 cur_timer = lapic_gettick() - lapic_tval;
539 cur_timer = ci->ci_lapic_counter - cur_timer; 539 cur_timer = ci->ci_lapic_counter - cur_timer;
540 splx(s); 540 splx(s);
541 541
542 return cur_timer; 542 return cur_timer;
543} 543}
544 544
545static struct timecounter lapic_timecounter = { 545static struct timecounter lapic_timecounter = {
546 lapic_get_timecount, 546 lapic_get_timecount,
547 NULL, 547 NULL,
548 ~0u, 548 ~0u,
549 0, 549 0,
550 "lapic", 550 "lapic",
551#ifndef MULTIPROCESSOR 551#ifndef MULTIPROCESSOR
552 2100, 552 2100,
553#else 553#else
554 -100, /* per CPU state */ 554 -100, /* per CPU state */
555#endif 555#endif
556 NULL, 556 NULL,
557 NULL, 557 NULL,
558}; 558};
559 559
560extern u_int i8254_get_timecount(struct timecounter *); 560extern u_int i8254_get_timecount(struct timecounter *);
561 561
562void 562void
563lapic_clockintr(void *arg, struct intrframe *frame) 563lapic_clockintr(void *arg, struct intrframe *frame)
564{ 564{
565 struct cpu_info *ci = curcpu(); 565 struct cpu_info *ci = curcpu();
566 566
567 ci->ci_lapic_counter += lapic_tval; 567 ci->ci_lapic_counter += lapic_tval;
568 ci->ci_isources[LIR_TIMER]->is_evcnt.ev_count++; 568 ci->ci_isources[LIR_TIMER]->is_evcnt.ev_count++;
569 hardclock((struct clockframe *)frame); 569 hardclock((struct clockframe *)frame);
570} 570}
571 571
572void 572void
573lapic_initclocks(void) 573lapic_initclocks(void)
574{ 574{
575 /* 575 /*
576 * Start local apic countdown timer running, in repeated mode. 576 * Start local apic countdown timer running, in repeated mode.
577 * 577 *
578 * Mask the clock interrupt and set mode, 578 * Mask the clock interrupt and set mode,
579 * then set divisor, 579 * then set divisor,
580 * then unmask and set the vector. 580 * then unmask and set the vector.
581 */ 581 */
582 lapic_writereg(LAPIC_LVTT, LAPIC_LVTT_TM | LAPIC_LVTT_M); 582 lapic_writereg(LAPIC_LVTT, LAPIC_LVTT_TM | LAPIC_LVTT_M);
583 lapic_writereg(LAPIC_DCR_TIMER, LAPIC_DCRT_DIV1); 583 lapic_writereg(LAPIC_DCR_TIMER, LAPIC_DCRT_DIV1);
584 lapic_writereg(LAPIC_ICR_TIMER, lapic_tval); 584 lapic_writereg(LAPIC_ICR_TIMER, lapic_tval);
585 lapic_writereg(LAPIC_LVTT, LAPIC_LVTT_TM | LAPIC_TIMER_VECTOR); 585 lapic_writereg(LAPIC_LVTT, LAPIC_LVTT_TM | LAPIC_TIMER_VECTOR);
586 lapic_eoi(); 586 lapic_eoi();
587} 587}
588 588
589extern unsigned int gettick(void); /* XXX put in header file */ 589extern unsigned int gettick(void); /* XXX put in header file */
590extern u_long rtclock_tval; /* XXX put in header file */ 590extern u_long rtclock_tval; /* XXX put in header file */
591extern void (*initclock_func)(void); /* XXX put in header file */ 591extern void (*initclock_func)(void); /* XXX put in header file */
592 592
593/* 593/*
594 * Calibrate the local apic count-down timer (which is running at 594 * Calibrate the local apic count-down timer (which is running at
595 * bus-clock speed) vs. the i8254 counter/timer (which is running at 595 * bus-clock speed) vs. the i8254 counter/timer (which is running at
596 * a fixed rate). 596 * a fixed rate).
597 * 597 *
598 * The Intel MP spec says: "An MP operating system may use the IRQ8 598 * The Intel MP spec says: "An MP operating system may use the IRQ8
599 * real-time clock as a reference to determine the actual APIC timer clock 599 * real-time clock as a reference to determine the actual APIC timer clock
600 * speed." 600 * speed."
601 * 601 *
602 * We're actually using the IRQ0 timer. Hmm. 602 * We're actually using the IRQ0 timer. Hmm.
603 */ 603 */
604void 604void
605lapic_calibrate_timer(struct cpu_info *ci) 605lapic_calibrate_timer(struct cpu_info *ci)
606{ 606{
607 unsigned int seen, delta, initial_i8254, initial_lapic; 607 unsigned int seen, delta, initial_i8254, initial_lapic;
608 unsigned int cur_i8254, cur_lapic; 608 unsigned int cur_i8254, cur_lapic;
609 uint64_t tmp; 609 uint64_t tmp;
610 int i; 610 int i;
611 char tbuf[9]; 611 char tbuf[9];
612 612
613 aprint_debug_dev(ci->ci_dev, "calibrating local timer\n"); 613 aprint_debug_dev(ci->ci_dev, "calibrating local timer\n");
614 614
615 /* 615 /*
616 * Configure timer to one-shot, interrupt masked, 616 * Configure timer to one-shot, interrupt masked,
617 * large positive number. 617 * large positive number.
618 */ 618 */
619 lapic_writereg(LAPIC_LVTT, LAPIC_LVTT_M); 619 lapic_writereg(LAPIC_LVTT, LAPIC_LVTT_M);
620 lapic_writereg(LAPIC_DCR_TIMER, LAPIC_DCRT_DIV1); 620 lapic_writereg(LAPIC_DCR_TIMER, LAPIC_DCRT_DIV1);
621 lapic_writereg(LAPIC_ICR_TIMER, 0x80000000); 621 lapic_writereg(LAPIC_ICR_TIMER, 0x80000000);
622 622
623 x86_disable_intr(); 623 x86_disable_intr();
624 624
625 initial_lapic = lapic_gettick(); 625 initial_lapic = lapic_gettick();
626 initial_i8254 = gettick(); 626 initial_i8254 = gettick();
627 627
628 for (seen = 0; seen < TIMER_FREQ / 100; seen += delta) { 628 for (seen = 0; seen < TIMER_FREQ / 100; seen += delta) {
629 cur_i8254 = gettick(); 629 cur_i8254 = gettick();
630 if (cur_i8254 > initial_i8254) 630 if (cur_i8254 > initial_i8254)
631 delta = rtclock_tval - (cur_i8254 - initial_i8254); 631 delta = rtclock_tval - (cur_i8254 - initial_i8254);
632 else 632 else
633 delta = initial_i8254 - cur_i8254; 633 delta = initial_i8254 - cur_i8254;
634 initial_i8254 = cur_i8254; 634 initial_i8254 = cur_i8254;
635 } 635 }
636 cur_lapic = lapic_gettick(); 636 cur_lapic = lapic_gettick();
637 637
638 x86_enable_intr(); 638 x86_enable_intr();
639 639
640 tmp = initial_lapic - cur_lapic; 640 tmp = initial_lapic - cur_lapic;
641 lapic_per_second = (tmp * TIMER_FREQ + seen / 2) / seen; 641 lapic_per_second = (tmp * TIMER_FREQ + seen / 2) / seen;
642 642
643 humanize_number(tbuf, sizeof(tbuf), lapic_per_second, "Hz", 1000); 643 humanize_number(tbuf, sizeof(tbuf), lapic_per_second, "Hz", 1000);
644 644
645 aprint_debug_dev(ci->ci_dev, "apic clock running at %s\n", tbuf); 645 aprint_debug_dev(ci->ci_dev, "apic clock running at %s\n", tbuf);
646 646
647 if (lapic_per_second != 0) { 647 if (lapic_per_second != 0) {
648 /* 648 /*
649 * reprogram the apic timer to run in periodic mode. 649 * reprogram the apic timer to run in periodic mode.
650 * XXX need to program timer on other CPUs, too. 650 * XXX need to program timer on other CPUs, too.
651 */ 651 */
652 lapic_tval = (lapic_per_second * 2) / hz; 652 lapic_tval = (lapic_per_second * 2) / hz;
653 lapic_tval = (lapic_tval / 2) + (lapic_tval & 0x1); 653 lapic_tval = (lapic_tval / 2) + (lapic_tval & 0x1);
654 654
655 lapic_writereg(LAPIC_LVTT, LAPIC_LVTT_TM | LAPIC_LVTT_M 655 lapic_writereg(LAPIC_LVTT, LAPIC_LVTT_TM | LAPIC_LVTT_M
656 | LAPIC_TIMER_VECTOR); 656 | LAPIC_TIMER_VECTOR);
657 lapic_writereg(LAPIC_DCR_TIMER, LAPIC_DCRT_DIV1); 657 lapic_writereg(LAPIC_DCR_TIMER, LAPIC_DCRT_DIV1);
658 lapic_writereg(LAPIC_ICR_TIMER, lapic_tval); 658 lapic_writereg(LAPIC_ICR_TIMER, lapic_tval);
659 659
660 /* 660 /*
661 * Compute fixed-point ratios between cycles and 661 * Compute fixed-point ratios between cycles and
662 * microseconds to avoid having to do any division 662 * microseconds to avoid having to do any division
663 * in lapic_delay. 663 * in lapic_delay.
664 */ 664 */
665 665
666 tmp = (1000000 * (uint64_t)1 << 32) / lapic_per_second; 666 tmp = (1000000 * (uint64_t)1 << 32) / lapic_per_second;
667 lapic_frac_usec_per_cycle = tmp; 667 lapic_frac_usec_per_cycle = tmp;
668 668
669 tmp = (lapic_per_second * (uint64_t)1 << 32) / 1000000; 669 tmp = (lapic_per_second * (uint64_t)1 << 32) / 1000000;
670 670
671 lapic_frac_cycle_per_usec = tmp; 671 lapic_frac_cycle_per_usec = tmp;
672 672
673 /* 673 /*
674 * Compute delay in cycles for likely short delays in usec. 674 * Compute delay in cycles for likely short delays in usec.
675 */ 675 */
676 for (i = 0; i < 26; i++) 676 for (i = 0; i < 26; i++)
677 lapic_delaytab[i] = (lapic_frac_cycle_per_usec * i) >> 677 lapic_delaytab[i] = (lapic_frac_cycle_per_usec * i) >>
678 32; 678 32;
679 679
680 /* 680 /*
681 * Now that the timer's calibrated, use the apic timer routines 681 * Now that the timer's calibrated, use the apic timer routines
682 * for all our timing needs.. 682 * for all our timing needs..
683 */ 683 */
684 delay_func = lapic_delay; 684 delay_func = lapic_delay;
685 initclock_func = lapic_initclocks; 685 initclock_func = lapic_initclocks;
686 initrtclock(0); 686 initrtclock(0);
687 687
688 if (lapic_timecounter.tc_frequency == 0) { 688 if (lapic_timecounter.tc_frequency == 0) {
689 /* 689 /*
690 * Hook up time counter. 690 * Hook up time counter.
691 * This assume that all LAPICs have the same frequency. 691 * This assume that all LAPICs have the same frequency.
692 */ 692 */
693 lapic_timecounter.tc_frequency = lapic_per_second; 693 lapic_timecounter.tc_frequency = lapic_per_second;
694 tc_init(&lapic_timecounter); 694 tc_init(&lapic_timecounter);
695 } 695 }
696 } 696 }
697} 697}
698 698
699/* 699/*
700 * delay for N usec. 700 * delay for N usec.
701 */ 701 */
702 702
703static void 703static void
704lapic_delay(unsigned int usec) 704lapic_delay(unsigned int usec)
705{ 705{
706 int32_t xtick, otick; 706 int32_t xtick, otick;
707 int64_t deltat; /* XXX may want to be 64bit */ 707 int64_t deltat; /* XXX may want to be 64bit */
708 708
709 otick = lapic_gettick(); 709 otick = lapic_gettick();
710 710
711 if (usec <= 0) 711 if (usec <= 0)
712 return; 712 return;
713 if (usec <= 25) 713 if (usec <= 25)
714 deltat = lapic_delaytab[usec]; 714 deltat = lapic_delaytab[usec];
715 else 715 else
716 deltat = (lapic_frac_cycle_per_usec * usec) >> 32; 716 deltat = (lapic_frac_cycle_per_usec * usec) >> 32;
717 717
718 while (deltat > 0) { 718 while (deltat > 0) {
719 xtick = lapic_gettick(); 719 xtick = lapic_gettick();
720 if (xtick > otick) 720 if (xtick > otick)
721 deltat -= lapic_tval - (xtick - otick); 721 deltat -= lapic_tval - (xtick - otick);
722 else 722 else
723 deltat -= otick - xtick; 723 deltat -= otick - xtick;
724 otick = xtick; 724 otick = xtick;
725 725
726 x86_pause(); 726 x86_pause();
727 } 727 }
728} 728}
729 729
730/* 730/*
731 * XXX the following belong mostly or partly elsewhere.. 731 * XXX the following belong mostly or partly elsewhere..
732 */ 732 */
733 733
734static void 734static void
735i82489_icr_wait(void) 735i82489_icr_wait(void)
736{ 736{
737#ifdef DIAGNOSTIC 737#ifdef DIAGNOSTIC
738 unsigned j = 100000; 738 unsigned j = 100000;
739#endif /* DIAGNOSTIC */ 739#endif /* DIAGNOSTIC */
740 740
741 while ((i82489_readreg(LAPIC_ICRLO) & LAPIC_DLSTAT_BUSY) != 0) { 741 while ((i82489_readreg(LAPIC_ICRLO) & LAPIC_DLSTAT_BUSY) != 0) {
742 x86_pause(); 742 x86_pause();
743#ifdef DIAGNOSTIC 743#ifdef DIAGNOSTIC
744 j--; 744 j--;
745 if (j == 0) 745 if (j == 0)
746 panic("i82489_icr_wait: busy"); 746 panic("i82489_icr_wait: busy");
747#endif /* DIAGNOSTIC */ 747#endif /* DIAGNOSTIC */
748 } 748 }
749} 749}
750 750
751static int 751static int
752i82489_ipi_init(int target) 752i82489_ipi_init(int target)
753{ 753{
754 uint32_t esr; 754 uint32_t esr;
755 755
756 i82489_writereg(LAPIC_ESR, 0); 756 i82489_writereg(LAPIC_ESR, 0);
757 (void)i82489_readreg(LAPIC_ESR); 757 (void)i82489_readreg(LAPIC_ESR);
758 758
759 i82489_writereg(LAPIC_ICRHI, target << LAPIC_ID_SHIFT); 759 i82489_writereg(LAPIC_ICRHI, target << LAPIC_ID_SHIFT);
760 760
761 i82489_writereg(LAPIC_ICRLO, LAPIC_DLMODE_INIT | LAPIC_LEVEL_ASSERT); 761 i82489_writereg(LAPIC_ICRLO, LAPIC_DLMODE_INIT | LAPIC_LEVEL_ASSERT);
762 i82489_icr_wait(); 762 i82489_icr_wait();
763 i8254_delay(10000); 763 i8254_delay(10000);
764 i82489_writereg(LAPIC_ICRLO, 764 i82489_writereg(LAPIC_ICRLO,
765 LAPIC_DLMODE_INIT | LAPIC_TRIGGER_LEVEL | LAPIC_LEVEL_DEASSERT); 765 LAPIC_DLMODE_INIT | LAPIC_TRIGGER_LEVEL | LAPIC_LEVEL_DEASSERT);
766 i82489_icr_wait(); 766 i82489_icr_wait();
767 767
768 if ((i82489_readreg(LAPIC_ICRLO) & LAPIC_DLSTAT_BUSY) != 0) 768 if ((i82489_readreg(LAPIC_ICRLO) & LAPIC_DLSTAT_BUSY) != 0)
769 return EBUSY; 769 return EBUSY;
770 770
771 esr = i82489_readreg(LAPIC_ESR); 771 esr = i82489_readreg(LAPIC_ESR);
772 if (esr != 0) 772 if (esr != 0)
773 aprint_debug("%s: ESR %08x\n", __func__, esr); 773 aprint_debug("%s: ESR %08x\n", __func__, esr);
774 774
775 return 0; 775 return 0;
776} 776}
777 777
778static int 778static int
779i82489_ipi_startup(int target, int vec) 779i82489_ipi_startup(int target, int vec)
780{ 780{
781 uint32_t esr; 781 uint32_t esr;
782 782
783 i82489_writereg(LAPIC_ESR, 0); 783 i82489_writereg(LAPIC_ESR, 0);
784 (void)i82489_readreg(LAPIC_ESR); 784 (void)i82489_readreg(LAPIC_ESR);
785 785
786 i82489_icr_wait(); 786 i82489_icr_wait();
787 i82489_writereg(LAPIC_ICRHI, target << LAPIC_ID_SHIFT); 787 i82489_writereg(LAPIC_ICRHI, target << LAPIC_ID_SHIFT);
788 i82489_writereg(LAPIC_ICRLO, vec | LAPIC_DLMODE_STARTUP | 788 i82489_writereg(LAPIC_ICRLO, vec | LAPIC_DLMODE_STARTUP |
789 LAPIC_LEVEL_ASSERT); 789 LAPIC_LEVEL_ASSERT);
790 i82489_icr_wait(); 790 i82489_icr_wait();
791 791
792 if ((i82489_readreg(LAPIC_ICRLO) & LAPIC_DLSTAT_BUSY) != 0) 792 if ((i82489_readreg(LAPIC_ICRLO) & LAPIC_DLSTAT_BUSY) != 0)
793 return EBUSY; 793 return EBUSY;
794 794
795 esr = i82489_readreg(LAPIC_ESR); 795 esr = i82489_readreg(LAPIC_ESR);
796 if (esr != 0) 796 if (esr != 0)
797 aprint_debug("%s: ESR %08x\n", __func__, esr); 797 aprint_debug("%s: ESR %08x\n", __func__, esr);
798 798
799 return 0; 799 return 0;
800} 800}
801 801
802static int 802static int
803i82489_ipi(int vec, int target, int dl) 803i82489_ipi(int vec, int target, int dl)
804{ 804{
805 int result, s; 805 int result, s;
806 806
807 s = splhigh(); 807 s = splhigh();
808 808
809 i82489_icr_wait(); 809 i82489_icr_wait();
810 810
811 if ((target & LAPIC_DEST_MASK) == 0) 811 if ((target & LAPIC_DEST_MASK) == 0)
812 i82489_writereg(LAPIC_ICRHI, target << LAPIC_ID_SHIFT); 812 i82489_writereg(LAPIC_ICRHI, target << LAPIC_ID_SHIFT);
813 813
814 i82489_writereg(LAPIC_ICRLO, 814 i82489_writereg(LAPIC_ICRLO,
815 (target & LAPIC_DEST_MASK) | vec | dl | LAPIC_LEVEL_ASSERT); 815 (target & LAPIC_DEST_MASK) | vec | dl | LAPIC_LEVEL_ASSERT);
816 816
817#ifdef DIAGNOSTIC 817#ifdef DIAGNOSTIC
818 i82489_icr_wait(); 818 i82489_icr_wait();
819 result = (i82489_readreg(LAPIC_ICRLO) & LAPIC_DLSTAT_BUSY) ? EBUSY : 0; 819 result = (i82489_readreg(LAPIC_ICRLO) & LAPIC_DLSTAT_BUSY) ? EBUSY : 0;
820#else 820#else
821 /* Don't wait - if it doesn't go, we're in big trouble anyway. */ 821 /* Don't wait - if it doesn't go, we're in big trouble anyway. */
822 result = 0; 822 result = 0;
823#endif 823#endif
824 splx(s); 824 splx(s);
825 825
826 return result; 826 return result;
827} 827}
828 828
829static int 829static int
830x2apic_ipi_init(int target) 830x2apic_ipi_init(int target)
831{ 831{
832 832
833 x2apic_write_icr(target, LAPIC_DLMODE_INIT | LAPIC_LEVEL_ASSERT); 833 x2apic_write_icr(target, LAPIC_DLMODE_INIT | LAPIC_LEVEL_ASSERT);
834 834
835 i8254_delay(10000); 835 i8254_delay(10000);
836 836
837 x2apic_write_icr(0, 837 x2apic_write_icr(0,
838 LAPIC_DLMODE_INIT | LAPIC_TRIGGER_LEVEL | LAPIC_LEVEL_DEASSERT); 838 LAPIC_DLMODE_INIT | LAPIC_TRIGGER_LEVEL | LAPIC_LEVEL_DEASSERT);
839 839
840 return 0; 840 return 0;
841} 841}
842 842
843static int 843static int
844x2apic_ipi_startup(int target, int vec) 844x2apic_ipi_startup(int target, int vec)
845{ 845{
846 846
847 x2apic_write_icr(target, vec | LAPIC_DLMODE_STARTUP | LAPIC_LEVEL_ASSERT); 847 x2apic_write_icr(target, vec | LAPIC_DLMODE_STARTUP | LAPIC_LEVEL_ASSERT);
848 848
849 return 0; 849 return 0;
850} 850}
851 851
852static int 852static int
853x2apic_ipi(int vec, int target, int dl) 853x2apic_ipi(int vec, int target, int dl)
854{ 854{
855 uint32_t dest_id = 0; 855 uint32_t dest_id = 0;
856 856
857 if ((target & LAPIC_DEST_MASK) == 0) 857 if ((target & LAPIC_DEST_MASK) == 0)
858 dest_id = target; 858 dest_id = target;
859 859
860 x2apic_write_icr(dest_id, 860 x2apic_write_icr(dest_id,
861 (target & LAPIC_DEST_MASK) | vec | dl | LAPIC_LEVEL_ASSERT); 861 (target & LAPIC_DEST_MASK) | vec | dl | LAPIC_LEVEL_ASSERT);
862 862
863 return 0; 863 return 0;
864} 864}
865 865
866int 866int
867x86_ipi_init(int target) 867x86_ipi_init(int target)
868{ 868{
869 if (x2apic_mode) 869 if (x2apic_mode)
870 return x2apic_ipi_init(target); 870 return x2apic_ipi_init(target);
871 return i82489_ipi_init(target); 871 return i82489_ipi_init(target);
872} 872}
873 873
874int 874int
875x86_ipi_startup(int target, int vec) 875x86_ipi_startup(int target, int vec)
876{ 876{
877 if (x2apic_mode) 877 if (x2apic_mode)
878 return x2apic_ipi_startup(target, vec); 878 return x2apic_ipi_startup(target, vec);
879 return i82489_ipi_startup(target, vec); 879 return i82489_ipi_startup(target, vec);
880} 880}
881 881
882/* 882/*
883 * Using 'pin numbers' as: 883 * Using 'pin numbers' as:
884 * 0 - timer 884 * 0 - timer
885 * 1 - unused 885 * 1 - unused
886 * 2 - PCINT 886 * 2 - PCINT
887 * 3 - LVINT0 887 * 3 - LVINT0
888 * 4 - LVINT1 888 * 4 - LVINT1
889 * 5 - LVERR 889 * 5 - LVERR
890 */ 890 */
891 891
892static void 892static void
893lapic_hwmask(struct pic *pic, int pin) 893lapic_hwmask(struct pic *pic, int pin)
894{ 894{
895 int reg; 895 int reg;
896 uint32_t val; 896 uint32_t val;
897 897
898 reg = LAPIC_LVTT + (pin << 4); 898 reg = LAPIC_LVTT + (pin << 4);
899 val = lapic_readreg(reg); 899 val = lapic_readreg(reg);
900 val |= LAPIC_LVT_MASKED; 900 val |= LAPIC_LVT_MASKED;
901 lapic_writereg(reg, val); 901 lapic_writereg(reg, val);
902} 902}
903 903
904static void 904static void
905lapic_hwunmask(struct pic *pic, int pin) 905lapic_hwunmask(struct pic *pic, int pin)
906{ 906{
907 int reg; 907 int reg;
908 uint32_t val; 908 uint32_t val;
909 909
910 reg = LAPIC_LVTT + (pin << 4); 910 reg = LAPIC_LVTT + (pin << 4);
911 val = lapic_readreg(reg); 911 val = lapic_readreg(reg);
912 val &= ~LAPIC_LVT_MASKED; 912 val &= ~LAPIC_LVT_MASKED;
913 lapic_writereg(reg, val); 913 lapic_writereg(reg, val);
914} 914}
915 915
916static void 916static void
917lapic_setup(struct pic *pic, struct cpu_info *ci, 917lapic_setup(struct pic *pic, struct cpu_info *ci,
918 int pin, int idtvec, int type) 918 int pin, int idtvec, int type)
919{ 919{
920} 920}
921 921
922void 922void
923lapic_dump(void) 923lapic_dump(void)
924{ 924{
925 struct cpu_info *ci = curcpu(); 925 struct cpu_info *ci = curcpu();
926 926
927 apic_format_redir(device_xname(ci->ci_dev), "timer", 0, 0, 927 apic_format_redir(device_xname(ci->ci_dev), "timer", 0, 0,
928 lapic_readreg(LAPIC_LVTT)); 928 lapic_readreg(LAPIC_LVTT));
929 apic_format_redir(device_xname(ci->ci_dev), "pcint", 0, 0, 929 apic_format_redir(device_xname(ci->ci_dev), "pcint", 0, 0,
930 lapic_readreg(LAPIC_PCINT)); 930 lapic_readreg(LAPIC_PCINT));
931 apic_format_redir(device_xname(ci->ci_dev), "lint", 0, 0, 931 apic_format_redir(device_xname(ci->ci_dev), "lint", 0, 0,
932 lapic_readreg(LAPIC_LVINT0)); 932 lapic_readreg(LAPIC_LVINT0));
933 apic_format_redir(device_xname(ci->ci_dev), "lint", 1, 0, 933 apic_format_redir(device_xname(ci->ci_dev), "lint", 1, 0,
934 lapic_readreg(LAPIC_LVINT1)); 934 lapic_readreg(LAPIC_LVINT1));
935 apic_format_redir(device_xname(ci->ci_dev), "err", 0, 0, 935 apic_format_redir(device_xname(ci->ci_dev), "err", 0, 0,
936 lapic_readreg(LAPIC_LVERR)); 936 lapic_readreg(LAPIC_LVERR));
937} 937}