aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ia64
diff options
context:
space:
mode:
Diffstat (limited to 'arch/ia64')
-rw-r--r--arch/ia64/Kconfig1
-rw-r--r--arch/ia64/include/asm/ftrace.h15
-rw-r--r--arch/ia64/kernel/entry.S49
-rw-r--r--arch/ia64/kernel/ia64_ksyms.c6
4 files changed, 71 insertions, 0 deletions
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 3d31636cbafb..b992ba447c41 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -21,6 +21,7 @@ config IA64
21 select HAVE_OPROFILE 21 select HAVE_OPROFILE
22 select HAVE_KPROBES 22 select HAVE_KPROBES
23 select HAVE_KRETPROBES 23 select HAVE_KRETPROBES
24 select HAVE_FUNCTION_TRACER
24 select HAVE_DMA_ATTRS 25 select HAVE_DMA_ATTRS
25 select HAVE_KVM 26 select HAVE_KVM
26 select HAVE_ARCH_TRACEHOOK 27 select HAVE_ARCH_TRACEHOOK
diff --git a/arch/ia64/include/asm/ftrace.h b/arch/ia64/include/asm/ftrace.h
new file mode 100644
index 000000000000..48694b3ba5a8
--- /dev/null
+++ b/arch/ia64/include/asm/ftrace.h
@@ -0,0 +1,15 @@
1#ifndef _ASM_IA64_FTRACE_H
2#define _ASM_IA64_FTRACE_H
3
4#ifdef CONFIG_FUNCTION_TRACER
5#define MCOUNT_INSN_SIZE 32 /* sizeof mcount call */
6
7#ifndef __ASSEMBLY__
8extern void _mcount(unsigned long pfs, unsigned long r1, unsigned long b0, unsigned long r0);
9#define mcount _mcount
10
11#endif
12
13#endif /* CONFIG_FUNCTION_TRACER */
14
15#endif /* _ASM_IA64_FTRACE_H */
diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S
index d435f4a7a96c..c2f7d798e2a5 100644
--- a/arch/ia64/kernel/entry.S
+++ b/arch/ia64/kernel/entry.S
@@ -47,6 +47,7 @@
47#include <asm/processor.h> 47#include <asm/processor.h>
48#include <asm/thread_info.h> 48#include <asm/thread_info.h>
49#include <asm/unistd.h> 49#include <asm/unistd.h>
50#include <asm/ftrace.h>
50 51
51#include "minstate.h" 52#include "minstate.h"
52 53
@@ -1404,6 +1405,54 @@ GLOBAL_ENTRY(unw_init_running)
1404 br.ret.sptk.many rp 1405 br.ret.sptk.many rp
1405END(unw_init_running) 1406END(unw_init_running)
1406 1407
1408#ifdef CONFIG_FUNCTION_TRACER
1409GLOBAL_ENTRY(_mcount)
1410 movl r2 = ftrace_stub
1411 movl r3 = ftrace_trace_function;;
1412 ld8 r3 = [r3];;
1413 ld8 r3 = [r3];;
1414 cmp.eq p7,p0 = r2, r3
1415(p7) br.sptk.many ftrace_stub
1416 ;;
1417
1418 alloc loc0 = ar.pfs, 4, 4, 2, 0
1419 ;;
1420 mov loc1 = b0
1421 mov out0 = b0
1422 mov loc2 = r8
1423 mov loc3 = r15
1424 ;;
1425 adds out0 = -MCOUNT_INSN_SIZE, out0
1426 mov out1 = in2
1427 mov b6 = r3
1428
1429 br.call.sptk.many b0 = b6
1430 ;;
1431 mov ar.pfs = loc0
1432 mov b0 = loc1
1433 mov r8 = loc2
1434 mov r15 = loc3
1435 br ftrace_stub
1436 ;;
1437END(_mcount)
1438
1439GLOBAL_ENTRY(ftrace_stub)
1440 mov r3 = b0
1441 movl r2 = _mcount_ret_helper
1442 ;;
1443 mov b6 = r2
1444 mov b7 = r3
1445 br.ret.sptk.many b6
1446
1447_mcount_ret_helper:
1448 mov b0 = r42
1449 mov r1 = r41
1450 mov ar.pfs = r40
1451 br b7
1452END(ftrace_stub)
1453
1454#endif /* CONFIG_FUNCTION_TRACER */
1455
1407 .rodata 1456 .rodata
1408 .align 8 1457 .align 8
1409 .globl sys_call_table 1458 .globl sys_call_table
diff --git a/arch/ia64/kernel/ia64_ksyms.c b/arch/ia64/kernel/ia64_ksyms.c
index 6da1f20d7372..2d311864e359 100644
--- a/arch/ia64/kernel/ia64_ksyms.c
+++ b/arch/ia64/kernel/ia64_ksyms.c
@@ -112,3 +112,9 @@ EXPORT_SYMBOL_GPL(esi_call_phys);
112#endif 112#endif
113extern char ia64_ivt[]; 113extern char ia64_ivt[];
114EXPORT_SYMBOL(ia64_ivt); 114EXPORT_SYMBOL(ia64_ivt);
115
116#include <asm/ftrace.h>
117#ifdef CONFIG_FUNCTION_TRACER
118/* mcount is defined in assembly */
119EXPORT_SYMBOL(_mcount);
120#endif