X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=include%2Finstrumentation%2Fevents%2Farch%2Fx86%2Fexceptions.h;h=89769e2ce3de7dd98ffd17fc54e181cb7b2b77ba;hb=1efbdb9f014bb9378a6cba60fad47a8e906b8e45;hp=b322f3e75be0dd17cec816dc74d045762a8a96ec;hpb=4f47ccf08dfac3d5db7553eb8b40bdab19764727;p=lttng-modules.git diff --git a/include/instrumentation/events/arch/x86/exceptions.h b/include/instrumentation/events/arch/x86/exceptions.h index b322f3e7..89769e2c 100644 --- a/include/instrumentation/events/arch/x86/exceptions.h +++ b/include/instrumentation/events/arch/x86/exceptions.h @@ -3,11 +3,52 @@ #define LTTNG_TRACE_EXCEPTIONS_H #include -#include +#include + +#ifdef CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM +#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,15,0)) +#include <../arch/x86/include/asm/traps.h> +#else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,15,0)) */ + +/* Only define this enum once. */ + +#ifndef ONCE_LTTNG_EXCEPTIONS_H +#define ONCE_LTTNG_EXCEPTIONS_H + +enum { + X86_PF_PROT = 1 << 0, + X86_PF_WRITE = 1 << 1, + X86_PF_USER = 1 << 2, + X86_PF_RSVD = 1 << 3, + X86_PF_INSTR = 1 << 4, +#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,6,0)) + X86_PF_PK = 1 << 5, +#endif /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,6,0)) */ +}; + +#endif /* ONCE_LTTNG_EXCEPTIONS_H */ + +#endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,15,0)) */ +#endif /* CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM */ #undef TRACE_SYSTEM #define TRACE_SYSTEM x86_exceptions +#ifdef CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM +LTTNG_TRACEPOINT_ENUM(lttng_x86_pf_error_code, + TP_ENUM_VALUES( + ctf_enum_value("PROTECTION_FAULT", X86_PF_PROT) + ctf_enum_value("WRITE_ACCESS", X86_PF_WRITE) + ctf_enum_value("USER_MODE", X86_PF_USER) + ctf_enum_value("RESERVED_BIT", X86_PF_RSVD) + ctf_enum_value("INSTRUCTION_FETCH", X86_PF_INSTR) +#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,6,0)) + ctf_enum_value("PROTECTION_KEYS_BLOCK", X86_PF_PK) +#endif /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,6,0)) */ + ) +) +#endif /* CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM */ + LTTNG_TRACEPOINT_EVENT_CLASS(x86_exceptions_class, TP_PROTO(unsigned long address, struct pt_regs *regs, @@ -24,7 +65,11 @@ LTTNG_TRACEPOINT_EVENT_CLASS(x86_exceptions_class, * Currently, only 5 low bits are used. Should be made * larger if error codes are added to the kernel. */ +#ifdef CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM + ctf_enum(lttng_x86_pf_error_code, unsigned char, error_code, error_code) +#else ctf_integer_hex(unsigned char, error_code, error_code) +#endif ) )