]>
Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
ccbfac29 SR |
2 | #ifndef _ASM_POWERPC_FTRACE |
3 | #define _ASM_POWERPC_FTRACE | |
4 | ||
f55d9665 ME |
5 | #include <asm/types.h> |
6 | ||
606576ce | 7 | #ifdef CONFIG_FUNCTION_TRACER |
c93bf928 | 8 | #define MCOUNT_ADDR ((unsigned long)(_mcount)) |
395a59d0 AS |
9 | #define MCOUNT_INSN_SIZE 4 /* sizeof mcount call */ |
10 | ||
bf528a3a SR |
11 | #ifdef __ASSEMBLY__ |
12 | ||
13 | /* Based off of objdump optput from glibc */ | |
14 | ||
15 | #define MCOUNT_SAVE_FRAME \ | |
16 | stwu r1,-48(r1); \ | |
17 | stw r3, 12(r1); \ | |
18 | stw r4, 16(r1); \ | |
19 | stw r5, 20(r1); \ | |
20 | stw r6, 24(r1); \ | |
21 | mflr r3; \ | |
22 | lwz r4, 52(r1); \ | |
23 | mfcr r5; \ | |
24 | stw r7, 28(r1); \ | |
25 | stw r8, 32(r1); \ | |
26 | stw r9, 36(r1); \ | |
27 | stw r10,40(r1); \ | |
28 | stw r3, 44(r1); \ | |
29 | stw r5, 8(r1) | |
30 | ||
31 | #define MCOUNT_RESTORE_FRAME \ | |
32 | lwz r6, 8(r1); \ | |
33 | lwz r0, 44(r1); \ | |
34 | lwz r3, 12(r1); \ | |
35 | mtctr r0; \ | |
36 | lwz r4, 16(r1); \ | |
37 | mtcr r6; \ | |
38 | lwz r5, 20(r1); \ | |
39 | lwz r6, 24(r1); \ | |
40 | lwz r0, 52(r1); \ | |
41 | lwz r7, 28(r1); \ | |
42 | lwz r8, 32(r1); \ | |
43 | mtlr r0; \ | |
44 | lwz r9, 36(r1); \ | |
45 | lwz r10,40(r1); \ | |
46 | addi r1, r1, 48 | |
47 | ||
48 | #else /* !__ASSEMBLY__ */ | |
ccbfac29 | 49 | extern void _mcount(void); |
8fd6e5a8 SR |
50 | |
51 | #ifdef CONFIG_DYNAMIC_FTRACE | |
15308664 TD |
52 | # define FTRACE_ADDR ((unsigned long)ftrace_caller) |
53 | # define FTRACE_REGS_ADDR FTRACE_ADDR | |
8fd6e5a8 SR |
54 | static inline unsigned long ftrace_call_adjust(unsigned long addr) |
55 | { | |
56 | /* reloction of mcount call site is the same as the address */ | |
57 | return addr; | |
58 | } | |
59 | ||
60 | struct dyn_arch_ftrace { | |
f48cb8b4 | 61 | struct module *mod; |
8fd6e5a8 SR |
62 | }; |
63 | #endif /* CONFIG_DYNAMIC_FTRACE */ | |
64 | #endif /* __ASSEMBLY__ */ | |
ccbfac29 | 65 | |
15308664 TD |
66 | #ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS |
67 | #define ARCH_SUPPORTS_FTRACE_OPS 1 | |
68 | #endif | |
ccbfac29 | 69 | #endif |
395a59d0 | 70 | |
f55d9665 ME |
71 | #if defined(CONFIG_FTRACE_SYSCALLS) && !defined(__ASSEMBLY__) |
72 | #ifdef PPC64_ELF_ABI_v1 | |
02424d89 IM |
73 | #define ARCH_HAS_SYSCALL_MATCH_SYM_NAME |
74 | static inline bool arch_syscall_match_sym_name(const char *sym, const char *name) | |
75 | { | |
76 | /* | |
77 | * Compare the symbol name with the system call name. Skip the .sys or .SyS | |
78 | * prefix from the symbol name and the sys prefix from the system call name and | |
79 | * just match the rest. This is only needed on ppc64 since symbol names on | |
80 | * 32bit do not start with a period so the generic function will work. | |
81 | */ | |
82 | return !strcmp(sym + 4, name + 3); | |
83 | } | |
7167af7c | 84 | #endif |
f55d9665 | 85 | #endif /* CONFIG_FTRACE_SYSCALLS && !__ASSEMBLY__ */ |
02424d89 | 86 | |
395a59d0 | 87 | #endif /* _ASM_POWERPC_FTRACE */ |