[PATCH] m68knommu: add FTRACE support
From: Sebastian Siewior
Date: Tue May 13 2008 - 12:53:01 EST
due to a gcc bug or feature, the following patch has to be applied to gcc:
|m68k: remove label generation on -pg
|
|haven't found a reason why this flag is needed. Maybe glibc needs this label.
|However this implementation puts the labels too far away.
|
|Signed-off-by: Sebastian Siewior <bigeasy@xxxxxxxxxxxxx>
|
|--- a/gcc/config/m68k/linux.h
|+++ b/gcc/config/m68k/linux.h
|@@ -143,7 +143,6 @@ along with GCC; see the file COPYING3.
| #undef FUNCTION_PROFILER
| #define FUNCTION_PROFILER(FILE, LABELNO) \
| { \
|- asm_fprintf (FILE, "\tlea (%LLP%d,%Rpc),%Ra1\n", (LABELNO)); \
| if (flag_pic) \
| fprintf (FILE, "\tbsr.l _mcount@PLTPC\n"); \
| else \
|--- a/gcc/config/m68k/m68k.h
|+++ b/gcc/config/m68k/m68k.h
|@@ -576,7 +576,7 @@ extern enum reg_class regno_reg_class[];
| #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) 0
|
| #define FUNCTION_PROFILER(FILE, LABELNO) \
|- asm_fprintf (FILE, "\tlea %LLP%d,%Ra0\n\tjsr mcount\n", (LABELNO))
|+ asm_fprintf (FILE, "\tjsr mcount\n", (LABELNO))
|
| #define EXIT_IGNORE_STACK 1
|
GCC bug report: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36047
Signed-off-by: Sebastian Siewior <bigeasy@xxxxxxxxxxxxx>
---
arch/m68knommu/Kconfig | 1 +
arch/m68knommu/kernel/process.c | 2 +
arch/m68knommu/platform/coldfire/entry.S | 33 ++++++++++++++++++++++++++++++
kernel/trace/Kconfig | 2 +-
4 files changed, 37 insertions(+), 1 deletions(-)
diff --git a/arch/m68knommu/Kconfig b/arch/m68knommu/Kconfig
index 07eb4c4..90ce97b 100644
--- a/arch/m68knommu/Kconfig
+++ b/arch/m68knommu/Kconfig
@@ -166,6 +166,7 @@ config M527x
config COLDFIRE
bool
depends on (M5206 || M5206e || M520x || M523x || M5249 || M527x || M5272 || M528x || M5307 || M532x || M5407)
+ select HAVE_FTRACE
default y
config CLOCK_SET
diff --git a/arch/m68knommu/kernel/process.c b/arch/m68knommu/kernel/process.c
index 47502d5..57678a5 100644
--- a/arch/m68knommu/kernel/process.c
+++ b/arch/m68knommu/kernel/process.c
@@ -74,7 +74,9 @@ void cpu_idle(void)
{
/* endless idle loop with no priority at all */
while (1) {
+ stop_critical_timings();
idle();
+ start_critical_timings();
preempt_enable_no_resched();
schedule();
preempt_disable();
diff --git a/arch/m68knommu/platform/coldfire/entry.S b/arch/m68knommu/platform/coldfire/entry.S
index 111b66d..0301a80 100644
--- a/arch/m68knommu/platform/coldfire/entry.S
+++ b/arch/m68knommu/platform/coldfire/entry.S
@@ -55,6 +55,39 @@ sw_usp:
.globl inthandler
.globl fasthandler
+#ifdef CONFIG_FTRACE
+ENTRY(_mcount)
+ linkw %fp, #0
+
+ moveal ftrace_trace_function, %a0
+ movel #ftrace_stub, %d0
+ cmpl %a0@, %d0
+
+ bnew do_mcount
+
+ unlk %fp
+ rts
+
+do_mcount:
+
+ movel %fp, %d0
+ moveal %d0, %a1
+
+ moveal %a1@, %a0
+ movel %a0@(4), %sp@- /* push parent ip */
+ movel %a1@(4), %sp@- /* push ip */
+
+ moveal ftrace_trace_function, %a0
+ jsr %a0@
+
+ unlk %fp
+
+.globl ftrace_stub
+ftrace_stub:
+ rts
+END(mcount)
+#endif
+
enosys:
mov.l #sys_ni_syscall,%d3
bra 1f
diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
index c93446e..deaa9a5 100644
--- a/kernel/trace/Kconfig
+++ b/kernel/trace/Kconfig
@@ -101,7 +101,7 @@ config CONTEXT_SWITCH_TRACER
config DYNAMIC_FTRACE
bool "enable/disable ftrace tracepoints dynamically"
- depends on FTRACE
+ depends on FTRACE && !COLDFIRE
default y
help
This option will modify all the calls to ftrace dynamically
--
1.5.4.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/