diff options
author | Vyacheslav Cherkashin <v.cherkashin@samsung.com> | 2014-05-26 15:35:52 +0400 |
---|---|---|
committer | Vyacheslav Cherkashin <v.cherkashin@samsung.com> | 2014-07-28 19:39:48 +0400 |
commit | 50c7ae6487704086120051c1f810c1431580d59a (patch) | |
tree | 35956f54348c27a80f5a0863990ddb9627ac883c | |
parent | 60cccc5017cf8e6bea4859830b0e255d0a60e0b1 (diff) | |
download | swap-modules-50c7ae6487704086120051c1f810c1431580d59a.tar.gz swap-modules-50c7ae6487704086120051c1f810c1431580d59a.tar.bz2 swap-modules-50c7ae6487704086120051c1f810c1431580d59a.zip |
[IMPROVE] ARM: new interface for kjumper
Change-Id: I2792801ba6d845c3045b8702eab754c9e6238dd5
Signed-off-by: Vyacheslav Cherkashin <v.cherkashin@samsung.com>
-rw-r--r-- | kprobe/arch/asm-arm/swap_kprobes.c | 21 | ||||
-rw-r--r-- | kprobe/arch/asm-arm/swap_kprobes.h | 5 | ||||
-rw-r--r-- | us_manager/helper.c | 6 |
3 files changed, 9 insertions, 23 deletions
diff --git a/kprobe/arch/asm-arm/swap_kprobes.c b/kprobe/arch/asm-arm/swap_kprobes.c index c569e362..6f5b90ec 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 dcfccdc9..fb23151d 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 d9b1b7aa..5b5d01aa 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; } |