[IMPROVE] ARM: new interface for kjumper 86/21686/3
authorVyacheslav Cherkashin <v.cherkashin@samsung.com>
Mon, 26 May 2014 11:35:52 +0000 (15:35 +0400)
committerVyacheslav Cherkashin <v.cherkashin@samsung.com>
Mon, 28 Jul 2014 15:39:48 +0000 (19:39 +0400)
Change-Id: I2792801ba6d845c3045b8702eab754c9e6238dd5
Signed-off-by: Vyacheslav Cherkashin <v.cherkashin@samsung.com>
kprobe/arch/asm-arm/swap_kprobes.c
kprobe/arch/asm-arm/swap_kprobes.h
us_manager/helper.c

index c569e36..6f5b90e 100644 (file)
@@ -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 */
index dcfccdc..fb23151 100644 (file)
@@ -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,
index d9b1b7a..5b5d01a 100644 (file)
@@ -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;
 }