1 #ifndef __X86_KERNEL_KPROBES_COMMON_H
2 #define __X86_KERNEL_KPROBES_COMMON_H
4 /* Kprobes and Optprobes common header */
8 #ifdef CONFIG_FRAME_POINTER
9 # define SAVE_RBP_STRING " push %" _ASM_BP "\n" \
10 " mov %" _ASM_SP ", %" _ASM_BP "\n"
12 # define SAVE_RBP_STRING " push %" _ASM_BP "\n"
16 #define SAVE_REGS_STRING \
17 /* Skip cs, ip, orig_ax. */ \
34 #define RESTORE_REGS_STRING \
50 /* Skip orig_ax, ip, cs */ \
53 #define SAVE_REGS_STRING \
54 /* Skip cs, ip, orig_ax and gs. */ \
66 #define RESTORE_REGS_STRING \
74 /* Skip ds, es, fs, gs, orig_ax, and ip. Note: don't pop cs here*/\
78 /* Ensure if the instruction can be boostable */
79 extern int can_boost(struct insn *insn, void *orig_addr);
80 /* Recover instruction if given address is probed */
81 extern unsigned long recover_probed_instruction(kprobe_opcode_t *buf,
84 * Copy an instruction and adjust the displacement if the instruction
85 * uses the %rip-relative addressing mode.
87 extern int __copy_instruction(u8 *dest, u8 *src, struct insn *insn);
89 /* Generate a relative-jump/call instruction */
90 extern void synthesize_reljump(void *from, void *to);
91 extern void synthesize_relcall(void *from, void *to);
93 #ifdef CONFIG_OPTPROBES
94 extern int setup_detour_execution(struct kprobe *p, struct pt_regs *regs, int reenter);
95 extern unsigned long __recover_optprobed_insn(kprobe_opcode_t *buf, unsigned long addr);
96 #else /* !CONFIG_OPTPROBES */
97 static inline int setup_detour_execution(struct kprobe *p, struct pt_regs *regs, int reenter)
101 static inline unsigned long __recover_optprobed_insn(kprobe_opcode_t *buf, unsigned long addr)
107 #ifdef CONFIG_KPROBES_ON_FTRACE
108 extern int skip_singlestep(struct kprobe *p, struct pt_regs *regs,
109 struct kprobe_ctlblk *kcb);
111 static inline int skip_singlestep(struct kprobe *p, struct pt_regs *regs,
112 struct kprobe_ctlblk *kcb)