aboutsummaryrefslogtreecommitdiffstats
path: root/arch/score/include/asm/irqflags.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/score/include/asm/irqflags.h')
-rw-r--r--arch/score/include/asm/irqflags.h111
1 files changed, 111 insertions, 0 deletions
diff --git a/arch/score/include/asm/irqflags.h b/arch/score/include/asm/irqflags.h
new file mode 100644
index 000000000000..92eeb33dd72b
--- /dev/null
+++ b/arch/score/include/asm/irqflags.h
@@ -0,0 +1,111 @@
1#ifndef _ASM_SCORE_IRQFLAGS_H
2#define _ASM_SCORE_IRQFLAGS_H
3
4#ifndef __ASSEMBLY__
5
6#define raw_local_irq_save(x) \
7{ \
8 __asm__ __volatile__( \
9 "mfcr r8, cr0;" \
10 "li r9, 0xfffffffe;" \
11 "nop;" \
12 "mv %0, r8;" \
13 "and r8, r8, r9;" \
14 "mtcr r8, cr0;" \
15 "nop;" \
16 "nop;" \
17 "nop;" \
18 "nop;" \
19 "nop;" \
20 "ldi r9, 0x1;" \
21 "and %0, %0, r9;" \
22 : "=r" (x) \
23 : \
24 : "r8", "r9" \
25 ); \
26}
27
28#define raw_local_irq_restore(x) \
29{ \
30 __asm__ __volatile__( \
31 "mfcr r8, cr0;" \
32 "ldi r9, 0x1;" \
33 "and %0, %0, r9;" \
34 "or r8, r8, %0;" \
35 "mtcr r8, cr0;" \
36 "nop;" \
37 "nop;" \
38 "nop;" \
39 "nop;" \
40 "nop;" \
41 : \
42 : "r"(x) \
43 : "r8", "r9" \
44 ); \
45}
46
47#define raw_local_irq_enable(void) \
48{ \
49 __asm__ __volatile__( \
50 "mfcr\tr8,cr0;" \
51 "nop;" \
52 "nop;" \
53 "ori\tr8,0x1;" \
54 "mtcr\tr8,cr0;" \
55 "nop;" \
56 "nop;" \
57 "nop;" \
58 "nop;" \
59 "nop;" \
60 : \
61 : \
62 : "r8"); \
63}
64
65#define raw_local_irq_disable(void) \
66{ \
67 __asm__ __volatile__( \
68 "mfcr\tr8,cr0;" \
69 "nop;" \
70 "nop;" \
71 "srli\tr8,r8,1;" \
72 "slli\tr8,r8,1;" \
73 "mtcr\tr8,cr0;" \
74 "nop;" \
75 "nop;" \
76 "nop;" \
77 "nop;" \
78 "nop;" \
79 : \
80 : \
81 : "r8"); \
82}
83
84#define raw_local_save_flags(x) \
85{ \
86 __asm__ __volatile__( \
87 "mfcr r8, cr0;" \
88 "nop;" \
89 "nop;" \
90 "mv %0, r8;" \
91 "nop;" \
92 "nop;" \
93 "nop;" \
94 "nop;" \
95 "nop;" \
96 "ldi r9, 0x1;" \
97 "and %0, %0, r9;" \
98 : "=r" (x) \
99 : \
100 : "r8", "r9" \
101 ); \
102}
103
104static inline int raw_irqs_disabled_flags(unsigned long flags)
105{
106 return !(flags & 1);
107}
108
109#endif
110
111#endif /* _ASM_SCORE_IRQFLAGS_H */