X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=wrapper%2Fkallsyms.c;h=5d0272032abc4001b6b268198b244a8bb1a3e889;hb=53772db24facd84f1f3ddcf21a1ef5f162608721;hp=6af77f538950d7b3718bd33fffb749053ae03333;hpb=d551a26d9a6bf87e80708ad8a35f49111442bf11;p=lttng-modules.git diff --git a/wrapper/kallsyms.c b/wrapper/kallsyms.c index 6af77f53..5d027203 100644 --- a/wrapper/kallsyms.c +++ b/wrapper/kallsyms.c @@ -14,7 +14,7 @@ #include #include -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,7,0)) +#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,7,0)) #ifndef CONFIG_KPROBES # error "LTTng-modules requires CONFIG_KPROBES on kernels >= 5.7.0" @@ -39,10 +39,26 @@ unsigned long do_get_kallsyms(void) memset(&probe, 0, sizeof(probe)); probe.pre_handler = dummy_kprobe_handler; probe.symbol_name = "kallsyms_lookup_name"; +#ifdef PPC64_ELF_ABI_v2 + /* + * With powerpc64 ABIv2, we need the global entry point of + * kallsyms_lookup_name to call it later, while kprobe_register would + * automatically adjust the global entry point to the local entry point, + * when a kprobe was registered at a function entry. So we add 4 bytes + * which is the length of one instruction to kallsyms_lookup_name to + * avoid the adjustment. + */ + probe.offset = 4; +#endif ret = register_kprobe(&probe); if (ret) return 0; +#ifdef PPC64_ELF_ABI_v2 + /* Substract 4 bytes to get what we originally want */ + addr = (unsigned long)(((char *)probe.addr) - 4); +#else addr = (unsigned long)probe.addr; +#endif #ifdef CONFIG_ARM #ifdef CONFIG_THUMB2_KERNEL if (addr)