]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - arch/x86/kernel/idt.c
x86/idt: Consolidate IDT invalidation
[mirror_ubuntu-bionic-kernel.git] / arch / x86 / kernel / idt.c
CommitLineData
d8ed9d48
TG
1/*
2 * Interrupt descriptor table related code
3 *
4 * This file is licensed under the GPL V2
5 */
6#include <linux/interrupt.h>
7
8#include <asm/desc.h>
9
10/* Must be page-aligned because the real IDT is used in a fixmap. */
11gate_desc idt_table[IDT_ENTRIES] __page_aligned_bss;
12
d8ed9d48 13struct desc_ptr idt_descr __ro_after_init = {
16bc18d8 14 .size = (IDT_ENTRIES * 2 * sizeof(unsigned long)) - 1,
d8ed9d48
TG
15 .address = (unsigned long) idt_table,
16};
17
16bc18d8
TG
18#ifdef CONFIG_X86_64
19/* No need to be aligned, but done to keep all IDTs defined the same way. */
20gate_desc debug_idt_table[IDT_ENTRIES] __page_aligned_bss;
21
d8ed9d48
TG
22const struct desc_ptr debug_idt_descr = {
23 .size = IDT_ENTRIES * 16 - 1,
24 .address = (unsigned long) debug_idt_table,
25};
26#endif
e802a51e
TG
27
28/**
29 * idt_invalidate - Invalidate interrupt descriptor table
30 * @addr: The virtual address of the 'invalid' IDT
31 */
32void idt_invalidate(void *addr)
33{
34 struct desc_ptr idt = { .address = (unsigned long) addr, .size = 0 };
35
36 load_idt(&idt);
37}