1d8ed9d48SThomas Gleixner /* 2d8ed9d48SThomas Gleixner * Interrupt descriptor table related code 3d8ed9d48SThomas Gleixner * 4d8ed9d48SThomas Gleixner * This file is licensed under the GPL V2 5d8ed9d48SThomas Gleixner */ 6d8ed9d48SThomas Gleixner #include <linux/interrupt.h> 7d8ed9d48SThomas Gleixner 83318e974SThomas Gleixner #include <asm/traps.h> 93318e974SThomas Gleixner #include <asm/proto.h> 10d8ed9d48SThomas Gleixner #include <asm/desc.h> 11d8ed9d48SThomas Gleixner 123318e974SThomas Gleixner struct idt_data { 133318e974SThomas Gleixner unsigned int vector; 143318e974SThomas Gleixner unsigned int segment; 153318e974SThomas Gleixner struct idt_bits bits; 163318e974SThomas Gleixner const void *addr; 173318e974SThomas Gleixner }; 183318e974SThomas Gleixner 193318e974SThomas Gleixner #define DPL0 0x0 203318e974SThomas Gleixner #define DPL3 0x3 213318e974SThomas Gleixner 223318e974SThomas Gleixner #define DEFAULT_STACK 0 233318e974SThomas Gleixner 243318e974SThomas Gleixner #define G(_vector, _addr, _ist, _type, _dpl, _segment) \ 253318e974SThomas Gleixner { \ 263318e974SThomas Gleixner .vector = _vector, \ 273318e974SThomas Gleixner .bits.ist = _ist, \ 283318e974SThomas Gleixner .bits.type = _type, \ 293318e974SThomas Gleixner .bits.dpl = _dpl, \ 303318e974SThomas Gleixner .bits.p = 1, \ 313318e974SThomas Gleixner .addr = _addr, \ 323318e974SThomas Gleixner .segment = _segment, \ 333318e974SThomas Gleixner } 343318e974SThomas Gleixner 353318e974SThomas Gleixner /* Interrupt gate */ 363318e974SThomas Gleixner #define INTG(_vector, _addr) \ 373318e974SThomas Gleixner G(_vector, _addr, DEFAULT_STACK, GATE_INTERRUPT, DPL0, __KERNEL_CS) 383318e974SThomas Gleixner 393318e974SThomas Gleixner /* System interrupt gate */ 403318e974SThomas Gleixner #define SYSG(_vector, _addr) \ 413318e974SThomas Gleixner G(_vector, _addr, DEFAULT_STACK, GATE_INTERRUPT, DPL3, __KERNEL_CS) 423318e974SThomas Gleixner 433318e974SThomas Gleixner /* Interrupt gate with interrupt stack */ 443318e974SThomas Gleixner #define ISTG(_vector, _addr, _ist) \ 453318e974SThomas Gleixner G(_vector, _addr, _ist, GATE_INTERRUPT, DPL0, __KERNEL_CS) 463318e974SThomas Gleixner 47c6ef8942SIngo Molnar /* System interrupt gate with interrupt stack */ 48c6ef8942SIngo Molnar #define SISTG(_vector, _addr, _ist) \ 49c6ef8942SIngo Molnar G(_vector, _addr, _ist, GATE_INTERRUPT, DPL3, __KERNEL_CS) 50c6ef8942SIngo Molnar 513318e974SThomas Gleixner /* Task gate */ 523318e974SThomas Gleixner #define TSKG(_vector, _gdt) \ 533318e974SThomas Gleixner G(_vector, NULL, DEFAULT_STACK, GATE_TASK, DPL0, _gdt << 3) 543318e974SThomas Gleixner 55433f8924SThomas Gleixner /* 56433f8924SThomas Gleixner * Early traps running on the DEFAULT_STACK because the other interrupt 57433f8924SThomas Gleixner * stacks work only after cpu_init(). 58433f8924SThomas Gleixner */ 59*327867faSAndi Kleen static const __initconst struct idt_data early_idts[] = { 60433f8924SThomas Gleixner INTG(X86_TRAP_DB, debug), 61433f8924SThomas Gleixner SYSG(X86_TRAP_BP, int3), 62433f8924SThomas Gleixner #ifdef CONFIG_X86_32 63433f8924SThomas Gleixner INTG(X86_TRAP_PF, page_fault), 64433f8924SThomas Gleixner #endif 65433f8924SThomas Gleixner }; 66433f8924SThomas Gleixner 67b70543a0SThomas Gleixner /* 68b70543a0SThomas Gleixner * The default IDT entries which are set up in trap_init() before 69b70543a0SThomas Gleixner * cpu_init() is invoked. Interrupt stacks cannot be used at that point and 70b70543a0SThomas Gleixner * the traps which use them are reinitialized with IST after cpu_init() has 71b70543a0SThomas Gleixner * set up TSS. 72b70543a0SThomas Gleixner */ 73*327867faSAndi Kleen static const __initconst struct idt_data def_idts[] = { 74b70543a0SThomas Gleixner INTG(X86_TRAP_DE, divide_error), 75b70543a0SThomas Gleixner INTG(X86_TRAP_NMI, nmi), 76b70543a0SThomas Gleixner INTG(X86_TRAP_BR, bounds), 77b70543a0SThomas Gleixner INTG(X86_TRAP_UD, invalid_op), 78b70543a0SThomas Gleixner INTG(X86_TRAP_NM, device_not_available), 79b70543a0SThomas Gleixner INTG(X86_TRAP_OLD_MF, coprocessor_segment_overrun), 80b70543a0SThomas Gleixner INTG(X86_TRAP_TS, invalid_TSS), 81b70543a0SThomas Gleixner INTG(X86_TRAP_NP, segment_not_present), 82b70543a0SThomas Gleixner INTG(X86_TRAP_SS, stack_segment), 83b70543a0SThomas Gleixner INTG(X86_TRAP_GP, general_protection), 84b70543a0SThomas Gleixner INTG(X86_TRAP_SPURIOUS, spurious_interrupt_bug), 85b70543a0SThomas Gleixner INTG(X86_TRAP_MF, coprocessor_error), 86b70543a0SThomas Gleixner INTG(X86_TRAP_AC, alignment_check), 87b70543a0SThomas Gleixner INTG(X86_TRAP_XF, simd_coprocessor_error), 88b70543a0SThomas Gleixner 89b70543a0SThomas Gleixner #ifdef CONFIG_X86_32 90b70543a0SThomas Gleixner TSKG(X86_TRAP_DF, GDT_ENTRY_DOUBLEFAULT_TSS), 91b70543a0SThomas Gleixner #else 92b70543a0SThomas Gleixner INTG(X86_TRAP_DF, double_fault), 93b70543a0SThomas Gleixner #endif 94b70543a0SThomas Gleixner INTG(X86_TRAP_DB, debug), 95b70543a0SThomas Gleixner 96b70543a0SThomas Gleixner #ifdef CONFIG_X86_MCE 97b70543a0SThomas Gleixner INTG(X86_TRAP_MC, &machine_check), 98b70543a0SThomas Gleixner #endif 99b70543a0SThomas Gleixner 100b70543a0SThomas Gleixner SYSG(X86_TRAP_OF, overflow), 101b70543a0SThomas Gleixner #if defined(CONFIG_IA32_EMULATION) 102b70543a0SThomas Gleixner SYSG(IA32_SYSCALL_VECTOR, entry_INT80_compat), 103b70543a0SThomas Gleixner #elif defined(CONFIG_X86_32) 104b70543a0SThomas Gleixner SYSG(IA32_SYSCALL_VECTOR, entry_INT80_32), 105b70543a0SThomas Gleixner #endif 106b70543a0SThomas Gleixner }; 107b70543a0SThomas Gleixner 108636a7598SThomas Gleixner /* 109636a7598SThomas Gleixner * The APIC and SMP idt entries 110636a7598SThomas Gleixner */ 111*327867faSAndi Kleen static const __initconst struct idt_data apic_idts[] = { 112636a7598SThomas Gleixner #ifdef CONFIG_SMP 113636a7598SThomas Gleixner INTG(RESCHEDULE_VECTOR, reschedule_interrupt), 114636a7598SThomas Gleixner INTG(CALL_FUNCTION_VECTOR, call_function_interrupt), 115636a7598SThomas Gleixner INTG(CALL_FUNCTION_SINGLE_VECTOR, call_function_single_interrupt), 116636a7598SThomas Gleixner INTG(IRQ_MOVE_CLEANUP_VECTOR, irq_move_cleanup_interrupt), 117636a7598SThomas Gleixner INTG(REBOOT_VECTOR, reboot_interrupt), 118636a7598SThomas Gleixner #endif 119636a7598SThomas Gleixner 120636a7598SThomas Gleixner #ifdef CONFIG_X86_THERMAL_VECTOR 121636a7598SThomas Gleixner INTG(THERMAL_APIC_VECTOR, thermal_interrupt), 122636a7598SThomas Gleixner #endif 123636a7598SThomas Gleixner 124636a7598SThomas Gleixner #ifdef CONFIG_X86_MCE_THRESHOLD 125636a7598SThomas Gleixner INTG(THRESHOLD_APIC_VECTOR, threshold_interrupt), 126636a7598SThomas Gleixner #endif 127636a7598SThomas Gleixner 128636a7598SThomas Gleixner #ifdef CONFIG_X86_MCE_AMD 129636a7598SThomas Gleixner INTG(DEFERRED_ERROR_VECTOR, deferred_error_interrupt), 130636a7598SThomas Gleixner #endif 131636a7598SThomas Gleixner 132636a7598SThomas Gleixner #ifdef CONFIG_X86_LOCAL_APIC 133636a7598SThomas Gleixner INTG(LOCAL_TIMER_VECTOR, apic_timer_interrupt), 134636a7598SThomas Gleixner INTG(X86_PLATFORM_IPI_VECTOR, x86_platform_ipi), 135636a7598SThomas Gleixner # ifdef CONFIG_HAVE_KVM 136636a7598SThomas Gleixner INTG(POSTED_INTR_VECTOR, kvm_posted_intr_ipi), 137636a7598SThomas Gleixner INTG(POSTED_INTR_WAKEUP_VECTOR, kvm_posted_intr_wakeup_ipi), 138636a7598SThomas Gleixner INTG(POSTED_INTR_NESTED_VECTOR, kvm_posted_intr_nested_ipi), 139636a7598SThomas Gleixner # endif 140636a7598SThomas Gleixner # ifdef CONFIG_IRQ_WORK 141636a7598SThomas Gleixner INTG(IRQ_WORK_VECTOR, irq_work_interrupt), 142636a7598SThomas Gleixner # endif 143636a7598SThomas Gleixner INTG(SPURIOUS_APIC_VECTOR, spurious_interrupt), 144636a7598SThomas Gleixner INTG(ERROR_APIC_VECTOR, error_interrupt), 145636a7598SThomas Gleixner #endif 146636a7598SThomas Gleixner }; 147636a7598SThomas Gleixner 148433f8924SThomas Gleixner #ifdef CONFIG_X86_64 149433f8924SThomas Gleixner /* 150433f8924SThomas Gleixner * Early traps running on the DEFAULT_STACK because the other interrupt 151433f8924SThomas Gleixner * stacks work only after cpu_init(). 152433f8924SThomas Gleixner */ 153*327867faSAndi Kleen static const __initconst struct idt_data early_pf_idts[] = { 154433f8924SThomas Gleixner INTG(X86_TRAP_PF, page_fault), 155433f8924SThomas Gleixner }; 1560a30908bSThomas Gleixner 1570a30908bSThomas Gleixner /* 1580a30908bSThomas Gleixner * Override for the debug_idt. Same as the default, but with interrupt 1590a30908bSThomas Gleixner * stack set to DEFAULT_STACK (0). Required for NMI trap handling. 1600a30908bSThomas Gleixner */ 161*327867faSAndi Kleen static const __initconst struct idt_data dbg_idts[] = { 1620a30908bSThomas Gleixner INTG(X86_TRAP_DB, debug), 1630a30908bSThomas Gleixner INTG(X86_TRAP_BP, int3), 1640a30908bSThomas Gleixner }; 165433f8924SThomas Gleixner #endif 166433f8924SThomas Gleixner 167d8ed9d48SThomas Gleixner /* Must be page-aligned because the real IDT is used in a fixmap. */ 168d8ed9d48SThomas Gleixner gate_desc idt_table[IDT_ENTRIES] __page_aligned_bss; 169d8ed9d48SThomas Gleixner 17016bc18d8SThomas Gleixner struct desc_ptr idt_descr __ro_after_init = { 17116bc18d8SThomas Gleixner .size = (IDT_ENTRIES * 2 * sizeof(unsigned long)) - 1, 17216bc18d8SThomas Gleixner .address = (unsigned long) idt_table, 17316bc18d8SThomas Gleixner }; 17416bc18d8SThomas Gleixner 175d8ed9d48SThomas Gleixner #ifdef CONFIG_X86_64 176d8ed9d48SThomas Gleixner /* No need to be aligned, but done to keep all IDTs defined the same way. */ 177d8ed9d48SThomas Gleixner gate_desc debug_idt_table[IDT_ENTRIES] __page_aligned_bss; 178d8ed9d48SThomas Gleixner 1790a30908bSThomas Gleixner /* 18090f6225fSThomas Gleixner * The exceptions which use Interrupt stacks. They are setup after 18190f6225fSThomas Gleixner * cpu_init() when the TSS has been initialized. 18290f6225fSThomas Gleixner */ 183*327867faSAndi Kleen static const __initconst struct idt_data ist_idts[] = { 18490f6225fSThomas Gleixner ISTG(X86_TRAP_DB, debug, DEBUG_STACK), 18590f6225fSThomas Gleixner ISTG(X86_TRAP_NMI, nmi, NMI_STACK), 186c6ef8942SIngo Molnar SISTG(X86_TRAP_BP, int3, DEBUG_STACK), 18790f6225fSThomas Gleixner ISTG(X86_TRAP_DF, double_fault, DOUBLEFAULT_STACK), 18890f6225fSThomas Gleixner #ifdef CONFIG_X86_MCE 18990f6225fSThomas Gleixner ISTG(X86_TRAP_MC, &machine_check, MCE_STACK), 19090f6225fSThomas Gleixner #endif 19190f6225fSThomas Gleixner }; 19290f6225fSThomas Gleixner 19390f6225fSThomas Gleixner /* 1940a30908bSThomas Gleixner * Override for the debug_idt. Same as the default, but with interrupt 1950a30908bSThomas Gleixner * stack set to DEFAULT_STACK (0). Required for NMI trap handling. 1960a30908bSThomas Gleixner */ 197d8ed9d48SThomas Gleixner const struct desc_ptr debug_idt_descr = { 198d8ed9d48SThomas Gleixner .size = IDT_ENTRIES * 16 - 1, 199d8ed9d48SThomas Gleixner .address = (unsigned long) debug_idt_table, 200d8ed9d48SThomas Gleixner }; 201d8ed9d48SThomas Gleixner #endif 202e802a51eSThomas Gleixner 2033318e974SThomas Gleixner static inline void idt_init_desc(gate_desc *gate, const struct idt_data *d) 2043318e974SThomas Gleixner { 2053318e974SThomas Gleixner unsigned long addr = (unsigned long) d->addr; 2063318e974SThomas Gleixner 2073318e974SThomas Gleixner gate->offset_low = (u16) addr; 2083318e974SThomas Gleixner gate->segment = (u16) d->segment; 2093318e974SThomas Gleixner gate->bits = d->bits; 2103318e974SThomas Gleixner gate->offset_middle = (u16) (addr >> 16); 2113318e974SThomas Gleixner #ifdef CONFIG_X86_64 2123318e974SThomas Gleixner gate->offset_high = (u32) (addr >> 32); 2133318e974SThomas Gleixner gate->reserved = 0; 2143318e974SThomas Gleixner #endif 2153318e974SThomas Gleixner } 2163318e974SThomas Gleixner 217db18da78SThomas Gleixner static void 218db18da78SThomas Gleixner idt_setup_from_table(gate_desc *idt, const struct idt_data *t, int size, bool sys) 2193318e974SThomas Gleixner { 2203318e974SThomas Gleixner gate_desc desc; 2213318e974SThomas Gleixner 2223318e974SThomas Gleixner for (; size > 0; t++, size--) { 2233318e974SThomas Gleixner idt_init_desc(&desc, t); 2243318e974SThomas Gleixner write_idt_entry(idt, t->vector, &desc); 225db18da78SThomas Gleixner if (sys) 2267854f822SThomas Gleixner set_bit(t->vector, system_vectors); 2273318e974SThomas Gleixner } 2283318e974SThomas Gleixner } 2293318e974SThomas Gleixner 230facaa3e3SThomas Gleixner static void set_intr_gate(unsigned int n, const void *addr) 231facaa3e3SThomas Gleixner { 232facaa3e3SThomas Gleixner struct idt_data data; 233facaa3e3SThomas Gleixner 234facaa3e3SThomas Gleixner BUG_ON(n > 0xFF); 235facaa3e3SThomas Gleixner 236facaa3e3SThomas Gleixner memset(&data, 0, sizeof(data)); 237facaa3e3SThomas Gleixner data.vector = n; 238facaa3e3SThomas Gleixner data.addr = addr; 239facaa3e3SThomas Gleixner data.segment = __KERNEL_CS; 240facaa3e3SThomas Gleixner data.bits.type = GATE_INTERRUPT; 241facaa3e3SThomas Gleixner data.bits.p = 1; 242facaa3e3SThomas Gleixner 243facaa3e3SThomas Gleixner idt_setup_from_table(idt_table, &data, 1, false); 244facaa3e3SThomas Gleixner } 245facaa3e3SThomas Gleixner 246e802a51eSThomas Gleixner /** 247433f8924SThomas Gleixner * idt_setup_early_traps - Initialize the idt table with early traps 248433f8924SThomas Gleixner * 249433f8924SThomas Gleixner * On X8664 these traps do not use interrupt stacks as they can't work 250433f8924SThomas Gleixner * before cpu_init() is invoked and sets up TSS. The IST variants are 251433f8924SThomas Gleixner * installed after that. 252433f8924SThomas Gleixner */ 253433f8924SThomas Gleixner void __init idt_setup_early_traps(void) 254433f8924SThomas Gleixner { 255db18da78SThomas Gleixner idt_setup_from_table(idt_table, early_idts, ARRAY_SIZE(early_idts), 256db18da78SThomas Gleixner true); 257433f8924SThomas Gleixner load_idt(&idt_descr); 258433f8924SThomas Gleixner } 259433f8924SThomas Gleixner 260b70543a0SThomas Gleixner /** 261b70543a0SThomas Gleixner * idt_setup_traps - Initialize the idt table with default traps 262b70543a0SThomas Gleixner */ 263b70543a0SThomas Gleixner void __init idt_setup_traps(void) 264b70543a0SThomas Gleixner { 265db18da78SThomas Gleixner idt_setup_from_table(idt_table, def_idts, ARRAY_SIZE(def_idts), true); 266b70543a0SThomas Gleixner } 267b70543a0SThomas Gleixner 268433f8924SThomas Gleixner #ifdef CONFIG_X86_64 269433f8924SThomas Gleixner /** 270433f8924SThomas Gleixner * idt_setup_early_pf - Initialize the idt table with early pagefault handler 271433f8924SThomas Gleixner * 272433f8924SThomas Gleixner * On X8664 this does not use interrupt stacks as they can't work before 273433f8924SThomas Gleixner * cpu_init() is invoked and sets up TSS. The IST variant is installed 274433f8924SThomas Gleixner * after that. 275433f8924SThomas Gleixner * 276433f8924SThomas Gleixner * FIXME: Why is 32bit and 64bit installing the PF handler at different 277433f8924SThomas Gleixner * places in the early setup code? 278433f8924SThomas Gleixner */ 279433f8924SThomas Gleixner void __init idt_setup_early_pf(void) 280433f8924SThomas Gleixner { 281433f8924SThomas Gleixner idt_setup_from_table(idt_table, early_pf_idts, 282db18da78SThomas Gleixner ARRAY_SIZE(early_pf_idts), true); 283433f8924SThomas Gleixner } 2840a30908bSThomas Gleixner 2850a30908bSThomas Gleixner /** 28690f6225fSThomas Gleixner * idt_setup_ist_traps - Initialize the idt table with traps using IST 28790f6225fSThomas Gleixner */ 28890f6225fSThomas Gleixner void __init idt_setup_ist_traps(void) 28990f6225fSThomas Gleixner { 290db18da78SThomas Gleixner idt_setup_from_table(idt_table, ist_idts, ARRAY_SIZE(ist_idts), true); 29190f6225fSThomas Gleixner } 29290f6225fSThomas Gleixner 29390f6225fSThomas Gleixner /** 2940a30908bSThomas Gleixner * idt_setup_debugidt_traps - Initialize the debug idt table with debug traps 2950a30908bSThomas Gleixner */ 2960a30908bSThomas Gleixner void __init idt_setup_debugidt_traps(void) 2970a30908bSThomas Gleixner { 2980a30908bSThomas Gleixner memcpy(&debug_idt_table, &idt_table, IDT_ENTRIES * 16); 2990a30908bSThomas Gleixner 300db18da78SThomas Gleixner idt_setup_from_table(debug_idt_table, dbg_idts, ARRAY_SIZE(dbg_idts), false); 3010a30908bSThomas Gleixner } 302433f8924SThomas Gleixner #endif 303433f8924SThomas Gleixner 304433f8924SThomas Gleixner /** 305636a7598SThomas Gleixner * idt_setup_apic_and_irq_gates - Setup APIC/SMP and normal interrupt gates 306636a7598SThomas Gleixner */ 307636a7598SThomas Gleixner void __init idt_setup_apic_and_irq_gates(void) 308636a7598SThomas Gleixner { 309dc20b2d5SThomas Gleixner int i = FIRST_EXTERNAL_VECTOR; 310dc20b2d5SThomas Gleixner void *entry; 311dc20b2d5SThomas Gleixner 312db18da78SThomas Gleixner idt_setup_from_table(idt_table, apic_idts, ARRAY_SIZE(apic_idts), true); 313dc20b2d5SThomas Gleixner 3147854f822SThomas Gleixner for_each_clear_bit_from(i, system_vectors, FIRST_SYSTEM_VECTOR) { 315dc20b2d5SThomas Gleixner entry = irq_entries_start + 8 * (i - FIRST_EXTERNAL_VECTOR); 316dc20b2d5SThomas Gleixner set_intr_gate(i, entry); 317dc20b2d5SThomas Gleixner } 318dc20b2d5SThomas Gleixner 3197854f822SThomas Gleixner for_each_clear_bit_from(i, system_vectors, NR_VECTORS) { 320dc20b2d5SThomas Gleixner #ifdef CONFIG_X86_LOCAL_APIC 3217854f822SThomas Gleixner set_bit(i, system_vectors); 322dc20b2d5SThomas Gleixner set_intr_gate(i, spurious_interrupt); 323dc20b2d5SThomas Gleixner #else 324dc20b2d5SThomas Gleixner entry = irq_entries_start + 8 * (i - FIRST_EXTERNAL_VECTOR); 325dc20b2d5SThomas Gleixner set_intr_gate(i, entry); 326dc20b2d5SThomas Gleixner #endif 327dc20b2d5SThomas Gleixner } 328636a7598SThomas Gleixner } 329636a7598SThomas Gleixner 330636a7598SThomas Gleixner /** 331588787fdSThomas Gleixner * idt_setup_early_handler - Initializes the idt table with early handlers 332588787fdSThomas Gleixner */ 333588787fdSThomas Gleixner void __init idt_setup_early_handler(void) 334588787fdSThomas Gleixner { 335588787fdSThomas Gleixner int i; 336588787fdSThomas Gleixner 337588787fdSThomas Gleixner for (i = 0; i < NUM_EXCEPTION_VECTORS; i++) 338588787fdSThomas Gleixner set_intr_gate(i, early_idt_handler_array[i]); 33987e81786SThomas Gleixner #ifdef CONFIG_X86_32 34087e81786SThomas Gleixner for ( ; i < NR_VECTORS; i++) 34187e81786SThomas Gleixner set_intr_gate(i, early_ignore_irq); 34287e81786SThomas Gleixner #endif 343588787fdSThomas Gleixner load_idt(&idt_descr); 344588787fdSThomas Gleixner } 345588787fdSThomas Gleixner 346588787fdSThomas Gleixner /** 347e802a51eSThomas Gleixner * idt_invalidate - Invalidate interrupt descriptor table 348e802a51eSThomas Gleixner * @addr: The virtual address of the 'invalid' IDT 349e802a51eSThomas Gleixner */ 350e802a51eSThomas Gleixner void idt_invalidate(void *addr) 351e802a51eSThomas Gleixner { 352e802a51eSThomas Gleixner struct desc_ptr idt = { .address = (unsigned long) addr, .size = 0 }; 353e802a51eSThomas Gleixner 354e802a51eSThomas Gleixner load_idt(&idt); 355e802a51eSThomas Gleixner } 356db18da78SThomas Gleixner 357facaa3e3SThomas Gleixner void __init update_intr_gate(unsigned int n, const void *addr) 358db18da78SThomas Gleixner { 3597854f822SThomas Gleixner if (WARN_ON_ONCE(!test_bit(n, system_vectors))) 360facaa3e3SThomas Gleixner return; 361facaa3e3SThomas Gleixner set_intr_gate(n, addr); 362db18da78SThomas Gleixner } 363db18da78SThomas Gleixner 364db18da78SThomas Gleixner void alloc_intr_gate(unsigned int n, const void *addr) 365db18da78SThomas Gleixner { 3664447ac11SThomas Gleixner BUG_ON(n < FIRST_SYSTEM_VECTOR); 3677854f822SThomas Gleixner if (!test_and_set_bit(n, system_vectors)) 368db18da78SThomas Gleixner set_intr_gate(n, addr); 369db18da78SThomas Gleixner } 370