]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - kernel/extable.c
Merge branch 'sched/clock' into tracing/ftrace
[karo-tx-linux.git] / kernel / extable.c
index a26cb2e170237d849c9f87038a6def48ee948dd6..0df6253730bedff8ab66a0aa8dfbe9968db0b564 100644 (file)
@@ -17,6 +17,7 @@
 */
 #include <linux/module.h>
 #include <linux/init.h>
+#include <linux/ftrace.h>
 #include <asm/uaccess.h>
 #include <asm/sections.h>
 
@@ -66,3 +67,19 @@ int kernel_text_address(unsigned long addr)
                return 1;
        return module_text_address(addr) != NULL;
 }
+
+/*
+ * On some architectures (PPC64, IA64) function pointers
+ * are actually only tokens to some data that then holds the
+ * real function address. As a result, to find if a function
+ * pointer is part of the kernel text, we need to do some
+ * special dereferencing first.
+ */
+int func_ptr_is_kernel_text(void *ptr)
+{
+       unsigned long addr;
+       addr = (unsigned long) dereference_function_descriptor(ptr);
+       if (core_kernel_text(addr))
+               return 1;
+       return module_text_address(addr) != NULL;
+}