[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 1/3] x86/traps: Export the exception_table[] function pointer table to C
and use it in preference to the direct call to do_nmi() in vmx.c The value 'TRAP_last_reserved' was only used where 'TRAP_nr' would be more appropriate, so is replaced. No functional change Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> CC: Jan Beulich <JBeulich@xxxxxxxx> CC: Tim Deegan <tim@xxxxxxx> --- Diffing the dissassembly confirms no change: @@ -236036,10 +236036,10 @@ ffff82d0801e1a9d: 48 3d 00 02 00 00 cmp $0x200,%rax ffff82d0801e1aa3: 0f 85 84 fe ff ff jne ffff82d0801e192d <vmx_vmexit_handler+0x10d> ffff82d0801e1aa9: 48 89 ef mov %rbp,%rdi -ffff82d0801e1aac: e8 4f c3 fa ff callq ffff82d08018de00 <do_nmi> -ffff82d0801e1ab1: e8 ea 7f 04 00 callq ffff82d080229aa0 <enable_nmis> -ffff82d0801e1ab6: e9 72 fe ff ff jmpq ffff82d0801e192d <vmx_vmexit_handler+0x10d> -ffff82d0801e1abb: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1) +ffff82d0801e1aac: ff 15 be 62 05 00 callq *0x562be(%rip) +ffff82d0801e1ab2: e8 e9 7f 04 00 callq ffff82d080229aa0 <enable_nmis> +ffff82d0801e1ab7: e9 71 fe ff ff jmpq ffff82d0801e192d <vmx_vmexit_handler+0x10d> +ffff82d0801e1abc: 0f 1f 40 00 nopl 0x0(%rax) ffff82d0801e1ac0: f6 83 c3 03 00 00 80 testb $0x80,0x3c3(%rbx) ffff82d0801e1ac7: 0f 84 07 fe ff ff je ffff82d0801e18d4 <vmx_vmexit_handler+0xb4> ffff82d0801e1acd: 48 8b 83 08 04 00 00 mov 0x408(%rbx),%rax --- xen/arch/x86/hvm/vmx/vmx.c | 2 +- xen/arch/x86/x86_64/entry.S | 5 +++-- xen/include/asm-x86/processor.h | 5 ++++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c index 88b7821..357ef6c 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -2701,7 +2701,7 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs) && ((intr_info & INTR_INFO_INTR_TYPE_MASK) == (X86_EVENTTYPE_NMI << 8)) ) { - do_nmi(regs); + exception_table[TRAP_nmi](regs); enable_nmis(); } break; diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S index b3d6e32..062c690 100644 --- a/xen/arch/x86/x86_64/entry.S +++ b/xen/arch/x86/x86_64/entry.S @@ -728,9 +728,10 @@ ENTRY(exception_table) .quad do_alignment_check .quad do_machine_check .quad do_simd_coprocessor_error - .rept TRAP_last_reserved + 1 - ((. - exception_table) / 8) + .rept TRAP_nr - ((. - exception_table) / 8) .quad do_reserved_trap /* Architecturally reserved exceptions. */ .endr + .size exception_table, . - exception_table ENTRY(hypercall_table) .quad do_set_trap_table /* 0 */ @@ -857,7 +858,7 @@ autogen_stubs: /* Automatically generated stubs. */ entrypoint 1b /* Reserved exceptions, heading towards do_reserved_trap(). */ - .elseif vec == TRAP_copro_seg || vec == TRAP_spurious_int || (vec > TRAP_simd_error && vec <= TRAP_last_reserved) + .elseif vec == TRAP_copro_seg || vec == TRAP_spurious_int || (vec > TRAP_simd_error && vec < TRAP_nr) 1: test $8,%spl /* 64bit exception frames are 16 byte aligned, but the word */ jz 2f /* size is 8 bytes. Check whether the processor gave us an */ diff --git a/xen/include/asm-x86/processor.h b/xen/include/asm-x86/processor.h index 20eade6..2773ea8 100644 --- a/xen/include/asm-x86/processor.h +++ b/xen/include/asm-x86/processor.h @@ -114,7 +114,7 @@ #define TRAP_machine_check 18 #define TRAP_simd_error 19 #define TRAP_virtualisation 20 -#define TRAP_last_reserved 31 +#define TRAP_nr 32 /* Set for entry via SYSCALL. Informs return code to use SYSRETQ not IRETQ. */ /* NB. Same as VGCF_in_syscall. No bits in common with any other TRAP_ defn. */ @@ -492,6 +492,9 @@ extern void mtrr_bp_init(void); void mcheck_init(struct cpuinfo_x86 *c, bool_t bsp); +/* Dispatch table for exceptions */ +extern void (* const exception_table[TRAP_nr])(struct cpu_user_regs *regs); + #define DECLARE_TRAP_HANDLER(_name) \ void _name(void); \ void do_ ## _name(struct cpu_user_regs *regs) -- 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 |