|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v2 05/10] x86/traps: Functional prep work
* 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@xxxxxxxxxx>
CC: Keir Fraser <keir@xxxxxxx>
CC: Jan Beulich <JBeulich@xxxxxxxx>
CC: Tim Deegan <tim@xxxxxxx>
---
It would be nice if the linker could sort the exception tables for us, and the
Xen check could simply assert that it was sorted. Making this happen is not a
job for now.
v2:
* Don't introduce an explicitly latent this_cpu() bug before
percpu_area_init(), and implicit latent bug with subsequent changes.
---
xen/arch/x86/setup.c | 14 +++++++-------
xen/arch/x86/x86_64/traps.c | 1 -
xen/include/asm-x86/processor.h | 2 ++
xen/include/asm-x86/setup.h | 1 -
4 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 68f4bcc..82ce344 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -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();
diff --git a/xen/arch/x86/x86_64/traps.c b/xen/arch/x86/x86_64/traps.c
index af20e0b..898f9a0 100644
--- a/xen/arch/x86/x86_64/traps.c
+++ b/xen/arch/x86/x86_64/traps.c
@@ -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;
diff --git a/xen/include/asm-x86/processor.h b/xen/include/asm-x86/processor.h
index 35b2433..c9051be 100644
--- a/xen/include/asm-x86/processor.h
+++ b/xen/include/asm-x86/processor.h
@@ -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);
diff --git a/xen/include/asm-x86/setup.h b/xen/include/asm-x86/setup.h
index 3039e1b..8f8c6f3 100644
--- a/xen/include/asm-x86/setup.h
+++ b/xen/include/asm-x86/setup.h
@@ -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);
--
1.7.10.4
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |