Commit | Line | Data |
---|---|---|
9f36eaed MJ |
1 | /* SPDX-License-Identifier: (GPL-2.0 or LGPL-2.1) |
2 | * | |
79150a49 JD |
3 | * wrapper/irqflags.h |
4 | * | |
5 | * wrapper around IRQ flags. | |
6 | * | |
7 | * Copyright (C) 2015 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> | |
79150a49 JD |
8 | */ |
9 | ||
9f36eaed MJ |
10 | #ifndef _LTTNG_WRAPPER_IRQFLAGS_H |
11 | #define _LTTNG_WRAPPER_IRQFLAGS_H | |
12 | ||
79150a49 JD |
13 | #include <linux/version.h> |
14 | #include <linux/irqflags.h> | |
15 | ||
16 | #ifdef CONFIG_X86 | |
17 | ||
18 | static inline | |
19 | int lttng_regs_irqs_disabled(struct pt_regs *regs) | |
20 | { | |
21 | unsigned long flags = regs->flags; | |
22 | ||
2817cac0 | 23 | return raw_irqs_disabled_flags(flags); |
79150a49 JD |
24 | } |
25 | ||
26 | #else | |
27 | /* | |
28 | * lttng_regs_irqs_disabled() returns -1 if irqoff state is unknown. | |
29 | * TODO: should implement lttng_regs_irqs_disabled for each architecture | |
30 | * to add interruptible context for kprobes and kretprobes. | |
31 | */ | |
32 | ||
33 | static inline | |
34 | int lttng_regs_irqs_disabled(struct pt_regs *regs) | |
35 | { | |
36 | return -1; | |
37 | } | |
38 | #endif | |
39 | ||
40 | #endif /* _LTTNG_WRAPPER_IRQFLAGS_H */ |