1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16#ifndef __ASM_IRQFLAGS_H
17#define __ASM_IRQFLAGS_H
18
19#ifdef __KERNEL__
20
21#include <asm/ptrace.h>
22
23
24
25
26static inline unsigned long arch_local_irq_save(void)
27{
28 unsigned long flags;
29 asm volatile(
30 "mrs %0, daif // arch_local_irq_save\n"
31 "msr daifset, #2"
32 : "=r" (flags)
33 :
34 : "memory");
35 return flags;
36}
37
38static inline void arch_local_irq_enable(void)
39{
40 asm volatile(
41 "msr daifclr, #2 // arch_local_irq_enable"
42 :
43 :
44 : "memory");
45}
46
47static inline void arch_local_irq_disable(void)
48{
49 asm volatile(
50 "msr daifset, #2 // arch_local_irq_disable"
51 :
52 :
53 : "memory");
54}
55
56#define local_fiq_enable() asm("msr daifclr, #1" : : : "memory")
57#define local_fiq_disable() asm("msr daifset, #1" : : : "memory")
58
59#define local_async_enable() asm("msr daifclr, #4" : : : "memory")
60#define local_async_disable() asm("msr daifset, #4" : : : "memory")
61
62
63
64
65static inline unsigned long arch_local_save_flags(void)
66{
67 unsigned long flags;
68 asm volatile(
69 "mrs %0, daif // arch_local_save_flags"
70 : "=r" (flags)
71 :
72 : "memory");
73 return flags;
74}
75
76
77
78
79static inline void arch_local_irq_restore(unsigned long flags)
80{
81 asm volatile(
82 "msr daif, %0 // arch_local_irq_restore"
83 :
84 : "r" (flags)
85 : "memory");
86}
87
88static inline int arch_irqs_disabled_flags(unsigned long flags)
89{
90 return flags & PSR_I_BIT;
91}
92
93
94
95
96#define local_dbg_save(flags) \
97 do { \
98 typecheck(unsigned long, flags); \
99 asm volatile( \
100 "mrs %0, daif // local_dbg_save\n" \
101 "msr daifset, #8" \
102 : "=r" (flags) : : "memory"); \
103 } while (0)
104
105#define local_dbg_restore(flags) \
106 do { \
107 typecheck(unsigned long, flags); \
108 asm volatile( \
109 "msr daif, %0 // local_dbg_restore\n" \
110 : : "r" (flags) : "memory"); \
111 } while (0)
112
113#endif
114#endif
115