mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-26 06:33:19 -04:00
[POWERPC] Make soft_enabled irqs preempt safe
Rewrite local_get_flags and local_irq_disable to use r13 explicitly, to avoid the risk that gcc will split get_paca()->soft_enabled into a sequence unsafe against preemption. Similar care in local_irq_restore. Signed-off-by: Hugh Dickins <hugh@veritas.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
This commit is contained in:
parent
56291e19e3
commit
ef2b343e99
2 changed files with 67 additions and 10 deletions
|
|
@ -18,15 +18,25 @@ extern void timer_interrupt(struct pt_regs *);
|
|||
|
||||
static inline unsigned long local_get_flags(void)
|
||||
{
|
||||
return get_paca()->soft_enabled;
|
||||
unsigned long flags;
|
||||
|
||||
__asm__ __volatile__("lbz %0,%1(13)"
|
||||
: "=r" (flags)
|
||||
: "i" (offsetof(struct paca_struct, soft_enabled)));
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
static inline unsigned long local_irq_disable(void)
|
||||
{
|
||||
unsigned long flag = get_paca()->soft_enabled;
|
||||
get_paca()->soft_enabled = 0;
|
||||
barrier();
|
||||
return flag;
|
||||
unsigned long flags, zero;
|
||||
|
||||
__asm__ __volatile__("li %1,0; lbz %0,%2(13); stb %1,%2(13)"
|
||||
: "=r" (flags), "=&r" (zero)
|
||||
: "i" (offsetof(struct paca_struct, soft_enabled))
|
||||
: "memory");
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
extern void local_irq_restore(unsigned long);
|
||||
|
|
|
|||
Loading…
Reference in a new issue