Loading handle_arch_irq with a PC relative load

Gilles Chanteperdrix gilles.chanteperdrix at xenomai.org
Fri Jul 13 15:05:59 EDT 2012


I do not know if it is really useful, but it seems it would be possible 
to reduce the number of memory accesses to just one in the irq_handler 
macro in the case where CONFIG_MULTI_IRQ_HANDLER is enabled, by using a 
PC relative load, with something like the following patch:

diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index 0d1851c..48ee46a 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -37,10 +37,9 @@
  */
 	.macro	irq_handler
 #ifdef CONFIG_MULTI_IRQ_HANDLER
-	ldr	r1, =handle_arch_irq
 	mov	r0, sp
 	adr	lr, BSYM(9997f)
-	ldr	pc, [r1]
+	ldr	pc, handle_arch_irq
 #else
 	arch_irq_handler_default
 #endif
@@ -325,6 +324,12 @@ ENDPROC(__pabt_svc)
 #endif
 .LCfp:
 	.word	fp_enter
+#ifdef CONFIG_MULTI_IRQ_HANDLER
+	.globl	handle_arch_irq
+handle_arch_irq:
+	.space	4
+#endif
+
 
 /*
  * User mode handlers
@@ -1151,9 +1156,3 @@ cr_alignment:
 	.space	4
 cr_no_alignment:
 	.space	4
-
-#ifdef CONFIG_MULTI_IRQ_HANDLER
-	.globl	handle_arch_irq
-handle_arch_irq:
-	.space	4
-#endif


-- 
                                                                Gilles.



More information about the linux-arm-kernel mailing list