ARM64 initial version 97/111097/3
authorVyacheslav Cherkashin <v.cherkashin@samsung.com>
Fri, 7 Feb 2014 11:25:29 +0000 (15:25 +0400)
committerVyacheslav Cherkashin <v.cherkashin@samsung.com>
Mon, 30 Jan 2017 16:35:07 +0000 (19:35 +0300)
use dummy for arch dependent functions

Change-Id: Ib63a5efc58ec36f362c688213196e46416d41e6b
Signed-off-by: Vyacheslav Cherkashin <v.cherkashin@samsung.com>
Signed-off-by: Alexander Aksenov <a.aksenov@samsung.com>
22 files changed:
build.sh
energy/lcd/lcd_base.c
energy/lcd/lcd_base.h
energy/lcd/maru.c
energy/lcd/s6e8aa0.c
energy/lcd/s6e8aa0_panel.c
kprobe/Kbuild
kprobe/arch/arm64/swap-asm/swap_kprobes.c [new file with mode: 0644]
kprobe/arch/arm64/swap-asm/swap_kprobes.h [new file with mode: 0644]
kprobe/swap_kprobes.c
ks_features/ks_features.c
loader/loader_module.c
parser/msg_cmd.c
preload/preload_module.c
uprobe/Kbuild
uprobe/arch/arm64/swap-asm/swap_uprobes.c [new file with mode: 0644]
uprobe/arch/arm64/swap-asm/swap_uprobes.h [new file with mode: 0644]
us_manager/helper.c
us_manager/pf/proc_filters.c
us_manager/us_slot_manager.c
writer/kernel_operations.h
writer/swap_msg.c

index b974c24..935d317 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -11,7 +11,7 @@ show_usage_and_exit () {
        echo -e "\t--file <config file>"
 #      echo -e "\t--debug"
        echo -e "\t--kernel <kernel path>"
-       echo -e "\t--arch <arm|i386>"
+       echo -e "\t--arch <arm|arm64|i386>"
        echo -e "\t[--toolchain <cross compile path>]"
        exit 1
 }
@@ -68,6 +68,8 @@ fi
 
 if [ "${ARCH}" = "arm" ] ; then
        LINKNAME="arm"
+elif [ "${ARCH}" = "arm64" ] ; then
+       LINKNAME="arm64"
 elif [ "${ARCH}" = "i386" ] ; then
        LINKNAME="x86"
 else
index 018fe7b..12ee466 100644 (file)
@@ -99,7 +99,7 @@ static void *create_lcd_priv(struct lcd_ops *ops, size_t tms_brt_cnt)
        struct lcd_priv_data *lcd;
 
        if (tms_brt_cnt <= 0) {
-               printk(KERN_INFO "error variable tms_brt_cnt=%d\n",
+               printk(KERN_INFO "error variable tms_brt_cnt=%zu\n",
                       tms_brt_cnt);
                return NULL;
        }
@@ -247,10 +247,10 @@ static int func_notifier_lcd(struct lcd_ops *ops, enum lcd_action_type action,
 {
        switch (action) {
        case LAT_BRIGHTNESS:
-               set_brightness(ops, (int)data);
+               set_brightness(ops, VOIDP2INT(data));
                break;
        case LAT_POWER:
-               set_power(ops, (int)data);
+               set_power(ops, VOIDP2INT(data));
                break;
        default:
                printk(KERN_INFO "LCD energy error: action=%d\n", action);
index 44de0b4..85d59c6 100644 (file)
 #include <energy/rational_debugfs.h>
 
 
+#define VOIDP2INT(x)   ((int)(unsigned long)(x))
+#define INT2VOIDP(x)   ((void *)(unsigned long)(x))
+
+
 /** Description of actions */
 enum lcd_action_type {
        LAT_BRIGHTNESS,         /**< LCD brightness */
index 7431b44..e6a9c2c 100644 (file)
@@ -149,7 +149,7 @@ static int ret_handler_set_backlight(struct kretprobe_instance *ri,
 
        if (!ret && maru_ops.notifier)
                maru_ops.notifier(&maru_ops, LAT_BRIGHTNESS,
-                                 (void *)*brightness);
+                                 INT2VOIDP(*brightness));
 
        return 0;
 }
index b987bae..241003b 100644 (file)
@@ -143,7 +143,7 @@ static int ret_handler_set_power(struct kretprobe_instance *ri,
        int *power = (int *)ri->data;
 
        if (!ret && s6e8aa0_ops.notifier)
-               s6e8aa0_ops.notifier(&s6e8aa0_ops, LAT_POWER, (void *)*power);
+               s6e8aa0_ops.notifier(&s6e8aa0_ops, LAT_POWER, INT2VOIDP(*power));
 
        return 0;
 }
@@ -173,7 +173,7 @@ static int ret_handler_set_backlight(struct kretprobe_instance *ri,
 
        if (!ret && s6e8aa0_ops.notifier)
                s6e8aa0_ops.notifier(&s6e8aa0_ops, LAT_BRIGHTNESS,
-                                    (void *)*brightness);
+                                    INT2VOIDP(*brightness));
 
        return 0;
 }
index 2119af1..e2cd8fa 100644 (file)
@@ -142,7 +142,7 @@ static int ret_handler_set_power(struct kretprobe_instance *ri,
 
        if (!ret && s6e8aa0_ops.notifier)
                s6e8aa0_ops.notifier(&s6e8aa0_ops, LAT_POWER,
-                                    (void *)*power);
+                                    INT2VOIDP(*power));
 
        return 0;
 }
@@ -175,7 +175,7 @@ static int ret_handler_set_backlight(struct kretprobe_instance *ri,
 
        if (!ret && s6e8aa0_ops.notifier)
                s6e8aa0_ops.notifier(&s6e8aa0_ops, LAT_BRIGHTNESS,
-                                    (void *)*brightness);
+                                    INT2VOIDP(*brightness));
 
        return 0;
 }
index 09e7c43..489db75 100644 (file)
@@ -15,5 +15,9 @@ swap_kprobe-$(CONFIG_ARM) += arch/arm/swap-asm/memory_rwx.o
 endif #ifeq ($(CONFIG_STRICT_MEMORY_RWX), y)
 
 
+### ARM64
+swap_kprobe-$(CONFIG_ARM64) += arch/arm64/swap-asm/swap_kprobes.o
+
+
 ### X86
 swap_kprobe-$(CONFIG_X86) += arch/x86/swap-asm/swap_kprobes.o
diff --git a/kprobe/arch/arm64/swap-asm/swap_kprobes.c b/kprobe/arch/arm64/swap-asm/swap_kprobes.c
new file mode 100644 (file)
index 0000000..bfc29e1
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Copyright (C) Samsung Electronics, 2014
+ *
+ * 2014         Vyacheslav Cherkashin <v.cherkashin@samsung.com>
+ *
+ */
+
+
+#include <linux/bug.h>
+
+
+struct kprobe;
+struct pt_regs;
+
+
+int swap_arch_init_kprobes(void)
+{
+       WARN(1, "not implemented"); /* FIXME: to implement */
+       return 0;
+}
+
+void swap_arch_exit_kprobes(void)
+{
+       WARN(1, "not implemented"); /* FIXME: to implement */
+}
diff --git a/kprobe/arch/arm64/swap-asm/swap_kprobes.h b/kprobe/arch/arm64/swap-asm/swap_kprobes.h
new file mode 100644 (file)
index 0000000..e738a89
--- /dev/null
@@ -0,0 +1,168 @@
+#ifndef _ASM_ARM64_KPROBES_H
+#define _ASM_ARM64_KPROBES_H
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Copyright (C) Samsung Electronics, 2014
+ *
+ * 2014         Vyacheslav Cherkashin <v.cherkashin@samsung.com>
+ *
+ */
+
+
+#include <linux/types.h>
+
+
+#define BREAKPOINT_INSTRUCTION 0       /* FIXME: to implement */
+#define KPROBES_TRAMP_LEN      10      /* FIXME: to implement */
+
+
+typedef u32 kprobe_opcode_t;
+
+struct arch_specific_insn {    /* FIXME: to implement */
+       /* copy of the original instruction */
+       kprobe_opcode_t *insn;
+};
+
+/* per-cpu kprobe control block */
+struct kp_core_ctlblk {                /* FIXME: to implement */
+       unsigned long kp_core_status;
+};
+
+
+struct kprobe;
+struct kp_core;
+struct slot_manager;
+struct kretprobe_instance;
+
+
+static inline unsigned long swap_get_karg(struct pt_regs *regs,
+                                         unsigned long n)
+{
+       WARN(1, "not implemented"); /* FIXME: to implement */
+       return 0;
+}
+
+static inline unsigned long swap_get_sarg(struct pt_regs *regs,
+                                         unsigned long n)
+{
+       WARN(1, "not implemented"); /* FIXME: to implement */
+       return 0;
+}
+
+static inline unsigned long swap_get_instr_ptr(struct pt_regs *regs)
+{
+       WARN(1, "not implemented"); /* FIXME: to implement */
+       return 0xdeadc0de;
+}
+
+static inline void swap_set_instr_ptr(struct pt_regs *regs, unsigned long val)
+{
+       WARN(1, "not implemented"); /* FIXME: to implement */
+}
+
+static inline unsigned long swap_get_ret_addr(struct pt_regs *regs)
+{
+       WARN(1, "not implemented"); /* FIXME: to implement */
+       return 0xdeadc0de;
+}
+
+static inline void swap_set_ret_addr(struct pt_regs *regs, unsigned long val)
+{
+       WARN(1, "not implemented"); /* FIXME: to implement */
+}
+
+static inline int arch_kp_core_prepare(struct kp_core *p,
+                                      struct slot_manager *sm)
+{
+       WARN(1, "not implemented"); /* FIXME: to implement */
+       return 0;
+}
+
+static inline void arch_kp_core_arm(struct kp_core *p)
+{
+       WARN(1, "not implemented"); /* FIXME: to implement */
+}
+
+static inline void arch_kp_core_disarm(struct kp_core *p)
+{
+       WARN(1, "not implemented"); /* FIXME: to implement */
+}
+
+
+static inline void restore_previous_kp_core(struct kp_core_ctlblk *kcb)
+{
+       WARN(1, "not implemented"); /* FIXME: to implement */
+}
+
+static inline void swap_arch_prepare_kretprobe(struct kretprobe_instance *ri,
+                                              struct pt_regs *regs)
+{
+       WARN(1, "not implemented"); /* FIXME: to implement */
+}
+
+static inline void swap_kretprobe_trampoline(void)
+{
+       WARN(1, "not implemented"); /* FIXME: to implement */
+}
+
+
+static inline unsigned long arch_get_task_pc(struct task_struct *p)
+{
+       WARN(1, "not implemented"); /* FIXME: to implement */
+       return 0xdeadc0de;
+}
+
+static inline void arch_set_task_pc(struct task_struct *p, unsigned long val)
+{
+       WARN(1, "not implemented"); /* FIXME: to implement */
+}
+
+static inline int swap_setjmp_pre_handler(struct kprobe *p,
+                                         struct pt_regs *regs)
+{
+       WARN(1, "not implemented"); /* FIXME: to implement */
+       return 0;
+}
+
+/* jumper */
+typedef unsigned long (*jumper_cb_t)(void *);
+
+static inline unsigned long get_jump_addr(void)
+{
+       WARN(1, "not implemented"); /* FIXME: to implement */
+       return 0x87654321;
+}
+
+static inline int set_jump_cb(unsigned long ret_addr, struct pt_regs *regs,
+                             jumper_cb_t cb, void *data, size_t size)
+{
+       WARN(1, "not implemented"); /* FIXME: to implement */
+       return 0;
+}
+
+static inline int arch_init_module_deps(void)
+{
+       WARN(1, "not implemented"); /* FIXME: to implement */
+       return 0;
+}
+
+
+int swap_arch_init_kprobes(void);
+void swap_arch_exit_kprobes(void);
+
+
+#endif /* _ASM_ARM64_KPROBES_H */
index 918d5a6..62538ff 100644 (file)
@@ -1054,12 +1054,12 @@ static int swap_disarm_krp_inst(struct kretprobe_instance *ri)
 
        if (found) {
                printk(KERN_INFO "---> [%d] %s (%d/%d): tramp (%08lx) "
-                      "found at %08lx (%08lx /%+d) - %08lx\n",
+                      "found at %08lx (%08lx /%+ld) - %08lx\n",
                       task_cpu(ri->task),
                       ri->task->comm, ri->task->tgid, ri->task->pid,
                       (long unsigned int)tramp,
                       (long unsigned int)found, (long unsigned int)ri->sp,
-                      found - ri->sp, ri->rp ? ri->rp->kp.addr : 0);
+                      (unsigned long)(found - ri->sp), ri->rp ? ri->rp->kp.addr : 0);
                *found = (unsigned long)ri->ret_addr;
                retval = 0;
        } else {
index a572b67..7957b60 100644 (file)
@@ -571,7 +571,7 @@ static void print_feature(struct feature *f)
        size_t i;
 
        for (i = 0; i < f->cnt; ++i)
-               printk(KERN_INFO "    feature[%3u]: %s\n", i,
+               printk(KERN_INFO "    feature[%3zu]: %s\n", i,
                       get_sys_name(f->feature_list[i]));
 }
 
index 8ee703e..53c38c5 100644 (file)
@@ -139,10 +139,10 @@ static inline void __restore_uregs(struct uretprobe_instance *ri,
        swap_put_uarg(regs, 0, priv->arg0);
        swap_put_uarg(regs, 1, priv->arg1);
        swap_set_ret_addr(regs, priv->raddr);
-#ifndef CONFIG_ARM
+#ifdef CONFIG_X86_32
        /* need to do it only on x86 */
        regs->EREG(ip) -= 1;
-#endif /* !CONFIG_ARM */
+#endif /* CONFIG_X86_32 */
        /* we have just restored the registers => no need to do it in
         * trampoline_uprobe_handler */
        ri->ret_addr = NULL;
@@ -153,7 +153,7 @@ static inline void print_regs(const char *prefix, struct pt_regs *regs,
 {
        struct dentry *dentry = lpd_get_dentry(hd);
 
-#ifdef CONFIG_ARM
+#if defined(CONFIG_ARM)
        printk(LOADER_PREFIX "%s[%d/%d] %s (%d) %s addr(%08lx), "
               "r0(%08lx), r1(%08lx), r2(%08lx), r3(%08lx), "
               "r4(%08lx), r5(%08lx), r6(%08lx), r7(%08lx), "
@@ -166,7 +166,7 @@ static inline void print_regs(const char *prefix, struct pt_regs *regs,
               regs->ARM_r0, regs->ARM_r1, regs->ARM_r2, regs->ARM_r3,
               regs->ARM_r4, regs->ARM_r5, regs->ARM_r6, regs->ARM_r7,
               regs->ARM_sp, regs->ARM_lr, regs->ARM_pc);
-#else /* !CONFIG_ARM */
+#elif defined(CONFIG_X86_32)
        printk(LOADER_PREFIX "%s[%d/%d] %s (%d) %s addr(%08lx), "
               "ip(%08lx), arg0(%08lx), arg1(%08lx), raddr(%08lx)\n",
               current->comm, current->tgid, current->pid,
@@ -176,7 +176,12 @@ static inline void print_regs(const char *prefix, struct pt_regs *regs,
               prefix, (unsigned long)ri->rp->up.addr,
               regs->EREG(ip), swap_get_uarg(regs, 0), swap_get_uarg(regs, 1),
               swap_get_ret_addr(regs));
-#endif /* CONFIG_ARM */
+#elif defined(CONFIG_ARM64)
+       WARN(1, "not implemented"); /* FIXME: to implement */
+       (void)dentry;
+#else /* CONFIG_arch */
+# error "this architecture is not supported"
+#endif /* CONFIG_arch */
 }
 
 static inline unsigned long __get_r_debug_off(struct vm_area_struct *linker_vma)
index b0ff1c5..9d032fd 100644 (file)
@@ -61,7 +61,7 @@ static int set_config(struct conf_data *conf)
 int msg_keep_alive(struct msg_buf *mb)
 {
        if (!is_end_mb(mb)) {
-               print_err("to long message, remained=%u", remained_mb(mb));
+               print_err("to long message, remained=%zu", remained_mb(mb));
                return -EINVAL;
        }
 
@@ -88,7 +88,7 @@ int msg_start(struct msg_buf *mb)
                return -EINVAL;
 
        if (!is_end_mb(mb)) {
-               print_err("to long message, remained=%u", remained_mb(mb));
+               print_err("to long message, remained=%zu", remained_mb(mb));
                ret = -EINVAL;
                goto free_us_inst;
        }
@@ -128,7 +128,7 @@ int msg_stop(struct msg_buf *mb)
        int discarded;
 
        if (!is_end_mb(mb)) {
-               print_err("to long message, remained=%u", remained_mb(mb));
+               print_err("to long message, remained=%zu", remained_mb(mb));
                return -EINVAL;
        }
 
@@ -170,7 +170,7 @@ int msg_config(struct msg_buf *mb)
                return -EINVAL;
 
        if (!is_end_mb(mb)) {
-               print_err("to long message, remained=%u", remained_mb(mb));
+               print_err("to long message, remained=%zu", remained_mb(mb));
                ret = -EINVAL;
                goto free_conf_data;
        }
@@ -207,7 +207,7 @@ int msg_swap_inst_add(struct msg_buf *mb)
                return -EINVAL;
 
        if (!is_end_mb(mb)) {
-               print_err("to long message, remained=%u", remained_mb(mb));
+               print_err("to long message, remained=%zu", remained_mb(mb));
                ret = -EINVAL;
                goto free_us_inst;
        }
@@ -251,7 +251,7 @@ int msg_swap_inst_remove(struct msg_buf *mb)
                return -EINVAL;
 
        if (!is_end_mb(mb)) {
-               print_err("to long message, remained=%u", remained_mb(mb));
+               print_err("to long message, remained=%zu", remained_mb(mb));
                ret = -EINVAL;
                goto free_us_inst;
        }
index e0a80b7..779f755 100644 (file)
@@ -333,14 +333,14 @@ static int write_msg_handler(struct uprobe *p, struct pt_regs *regs)
 
        buf = kmalloc(len, GFP_ATOMIC);
        if (buf == NULL) {
-               printk(PRELOAD_PREFIX "No mem for buffer! Size = %d\n", len);
+               printk(PRELOAD_PREFIX "No mem for buffer! Size = %zd\n", len);
                return 0;
        }
 
        ret = read_proc_vm_atomic(current, (unsigned long)user_buf, buf, len);
        if (ret < 0) {
                printk(PRELOAD_PREFIX "Cannot copy data from userspace! Size = "
-                                     "%d ptr 0x%lx ret %d\n", len,
+                                     "%zd ptr 0x%lx ret %d\n", len,
                                      (unsigned long)user_buf, ret);
                goto write_msg_fail;
        }
index bed91d2..553aae1 100644 (file)
@@ -12,6 +12,10 @@ swap_uprobe-$(CONFIG_ARM) += \
        arch/arm/swap-asm/thumb_tramps.o
 
 
+### ARM64
+swap_uprobe-$(CONFIG_ARM64) += arch/arm64/swap-asm/swap_uprobes.o
+
+
 ### X86
 swap_uprobe-$(CONFIG_X86) += arch/x86/swap-asm/swap_uprobes.o \
                             arch/x86/swap-asm/swap_sc_patch.o
diff --git a/uprobe/arch/arm64/swap-asm/swap_uprobes.c b/uprobe/arch/arm64/swap-asm/swap_uprobes.c
new file mode 100644 (file)
index 0000000..6de4d31
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Copyright (C) Samsung Electronics, 2014
+ *
+ * 2014         Vyacheslav Cherkashin <v.cherkashin@samsung.com>
+ *
+ */
+
+
+#include <linux/bug.h>
+
+
+int swap_arch_init_uprobes(void)
+{
+       WARN(1, "not implemented"); /* FIXME: to implement */
+       return 0;
+}
+
+void swap_arch_exit_uprobes(void)
+{
+       WARN(1, "not implemented"); /* FIXME: to implement */
+}
diff --git a/uprobe/arch/arm64/swap-asm/swap_uprobes.h b/uprobe/arch/arm64/swap-asm/swap_uprobes.h
new file mode 100644 (file)
index 0000000..0ca8347
--- /dev/null
@@ -0,0 +1,145 @@
+#ifndef _ASM_ARM64_UPROBES_H
+#define _ASM_ARM64_UPROBES_H
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Copyright (C) Samsung Electronics, 2014
+ *
+ * 2014         Vyacheslav Cherkashin <v.cherkashin@samsung.com>
+ *
+ */
+
+
+#define UPROBES_TRAMP_LEN      1 /* FIXME: to implement */
+
+
+struct kprobe;
+struct uprobe;
+struct uretprobe;
+struct uretprobe_instance;
+
+
+typedef u32 uprobe_opcode_t;
+
+struct arch_insn {
+       uprobe_opcode_t *insn; /* FIXME: to implement */
+};
+
+
+static inline u32 swap_get_urp_float(struct pt_regs *regs)
+{
+       WARN(1, "not implemented"); /* FIXME: to implement */
+       return 0;
+}
+
+static inline u64 swap_get_urp_double(struct pt_regs *regs)
+{
+       WARN(1, "not implemented"); /* FIXME: to implement */
+       return 0;
+}
+
+static inline unsigned long swap_get_uarg(struct pt_regs *regs, unsigned long n)
+{
+       WARN(1, "not implemented"); /* FIXME: to implement */
+       return 0x12345678;
+}
+
+static inline void swap_put_uarg(struct pt_regs *regs, unsigned long n,
+                                unsigned long val)
+{
+       WARN(1, "not implemented"); /* FIXME: to implement */
+}
+
+static inline int arch_prepare_uprobe(struct uprobe *up)
+{
+       WARN(1, "not implemented"); /* FIXME: to implement */
+       return 0;
+}
+
+static inline void arch_remove_uprobe(struct uprobe *up)
+{
+       WARN(1, "not implemented"); /* FIXME: to implement */
+}
+
+static inline int setjmp_upre_handler(struct uprobe *p, struct pt_regs *regs)
+{
+       WARN(1, "not implemented"); /* FIXME: to implement */
+       return 0;
+}
+
+static inline int longjmp_break_uhandler(struct uprobe *p,
+                                        struct pt_regs *regs)
+{
+       WARN(1, "not implemented"); /* FIXME: to implement */
+       return 0;
+}
+
+static inline int arch_arm_uprobe(struct uprobe *p)
+{
+       WARN(1, "not implemented"); /* FIXME: to implement */
+       return 0;
+}
+
+static inline void arch_disarm_uprobe(struct uprobe *p,
+                                     struct task_struct *task)
+{
+       WARN(1, "not implemented"); /* FIXME: to implement */
+}
+
+
+static inline unsigned long arch_get_trampoline_addr(struct uprobe *p,
+                                                    struct pt_regs *regs)
+{
+       WARN(1, "not implemented"); /* FIXME: to implement */
+       return 0;
+}
+
+static inline void arch_set_orig_ret_addr(unsigned long orig_ret_addr,
+                                         struct pt_regs *regs)
+{
+       WARN(1, "not implemented"); /* FIXME: to implement */
+}
+
+static inline int arch_prepare_uretprobe(struct uretprobe_instance *ri,
+                                        struct pt_regs *regs)
+{
+       WARN(1, "not implemented"); /* FIXME: to implement */
+       return 0;
+}
+
+static inline int arch_opcode_analysis_uretprobe(struct uretprobe *rp)
+{
+       WARN(1, "not implemented"); /* FIXME: to implement */
+       return 0;
+}
+
+static inline int arch_disarm_urp_inst(struct uretprobe_instance *ri,
+                                      struct task_struct *task)
+{
+       WARN(1, "not implemented"); /* FIXME: to implement */
+       return 0;
+}
+
+static inline void arch_ujprobe_return(void)
+{
+       WARN(1, "not implemented"); /* FIXME: to implement */
+}
+
+int swap_arch_init_uprobes(void);
+void swap_arch_exit_uprobes(void);
+
+
+#endif /* _ASM_ARM64_UPROBES_H */
index 5923868..7b48ccc 100644 (file)
@@ -64,6 +64,8 @@ static int entry_handler_pf(struct kretprobe_instance *ri, struct pt_regs *regs)
        data->addr = read_cr2();
        data->pf_regs = (struct pt_regs *)swap_get_karg(regs, 0);
        data->save_pc = data->pf_regs->ip;
+#elif defined(CONFIG_ARM64)
+       WARN(1, "not implemented"); /* FIXME: to implement */
 #else
        #error "this architecture is not supported"
 #endif /* CONFIG_arch */
index 5806048..d3d5d98 100644 (file)
 #include "proc_filters.h"
 #include <us_manager/sspt/sspt.h>
 
+
+#define VOIDP2PID(x)   ((pid_t)(unsigned long)(x))
+#define PID2VOIDP(x)   ((void *)(unsigned long)(x))
+
 static int check_dentry(struct task_struct *task, struct dentry *dentry)
 {
        struct vm_area_struct *vma;
@@ -66,7 +70,7 @@ static inline void free_by_dentry(struct proc_filter *self)
 static struct task_struct *call_by_tgid(struct proc_filter *self,
                                       struct task_struct *task)
 {
-       pid_t tgid = (pid_t)self->data;
+       pid_t tgid = VOIDP2PID(self->data);
 
        if (task->tgid == tgid)
                return task;
@@ -134,7 +138,7 @@ void set_pf_by_dentry(struct proc_filter *pf, struct dentry *dentry, void *priv)
 void set_pf_by_tgid(struct proc_filter *pf, pid_t tgid, void *priv)
 {
        pf->call = &call_by_tgid;
-       pf->data = (void *)tgid;
+       pf->data = PID2VOIDP(tgid);
        pf->priv = priv;
 }
 
@@ -221,7 +225,8 @@ int check_pf_by_dentry(struct proc_filter *filter, struct dentry *dentry)
  */
 int check_pf_by_tgid(struct proc_filter *filter, pid_t tgid)
 {
-       return filter->data == (void *)tgid && filter->call == &call_by_tgid;
+       return filter->data == PID2VOIDP(tgid)
+           && filter->call == &call_by_tgid;
 }
 
 /**
index a48972f..56e8f28 100644 (file)
@@ -32,6 +32,7 @@
 
 #include <kprobe/swap_slots.h>
 #include <swap-asm/swap_kprobes.h>
+#include <swap-asm/swap_uprobes.h>
 #include "us_manager_common.h"
 
 
index f7f312b..6fa27cc 100644 (file)
 /* Regs manipulations */
 #if defined(CONFIG_ARM)
 
-#define get_regs_ip(regs)           (regs->ARM_pc)    /**< Get pc reg. */
 #define get_regs_ret_func(regs)     (regs->ARM_lr)    /**< Get lr reg. */
 #define get_regs_ret_val(regs)      (regs->ARM_r0)    /**< Get ret val. */
 #define get_regs_stack_ptr(regs)    (regs->ARM_sp)    /**< Get stack pointer. */
 
 #elif defined(CONFIG_X86_32)
 
-#define get_regs_ip(regs)           (regs->ip - 1)    /**< Get ip. */
 #define get_regs_ret_val(regs)      (regs->ax)        /**< Get ret val. */
 #define get_regs_stack_ptr(regs)    (regs->sp)        /**< Get stack pointer. */
 
@@ -62,7 +60,7 @@ static inline u32 get_regs_ret_func(struct pt_regs *regs)
                sp = (u32 *)regs->sp;
                if (get_user(addr, sp))
                        pr_info("failed to dereference a pointer, sp=%p, "
-                               "pc=%lx\n", sp, get_regs_ip(regs));
+                               "pc=%lx\n", sp, regs->ip - 1);
        } else {
                sp = (u32 *)kernel_stack_pointer(regs);
                addr = *sp;
@@ -71,6 +69,14 @@ static inline u32 get_regs_ret_func(struct pt_regs *regs)
        return addr;
 }
 
+#elif defined(CONFIG_ARM64)
+
+static inline u64 get_regs_ret_func(struct pt_regs *regs)
+{
+       WARN(1, "not implemented"); /* FIXME: to implement */
+       return 0;
+}
+
 #endif /* CONFIG_arch */
 
 #endif /* __KERNEL_OPERATIONS_H__ */
index fcd0a82..81b3f0d 100644 (file)
@@ -486,7 +486,7 @@ int swap_msg_raw(void *data, size_t size)
        struct swap_msg *m = (struct swap_msg *)data;
 
        if (sizeof(*m) > size) {
-               pr_err(MSG_PREFIX "ERROR: message RAW small size=%u\n", size);
+               pr_err(MSG_PREFIX "ERROR: message RAW small size=%zu\n", size);
                return -EINVAL;
        }