diff options
author | Max Filippov <jcmvbkbc@gmail.com> | 2013-05-23 23:02:25 -0400 |
---|---|---|
committer | Chris Zankel <chris@zankel.net> | 2013-07-08 04:18:57 -0400 |
commit | 478ba61afccd3a4d7ca662cadff1d35d183fe67d (patch) | |
tree | 9458a98aa39dba5e195241a48a4c31435a4c92e3 /arch/xtensa/kernel | |
parent | 220f5354089b27e8eeaa8658806dabc59ce55729 (diff) |
xtensa: add static function tracer support
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Chris Zankel <chris@zankel.net>
Diffstat (limited to 'arch/xtensa/kernel')
-rw-r--r-- | arch/xtensa/kernel/Makefile | 1 | ||||
-rw-r--r-- | arch/xtensa/kernel/mcount.S | 50 | ||||
-rw-r--r-- | arch/xtensa/kernel/xtensa_ksyms.c | 4 |
3 files changed, 55 insertions, 0 deletions
diff --git a/arch/xtensa/kernel/Makefile b/arch/xtensa/kernel/Makefile index 1e7fc87a94bb..f90265ec1ccc 100644 --- a/arch/xtensa/kernel/Makefile +++ b/arch/xtensa/kernel/Makefile | |||
@@ -11,6 +11,7 @@ obj-y := align.o coprocessor.o entry.o irq.o pci-dma.o platform.o process.o \ | |||
11 | obj-$(CONFIG_KGDB) += xtensa-stub.o | 11 | obj-$(CONFIG_KGDB) += xtensa-stub.o |
12 | obj-$(CONFIG_PCI) += pci.o | 12 | obj-$(CONFIG_PCI) += pci.o |
13 | obj-$(CONFIG_MODULES) += xtensa_ksyms.o module.o | 13 | obj-$(CONFIG_MODULES) += xtensa_ksyms.o module.o |
14 | obj-$(CONFIG_FUNCTION_TRACER) += mcount.o | ||
14 | 15 | ||
15 | AFLAGS_head.o += -mtext-section-literals | 16 | AFLAGS_head.o += -mtext-section-literals |
16 | 17 | ||
diff --git a/arch/xtensa/kernel/mcount.S b/arch/xtensa/kernel/mcount.S new file mode 100644 index 000000000000..0eeda2e4a25e --- /dev/null +++ b/arch/xtensa/kernel/mcount.S | |||
@@ -0,0 +1,50 @@ | |||
1 | /* | ||
2 | * arch/xtensa/kernel/mcount.S | ||
3 | * | ||
4 | * Xtensa specific mcount support | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | * | ||
10 | * Copyright (C) 2013 Tensilica Inc. | ||
11 | */ | ||
12 | |||
13 | #include <linux/linkage.h> | ||
14 | #include <asm/ftrace.h> | ||
15 | |||
16 | /* | ||
17 | * Entry condition: | ||
18 | * | ||
19 | * a2: a0 of the caller | ||
20 | */ | ||
21 | |||
22 | ENTRY(_mcount) | ||
23 | |||
24 | entry a1, 16 | ||
25 | |||
26 | movi a4, ftrace_trace_function | ||
27 | l32i a4, a4, 0 | ||
28 | movi a3, ftrace_stub | ||
29 | bne a3, a4, 1f | ||
30 | retw | ||
31 | |||
32 | 1: xor a7, a2, a1 | ||
33 | movi a3, 0x3fffffff | ||
34 | and a7, a7, a3 | ||
35 | xor a7, a7, a1 | ||
36 | |||
37 | xor a6, a0, a1 | ||
38 | and a6, a6, a3 | ||
39 | xor a6, a6, a1 | ||
40 | addi a6, a6, -MCOUNT_INSN_SIZE | ||
41 | callx4 a4 | ||
42 | |||
43 | retw | ||
44 | |||
45 | ENDPROC(_mcount) | ||
46 | |||
47 | ENTRY(ftrace_stub) | ||
48 | entry a1, 16 | ||
49 | retw | ||
50 | ENDPROC(ftrace_stub) | ||
diff --git a/arch/xtensa/kernel/xtensa_ksyms.c b/arch/xtensa/kernel/xtensa_ksyms.c index 42c53c87c204..d8507f812f46 100644 --- a/arch/xtensa/kernel/xtensa_ksyms.c +++ b/arch/xtensa/kernel/xtensa_ksyms.c | |||
@@ -124,3 +124,7 @@ extern long common_exception_return; | |||
124 | extern long _spill_registers; | 124 | extern long _spill_registers; |
125 | EXPORT_SYMBOL(common_exception_return); | 125 | EXPORT_SYMBOL(common_exception_return); |
126 | EXPORT_SYMBOL(_spill_registers); | 126 | EXPORT_SYMBOL(_spill_registers); |
127 | |||
128 | #ifdef CONFIG_FUNCTION_TRACER | ||
129 | EXPORT_SYMBOL(_mcount); | ||
130 | #endif | ||