Commit 0bf6e0a2 authored by Gu Zitao's avatar Gu Zitao Committed by guzitao
Browse files

sw64: add support for KPROBES_ON_FTRACE

Sunway inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I645TO



--------------------------------

This patch adds support for KPROBES_ON_FTRACE on SW64, and it allows
kprobes to be placed on ftrace _mcount() call sites.

However, kprobe_ftrace_handler() makes ftrace_regs_caller() return
to the instruction after _mcount() call site. Then if the function
accesses global symbol with an address caculated based on gp($29),
it'll access a wrong address because gp has been changed in
ftrace_regs_caller().

To fix it, gp has to be saved and restored in ftrace_regs_caller().

With this patch, ftrace/kprobe selftests return passed.

Signed-off-by: default avatarGu Zitao <guzitao@wxiat.com>
Reviewed-by: default avatarHe Sheng <hesheng@wxiat.com>
Signed-off-by: default avatarGu Zitao <guzitao@wxiat.com>
parent b1554ee3
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment