From: Feng Wu Subject: [PATCH] x86: move interrupt entry stubs to entry.S Date: Thu, 15 May 2014 13:34:06 +0800 Message-ID: <1400132046-25744-1-git-send-email-feng.wu@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: keir.xen@gmail.com, Feng Wu , JBeulich@suse.com List-Id: xen-devel@lists.xenproject.org This patch removes the ugly macros in i8259.c and asm_defns.h, which is used to build up the interrupt entry stubs. Move the definition of these stubs to entry.S instead. Signed-off-by: Feng Wu --- xen/arch/x86/i8259.c | 63 ++--------------------------------------- xen/arch/x86/x86_64/entry.S | 20 +++++++++++++ xen/include/asm-x86/asm_defns.h | 6 +--- 3 files changed, 23 insertions(+), 66 deletions(-) diff --git a/xen/arch/x86/i8259.c b/xen/arch/x86/i8259.c index 9fec490..f207c2c 100644 --- a/xen/arch/x86/i8259.c +++ b/xen/arch/x86/i8259.c @@ -23,65 +23,6 @@ #include /* - * Common place to define all x86 IRQ vectors - * - * This builds up the IRQ handler stubs using some ugly macros in irq.h - * - * These macros create the low-level assembly IRQ routines that save - * register context and call do_IRQ(). do_IRQ() then does all the - * operations that are needed to keep the AT (or SMP IOAPIC) - * interrupt-controller happy. - */ - -__asm__(".section .text"); - -#define IRQ_NAME(nr) VEC##nr##_interrupt - -#define BI(nr) \ -void IRQ_NAME(nr)(void); \ -__asm__( \ -".if " STR(0x##nr) " >= " STR(FIRST_DYNAMIC_VECTOR) "\n" \ -__ALIGN_STR "\n" \ -STR(IRQ_NAME(nr)) ":\n\t" \ -BUILD_IRQ(0x##nr) "\n" \ -".else\n" \ -".equ " STR(IRQ_NAME(nr)) ", 0\n" \ -".endif\n") - -#define BUILD_16_IRQS(x) \ - BI(x##0); BI(x##1); BI(x##2); BI(x##3); \ - BI(x##4); BI(x##5); BI(x##6); BI(x##7); \ - BI(x##8); BI(x##9); BI(x##a); BI(x##b); \ - BI(x##c); BI(x##d); BI(x##e); BI(x##f) - -BUILD_16_IRQS(0); BUILD_16_IRQS(1); BUILD_16_IRQS(2); BUILD_16_IRQS(3); -BUILD_16_IRQS(4); BUILD_16_IRQS(5); BUILD_16_IRQS(6); BUILD_16_IRQS(7); -BUILD_16_IRQS(8); BUILD_16_IRQS(9); BUILD_16_IRQS(a); BUILD_16_IRQS(b); -BUILD_16_IRQS(c); BUILD_16_IRQS(d); BUILD_16_IRQS(e); BUILD_16_IRQS(f); - -#undef BUILD_16_IRQS -#undef BI - - -#define IRQ(x,y) IRQ_NAME(x##y) - -#define IRQLIST_16(x) \ - IRQ(x,0), IRQ(x,1), IRQ(x,2), IRQ(x,3), \ - IRQ(x,4), IRQ(x,5), IRQ(x,6), IRQ(x,7), \ - IRQ(x,8), IRQ(x,9), IRQ(x,a), IRQ(x,b), \ - IRQ(x,c), IRQ(x,d), IRQ(x,e), IRQ(x,f) - -static void (*__initdata interrupt[NR_VECTORS])(void) = { - IRQLIST_16(0), IRQLIST_16(1), IRQLIST_16(2), IRQLIST_16(3), - IRQLIST_16(4), IRQLIST_16(5), IRQLIST_16(6), IRQLIST_16(7), - IRQLIST_16(8), IRQLIST_16(9), IRQLIST_16(a), IRQLIST_16(b), - IRQLIST_16(c), IRQLIST_16(d), IRQLIST_16(e), IRQLIST_16(f) -}; - -#undef IRQ -#undef IRQLIST_16 - -/* * This is the 'legacy' 8259A Programmable Interrupt Controller, * present in the majority of PC/AT boxes. * plus some generic x86 specific things if generic specifics makes @@ -407,8 +348,8 @@ void __init init_IRQ(void) { if (vector == HYPERCALL_VECTOR || vector == LEGACY_SYSCALL_VECTOR) continue; - BUG_ON(!interrupt[vector]); - set_intr_gate(vector, interrupt[vector]); + BUG_ON(!interrupt[vector - FIRST_DYNAMIC_VECTOR]); + set_intr_gate(vector, interrupt[vector - FIRST_DYNAMIC_VECTOR]); } for (irq = 0; platform_legacy_irq(irq); irq++) { diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S index 4796e65..8dc0d12 100644 --- a/xen/arch/x86/x86_64/entry.S +++ b/xen/arch/x86/x86_64/entry.S @@ -469,6 +469,26 @@ ENTRY(dom_crash_sync_extable) xorl %edi,%edi jmp asm_domain_crash_synchronous /* Does not return */ + .section .init.data,"a" +ENTRY(interrupt) + .section .text +ENTRY(irq_entries_start) + vector=FIRST_DYNAMIC_VECTOR + .rept NR_VECTORS-FIRST_DYNAMIC_VECTOR + ALIGN + .if vector < NR_VECTORS +1: pushq $0x0 + movl $vector,0x4(%rsp) + jmp common_interrupt + .previous + .quad 1b + .section .text + vector=vector+1 + .endif + .endr + .previous + .previous + ENTRY(common_interrupt) SAVE_ALL CLAC movq %rsp,%rdi diff --git a/xen/include/asm-x86/asm_defns.h b/xen/include/asm-x86/asm_defns.h index df4873b..7d620b1 100644 --- a/xen/include/asm-x86/asm_defns.h +++ b/xen/include/asm-x86/asm_defns.h @@ -13,6 +13,7 @@ #ifndef __ASSEMBLY__ void ret_from_intr(void); +extern void (*interrupt[])(void); #endif #ifdef CONFIG_FRAME_POINTER @@ -357,9 +358,4 @@ static inline void stac(void) #define REX64_PREFIX "rex64/" #endif -#define BUILD_IRQ(nr) \ - "pushq $0\n\t" \ - "movl $"#nr",4(%rsp)\n\t" \ - "jmp common_interrupt" - #endif /* __X86_ASM_DEFNS_H__ */ -- 1.8.3.1