mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2024-12-28 00:32:00 +00:00
samples/ftrace: Add support for ftrace direct samples on powerpc
Add powerpc 32-bit and 64-bit samples for ftrace direct. This serves to show the sample instruction sequence to be used by ftrace direct calls to adhere to the ftrace ABI. On 64-bit powerpc, TOC setup requires some additional work. Signed-off-by: Naveen N Rao <naveen@kernel.org> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://patch.msgid.link/20241030070850.1361304-17-hbathini@linux.ibm.com
This commit is contained in:
parent
a52f6043a2
commit
71db948b9d
@ -275,6 +275,8 @@ config PPC
|
||||
select HAVE_REGS_AND_STACK_ACCESS_API
|
||||
select HAVE_RELIABLE_STACKTRACE
|
||||
select HAVE_RSEQ
|
||||
select HAVE_SAMPLE_FTRACE_DIRECT if HAVE_DYNAMIC_FTRACE_WITH_DIRECT_CALLS
|
||||
select HAVE_SAMPLE_FTRACE_DIRECT_MULTI if HAVE_DYNAMIC_FTRACE_WITH_DIRECT_CALLS
|
||||
select HAVE_SETUP_PER_CPU_AREA if PPC64
|
||||
select HAVE_SOFTIRQ_ON_OWN_STACK
|
||||
select HAVE_STACKPROTECTOR if PPC32 && $(cc-option,$(m32-flag) -mstack-protector-guard=tls -mstack-protector-guard-reg=r2 -mstack-protector-guard-offset=0)
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/kthread.h>
|
||||
#include <linux/ftrace.h>
|
||||
#ifndef CONFIG_ARM64
|
||||
#if !defined(CONFIG_ARM64) && !defined(CONFIG_PPC32)
|
||||
#include <asm/asm-offsets.h>
|
||||
#endif
|
||||
|
||||
@ -199,6 +199,89 @@ asm (
|
||||
|
||||
#endif /* CONFIG_LOONGARCH */
|
||||
|
||||
#ifdef CONFIG_PPC
|
||||
#include <asm/ppc_asm.h>
|
||||
|
||||
#ifdef CONFIG_PPC64
|
||||
#define STACK_FRAME_SIZE 48
|
||||
#else
|
||||
#define STACK_FRAME_SIZE 24
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_PPC64_ELF_ABI_V2) && !defined(CONFIG_PPC_KERNEL_PCREL)
|
||||
#define PPC64_TOC_SAVE_AND_UPDATE \
|
||||
" std 2, 24(1)\n" \
|
||||
" bcl 20, 31, 1f\n" \
|
||||
" 1: mflr 12\n" \
|
||||
" ld 2, (99f - 1b)(12)\n"
|
||||
#define PPC64_TOC_RESTORE \
|
||||
" ld 2, 24(1)\n"
|
||||
#define PPC64_TOC \
|
||||
" 99: .quad .TOC.@tocbase\n"
|
||||
#else
|
||||
#define PPC64_TOC_SAVE_AND_UPDATE ""
|
||||
#define PPC64_TOC_RESTORE ""
|
||||
#define PPC64_TOC ""
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PPC_FTRACE_OUT_OF_LINE
|
||||
#define PPC_FTRACE_RESTORE_LR \
|
||||
PPC_LL" 0, "__stringify(PPC_LR_STKOFF)"(1)\n" \
|
||||
" mtlr 0\n"
|
||||
#define PPC_FTRACE_RET \
|
||||
" blr\n"
|
||||
#else
|
||||
#define PPC_FTRACE_RESTORE_LR \
|
||||
PPC_LL" 0, "__stringify(PPC_LR_STKOFF)"(1)\n" \
|
||||
" mtctr 0\n"
|
||||
#define PPC_FTRACE_RET \
|
||||
" mtlr 0\n" \
|
||||
" bctr\n"
|
||||
#endif
|
||||
|
||||
asm (
|
||||
" .pushsection .text, \"ax\", @progbits\n"
|
||||
" .type my_tramp1, @function\n"
|
||||
" .globl my_tramp1\n"
|
||||
" my_tramp1:\n"
|
||||
PPC_STL" 0, "__stringify(PPC_LR_STKOFF)"(1)\n"
|
||||
PPC_STLU" 1, -"__stringify(STACK_FRAME_MIN_SIZE)"(1)\n"
|
||||
" mflr 0\n"
|
||||
PPC_STL" 0, "__stringify(PPC_LR_STKOFF)"(1)\n"
|
||||
PPC_STLU" 1, -"__stringify(STACK_FRAME_SIZE)"(1)\n"
|
||||
PPC64_TOC_SAVE_AND_UPDATE
|
||||
" bl my_direct_func1\n"
|
||||
PPC64_TOC_RESTORE
|
||||
" addi 1, 1, "__stringify(STACK_FRAME_SIZE)"\n"
|
||||
PPC_FTRACE_RESTORE_LR
|
||||
" addi 1, 1, "__stringify(STACK_FRAME_MIN_SIZE)"\n"
|
||||
PPC_LL" 0, "__stringify(PPC_LR_STKOFF)"(1)\n"
|
||||
PPC_FTRACE_RET
|
||||
" .size my_tramp1, .-my_tramp1\n"
|
||||
|
||||
" .type my_tramp2, @function\n"
|
||||
" .globl my_tramp2\n"
|
||||
" my_tramp2:\n"
|
||||
PPC_STL" 0, "__stringify(PPC_LR_STKOFF)"(1)\n"
|
||||
PPC_STLU" 1, -"__stringify(STACK_FRAME_MIN_SIZE)"(1)\n"
|
||||
" mflr 0\n"
|
||||
PPC_STL" 0, "__stringify(PPC_LR_STKOFF)"(1)\n"
|
||||
PPC_STLU" 1, -"__stringify(STACK_FRAME_SIZE)"(1)\n"
|
||||
PPC64_TOC_SAVE_AND_UPDATE
|
||||
" bl my_direct_func2\n"
|
||||
PPC64_TOC_RESTORE
|
||||
" addi 1, 1, "__stringify(STACK_FRAME_SIZE)"\n"
|
||||
PPC_FTRACE_RESTORE_LR
|
||||
" addi 1, 1, "__stringify(STACK_FRAME_MIN_SIZE)"\n"
|
||||
PPC_LL" 0, "__stringify(PPC_LR_STKOFF)"(1)\n"
|
||||
PPC_FTRACE_RET
|
||||
PPC64_TOC
|
||||
" .size my_tramp2, .-my_tramp2\n"
|
||||
" .popsection\n"
|
||||
);
|
||||
|
||||
#endif /* CONFIG_PPC */
|
||||
|
||||
static struct ftrace_ops direct;
|
||||
|
||||
static unsigned long my_tramp = (unsigned long)my_tramp1;
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/kthread.h>
|
||||
#include <linux/ftrace.h>
|
||||
#ifndef CONFIG_ARM64
|
||||
#if !defined(CONFIG_ARM64) && !defined(CONFIG_PPC32)
|
||||
#include <asm/asm-offsets.h>
|
||||
#endif
|
||||
|
||||
@ -225,6 +225,105 @@ asm (
|
||||
|
||||
#endif /* CONFIG_LOONGARCH */
|
||||
|
||||
#ifdef CONFIG_PPC
|
||||
#include <asm/ppc_asm.h>
|
||||
|
||||
#ifdef CONFIG_PPC64
|
||||
#define STACK_FRAME_SIZE 48
|
||||
#else
|
||||
#define STACK_FRAME_SIZE 24
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_PPC64_ELF_ABI_V2) && !defined(CONFIG_PPC_KERNEL_PCREL)
|
||||
#define PPC64_TOC_SAVE_AND_UPDATE \
|
||||
" std 2, 24(1)\n" \
|
||||
" bcl 20, 31, 1f\n" \
|
||||
" 1: mflr 12\n" \
|
||||
" ld 2, (99f - 1b)(12)\n"
|
||||
#define PPC64_TOC_RESTORE \
|
||||
" ld 2, 24(1)\n"
|
||||
#define PPC64_TOC \
|
||||
" 99: .quad .TOC.@tocbase\n"
|
||||
#else
|
||||
#define PPC64_TOC_SAVE_AND_UPDATE ""
|
||||
#define PPC64_TOC_RESTORE ""
|
||||
#define PPC64_TOC ""
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PPC_FTRACE_OUT_OF_LINE
|
||||
#define PPC_FTRACE_RESTORE_LR \
|
||||
PPC_LL" 0, "__stringify(PPC_LR_STKOFF)"(1)\n" \
|
||||
" mtlr 0\n"
|
||||
#define PPC_FTRACE_RET \
|
||||
" blr\n"
|
||||
#define PPC_FTRACE_RECOVER_IP \
|
||||
" lwz 8, 4(3)\n" \
|
||||
" li 9, 6\n" \
|
||||
" slw 8, 8, 9\n" \
|
||||
" sraw 8, 8, 9\n" \
|
||||
" add 3, 3, 8\n" \
|
||||
" addi 3, 3, 4\n"
|
||||
#else
|
||||
#define PPC_FTRACE_RESTORE_LR \
|
||||
PPC_LL" 0, "__stringify(PPC_LR_STKOFF)"(1)\n" \
|
||||
" mtctr 0\n"
|
||||
#define PPC_FTRACE_RET \
|
||||
" mtlr 0\n" \
|
||||
" bctr\n"
|
||||
#define PPC_FTRACE_RECOVER_IP ""
|
||||
#endif
|
||||
|
||||
asm (
|
||||
" .pushsection .text, \"ax\", @progbits\n"
|
||||
" .type my_tramp1, @function\n"
|
||||
" .globl my_tramp1\n"
|
||||
" my_tramp1:\n"
|
||||
PPC_STL" 0, "__stringify(PPC_LR_STKOFF)"(1)\n"
|
||||
PPC_STLU" 1, -"__stringify(STACK_FRAME_MIN_SIZE)"(1)\n"
|
||||
" mflr 0\n"
|
||||
PPC_STL" 0, "__stringify(PPC_LR_STKOFF)"(1)\n"
|
||||
PPC_STLU" 1, -"__stringify(STACK_FRAME_SIZE)"(1)\n"
|
||||
PPC64_TOC_SAVE_AND_UPDATE
|
||||
PPC_STL" 3, "__stringify(STACK_FRAME_MIN_SIZE)"(1)\n"
|
||||
" mr 3, 0\n"
|
||||
PPC_FTRACE_RECOVER_IP
|
||||
" bl my_direct_func1\n"
|
||||
PPC_LL" 3, "__stringify(STACK_FRAME_MIN_SIZE)"(1)\n"
|
||||
PPC64_TOC_RESTORE
|
||||
" addi 1, 1, "__stringify(STACK_FRAME_SIZE)"\n"
|
||||
PPC_FTRACE_RESTORE_LR
|
||||
" addi 1, 1, "__stringify(STACK_FRAME_MIN_SIZE)"\n"
|
||||
PPC_LL" 0, "__stringify(PPC_LR_STKOFF)"(1)\n"
|
||||
PPC_FTRACE_RET
|
||||
" .size my_tramp1, .-my_tramp1\n"
|
||||
|
||||
" .type my_tramp2, @function\n"
|
||||
" .globl my_tramp2\n"
|
||||
" my_tramp2:\n"
|
||||
PPC_STL" 0, "__stringify(PPC_LR_STKOFF)"(1)\n"
|
||||
PPC_STLU" 1, -"__stringify(STACK_FRAME_MIN_SIZE)"(1)\n"
|
||||
" mflr 0\n"
|
||||
PPC_STL" 0, "__stringify(PPC_LR_STKOFF)"(1)\n"
|
||||
PPC_STLU" 1, -"__stringify(STACK_FRAME_SIZE)"(1)\n"
|
||||
PPC64_TOC_SAVE_AND_UPDATE
|
||||
PPC_STL" 3, "__stringify(STACK_FRAME_MIN_SIZE)"(1)\n"
|
||||
" mr 3, 0\n"
|
||||
PPC_FTRACE_RECOVER_IP
|
||||
" bl my_direct_func2\n"
|
||||
PPC_LL" 3, "__stringify(STACK_FRAME_MIN_SIZE)"(1)\n"
|
||||
PPC64_TOC_RESTORE
|
||||
" addi 1, 1, "__stringify(STACK_FRAME_SIZE)"\n"
|
||||
PPC_FTRACE_RESTORE_LR
|
||||
" addi 1, 1, "__stringify(STACK_FRAME_MIN_SIZE)"\n"
|
||||
PPC_LL" 0, "__stringify(PPC_LR_STKOFF)"(1)\n"
|
||||
PPC_FTRACE_RET
|
||||
PPC64_TOC
|
||||
" .size my_tramp2, .-my_tramp2\n"
|
||||
" .popsection\n"
|
||||
);
|
||||
|
||||
#endif /* CONFIG_PPC */
|
||||
|
||||
static unsigned long my_tramp = (unsigned long)my_tramp1;
|
||||
static unsigned long tramps[2] = {
|
||||
(unsigned long)my_tramp1,
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include <linux/mm.h> /* for handle_mm_fault() */
|
||||
#include <linux/ftrace.h>
|
||||
#include <linux/sched/stat.h>
|
||||
#ifndef CONFIG_ARM64
|
||||
#if !defined(CONFIG_ARM64) && !defined(CONFIG_PPC32)
|
||||
#include <asm/asm-offsets.h>
|
||||
#endif
|
||||
|
||||
@ -141,6 +141,83 @@ asm (
|
||||
|
||||
#endif /* CONFIG_LOONGARCH */
|
||||
|
||||
#ifdef CONFIG_PPC
|
||||
#include <asm/ppc_asm.h>
|
||||
|
||||
#ifdef CONFIG_PPC64
|
||||
#define STACK_FRAME_SIZE 48
|
||||
#else
|
||||
#define STACK_FRAME_SIZE 24
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_PPC64_ELF_ABI_V2) && !defined(CONFIG_PPC_KERNEL_PCREL)
|
||||
#define PPC64_TOC_SAVE_AND_UPDATE \
|
||||
" std 2, 24(1)\n" \
|
||||
" bcl 20, 31, 1f\n" \
|
||||
" 1: mflr 12\n" \
|
||||
" ld 2, (99f - 1b)(12)\n"
|
||||
#define PPC64_TOC_RESTORE \
|
||||
" ld 2, 24(1)\n"
|
||||
#define PPC64_TOC \
|
||||
" 99: .quad .TOC.@tocbase\n"
|
||||
#else
|
||||
#define PPC64_TOC_SAVE_AND_UPDATE ""
|
||||
#define PPC64_TOC_RESTORE ""
|
||||
#define PPC64_TOC ""
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PPC_FTRACE_OUT_OF_LINE
|
||||
#define PPC_FTRACE_RESTORE_LR \
|
||||
PPC_LL" 0, "__stringify(PPC_LR_STKOFF)"(1)\n" \
|
||||
" mtlr 0\n"
|
||||
#define PPC_FTRACE_RET \
|
||||
" blr\n"
|
||||
#define PPC_FTRACE_RECOVER_IP \
|
||||
" lwz 8, 4(3)\n" \
|
||||
" li 9, 6\n" \
|
||||
" slw 8, 8, 9\n" \
|
||||
" sraw 8, 8, 9\n" \
|
||||
" add 3, 3, 8\n" \
|
||||
" addi 3, 3, 4\n"
|
||||
#else
|
||||
#define PPC_FTRACE_RESTORE_LR \
|
||||
PPC_LL" 0, "__stringify(PPC_LR_STKOFF)"(1)\n" \
|
||||
" mtctr 0\n"
|
||||
#define PPC_FTRACE_RET \
|
||||
" mtlr 0\n" \
|
||||
" bctr\n"
|
||||
#define PPC_FTRACE_RECOVER_IP ""
|
||||
#endif
|
||||
|
||||
asm (
|
||||
" .pushsection .text, \"ax\", @progbits\n"
|
||||
" .type my_tramp, @function\n"
|
||||
" .globl my_tramp\n"
|
||||
" my_tramp:\n"
|
||||
PPC_STL" 0, "__stringify(PPC_LR_STKOFF)"(1)\n"
|
||||
PPC_STLU" 1, -"__stringify(STACK_FRAME_MIN_SIZE)"(1)\n"
|
||||
" mflr 0\n"
|
||||
PPC_STL" 0, "__stringify(PPC_LR_STKOFF)"(1)\n"
|
||||
PPC_STLU" 1, -"__stringify(STACK_FRAME_SIZE)"(1)\n"
|
||||
PPC64_TOC_SAVE_AND_UPDATE
|
||||
PPC_STL" 3, "__stringify(STACK_FRAME_MIN_SIZE)"(1)\n"
|
||||
" mr 3, 0\n"
|
||||
PPC_FTRACE_RECOVER_IP
|
||||
" bl my_direct_func\n"
|
||||
PPC_LL" 3, "__stringify(STACK_FRAME_MIN_SIZE)"(1)\n"
|
||||
PPC64_TOC_RESTORE
|
||||
" addi 1, 1, "__stringify(STACK_FRAME_SIZE)"\n"
|
||||
PPC_FTRACE_RESTORE_LR
|
||||
" addi 1, 1, "__stringify(STACK_FRAME_MIN_SIZE)"\n"
|
||||
PPC_LL" 0, "__stringify(PPC_LR_STKOFF)"(1)\n"
|
||||
PPC_FTRACE_RET
|
||||
PPC64_TOC
|
||||
" .size my_tramp, .-my_tramp\n"
|
||||
" .popsection\n"
|
||||
);
|
||||
|
||||
#endif /* CONFIG_PPC */
|
||||
|
||||
static struct ftrace_ops direct;
|
||||
|
||||
static int __init ftrace_direct_multi_init(void)
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include <linux/mm.h> /* for handle_mm_fault() */
|
||||
#include <linux/ftrace.h>
|
||||
#ifndef CONFIG_ARM64
|
||||
#if !defined(CONFIG_ARM64) && !defined(CONFIG_PPC32)
|
||||
#include <asm/asm-offsets.h>
|
||||
#endif
|
||||
|
||||
@ -153,6 +153,87 @@ asm (
|
||||
|
||||
#endif /* CONFIG_LOONGARCH */
|
||||
|
||||
#ifdef CONFIG_PPC
|
||||
#include <asm/ppc_asm.h>
|
||||
|
||||
#ifdef CONFIG_PPC64
|
||||
#define STACK_FRAME_SIZE 64
|
||||
#define STACK_FRAME_ARG1 32
|
||||
#define STACK_FRAME_ARG2 40
|
||||
#define STACK_FRAME_ARG3 48
|
||||
#define STACK_FRAME_ARG4 56
|
||||
#else
|
||||
#define STACK_FRAME_SIZE 32
|
||||
#define STACK_FRAME_ARG1 16
|
||||
#define STACK_FRAME_ARG2 20
|
||||
#define STACK_FRAME_ARG3 24
|
||||
#define STACK_FRAME_ARG4 28
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_PPC64_ELF_ABI_V2) && !defined(CONFIG_PPC_KERNEL_PCREL)
|
||||
#define PPC64_TOC_SAVE_AND_UPDATE \
|
||||
" std 2, 24(1)\n" \
|
||||
" bcl 20, 31, 1f\n" \
|
||||
" 1: mflr 12\n" \
|
||||
" ld 2, (99f - 1b)(12)\n"
|
||||
#define PPC64_TOC_RESTORE \
|
||||
" ld 2, 24(1)\n"
|
||||
#define PPC64_TOC \
|
||||
" 99: .quad .TOC.@tocbase\n"
|
||||
#else
|
||||
#define PPC64_TOC_SAVE_AND_UPDATE ""
|
||||
#define PPC64_TOC_RESTORE ""
|
||||
#define PPC64_TOC ""
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PPC_FTRACE_OUT_OF_LINE
|
||||
#define PPC_FTRACE_RESTORE_LR \
|
||||
PPC_LL" 0, "__stringify(PPC_LR_STKOFF)"(1)\n" \
|
||||
" mtlr 0\n"
|
||||
#define PPC_FTRACE_RET \
|
||||
" blr\n"
|
||||
#else
|
||||
#define PPC_FTRACE_RESTORE_LR \
|
||||
PPC_LL" 0, "__stringify(PPC_LR_STKOFF)"(1)\n" \
|
||||
" mtctr 0\n"
|
||||
#define PPC_FTRACE_RET \
|
||||
" mtlr 0\n" \
|
||||
" bctr\n"
|
||||
#endif
|
||||
|
||||
asm (
|
||||
" .pushsection .text, \"ax\", @progbits\n"
|
||||
" .type my_tramp, @function\n"
|
||||
" .globl my_tramp\n"
|
||||
" my_tramp:\n"
|
||||
PPC_STL" 0, "__stringify(PPC_LR_STKOFF)"(1)\n"
|
||||
PPC_STLU" 1, -"__stringify(STACK_FRAME_MIN_SIZE)"(1)\n"
|
||||
" mflr 0\n"
|
||||
PPC_STL" 0, "__stringify(PPC_LR_STKOFF)"(1)\n"
|
||||
PPC_STLU" 1, -"__stringify(STACK_FRAME_SIZE)"(1)\n"
|
||||
PPC64_TOC_SAVE_AND_UPDATE
|
||||
PPC_STL" 3, "__stringify(STACK_FRAME_ARG1)"(1)\n"
|
||||
PPC_STL" 4, "__stringify(STACK_FRAME_ARG2)"(1)\n"
|
||||
PPC_STL" 5, "__stringify(STACK_FRAME_ARG3)"(1)\n"
|
||||
PPC_STL" 6, "__stringify(STACK_FRAME_ARG4)"(1)\n"
|
||||
" bl my_direct_func\n"
|
||||
PPC_LL" 6, "__stringify(STACK_FRAME_ARG4)"(1)\n"
|
||||
PPC_LL" 5, "__stringify(STACK_FRAME_ARG3)"(1)\n"
|
||||
PPC_LL" 4, "__stringify(STACK_FRAME_ARG2)"(1)\n"
|
||||
PPC_LL" 3, "__stringify(STACK_FRAME_ARG1)"(1)\n"
|
||||
PPC64_TOC_RESTORE
|
||||
" addi 1, 1, "__stringify(STACK_FRAME_SIZE)"\n"
|
||||
PPC_FTRACE_RESTORE_LR
|
||||
" addi 1, 1, "__stringify(STACK_FRAME_MIN_SIZE)"\n"
|
||||
PPC_LL" 0, "__stringify(PPC_LR_STKOFF)"(1)\n"
|
||||
PPC_FTRACE_RET
|
||||
PPC64_TOC
|
||||
" .size my_tramp, .-my_tramp\n"
|
||||
" .popsection\n"
|
||||
);
|
||||
|
||||
#endif /* CONFIG_PPC */
|
||||
|
||||
static struct ftrace_ops direct;
|
||||
|
||||
static int __init ftrace_direct_init(void)
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include <linux/sched.h> /* for wake_up_process() */
|
||||
#include <linux/ftrace.h>
|
||||
#ifndef CONFIG_ARM64
|
||||
#if !defined(CONFIG_ARM64) && !defined(CONFIG_PPC32)
|
||||
#include <asm/asm-offsets.h>
|
||||
#endif
|
||||
|
||||
@ -134,6 +134,73 @@ asm (
|
||||
|
||||
#endif /* CONFIG_LOONGARCH */
|
||||
|
||||
#ifdef CONFIG_PPC
|
||||
#include <asm/ppc_asm.h>
|
||||
|
||||
#ifdef CONFIG_PPC64
|
||||
#define STACK_FRAME_SIZE 48
|
||||
#else
|
||||
#define STACK_FRAME_SIZE 24
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_PPC64_ELF_ABI_V2) && !defined(CONFIG_PPC_KERNEL_PCREL)
|
||||
#define PPC64_TOC_SAVE_AND_UPDATE \
|
||||
" std 2, 24(1)\n" \
|
||||
" bcl 20, 31, 1f\n" \
|
||||
" 1: mflr 12\n" \
|
||||
" ld 2, (99f - 1b)(12)\n"
|
||||
#define PPC64_TOC_RESTORE \
|
||||
" ld 2, 24(1)\n"
|
||||
#define PPC64_TOC \
|
||||
" 99: .quad .TOC.@tocbase\n"
|
||||
#else
|
||||
#define PPC64_TOC_SAVE_AND_UPDATE ""
|
||||
#define PPC64_TOC_RESTORE ""
|
||||
#define PPC64_TOC ""
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PPC_FTRACE_OUT_OF_LINE
|
||||
#define PPC_FTRACE_RESTORE_LR \
|
||||
PPC_LL" 0, "__stringify(PPC_LR_STKOFF)"(1)\n" \
|
||||
" mtlr 0\n"
|
||||
#define PPC_FTRACE_RET \
|
||||
" blr\n"
|
||||
#else
|
||||
#define PPC_FTRACE_RESTORE_LR \
|
||||
PPC_LL" 0, "__stringify(PPC_LR_STKOFF)"(1)\n" \
|
||||
" mtctr 0\n"
|
||||
#define PPC_FTRACE_RET \
|
||||
" mtlr 0\n" \
|
||||
" bctr\n"
|
||||
#endif
|
||||
|
||||
asm (
|
||||
" .pushsection .text, \"ax\", @progbits\n"
|
||||
" .type my_tramp, @function\n"
|
||||
" .globl my_tramp\n"
|
||||
" my_tramp:\n"
|
||||
PPC_STL" 0, "__stringify(PPC_LR_STKOFF)"(1)\n"
|
||||
PPC_STLU" 1, -"__stringify(STACK_FRAME_MIN_SIZE)"(1)\n"
|
||||
" mflr 0\n"
|
||||
PPC_STL" 0, "__stringify(PPC_LR_STKOFF)"(1)\n"
|
||||
PPC_STLU" 1, -"__stringify(STACK_FRAME_SIZE)"(1)\n"
|
||||
PPC64_TOC_SAVE_AND_UPDATE
|
||||
PPC_STL" 3, "__stringify(STACK_FRAME_MIN_SIZE)"(1)\n"
|
||||
" bl my_direct_func\n"
|
||||
PPC_LL" 3, "__stringify(STACK_FRAME_MIN_SIZE)"(1)\n"
|
||||
PPC64_TOC_RESTORE
|
||||
" addi 1, 1, "__stringify(STACK_FRAME_SIZE)"\n"
|
||||
PPC_FTRACE_RESTORE_LR
|
||||
" addi 1, 1, "__stringify(STACK_FRAME_MIN_SIZE)"\n"
|
||||
PPC_LL" 0, "__stringify(PPC_LR_STKOFF)"(1)\n"
|
||||
PPC_FTRACE_RET
|
||||
PPC64_TOC
|
||||
" .size my_tramp, .-my_tramp\n"
|
||||
" .popsection\n"
|
||||
);
|
||||
|
||||
#endif /* CONFIG_PPC */
|
||||
|
||||
static struct ftrace_ops direct;
|
||||
|
||||
static int __init ftrace_direct_init(void)
|
||||
|
Loading…
Reference in New Issue
Block a user