x86/traps: functional prep work
authorAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 16 May 2014 15:38:16 +0000 (17:38 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 16 May 2014 15:38:16 +0000 (17:38 +0200)
* Promote certain actions to earlier in __start_xen().
* Declare double_fault and early_page_fault as standard trap handlers.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/setup.c
xen/arch/x86/x86_64/traps.c
xen/include/asm-x86/processor.h
xen/include/asm-x86/setup.h

index 68f4bcc9f47c55f0ec2a4c32f91f17502d44e985..82ce34498ded3039aa9ae96f181e5dbe92deb8c6 100644 (file)
@@ -558,8 +558,15 @@ void __init noreturn __start_xen(unsigned long mbi_p)
         .stop_bits = 1
     };
 
+    set_processor_id(0);
+    set_current((struct vcpu *)0xfffff000); /* debug sanity. */
+    idle_vcpu[0] = current;
+
     percpu_init_areas();
 
+    smp_prepare_boot_cpu();
+    sort_exception_tables();
+
     set_intr_gate(TRAP_page_fault, &early_page_fault);
 
     loader = (mbi->flags & MBI_LOADERNAME)
@@ -588,15 +595,10 @@ void __init noreturn __start_xen(unsigned long mbi_p)
 
     parse_video_info();
 
-    set_current((struct vcpu *)0xfffff000); /* debug sanity */
-    idle_vcpu[0] = current;
-    set_processor_id(0); /* needed early, for smp_processor_id() */
     if ( cpu_has_efer )
         rdmsrl(MSR_EFER, this_cpu(efer));
     asm volatile ( "mov %%cr4,%0" : "=r" (this_cpu(cr4)) );
 
-    smp_prepare_boot_cpu();
-
     /* We initialise the serial devices very early so we can get debugging. */
     ns16550.io_base = 0x3f8;
     ns16550.irq     = 4;
@@ -1212,8 +1214,6 @@ void __init noreturn __start_xen(unsigned long mbi_p)
     if ( opt_watchdog ) 
         nmi_watchdog = NMI_LOCAL_APIC;
 
-    sort_exception_tables();
-
     find_smp_config();
 
     dmi_scan_machine();
index af20e0bcfef58d3edf369b324cc9376dc335da6b..898f9a0c1fa4fca053e603894a3427e7f1b89938 100644 (file)
@@ -223,7 +223,6 @@ void show_page_walk(unsigned long addr)
            l1_table_offset(addr), l1e_get_intpte(l1e), pfn);
 }
 
-void double_fault(void);
 void do_double_fault(struct cpu_user_regs *regs)
 {
     unsigned int cpu;
index 35b2433f22a23e1eca3e145273e0db327fe9d408..c9051be7f775037a195e25e45ca68aca8888c279 100644 (file)
@@ -500,12 +500,14 @@ DECLARE_TRAP_HANDLER(overflow);
 DECLARE_TRAP_HANDLER(bounds);
 DECLARE_TRAP_HANDLER(invalid_op);
 DECLARE_TRAP_HANDLER(device_not_available);
+DECLARE_TRAP_HANDLER(double_fault);
 DECLARE_TRAP_HANDLER(coprocessor_segment_overrun);
 DECLARE_TRAP_HANDLER(invalid_TSS);
 DECLARE_TRAP_HANDLER(segment_not_present);
 DECLARE_TRAP_HANDLER(stack_segment);
 DECLARE_TRAP_HANDLER(general_protection);
 DECLARE_TRAP_HANDLER(page_fault);
+DECLARE_TRAP_HANDLER(early_page_fault);
 DECLARE_TRAP_HANDLER(coprocessor_error);
 DECLARE_TRAP_HANDLER(simd_coprocessor_error);
 DECLARE_TRAP_HANDLER(machine_check);
index 3039e1b49b265dc67ced064626a48fdd6732ac6a..8f8c6f3f4cafc3bcf4d2cedc678eab3c16d4ac30 100644 (file)
@@ -7,7 +7,6 @@ extern unsigned long xenheap_initial_phys_start;
 
 void early_cpu_init(void);
 void early_time_init(void);
-void early_page_fault(void);
 
 int intel_cpu_init(void);
 int amd_init_cpu(void);