mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-01-15 04:46:08 +07:00
588787fde7
The early IDT handler setup is done in C entry code on 64-bit kernels and in ASM entry code on 32-bit kernels. Move the 64-bit variant to the IDT code so it can be shared with 32-bit in the next step. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: Andy Lutomirski <luto@kernel.org> Cc: Borislav Petkov <bp@alien8.de> Cc: Brian Gerst <brgerst@gmail.com> Cc: Denys Vlasenko <dvlasenk@redhat.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Josh Poimboeuf <jpoimboe@redhat.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Steven Rostedt <rostedt@goodmis.org> Link: http://lkml.kernel.org/r/20170828064958.679561404@linutronix.de Signed-off-by: Ingo Molnar <mingo@kernel.org>
50 lines
1.2 KiB
C
50 lines
1.2 KiB
C
/*
|
|
* 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 = {
|
|
.size = (IDT_ENTRIES * 2 * sizeof(unsigned long)) - 1,
|
|
.address = (unsigned long) idt_table,
|
|
};
|
|
|
|
#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;
|
|
|
|
const struct desc_ptr debug_idt_descr = {
|
|
.size = IDT_ENTRIES * 16 - 1,
|
|
.address = (unsigned long) debug_idt_table,
|
|
};
|
|
#endif
|
|
|
|
/**
|
|
* idt_setup_early_handler - Initializes the idt table with early handlers
|
|
*/
|
|
void __init idt_setup_early_handler(void)
|
|
{
|
|
int i;
|
|
|
|
for (i = 0; i < NUM_EXCEPTION_VECTORS; i++)
|
|
set_intr_gate(i, early_idt_handler_array[i]);
|
|
load_idt(&idt_descr);
|
|
}
|
|
|
|
/**
|
|
* 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);
|
|
}
|