From: Vyacheslav Cherkashin Date: Tue, 1 Dec 2015 15:04:53 +0000 (+0300) Subject: [CLEAN] remove arch_tramp struct X-Git-Tag: SRR_20160331~20 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e83c00a4e4eae708f9a115146dae4ca8b2e86659;p=kernel%2Fswap-modules.git [CLEAN] remove arch_tramp struct This structure is excessive and the need for it is now missing Change-Id: I350e81bd0909dceee5aa2ef9fa2bb99a12862cec Signed-off-by: Vyacheslav Cherkashin --- diff --git a/uprobe/arch/arm/swap-asm/swap_uprobes.h b/uprobe/arch/arm/swap-asm/swap_uprobes.h index fa74ddf..4065285 100644 --- a/uprobe/arch/arm/swap-asm/swap_uprobes.h +++ b/uprobe/arch/arm/swap-asm/swap_uprobes.h @@ -56,16 +56,6 @@ struct arch_insn { uprobe_opcode_t *insn; }; -/** - * @struct arch_tramp - * @brief Stores arch-dependent trampolines. - */ -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 */ -}; - static inline u32 swap_get_urp_float(struct pt_regs *regs) { diff --git a/uprobe/arch/x86/swap-asm/swap_uprobes.c b/uprobe/arch/x86/swap-asm/swap_uprobes.c index 4aae5f1..f914aba 100644 --- a/uprobe/arch/x86/swap-asm/swap_uprobes.c +++ b/uprobe/arch/x86/swap-asm/swap_uprobes.c @@ -100,7 +100,7 @@ static void restore_current_flags(struct pt_regs *regs, unsigned long flags) int arch_prepare_uprobe(struct uprobe *p) { struct task_struct *task = p->task; - u8 *tramp = p->atramp.tramp; + u8 tramp[UPROBES_TRAMP_LEN + BP_INSN_SIZE]; /* BP for uretprobe */ enum { call_relative_opcode = 0xe8 }; if (!read_proc_vm_atomic(task, (unsigned long)p->addr, @@ -116,9 +116,7 @@ int arch_prepare_uprobe(struct uprobe *p) tramp[UPROBES_TRAMP_RET_BREAK_IDX] = BREAKPOINT_INSTRUCTION; - /* TODO: remove dual info */ p->opcode = tramp[0]; - p->ainsn.boostable = swap_can_boost(tramp) ? 0 : -1; p->ainsn.insn = swap_slot_alloc(p->sm); @@ -128,7 +126,7 @@ int arch_prepare_uprobe(struct uprobe *p) } if (!write_proc_vm_atomic(task, (unsigned long)p->ainsn.insn, - tramp, sizeof(p->atramp.tramp))) { + tramp, sizeof(tramp))) { swap_slot_free(p->sm, p->ainsn.insn); printk(KERN_INFO "failed to write memory %p!\n", tramp); return -EINVAL; diff --git a/uprobe/arch/x86/swap-asm/swap_uprobes.h b/uprobe/arch/x86/swap-asm/swap_uprobes.h index a5c5eaa..3a65547 100644 --- a/uprobe/arch/x86/swap-asm/swap_uprobes.h +++ b/uprobe/arch/x86/swap-asm/swap_uprobes.h @@ -57,14 +57,6 @@ struct arch_insn { int boostable; }; -/** - * @struct arch_tramp - * @brief Stores x86 trampoline - */ -struct arch_tramp { - u8 tramp[UPROBES_TRAMP_LEN + BP_INSN_SIZE]; /**< BP for uretprobe */ -}; - static inline u32 swap_get_urp_float(struct pt_regs *regs) { diff --git a/uprobe/swap_uprobes.h b/uprobe/swap_uprobes.h index 16e12e7..e644524 100644 --- a/uprobe/swap_uprobes.h +++ b/uprobe/swap_uprobes.h @@ -98,7 +98,6 @@ struct uprobe { 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 */ bool atomic_ctx; /**< Handler context */