Skip to content

Commit 1ee2181

Browse files
author
Fox Snowpatch
committed
1 parent 5165c17 commit 1ee2181

File tree

4 files changed

+16
-8
lines changed

4 files changed

+16
-8
lines changed

arch/powerpc/include/asm/ftrace.h

+1-8
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,7 @@
2020
#ifndef __ASSEMBLY__
2121
extern void _mcount(void);
2222

23-
static inline unsigned long ftrace_call_adjust(unsigned long addr)
24-
{
25-
if (IS_ENABLED(CONFIG_ARCH_USING_PATCHABLE_FUNCTION_ENTRY))
26-
addr += MCOUNT_INSN_SIZE;
27-
28-
return addr;
29-
}
30-
23+
unsigned long ftrace_call_adjust(unsigned long addr);
3124
unsigned long prepare_ftrace_return(unsigned long parent, unsigned long ip,
3225
unsigned long sp);
3326

arch/powerpc/include/asm/sections.h

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ typedef struct func_desc func_desc_t;
1414

1515
extern char __head_end[];
1616
extern char __srwx_boundary[];
17+
extern char _sexittext[], _eexittext[];
1718

1819
/* Patch sites */
1920
extern s32 patch__call_flush_branch_caches1;

arch/powerpc/kernel/trace/ftrace.c

+12
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,22 @@
2727
#include <asm/ftrace.h>
2828
#include <asm/syscall.h>
2929
#include <asm/inst.h>
30+
#include <asm/sections.h>
3031

3132
#define NUM_FTRACE_TRAMPS 2
3233
static unsigned long ftrace_tramps[NUM_FTRACE_TRAMPS];
3334

35+
unsigned long ftrace_call_adjust(unsigned long addr)
36+
{
37+
if (addr >= (unsigned long)_sexittext && addr < (unsigned long)_eexittext)
38+
return 0;
39+
40+
if (IS_ENABLED(CONFIG_ARCH_USING_PATCHABLE_FUNCTION_ENTRY))
41+
addr += MCOUNT_INSN_SIZE;
42+
43+
return addr;
44+
}
45+
3446
static ppc_inst_t ftrace_create_branch_inst(unsigned long ip, unsigned long addr, int link)
3547
{
3648
ppc_inst_t op;

arch/powerpc/kernel/vmlinux.lds.S

+2
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,9 @@ SECTIONS
281281
* to deal with references from __bug_table
282282
*/
283283
.exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) {
284+
_sexittext = .;
284285
EXIT_TEXT
286+
_eexittext = .;
285287
}
286288

287289
. = ALIGN(PAGE_SIZE);

0 commit comments

Comments
 (0)