1 #ifndef __X86_KERNEL_KPROBES_COMMON_H
2 #define __X86_KERNEL_KPROBES_COMMON_H
4 /* Kprobes and Optprobes common header */
7 #define SAVE_REGS_STRING \
8 /* Skip cs, ip, orig_ax. */ \
25 #define RESTORE_REGS_STRING \
41 /* Skip orig_ax, ip, cs */ \
44 #define SAVE_REGS_STRING \
45 /* Skip cs, ip, orig_ax and gs. */ \
57 #define RESTORE_REGS_STRING \
65 /* Skip ds, es, fs, gs, orig_ax, and ip. Note: don't pop cs here*/\
69 /* Ensure if the instruction can be boostable */
70 extern int can_boost(kprobe_opcode_t
*instruction
);
71 /* Recover instruction if given address is probed */
72 extern unsigned long recover_probed_instruction(kprobe_opcode_t
*buf
,
75 * Copy an instruction and adjust the displacement if the instruction
76 * uses the %rip-relative addressing mode.
78 extern int __copy_instruction(u8
*dest
, u8
*src
);
80 /* Generate a relative-jump/call instruction */
81 extern void synthesize_reljump(void *from
, void *to
);
82 extern void synthesize_relcall(void *from
, void *to
);
84 #ifdef CONFIG_OPTPROBES
85 extern int arch_init_optprobes(void);
86 extern int setup_detour_execution(struct kprobe
*p
, struct pt_regs
*regs
, int reenter
);
87 extern unsigned long __recover_optprobed_insn(kprobe_opcode_t
*buf
, unsigned long addr
);
88 #else /* !CONFIG_OPTPROBES */
89 static inline int arch_init_optprobes(void)
93 static inline int setup_detour_execution(struct kprobe
*p
, struct pt_regs
*regs
, int reenter
)
97 static inline unsigned long __recover_optprobed_insn(kprobe_opcode_t
*buf
, unsigned long addr
)
103 #ifdef CONFIG_KPROBES_ON_FTRACE
104 extern int skip_singlestep(struct kprobe
*p
, struct pt_regs
*regs
,
105 struct kprobe_ctlblk
*kcb
);
107 static inline int skip_singlestep(struct kprobe
*p
, struct pt_regs
*regs
,
108 struct kprobe_ctlblk
*kcb
)