From: Vyacheslav Cherkashin Date: Mon, 26 May 2014 11:35:52 +0000 (+0400) Subject: [IMPROVE] ARM: new interface for kjumper X-Git-Tag: Tizen_SDK_2.3~14 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F86%2F21686%2F3;p=kernel%2Fswap-modules.git [IMPROVE] ARM: new interface for kjumper Change-Id: I2792801ba6d845c3045b8702eab754c9e6238dd5 Signed-off-by: Vyacheslav Cherkashin --- diff --git a/kprobe/arch/asm-arm/swap_kprobes.c b/kprobe/arch/asm-arm/swap_kprobes.c index c569e36..6f5b90e 100644 --- a/kprobe/arch/asm-arm/swap_kprobes.c +++ b/kprobe/arch/asm-arm/swap_kprobes.c @@ -658,36 +658,27 @@ __asm( ); /** - * @brief Gets kjump address. - * - * @return Kjump address. - */ -unsigned long get_kjump_addr(void) -{ - return (unsigned long)&kjump_trampoline; -} -EXPORT_SYMBOL_GPL(get_kjump_addr); - -/** * @brief Registers callback for kjump probes. * - * @param ret_addr Kjump probe return address. * @param regs Pointer to CPU registers data. * @param cb Kjump probe callback of jumper_cb_t type. * @param data Pointer to data that should be saved in kj_cb_data. * @param size Size of the data. * @return 0. */ -int set_kjump_cb(unsigned long ret_addr, struct pt_regs *regs, - jumper_cb_t cb, void *data, size_t size) +int set_kjump_cb(struct pt_regs *regs, jumper_cb_t cb, void *data, size_t size) { + struct kprobe *p; struct kj_cb_data *cb_data; cb_data = kmalloc(sizeof(*cb_data) + size, GFP_ATOMIC); if (cb_data == NULL) return -ENOMEM; - cb_data->ret_addr = ret_addr; + p = swap_kprobe_running(); + p->ss_addr[smp_processor_id()] = (kprobe_opcode_t *)&kjump_trampoline; + + cb_data->ret_addr = (unsigned long)p->ainsn.insn; cb_data->cb = cb; /* save regs */ diff --git a/kprobe/arch/asm-arm/swap_kprobes.h b/kprobe/arch/asm-arm/swap_kprobes.h index dcfccdc..fb23151 100644 --- a/kprobe/arch/asm-arm/swap_kprobes.h +++ b/kprobe/arch/asm-arm/swap_kprobes.h @@ -659,9 +659,8 @@ static inline unsigned long swap_get_sarg(struct pt_regs *regs, unsigned long n) /* jumper */ typedef unsigned long (*jumper_cb_t)(void *); -unsigned long get_kjump_addr(void); -int set_kjump_cb(unsigned long ret_addr, struct pt_regs *regs, - jumper_cb_t cb, void *data, size_t size); +int set_kjump_cb(struct pt_regs *regs, jumper_cb_t cb, + void *data, size_t size); unsigned long get_jump_addr(void); int set_jump_cb(unsigned long ret_addr, struct pt_regs *regs, diff --git a/us_manager/helper.c b/us_manager/helper.c index d9b1b7a..5b5d01a 100644 --- a/us_manager/helper.c +++ b/us_manager/helper.c @@ -143,11 +143,7 @@ static int ctx_task_pre_handler(struct kprobe *p, struct pt_regs *regs) return 0; page_addr = 0; - set_kjump_cb((unsigned long)p->ainsn.insn, regs, cb_pf, - &page_addr, sizeof(page_addr)); - - /* set kjumper */ - p->ss_addr[smp_processor_id()] = (unsigned long *)get_kjump_addr(); + set_kjump_cb(regs, cb_pf, &page_addr, sizeof(page_addr)); return 0; }