2017-08-28 14:47:43 +08:00
|
|
|
/*
|
|
|
|
* Interrupt descriptor table related code
|
|
|
|
*
|
|
|
|
* This file is licensed under the GPL V2
|
|
|
|
*/
|
|
|
|
#include <linux/interrupt.h>
|
|
|
|
|
|
|
|
#include <asm/desc.h>
|
|
|
|
|
|
|
|
/* Must be page-aligned because the real IDT is used in a fixmap. */
|
|
|
|
gate_desc idt_table[IDT_ENTRIES] __page_aligned_bss;
|
|
|
|
|
|
|
|
struct desc_ptr idt_descr __ro_after_init = {
|
2017-08-28 14:47:44 +08:00
|
|
|
.size = (IDT_ENTRIES * 2 * sizeof(unsigned long)) - 1,
|
2017-08-28 14:47:43 +08:00
|
|
|
.address = (unsigned long) idt_table,
|
|
|
|
};
|
|
|
|
|
2017-08-28 14:47:44 +08:00
|
|
|
#ifdef CONFIG_X86_64
|
|
|
|
/* No need to be aligned, but done to keep all IDTs defined the same way. */
|
|
|
|
gate_desc debug_idt_table[IDT_ENTRIES] __page_aligned_bss;
|
|
|
|
|
2017-08-28 14:47:43 +08:00
|
|
|
const struct desc_ptr debug_idt_descr = {
|
|
|
|
.size = IDT_ENTRIES * 16 - 1,
|
|
|
|
.address = (unsigned long) debug_idt_table,
|
|
|
|
};
|
|
|
|
#endif
|
2017-08-28 14:47:46 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* idt_invalidate - Invalidate interrupt descriptor table
|
|
|
|
* @addr: The virtual address of the 'invalid' IDT
|
|
|
|
*/
|
|
|
|
void idt_invalidate(void *addr)
|
|
|
|
{
|
|
|
|
struct desc_ptr idt = { .address = (unsigned long) addr, .size = 0 };
|
|
|
|
|
|
|
|
load_idt(&idt);
|
|
|
|
}
|