diff options
author | Heiko Carstens <heiko.carstens@de.ibm.com> | 2008-12-25 07:38:56 -0500 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2008-12-25 07:39:03 -0500 |
commit | 5d360a75f87f288e9a25d56cca503a7c7939e490 (patch) | |
tree | 46d9d0f1c05ac21395d1cc34abbf857a4a69cd6e /arch/s390 | |
parent | 98df67b324a2a986987ce29986e44ae9156b6698 (diff) |
[S390] ftrace: function tracer backend for s390
This implements just the basic function tracer (_mcount) backend for s390.
The dynamic variant will come later.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390')
-rw-r--r-- | arch/s390/Kconfig | 1 | ||||
-rw-r--r-- | arch/s390/include/asm/ftrace.h | 8 | ||||
-rw-r--r-- | arch/s390/kernel/Makefile | 6 | ||||
-rw-r--r-- | arch/s390/kernel/mcount.S | 56 | ||||
-rw-r--r-- | arch/s390/kernel/s390_ksyms.c | 5 |
5 files changed, 76 insertions, 0 deletions
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index 90ba5d35cf32..e6efc1277b04 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig | |||
@@ -74,6 +74,7 @@ mainmenu "Linux Kernel Configuration" | |||
74 | config S390 | 74 | config S390 |
75 | def_bool y | 75 | def_bool y |
76 | select USE_GENERIC_SMP_HELPERS if SMP | 76 | select USE_GENERIC_SMP_HELPERS if SMP |
77 | select HAVE_FUNCTION_TRACER | ||
77 | select HAVE_OPROFILE | 78 | select HAVE_OPROFILE |
78 | select HAVE_KPROBES | 79 | select HAVE_KPROBES |
79 | select HAVE_KRETPROBES | 80 | select HAVE_KRETPROBES |
diff --git a/arch/s390/include/asm/ftrace.h b/arch/s390/include/asm/ftrace.h new file mode 100644 index 000000000000..5a5bc75e19d4 --- /dev/null +++ b/arch/s390/include/asm/ftrace.h | |||
@@ -0,0 +1,8 @@ | |||
1 | #ifndef _ASM_S390_FTRACE_H | ||
2 | #define _ASM_S390_FTRACE_H | ||
3 | |||
4 | #ifndef __ASSEMBLY__ | ||
5 | extern void _mcount(void); | ||
6 | #endif | ||
7 | |||
8 | #endif /* _ASM_S390_FTRACE_H */ | ||
diff --git a/arch/s390/kernel/Makefile b/arch/s390/kernel/Makefile index 235b9484a4dc..92730cc3cdb4 100644 --- a/arch/s390/kernel/Makefile +++ b/arch/s390/kernel/Makefile | |||
@@ -2,6 +2,11 @@ | |||
2 | # Makefile for the linux kernel. | 2 | # Makefile for the linux kernel. |
3 | # | 3 | # |
4 | 4 | ||
5 | ifdef CONFIG_FUNCTION_TRACER | ||
6 | # Do not trace early boot code | ||
7 | CFLAGS_REMOVE_early.o = -pg | ||
8 | endif | ||
9 | |||
5 | # | 10 | # |
6 | # Passing null pointers is ok for smp code, since we access the lowcore here. | 11 | # Passing null pointers is ok for smp code, since we access the lowcore here. |
7 | # | 12 | # |
@@ -34,6 +39,7 @@ obj-$(CONFIG_COMPAT) += compat_linux.o compat_signal.o \ | |||
34 | obj-$(CONFIG_VIRT_TIMER) += vtime.o | 39 | obj-$(CONFIG_VIRT_TIMER) += vtime.o |
35 | obj-$(CONFIG_STACKTRACE) += stacktrace.o | 40 | obj-$(CONFIG_STACKTRACE) += stacktrace.o |
36 | obj-$(CONFIG_KPROBES) += kprobes.o | 41 | obj-$(CONFIG_KPROBES) += kprobes.o |
42 | obj-$(CONFIG_FUNCTION_TRACER) += mcount.o | ||
37 | 43 | ||
38 | # Kexec part | 44 | # Kexec part |
39 | S390_KEXEC_OBJS := machine_kexec.o crash.o | 45 | S390_KEXEC_OBJS := machine_kexec.o crash.o |
diff --git a/arch/s390/kernel/mcount.S b/arch/s390/kernel/mcount.S new file mode 100644 index 000000000000..397d131a345f --- /dev/null +++ b/arch/s390/kernel/mcount.S | |||
@@ -0,0 +1,56 @@ | |||
1 | /* | ||
2 | * Copyright IBM Corp. 2008 | ||
3 | * | ||
4 | * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>, | ||
5 | * | ||
6 | */ | ||
7 | |||
8 | #ifndef CONFIG_64BIT | ||
9 | .globl _mcount | ||
10 | _mcount: | ||
11 | stm %r0,%r5,8(%r15) | ||
12 | st %r14,56(%r15) | ||
13 | lr %r1,%r15 | ||
14 | ahi %r15,-96 | ||
15 | l %r3,100(%r15) | ||
16 | la %r2,0(%r14) | ||
17 | st %r1,0(%r15) | ||
18 | la %r3,0(%r3) | ||
19 | bras %r14,0f | ||
20 | .long ftrace_trace_function | ||
21 | 0: l %r14,0(%r14) | ||
22 | l %r14,0(%r14) | ||
23 | basr %r14,%r14 | ||
24 | ahi %r15,96 | ||
25 | lm %r0,%r5,8(%r15) | ||
26 | l %r14,56(%r15) | ||
27 | br %r14 | ||
28 | |||
29 | .globl ftrace_stub | ||
30 | ftrace_stub: | ||
31 | br %r14 | ||
32 | |||
33 | #else /* CONFIG_64BIT */ | ||
34 | |||
35 | .globl _mcount | ||
36 | _mcount: | ||
37 | stmg %r0,%r5,16(%r15) | ||
38 | stg %r14,112(%r15) | ||
39 | lgr %r1,%r15 | ||
40 | aghi %r15,-160 | ||
41 | stg %r1,0(%r15) | ||
42 | lgr %r2,%r14 | ||
43 | lg %r3,168(%r15) | ||
44 | larl %r14,ftrace_trace_function | ||
45 | lg %r14,0(%r14) | ||
46 | basr %r14,%r14 | ||
47 | aghi %r15,160 | ||
48 | lmg %r0,%r5,16(%r15) | ||
49 | lg %r14,112(%r15) | ||
50 | br %r14 | ||
51 | |||
52 | .globl ftrace_stub | ||
53 | ftrace_stub: | ||
54 | br %r14 | ||
55 | |||
56 | #endif /* CONFIG_64BIT */ | ||
diff --git a/arch/s390/kernel/s390_ksyms.c b/arch/s390/kernel/s390_ksyms.c index 48238a114ce9..46b90cb03707 100644 --- a/arch/s390/kernel/s390_ksyms.c +++ b/arch/s390/kernel/s390_ksyms.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <asm/delay.h> | 14 | #include <asm/delay.h> |
15 | #include <asm/pgalloc.h> | 15 | #include <asm/pgalloc.h> |
16 | #include <asm/setup.h> | 16 | #include <asm/setup.h> |
17 | #include <asm/ftrace.h> | ||
17 | #ifdef CONFIG_IP_MULTICAST | 18 | #ifdef CONFIG_IP_MULTICAST |
18 | #include <net/arp.h> | 19 | #include <net/arp.h> |
19 | #endif | 20 | #endif |
@@ -43,3 +44,7 @@ EXPORT_SYMBOL(csum_fold); | |||
43 | EXPORT_SYMBOL(console_mode); | 44 | EXPORT_SYMBOL(console_mode); |
44 | EXPORT_SYMBOL(console_devno); | 45 | EXPORT_SYMBOL(console_devno); |
45 | EXPORT_SYMBOL(console_irq); | 46 | EXPORT_SYMBOL(console_irq); |
47 | |||
48 | #ifdef CONFIG_FUNCTION_TRACER | ||
49 | EXPORT_SYMBOL(_mcount); | ||
50 | #endif | ||