Commit 33978cf6 authored by Philippe Gerum's avatar Philippe Gerum

ARM/atomic: ipipe: protect against domain preemption

parent 5b8d5daa
......@@ -168,9 +168,9 @@ static inline void atomic_##op(int i, atomic_t *v) \
{ \
unsigned long flags; \
\
raw_local_irq_save(flags); \
flags = hard_local_irq_save(); \
v->counter c_op i; \
raw_local_irq_restore(flags); \
hard_local_irq_restore(flags); \
} \
#define ATOMIC_OP_RETURN(op, c_op, asm_op) \
......@@ -179,10 +179,10 @@ static inline int atomic_##op##_return(int i, atomic_t *v) \
unsigned long flags; \
int val; \
\
raw_local_irq_save(flags); \
flags = hard_local_irq_save(); \
v->counter c_op i; \
val = v->counter; \
raw_local_irq_restore(flags); \
hard_local_irq_restore(flags); \
\
return val; \
}
......@@ -193,10 +193,10 @@ static inline int atomic_fetch_##op(int i, atomic_t *v) \
unsigned long flags; \
int val; \
\
raw_local_irq_save(flags); \
flags = hard_local_irq_save(); \
val = v->counter; \
v->counter c_op i; \
raw_local_irq_restore(flags); \
hard_local_irq_restore(flags); \
\
return val; \
}
......@@ -206,11 +206,11 @@ static inline int atomic_cmpxchg(atomic_t *v, int old, int new)
int ret;
unsigned long flags;
raw_local_irq_save(flags);
flags = hard_local_irq_save();
ret = v->counter;
if (likely(ret == old))
v->counter = new;
raw_local_irq_restore(flags);
hard_local_irq_restore(flags);
return ret;
}
......
......@@ -40,9 +40,9 @@ static inline void ____atomic_set_bit(unsigned int bit, volatile unsigned long *
p += BIT_WORD(bit);
raw_local_irq_save(flags);
flags = hard_local_irq_save();
*p |= mask;
raw_local_irq_restore(flags);
hard_local_irq_restore(flags);
}
static inline void ____atomic_clear_bit(unsigned int bit, volatile unsigned long *p)
......@@ -52,9 +52,9 @@ static inline void ____atomic_clear_bit(unsigned int bit, volatile unsigned long
p += BIT_WORD(bit);
raw_local_irq_save(flags);
flags = hard_local_irq_save();
*p &= ~mask;
raw_local_irq_restore(flags);
hard_local_irq_restore(flags);
}
static inline void ____atomic_change_bit(unsigned int bit, volatile unsigned long *p)
......@@ -64,9 +64,9 @@ static inline void ____atomic_change_bit(unsigned int bit, volatile unsigned lon
p += BIT_WORD(bit);
raw_local_irq_save(flags);
flags = hard_local_irq_save();
*p ^= mask;
raw_local_irq_restore(flags);
hard_local_irq_restore(flags);
}
static inline int
......@@ -78,10 +78,10 @@ ____atomic_test_and_set_bit(unsigned int bit, volatile unsigned long *p)
p += BIT_WORD(bit);
raw_local_irq_save(flags);
flags = hard_local_irq_save();
res = *p;
*p = res | mask;
raw_local_irq_restore(flags);
hard_local_irq_restore(flags);
return (res & mask) != 0;
}
......@@ -95,10 +95,10 @@ ____atomic_test_and_clear_bit(unsigned int bit, volatile unsigned long *p)
p += BIT_WORD(bit);
raw_local_irq_save(flags);
flags = hard_local_irq_save();
res = *p;
*p = res & ~mask;
raw_local_irq_restore(flags);
hard_local_irq_restore(flags);
return (res & mask) != 0;
}
......@@ -112,10 +112,10 @@ ____atomic_test_and_change_bit(unsigned int bit, volatile unsigned long *p)
p += BIT_WORD(bit);
raw_local_irq_save(flags);
flags = hard_local_irq_save();
res = *p;
*p = res ^ mask;
raw_local_irq_restore(flags);
hard_local_irq_restore(flags);
return (res & mask) != 0;
}
......
......@@ -77,17 +77,17 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr, int size
#error SMP is not supported on this platform
#endif
case 1:
raw_local_irq_save(flags);
flags = hard_local_irq_save();
ret = *(volatile unsigned char *)ptr;
*(volatile unsigned char *)ptr = x;
raw_local_irq_restore(flags);
hard_local_irq_restore(flags);
break;
case 4:
raw_local_irq_save(flags);
flags = hard_local_irq_save();
ret = *(volatile unsigned long *)ptr;
*(volatile unsigned long *)ptr = x;
raw_local_irq_restore(flags);
hard_local_irq_restore(flags);
break;
#else
case 1:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment