summaryrefslogtreecommitdiff
path: root/include/task.h
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2014-03-06 16:02:58 -0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-03-11 05:52:37 +0000
commit7aab81edce830e15134b52256ad3186e08951b10 (patch)
treee6197b4cc038172426b046153fc512ddefb019e8 /include/task.h
parent0e3ff013cc7814705137d373218ea7bfa0f94c2c (diff)
downloadchrome-ec-7aab81edce830e15134b52256ad3186e08951b10.tar.gz
force the compiler to use a valid register allocation for irq handlers
When we are calling the re-scheduling routine at the end of an irq handling routine, we need to ensure that the high registers are not currently saved on the system stack. On Cortex-M3/M4, the compiler is normally doing tail-call optimization there and behaving properly, but this fixes the fact that insanely large interrupt handling routines where sometimes not compile and not running properly (aka issue 24515). This also prepares for one more core-specific DECLARE_IRQ routine on Cortex-M0. Note: now on, the IRQ handling routines should no longer be "static". Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=chrome-os-partner:24515 TEST=make -j buildall revert the workaround for 24515, see the issue happening only without this CL. Change-Id: Ic419369231925568df05815fd079ed191a5446db Reviewed-on: https://chromium-review.googlesource.com/189153 Reviewed-by: Vic Yang <victoryang@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'include/task.h')
-rw-r--r--include/task.h30
1 files changed, 4 insertions, 26 deletions
diff --git a/include/task.h b/include/task.h
index f2df173501..4cbd60b857 100644
--- a/include/task.h
+++ b/include/task.h
@@ -201,32 +201,10 @@ struct irq_priority {
uint8_t priority;
};
-/* Helper macros to build the IRQ handler and priority struct names */
-#define IRQ_HANDLER(irqname) CONCAT3(irq_, irqname, _handler)
-#define IRQ_PRIORITY(irqname) CONCAT2(prio_, irqname)
/*
- * Macro to connect the interrupt handler "routine" to the irq number "irq" and
- * ensure it is enabled in the interrupt controller with the right priority.
- */
-#ifdef __nds32__
-#define DECLARE_IRQ(irq, routine, priority) \
- void IRQ_HANDLER(CPU_INT(irq))(void) \
- __attribute__ ((alias(STRINGIFY(routine)))); \
- const struct irq_priority IRQ_PRIORITY(CPU_INT(irq)) \
- __attribute__((section(".rodata.irqprio"))) \
- = {CPU_INT(irq), priority}
-#else
-#define DECLARE_IRQ(irq, routine, priority) \
- void IRQ_HANDLER(irq)(void) \
- { \
- void *ret = __builtin_return_address(0); \
- task_start_irq_handler(ret); \
- routine(); \
- task_resched_if_needed(ret); \
- } \
- const struct irq_priority IRQ_PRIORITY(irq) \
- __attribute__((section(".rodata.irqprio"))) \
- = {irq, priority}
-#endif
+ * Implement the DECLARE_IRQ(irq, routine, priority) macro which is
+ * a core specific helper macro to declare an interrupt handler "routine".
+ */
+#include "irq_handler.h"
#endif /* __CROS_EC_TASK_H */