Loading arch/xtensa/Kconfig +1 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ config XTENSA select CLONE_BACKWARDS select IRQ_DOMAIN select HAVE_OPROFILE select HAVE_FUNCTION_TRACER help Xtensa processors are 32-bit RISC machines designed by Tensilica primarily for embedded systems. These processors are both Loading arch/xtensa/boot/lib/Makefile +7 −0 Original line number Diff line number Diff line Loading @@ -7,6 +7,13 @@ zlib := inffast.c inflate.c inftrees.c lib-y += $(zlib:.c=.o) zmem.o ccflags-y := -Ilib/zlib_inflate ifdef CONFIG_FUNCTION_TRACER CFLAGS_REMOVE_inflate.o = -pg CFLAGS_REMOVE_zmem.o = -pg CFLAGS_REMOVE_inftrees.o = -pg CFLAGS_REMOVE_inffast.o = -pg endif quiet_cmd_copy_zlib = COPY $@ cmd_copy_zlib = cat $< > $@ Loading arch/xtensa/include/asm/ftrace.h +15 −2 Original line number Diff line number Diff line Loading @@ -13,6 +13,7 @@ #include <asm/processor.h> #define HAVE_ARCH_CALLER_ADDR #ifndef __ASSEMBLY__ #define CALLER_ADDR0 ({ unsigned long a0, a1; \ __asm__ __volatile__ ( \ "mov %0, a0\n" \ Loading @@ -24,10 +25,22 @@ extern unsigned long return_address(unsigned level); #define CALLER_ADDR1 return_address(1) #define CALLER_ADDR2 return_address(2) #define CALLER_ADDR3 return_address(3) #else #else /* CONFIG_FRAME_POINTER */ #define CALLER_ADDR1 (0) #define CALLER_ADDR2 (0) #define CALLER_ADDR3 (0) #endif #endif /* CONFIG_FRAME_POINTER */ #endif /* __ASSEMBLY__ */ #ifdef CONFIG_FUNCTION_TRACER #define MCOUNT_ADDR ((unsigned long)(_mcount)) #define MCOUNT_INSN_SIZE 3 #ifndef __ASSEMBLY__ extern void _mcount(void); #define mcount _mcount #endif /* __ASSEMBLY__ */ #endif /* CONFIG_FUNCTION_TRACER */ #endif /* _XTENSA_FTRACE_H */ arch/xtensa/kernel/Makefile +1 −0 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ obj-y := align.o coprocessor.o entry.o irq.o pci-dma.o platform.o process.o \ obj-$(CONFIG_KGDB) += xtensa-stub.o obj-$(CONFIG_PCI) += pci.o obj-$(CONFIG_MODULES) += xtensa_ksyms.o module.o obj-$(CONFIG_FUNCTION_TRACER) += mcount.o AFLAGS_head.o += -mtext-section-literals Loading arch/xtensa/kernel/mcount.S 0 → 100644 +50 −0 Original line number Diff line number Diff line /* * arch/xtensa/kernel/mcount.S * * Xtensa specific mcount support * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. * * Copyright (C) 2013 Tensilica Inc. */ #include <linux/linkage.h> #include <asm/ftrace.h> /* * Entry condition: * * a2: a0 of the caller */ ENTRY(_mcount) entry a1, 16 movi a4, ftrace_trace_function l32i a4, a4, 0 movi a3, ftrace_stub bne a3, a4, 1f retw 1: xor a7, a2, a1 movi a3, 0x3fffffff and a7, a7, a3 xor a7, a7, a1 xor a6, a0, a1 and a6, a6, a3 xor a6, a6, a1 addi a6, a6, -MCOUNT_INSN_SIZE callx4 a4 retw ENDPROC(_mcount) ENTRY(ftrace_stub) entry a1, 16 retw ENDPROC(ftrace_stub) Loading
arch/xtensa/Kconfig +1 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ config XTENSA select CLONE_BACKWARDS select IRQ_DOMAIN select HAVE_OPROFILE select HAVE_FUNCTION_TRACER help Xtensa processors are 32-bit RISC machines designed by Tensilica primarily for embedded systems. These processors are both Loading
arch/xtensa/boot/lib/Makefile +7 −0 Original line number Diff line number Diff line Loading @@ -7,6 +7,13 @@ zlib := inffast.c inflate.c inftrees.c lib-y += $(zlib:.c=.o) zmem.o ccflags-y := -Ilib/zlib_inflate ifdef CONFIG_FUNCTION_TRACER CFLAGS_REMOVE_inflate.o = -pg CFLAGS_REMOVE_zmem.o = -pg CFLAGS_REMOVE_inftrees.o = -pg CFLAGS_REMOVE_inffast.o = -pg endif quiet_cmd_copy_zlib = COPY $@ cmd_copy_zlib = cat $< > $@ Loading
arch/xtensa/include/asm/ftrace.h +15 −2 Original line number Diff line number Diff line Loading @@ -13,6 +13,7 @@ #include <asm/processor.h> #define HAVE_ARCH_CALLER_ADDR #ifndef __ASSEMBLY__ #define CALLER_ADDR0 ({ unsigned long a0, a1; \ __asm__ __volatile__ ( \ "mov %0, a0\n" \ Loading @@ -24,10 +25,22 @@ extern unsigned long return_address(unsigned level); #define CALLER_ADDR1 return_address(1) #define CALLER_ADDR2 return_address(2) #define CALLER_ADDR3 return_address(3) #else #else /* CONFIG_FRAME_POINTER */ #define CALLER_ADDR1 (0) #define CALLER_ADDR2 (0) #define CALLER_ADDR3 (0) #endif #endif /* CONFIG_FRAME_POINTER */ #endif /* __ASSEMBLY__ */ #ifdef CONFIG_FUNCTION_TRACER #define MCOUNT_ADDR ((unsigned long)(_mcount)) #define MCOUNT_INSN_SIZE 3 #ifndef __ASSEMBLY__ extern void _mcount(void); #define mcount _mcount #endif /* __ASSEMBLY__ */ #endif /* CONFIG_FUNCTION_TRACER */ #endif /* _XTENSA_FTRACE_H */
arch/xtensa/kernel/Makefile +1 −0 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ obj-y := align.o coprocessor.o entry.o irq.o pci-dma.o platform.o process.o \ obj-$(CONFIG_KGDB) += xtensa-stub.o obj-$(CONFIG_PCI) += pci.o obj-$(CONFIG_MODULES) += xtensa_ksyms.o module.o obj-$(CONFIG_FUNCTION_TRACER) += mcount.o AFLAGS_head.o += -mtext-section-literals Loading
arch/xtensa/kernel/mcount.S 0 → 100644 +50 −0 Original line number Diff line number Diff line /* * arch/xtensa/kernel/mcount.S * * Xtensa specific mcount support * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. * * Copyright (C) 2013 Tensilica Inc. */ #include <linux/linkage.h> #include <asm/ftrace.h> /* * Entry condition: * * a2: a0 of the caller */ ENTRY(_mcount) entry a1, 16 movi a4, ftrace_trace_function l32i a4, a4, 0 movi a3, ftrace_stub bne a3, a4, 1f retw 1: xor a7, a2, a1 movi a3, 0x3fffffff and a7, a7, a3 xor a7, a7, a1 xor a6, a0, a1 and a6, a6, a3 xor a6, a6, a1 addi a6, a6, -MCOUNT_INSN_SIZE callx4 a4 retw ENDPROC(_mcount) ENTRY(ftrace_stub) entry a1, 16 retw ENDPROC(ftrace_stub)