From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756704Ab1KRLey (ORCPT ); Fri, 18 Nov 2011 06:34:54 -0500 Received: from e23smtp08.au.ibm.com ([202.81.31.141]:37630 "EHLO e23smtp08.au.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755480Ab1KRLew (ORCPT ); Fri, 18 Nov 2011 06:34:52 -0500 From: Srikar Dronamraju To: Peter Zijlstra , Linus Torvalds Cc: Oleg Nesterov , Andrew Morton , LKML , Linux-mm , Ingo Molnar , Andi Kleen , Christoph Hellwig , Steven Rostedt , Roland McGrath , Thomas Gleixner , Masami Hiramatsu , Arnaldo Carvalho de Melo , Anton Arapov , Ananth N Mavinakayanahalli , Jim Keniston , Stephen Wilson Date: Fri, 18 Nov 2011 16:38:38 +0530 Message-Id: <20111118110838.10512.39493.sendpatchset@srdronam.in.ibm.com> In-Reply-To: <20111118110631.10512.73274.sendpatchset@srdronam.in.ibm.com> References: <20111118110631.10512.73274.sendpatchset@srdronam.in.ibm.com> Subject: [PATCH v7 3.2-rc2 10/30] x86: Set instruction pointer. x-cbid: 11111801-5140-0000-0000-00000047BB0C Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Provides x86 specific routine to set the instruction pointer to the given address. Signed-off-by: Jim Keniston Signed-off-by: Srikar Dronamraju --- arch/x86/include/asm/uprobes.h | 1 + arch/x86/kernel/uprobes.c | 10 ++++++++++ 2 files changed, 11 insertions(+), 0 deletions(-) diff --git a/arch/x86/include/asm/uprobes.h b/arch/x86/include/asm/uprobes.h index f0b4b2b..509c023 100644 --- a/arch/x86/include/asm/uprobes.h +++ b/arch/x86/include/asm/uprobes.h @@ -39,4 +39,5 @@ struct uprobe_arch_info {}; #endif struct uprobe; extern int analyze_insn(struct mm_struct *mm, struct uprobe *uprobe); +extern void set_instruction_pointer(struct pt_regs *regs, unsigned long vaddr); #endif /* _ASM_UPROBES_H */ diff --git a/arch/x86/kernel/uprobes.c b/arch/x86/kernel/uprobes.c index 0be7e67..67b926f 100644 --- a/arch/x86/kernel/uprobes.c +++ b/arch/x86/kernel/uprobes.c @@ -397,3 +397,13 @@ int analyze_insn(struct mm_struct *mm, struct uprobe *uprobe) prepare_fixups(uprobe, &insn); return 0; } + +/* + * @reg: reflects the saved state of the task + * @vaddr: the virtual address to jump to. + * Return 0 on success or a -ve number on error. + */ +void set_instruction_pointer(struct pt_regs *regs, unsigned long vaddr) +{ + regs->ip = vaddr; +}