/* * perf_hooks.c * * Copyright (C) 2016 Wang Nan * Copyright (C) 2016 Huawei Inc. */ #include #include #include #include #include "util/util.h" #include "util/debug.h" #include "util/perf-hooks.h" static sigjmp_buf jmpbuf; static const struct perf_hook_desc *current_perf_hook; void perf_hooks__invoke(const struct perf_hook_desc *desc) { if (!(desc && desc->p_hook_func && *desc->p_hook_func)) return; if (sigsetjmp(jmpbuf, 1)) { pr_warning("Fatal error (SEGFAULT) in perf hook '%s'\n", desc->hook_name); *(current_perf_hook->p_hook_func) = NULL; } else { current_perf_hook = desc; (**desc->p_hook_func)(desc->hook_ctx); } current_perf_hook = NULL; } void perf_hooks__recover(void) { if (current_perf_hook) siglongjmp(jmpbuf, 1); } #define PERF_HOOK(name) \ perf_hook_func_t __perf_hook_func_##name = NULL; \ struct perf_hook_desc __perf_hook_desc_##name = \ {.hook_name = #name, \ .p_hook_func = &__perf_hook_func_##name, \ .hook_ctx = NULL}; #include "perf-hooks-list.h" #undef PERF_HOOK #define PERF_HOOK(name) \ &__perf_hook_desc_##name, static struct perf_hook_desc *perf_hooks[] = { #include "perf-hooks-list.h" }; #undef PERF_HOOK int perf_hooks__set_hook(const char *hook_name, perf_hook_func_t hook_func, void *hook_ctx) { unsigned int i; for (i = 0; i < ARRAY_SIZE(perf_hooks); i++) { if (strcmp(hook_name, perf_hooks[i]->hook_name) != 0) continue; if (*(perf_hooks[i]->p_hook_func)) pr_warning("Overwrite existing hook: %s\n", hook_name); *(perf_hooks[i]->p_hook_func) = hook_func; perf_hooks[i]->hook_ctx = hook_ctx; return 0; } return -ENOENT; } perf_hook_func_t perf_hooks__get_hook(const char *hook_name) { unsigned int i; for (i = 0; i < ARRAY_SIZE(perf_hooks); i++) { if (strcmp(hook_name, perf_hooks[i]->hook_name) != 0) continue; return *(perf_hooks[i]->p_hook_func); } return ERR_PTR(-ENOENT); } href='/cgit.cgi/linux/net-next.git/commit/include/net/irda/irmod.h?h=nds-private-remove&id=b5b46c4740aed1538544f0fa849c5b76c7823469'>commitdiff
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2017-01-18 14:29:21 +0100
committerIngo Molnar <mingo@kernel.org>2017-01-19 08:39:44 +0100
commitb5b46c4740aed1538544f0fa849c5b76c7823469 (patch)
tree125e7aced4835bad6f6a0c0d02d012f333caf922 /include/net/irda/irmod.h
parentfa19a769f82fb9a5ca000b83cacd13fcaeda51ac (diff)
objtool: Fix IRET's opcode
The IRET opcode is 0xcf according to the Intel manual and also to objdump of my vmlinux: 1ea8: 48 cf iretq Fix the opcode in arch_decode_instruction(). The previous value (0xc5) seems to correspond to LDS. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Acked-by: Josh Poimboeuf <jpoimboe@redhat.com> Cc: Andy Lutomirski <luto@kernel.org> Cc: Borislav Petkov <bp@alien8.de> Cc: Brian Gerst <brgerst@gmail.com> Cc: Denys Vlasenko <dvlasenk@redhat.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/20170118132921.19319-1-jslaby@suse.cz Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'include/net/irda/irmod.h')