From db9ed37808aaf89a06432620262512ee4982022b Mon Sep 17 00:00:00 2001 From: Anatolii Nikulin Date: Fri, 26 Jun 2015 12:41:37 +0300 Subject: [PATCH] [REFACTOR] Rename arch specific structures Change-Id: I8258a3bab52f849968f4d9f08ff03fe044c711c8 Signed-off-by: Anatolii Nikulin --- uprobe/arch/arm/swap-asm/swap_uprobes.h | 14 ++++++++++++-- uprobe/arch/x86/swap-asm/swap_uprobes.h | 18 ++++++++++++++++-- uprobe/swap_uprobes.c | 2 +- uprobe/swap_uprobes.h | 6 ++---- 4 files changed, 31 insertions(+), 9 deletions(-) diff --git a/uprobe/arch/arm/swap-asm/swap_uprobes.h b/uprobe/arch/arm/swap-asm/swap_uprobes.h index 2a05864..f36b4cf 100644 --- a/uprobe/arch/arm/swap-asm/swap_uprobes.h +++ b/uprobe/arch/arm/swap-asm/swap_uprobes.h @@ -47,10 +47,20 @@ struct uretprobe_instance; typedef unsigned long uprobe_opcode_t; /** - * @struct arch_specific_tramp + * @struct arch_insn + * @brief Architecture depend copy of original instruction. + * @var arch_insn::insn + * Copy of the original instruction. + */ +struct arch_insn { + uprobe_opcode_t *insn; +}; + +/** + * @struct arch_tramp * @brief Stores arch-dependent trampolines. */ -struct arch_specific_tramp { +struct arch_tramp { unsigned long tramp_arm[UPROBES_TRAMP_LEN]; /**< ARM trampoline */ unsigned long tramp_thumb[UPROBES_TRAMP_LEN]; /**< Thumb trampoline */ void *utramp; /**< Pointer to trampoline */ diff --git a/uprobe/arch/x86/swap-asm/swap_uprobes.h b/uprobe/arch/x86/swap-asm/swap_uprobes.h index ec1f4d5..d89b01d 100644 --- a/uprobe/arch/x86/swap-asm/swap_uprobes.h +++ b/uprobe/arch/x86/swap-asm/swap_uprobes.h @@ -44,10 +44,24 @@ struct uretprobe_instance; typedef u8 uprobe_opcode_t; /** - * @struct arch_specific_tramp + * @struct arch_insn + * @brief Architecture depend copy of original instruction. + * @var arch_insn::insn + * Copy of the original instruction. + * @var arch_insn::boostable + * If this flag is not 0, this kprobe can be boost when its + * post_handler and break_handler is not set. + */ +struct arch_insn { + uprobe_opcode_t *insn; + int boostable; +}; + +/** + * @struct arch_tramp * @brief Stores x86 trampoline */ -struct arch_specific_tramp { +struct arch_tramp { u8 tramp[UPROBES_TRAMP_LEN + BP_INSN_SIZE]; /**< BP for uretprobe */ }; diff --git a/uprobe/swap_uprobes.c b/uprobe/swap_uprobes.c index 283323d..699ffa1 100644 --- a/uprobe/swap_uprobes.c +++ b/uprobe/swap_uprobes.c @@ -84,7 +84,7 @@ void print_uprobe_hash_table(void) static inline void copy_uprobe(struct uprobe *old_p, struct uprobe *p) { memcpy(&p->opcode, &old_p->opcode, sizeof(uprobe_opcode_t)); - memcpy(&p->ainsn, &old_p->ainsn, sizeof(struct arch_specific_insn)); + memcpy(&p->ainsn, &old_p->ainsn, sizeof(struct arch_insn)); #ifdef CONFIG_ARM p->safe_arm = old_p->safe_arm; p->safe_thumb = old_p->safe_thumb; diff --git a/uprobe/swap_uprobes.h b/uprobe/swap_uprobes.h index cd701d6..970b2a9 100644 --- a/uprobe/swap_uprobes.h +++ b/uprobe/swap_uprobes.h @@ -84,8 +84,6 @@ struct uprobe { uprobe_break_handler_t break_handler; /** Saved opcode (which has been replaced with breakpoint).*/ uprobe_opcode_t opcode; - /** Copy of the original instruction.*/ - struct arch_specific_insn ainsn; /** Override single-step target address, may be used to redirect * control-flow to arbitrary address after probe point without * invocation of original instruction; useful for functions @@ -99,10 +97,10 @@ struct uprobe { /** Safe/unsafe to use probe on Thumb.*/ unsigned safe_thumb:1; #endif - + struct arch_insn ainsn; /**< Copy of the original instruction.*/ + struct arch_tramp atramp; /**< Stores trampoline */ struct task_struct *task; /**< Pointer to the task struct */ struct slot_manager *sm; /**< Pointer to slot manager */ - struct arch_specific_tramp atramp; /**< Stores trampoline */ }; /** -- 2.7.4