[IMPROVE] add support kernel 3.12 61/23361/2
authorVyacheslav Cherkashin <v.cherkashin@samsung.com>
Tue, 24 Jun 2014 08:43:56 +0000 (12:43 +0400)
committerDmitry Kovalenko <d.kovalenko@samsung.com>
Tue, 24 Jun 2014 10:58:33 +0000 (03:58 -0700)
Change-Id: I803ffa89d24d8cbcb42bc4d97f63916ed6ea1f08
Signed-off-by: Vyacheslav Cherkashin <v.cherkashin@samsung.com>
kprobe/arch/asm-x86/swap_kprobes.c
kprobe/swap_kprobes_deps.c
kprobe/swap_kprobes_deps.h
us_manager/us_manager_common.h

index 9bc1f6c..3f1226a 100644 (file)
@@ -844,7 +844,11 @@ int arch_init_module_deps()
        if (swap_text_poke == NULL)
                goto not_found;
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 5, 0)
        sym = "show_registers";
+#else /* LINUX_VERSION_CODE < KERNEL_VERSION(3, 5, 0) */
+       sym = "show_regs";
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3, 5, 0) */
        swap_show_registers = (void *)swap_ksyms(sym);
        if (swap_show_registers == NULL)
                goto not_found;
index 008910c..275a3b0 100644 (file)
@@ -80,7 +80,7 @@ DECLARE_MOD_DEP_WRAPPER(swap_do_mmap_pgoff,
                        unsigned long flags, unsigned long pgoff,
                        unsigned long *populate)
 IMP_MOD_DEP_WRAPPER(do_mmap_pgoff, file, addr, len, prot, flags, pgoff, populate)
-#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0) /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) */
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0)
 DECLARE_MOD_FUNC_DEP(do_mmap_pgoff, unsigned long, struct file *file, unsigned long addr, unsigned long len, unsigned long prot, unsigned long flags, unsigned long pgoff);
 DECLARE_MOD_DEP_WRAPPER(swap_do_mmap_pgoff,
                        unsigned long,
@@ -88,7 +88,7 @@ DECLARE_MOD_DEP_WRAPPER(swap_do_mmap_pgoff,
                        unsigned long len, unsigned long prot,
                        unsigned long flags, unsigned long pgoff)
 IMP_MOD_DEP_WRAPPER(do_mmap_pgoff, file, addr, len, prot, flags, pgoff)
-#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0) */
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0) */
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0)
 EXPORT_SYMBOL_GPL(swap_do_mmap_pgoff);
@@ -124,13 +124,6 @@ static DECLARE_MOD_FUNC_DEP(get_gate_vma, struct vm_area_struct *, struct mm_str
 static DECLARE_MOD_FUNC_DEP(get_gate_vma, struct vm_area_struct *, struct task_struct *tsk);
 #endif /* LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 38) */
 
-#ifdef CONFIG_HUGETLB_PAGE
-DECLARE_MOD_FUNC_DEP(follow_hugetlb_page, int, struct mm_struct *mm, \
-               struct vm_area_struct *vma, struct page **pages, \
-               struct vm_area_struct **vmas, unsigned long *position, int *length, \
-               int i, int write);
-#endif
-
 #ifdef __HAVE_ARCH_GATE_AREA
 #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 38)
 DECLARE_MOD_FUNC_DEP(in_gate_area, int, struct mm_struct *mm, unsigned long addr);
@@ -216,13 +209,39 @@ IMP_MOD_DEP_WRAPPER (get_gate_vma, tsk)
 #endif /* LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 38) */
 
 #ifdef CONFIG_HUGETLB_PAGE
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0)
+DECLARE_MOD_FUNC_DEP(follow_hugetlb_page,                                      \
+                    int,                                                       \
+                    struct mm_struct *mm, struct vm_area_struct *vma,          \
+                    struct page **pages, struct vm_area_struct **vmas,         \
+                    unsigned long *position, int *length, int i,               \
+                    unsigned int flags);
 DECLARE_MOD_DEP_WRAPPER(swap_follow_hugetlb_page,
                        int,
                        struct mm_struct *mm, struct vm_area_struct *vma,
                        struct page **pages, struct vm_area_struct **vmas,
                        unsigned long *position, int *length, int i,
-                       unsigned int write)
-       IMP_MOD_DEP_WRAPPER (follow_hugetlb_page, mm, vma, pages, vmas, position, length, i, write)
+                       unsigned int flags)
+IMP_MOD_DEP_WRAPPER(follow_hugetlb_page,                                       \
+                   mm, vma, pages, vmas, position, length, i, flags)
+#else /* LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0) */
+DECLARE_MOD_FUNC_DEP(follow_hugetlb_page,                                      \
+                    long,                                                      \
+                    struct mm_struct *mm, struct vm_area_struct *vma,          \
+                    struct page **pages, struct vm_area_struct **vmas,         \
+                    unsigned long *position, unsigned long *nr_pages,          \
+                    long i, unsigned int flags);
+DECLARE_MOD_DEP_WRAPPER(swap_follow_hugetlb_page,
+                       long,
+                       struct mm_struct *mm, struct vm_area_struct *vma,
+                       struct page **pages, struct vm_area_struct **vmas,
+                       unsigned long *position, unsigned long *nr_pages,
+                       long i, unsigned int flags)
+IMP_MOD_DEP_WRAPPER(follow_hugetlb_page,                                       \
+                   mm, vma, pages, vmas, position, nr_pages, i, flags)
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0) */
+
 #else /* CONFIG_HUGETLB_PAGE */
 #define swap_follow_hugetlb_page follow_hugetlb_page
 #endif /* CONFIG_HUGETLB_PAGE */
index da58074..06a57e6 100644 (file)
@@ -96,5 +96,16 @@ int access_process_vm_atomic(struct task_struct *tsk, unsigned long addr, void *
 #define write_proc_vm_atomic(tsk, addr, buf, len)      access_process_vm_atomic (tsk, addr, buf, len, 1)
 int page_present (struct mm_struct *mm, unsigned long addr);
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)
+unsigned long swap_do_mmap_pgoff(struct file *file, unsigned long addr,
+                                unsigned long len, unsigned long prot,
+                                unsigned long flags, unsigned long pgoff,
+                                unsigned long *populate);
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0)
+unsigned long swap_do_mmap_pgoff(struct file *file, unsigned long addr,
+                                unsigned long len, unsigned long prot,
+                                unsigned long flags, unsigned long pgoff);
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0) */
+
 
 #endif /* _SWAP_KPROBES_DEPS_H */
index 13ad9dc..f190be2 100644 (file)
 #include <linux/mm.h>
 #include <linux/version.h>
 
+/*
+ * TODO: move declaration and definition swap_do_mmap_pgoff()
+ *       from swap_kprobe.ko to swap_us_manager.ko
+ */
+#include <kprobe/swap_kprobes_deps.h>
+
 
 static inline unsigned long swap_do_mmap(struct file *filp, unsigned long addr,
                                         unsigned long len, unsigned long prot,