[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v4 16/27] x86/traps: factor out pv_trap_init



Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
 xen/arch/x86/traps.c           | 22 ++++++++++++++--------
 xen/include/asm-x86/pv/traps.h |  4 ++++
 2 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 8861dfd332..29a83994bd 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -1871,14 +1871,8 @@ void __init init_idt_traps(void)
     this_cpu(compat_gdt_table) = boot_cpu_compat_gdt_table;
 }
 
-extern void (*const autogen_entrypoints[NR_VECTORS])(void);
-void __init trap_init(void)
+void __init pv_trap_init(void)
 {
-    unsigned int vector;
-
-    /* Replace early pagefault with real pagefault handler. */
-    set_intr_gate(TRAP_page_fault, &page_fault);
-
     /* The 32-on-64 hypercall vector is only accessible from ring 1. */
     _set_gate(idt_table + HYPERCALL_VECTOR,
               SYS_DESC_trap_gate, 1, entry_int82);
@@ -1886,6 +1880,19 @@ void __init trap_init(void)
     /* Fast trap for int80 (faster than taking the #GP-fixup path). */
     _set_gate(idt_table + 0x80, SYS_DESC_trap_gate, 3, &int80_direct_trap);
 
+    open_softirq(NMI_MCE_SOFTIRQ, nmi_mce_softirq);
+}
+
+extern void (*const autogen_entrypoints[NR_VECTORS])(void);
+void __init trap_init(void)
+{
+    unsigned int vector;
+
+    pv_trap_init();
+
+    /* Replace early pagefault with real pagefault handler. */
+    set_intr_gate(TRAP_page_fault, &page_fault);
+
     for ( vector = 0; vector < NR_VECTORS; ++vector )
     {
         if ( autogen_entrypoints[vector] )
@@ -1905,7 +1912,6 @@ void __init trap_init(void)
 
     cpu_init();
 
-    open_softirq(NMI_MCE_SOFTIRQ, nmi_mce_softirq);
     open_softirq(PCI_SERR_SOFTIRQ, pci_serr_softirq);
 }
 
diff --git a/xen/include/asm-x86/pv/traps.h b/xen/include/asm-x86/pv/traps.h
index a4af69e486..426c8f6216 100644
--- a/xen/include/asm-x86/pv/traps.h
+++ b/xen/include/asm-x86/pv/traps.h
@@ -25,6 +25,8 @@
 
 #include <public/xen.h>
 
+void pv_trap_init(void);
+
 int pv_emulate_privileged_op(struct cpu_user_regs *regs);
 void pv_emulate_gate_op(struct cpu_user_regs *regs);
 int pv_emulate_invalid_rdtscp(struct cpu_user_regs *regs);
@@ -32,6 +34,8 @@ int pv_emulate_forced_invalid_op(struct cpu_user_regs *regs);
 
 #else  /* !CONFIG_PV */
 
+void pv_trap_init(void) {}
+
 int pv_emulate_privileged_op(struct cpu_user_regs *regs) { return 0; }
 void pv_emulate_gate_op(struct cpu_user_regs *regs) {}
 int pv_emulate_invalid_rdtscp(struct cpu_user_regs *regs) { return 0; }
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.