Youling Tang 9cdc3b6a29 LoongArch: ftrace: Add direct call support
Select the HAVE_DYNAMIC_FTRACE_WITH_DIRECT_CALLS to provide the
register_ftrace_direct[_multi] interfaces allowing users to register
the customed trampoline (direct_caller) as the mcount for one or more
target functions. And modify_ftrace_direct[_multi] are also provided
for modifying direct_caller.

There are a few cases to distinguish:
- If a direct call ops is the only one tracing a function AND the direct
  called trampoline is within the reach of a 'bl' instruction
  -> the ftrace patchsite jumps to the trampoline
- Else
  -> the ftrace patchsite jumps to the ftrace_regs_caller trampoline points
     to ftrace_list_ops so it iterates over all registered ftrace ops,
     including the direct call ops and calls its call_direct_funcs handler
     which stores the direct called trampoline's address in the ftrace_regs
     and the ftrace_regs_caller trampoline will return to that address
     instead of returning to the traced function

Signed-off-by: Qing Zhang <zhangqing@loongson.cn>
Signed-off-by: Youling Tang <tangyouling@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
2023-05-01 17:19:53 +08:00
..
2022-10-12 16:36:19 +08:00
2022-12-19 08:23:27 -06:00
2022-06-03 20:09:28 +08:00
2022-12-14 08:41:53 +08:00
2022-06-03 20:09:28 +08:00
2023-05-01 17:19:27 +08:00
2023-02-25 22:12:17 +08:00
2022-10-12 16:36:19 +08:00
2022-12-14 08:41:53 +08:00
2022-10-12 16:36:19 +08:00
2022-12-19 08:23:27 -06:00
2022-10-12 16:36:14 +08:00
2022-10-12 16:36:19 +08:00
2022-12-14 08:41:53 +08:00
2022-06-03 20:09:28 +08:00
2023-03-01 09:27:00 -08:00