#include <linux/mm.h>
 #include <linux/memblock.h>
 
+#include <asm/desc.h>
 #include <asm/setup.h>
 #include <asm/sections.h>
 #include <asm/e820/api.h>
 asmlinkage __visible void __init i386_start_kernel(void)
 {
        cr4_init_shadow();
+
+       idt_setup_early_handler();
+
        sanitize_boot_params(&boot_params);
 
        x86_early_init_platform_quirks();
 
        movl %eax,%cr0
 
        lgdt early_gdt_descr
-       lidt idt_descr
        ljmp $(__KERNEL_CS),$1f
 1:     movl $(__KERNEL_DS),%eax        # reload all the segment registers
        movl %eax,%ss                   # after changing gdt.
  */
 __INIT
 setup_once:
-       /*
-        * Set up a idt with 256 interrupt gates that push zero if there
-        * is no error code and then jump to early_idt_handler_common.
-        * It doesn't actually load the idt - that needs to be done on
-        * each CPU. Interrupts are enabled elsewhere, when we can be
-        * relatively sure everything is ok.
-        */
-
-       movl $idt_table,%edi
-       movl $early_idt_handler_array,%eax
-       movl $NUM_EXCEPTION_VECTORS,%ecx
-1:
-       movl %eax,(%edi)
-       movl %eax,4(%edi)
-       /* interrupt gate, dpl=0, present */
-       movl $(0x8E000000 + __KERNEL_CS),2(%edi)
-       addl $EARLY_IDT_HANDLER_SIZE,%eax
-       addl $8,%edi
-       loop 1b
-
-       movl $256 - NUM_EXCEPTION_VECTORS,%ecx
-       movl $ignore_int,%edx
-       movl $(__KERNEL_CS << 16),%eax
-       movw %dx,%ax            /* selector = 0x0010 = cs */
-       movw $0x8E00,%dx        /* interrupt gate - dpl=0, present */
-2:
-       movl %eax,(%edi)
-       movl %edx,4(%edi)
-       addl $8,%edi
-       loop 2b
-
 #ifdef CONFIG_CC_STACKPROTECTOR
        /*
         * Configure the stack canary. The linker can't handle this by
 
 /* This is the default interrupt "handler" :-) */
        ALIGN
-ignore_int:
+ENTRY(early_ignore_irq)
        cld
 #ifdef CONFIG_PRINTK
        pushl %eax
 hlt_loop:
        hlt
        jmp hlt_loop
-ENDPROC(ignore_int)
+ENDPROC(early_ignore_irq)
 __INITDATA
        .align 4
 GLOBAL(early_recursion_flag)
 
 
        for (i = 0; i < NUM_EXCEPTION_VECTORS; i++)
                set_intr_gate(i, early_idt_handler_array[i]);
+#ifdef CONFIG_X86_32
+       for ( ; i < NR_VECTORS; i++)
+               set_intr_gate(i, early_ignore_irq);
+#endif
        load_idt(&idt_descr);
 }