]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/dde/linux26/lib/src/arch/l4/cli_sti.c
81c4feea9bcdacb1b14a2b72175060a9f66ea35d
[l4.git] / l4 / pkg / dde / linux26 / lib / src / arch / l4 / cli_sti.c
1 #include "local.h"
2
3 #include <linux/kernel.h>
4
5 /* IRQ lock reference counter */
6 static atomic_t      _refcnt   = ATOMIC_INIT(0);
7
8 /* Check whether IRQs are currently disabled.
9  *
10  * This is the case, if flags is greater than 0.
11  */
12
13 int raw_irqs_disabled_flags(unsigned long flags)
14 {
15         return ((int)flags > 0);
16 }
17
18 /* Store the current flags state.
19  *
20  * This is done by returning the current refcnt.
21  *
22  * XXX: Up to now, flags was always 0 at this point and
23  *      I assume that this is always the case. Prove?
24  */
25 unsigned long __raw_local_save_flags(void)
26 {
27         return (unsigned long)atomic_read(&_refcnt);
28 }
29
30 /* Restore IRQ state. */
31 void raw_local_irq_restore(unsigned long flags)
32 {
33         atomic_set(&_refcnt, flags);
34 }
35
36 /* Disable IRQs by grabbing the IRQ lock. */
37 void raw_local_irq_disable(void)
38 {
39         atomic_inc(&_refcnt);
40 }
41
42 /* Unlock the IRQ lock until refcnt is 0. */
43 void raw_local_irq_enable(void)
44 {
45         atomic_set(&_refcnt, 0);
46 }
47
48
49 void raw_safe_halt(void)
50 {
51         WARN_UNIMPL;
52 }
53
54
55 void halt(void)
56 {
57         WARN_UNIMPL;
58 }
59
60 /* These functions are empty for DDE. Every DDE thread is a separate
61  * "virtual" CPU. Therefore there is no need to en/disable bottom halves.
62  */
63 void local_bh_disable(void) {}
64 void __local_bh_enable(void) {}
65 void _local_bh_enable(void) {}
66 void local_bh_enable(void) {}