diff options
-rw-r--r-- | libdde_linux26/include/linux/spinlock.h | 10 | ||||
-rw-r--r-- | libdde_linux26/lib/src/arch/l4/cli_sti.c | 15 |
2 files changed, 23 insertions, 2 deletions
diff --git a/libdde_linux26/include/linux/spinlock.h b/libdde_linux26/include/linux/spinlock.h index f038d145..6830752b 100644 --- a/libdde_linux26/include/linux/spinlock.h +++ b/libdde_linux26/include/linux/spinlock.h @@ -372,6 +372,10 @@ extern int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock); #else /* DDE_LINUX */ +unsigned long fake_local_irq_disable_flags(void); +void fake_local_irq_enable(void); +void fake_local_irq_restore(unsigned long flags); + #define spin_lock_init(l) \ do { \ ddekit_lock_init(&(l)->ddekit_lock); \ @@ -394,7 +398,7 @@ extern int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock); #define read_lock(lock) spin_lock(lock) #define write_lock(lock) spin_lock(lock) -#define spin_lock_irq(lock) spin_lock(lock) +#define spin_lock_irq(lock) fake_local_irq_disable_flags(); spin_lock(lock) #define spin_lock_bh(lock) spin_lock(lock) #define read_lock_irq(lock) spin_lock_irq(lock) #define read_lock_bh(lock) spin_lock_bh(lock) @@ -411,7 +415,7 @@ extern int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock); #define read_unlock(lock) spin_unlock(lock) #define write_unlock(lock) spin_unlock(lock) -#define spin_unlock_irq(lock) spin_unlock(lock) +#define spin_unlock_irq(lock) spin_unlock(lock); fake_local_irq_enable() #define spin_unlock_bh(lock) spin_unlock(lock) #define read_unlock_irq(lock) spin_unlock_irq(lock) #define read_unlock_bh(lock) spin_unlock_bh(lock) @@ -420,6 +424,7 @@ extern int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock); #define spin_lock_irqsave(lock, flags) \ do { \ + flags = fake_local_irq_disable_flags(); \ spin_lock(lock);\ } while (0); @@ -429,6 +434,7 @@ extern int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock); #define spin_unlock_irqrestore(lock, flags) \ do { \ spin_unlock(lock); \ + fake_local_irq_restore (flags); \ } while (0); #define read_unlock_irqrestore(lock, flags) spin_unlock_irqrestore(lock, flags) diff --git a/libdde_linux26/lib/src/arch/l4/cli_sti.c b/libdde_linux26/lib/src/arch/l4/cli_sti.c index 3f5ba4cf..051f2598 100644 --- a/libdde_linux26/lib/src/arch/l4/cli_sti.c +++ b/libdde_linux26/lib/src/arch/l4/cli_sti.c @@ -39,6 +39,21 @@ static int nested_lock(ddekit_lock_t lock) return do_lock; } +unsigned long fake_local_irq_disable_flags(void) +{ + return atomic_add_return (1, &_refcnt) - 1; +} + +void fake_local_irq_enable(void) +{ + atomic_set(&_refcnt, 0); +} + +void fake_local_irq_restore(unsigned long flags) +{ + atomic_set(&_refcnt, flags); +} + /* Store the current flags state. * * This is done by returning the current refcnt. |