diff options
author | Paul Mundt <lethal@linux-sh.org> | 2008-09-21 03:43:45 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2008-09-21 03:43:45 -0400 |
commit | 9d2b1f81dd93b198e12bca8120afec4a7b609b06 (patch) | |
tree | 8091aa3e15c8d1d15f8109be7222b4b68b6a7f73 /arch | |
parent | 3d58695edbfac785161bf282dc11fd42a483d6c9 (diff) |
sh: ftrace support.
This adds support for ftrace to SH. This only includes CONFIG_FTRACE,
and does not handle dynamic ftrace presently.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/sh/Kconfig | 1 | ||||
-rw-r--r-- | arch/sh/boot/compressed/Makefile_32 | 5 | ||||
-rw-r--r-- | arch/sh/kernel/entry-common.S | 44 | ||||
-rw-r--r-- | arch/sh/kernel/sh_ksyms_32.c | 4 |
4 files changed, 54 insertions, 0 deletions
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig index adef42cd507f..38a5a9edb677 100644 --- a/arch/sh/Kconfig +++ b/arch/sh/Kconfig | |||
@@ -24,6 +24,7 @@ config SUPERH32 | |||
24 | select HAVE_KPROBES | 24 | select HAVE_KPROBES |
25 | select HAVE_KRETPROBES | 25 | select HAVE_KRETPROBES |
26 | select HAVE_ARCH_TRACEHOOK if !SH_FPU | 26 | select HAVE_ARCH_TRACEHOOK if !SH_FPU |
27 | select HAVE_FTRACE | ||
27 | 28 | ||
28 | config SUPERH64 | 29 | config SUPERH64 |
29 | def_bool y if CPU_SH5 | 30 | def_bool y if CPU_SH5 |
diff --git a/arch/sh/boot/compressed/Makefile_32 b/arch/sh/boot/compressed/Makefile_32 index 47685f618ae7..301e6d503256 100644 --- a/arch/sh/boot/compressed/Makefile_32 +++ b/arch/sh/boot/compressed/Makefile_32 | |||
@@ -23,6 +23,11 @@ IMAGE_OFFSET := $(shell /bin/bash -c 'printf "0x%08x" \ | |||
23 | 23 | ||
24 | LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) | 24 | LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) |
25 | 25 | ||
26 | ifeq ($(CONFIG_FTRACE),y) | ||
27 | ORIG_CFLAGS := $(KBUILD_CFLAGS) | ||
28 | KBUILD_CFLAGS = $(subst -pg, , $(ORIG_CFLAGS)) | ||
29 | endif | ||
30 | |||
26 | LDFLAGS_vmlinux := -Ttext $(IMAGE_OFFSET) -e startup -T $(obj)/../../kernel/vmlinux.lds | 31 | LDFLAGS_vmlinux := -Ttext $(IMAGE_OFFSET) -e startup -T $(obj)/../../kernel/vmlinux.lds |
27 | 32 | ||
28 | $(obj)/vmlinux: $(OBJECTS) $(obj)/piggy.o $(LIBGCC) FORCE | 33 | $(obj)/vmlinux: $(OBJECTS) $(obj)/piggy.o $(LIBGCC) FORCE |
diff --git a/arch/sh/kernel/entry-common.S b/arch/sh/kernel/entry-common.S index efbb4268875e..1a5cf9dd82de 100644 --- a/arch/sh/kernel/entry-common.S +++ b/arch/sh/kernel/entry-common.S | |||
@@ -371,3 +371,47 @@ syscall_exit: | |||
371 | #endif | 371 | #endif |
372 | 7: .long do_syscall_trace_enter | 372 | 7: .long do_syscall_trace_enter |
373 | 8: .long do_syscall_trace_leave | 373 | 8: .long do_syscall_trace_leave |
374 | |||
375 | #ifdef CONFIG_FTRACE | ||
376 | .align 2 | ||
377 | .globl _mcount | ||
378 | .type _mcount,@function | ||
379 | .globl mcount | ||
380 | .type mcount,@function | ||
381 | _mcount: | ||
382 | mcount: | ||
383 | mov.l r4, @-r15 | ||
384 | mov.l r5, @-r15 | ||
385 | mov.l r6, @-r15 | ||
386 | mov.l r7, @-r15 | ||
387 | sts.l pr, @-r15 | ||
388 | |||
389 | mov.l @(20,r15),r4 | ||
390 | sts pr, r5 | ||
391 | |||
392 | mov.l 1f, r6 | ||
393 | mov.l ftrace_stub, r7 | ||
394 | cmp/eq r6, r7 | ||
395 | bt skip_trace | ||
396 | |||
397 | mov.l @r6, r6 | ||
398 | jsr @r6 | ||
399 | nop | ||
400 | |||
401 | skip_trace: | ||
402 | |||
403 | lds.l @r15+, pr | ||
404 | mov.l @r15+, r7 | ||
405 | mov.l @r15+, r6 | ||
406 | mov.l @r15+, r5 | ||
407 | rts | ||
408 | mov.l @r15+, r4 | ||
409 | |||
410 | .align 2 | ||
411 | 1: .long ftrace_trace_function | ||
412 | |||
413 | .globl ftrace_stub | ||
414 | ftrace_stub: | ||
415 | rts | ||
416 | nop | ||
417 | #endif /* CONFIG_FTRACE */ | ||
diff --git a/arch/sh/kernel/sh_ksyms_32.c b/arch/sh/kernel/sh_ksyms_32.c index 6e1b1c271658..d917b7b4042b 100644 --- a/arch/sh/kernel/sh_ksyms_32.c +++ b/arch/sh/kernel/sh_ksyms_32.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <asm/delay.h> | 16 | #include <asm/delay.h> |
17 | #include <asm/tlbflush.h> | 17 | #include <asm/tlbflush.h> |
18 | #include <asm/cacheflush.h> | 18 | #include <asm/cacheflush.h> |
19 | #include <asm/ftrace.h> | ||
19 | 20 | ||
20 | extern int dump_fpu(struct pt_regs *, elf_fpregset_t *); | 21 | extern int dump_fpu(struct pt_regs *, elf_fpregset_t *); |
21 | extern struct hw_interrupt_type no_irq_type; | 22 | extern struct hw_interrupt_type no_irq_type; |
@@ -133,6 +134,9 @@ EXPORT_SYMBOL(__flush_purge_region); | |||
133 | EXPORT_SYMBOL(clear_user_page); | 134 | EXPORT_SYMBOL(clear_user_page); |
134 | #endif | 135 | #endif |
135 | 136 | ||
137 | #ifdef CONFIG_FTRACE | ||
138 | EXPORT_SYMBOL(mcount); | ||
139 | #endif | ||
136 | EXPORT_SYMBOL(csum_partial); | 140 | EXPORT_SYMBOL(csum_partial); |
137 | EXPORT_SYMBOL(csum_partial_copy_generic); | 141 | EXPORT_SYMBOL(csum_partial_copy_generic); |
138 | #ifdef CONFIG_IPV6 | 142 | #ifdef CONFIG_IPV6 |