Save and restore whole IE register instead of just the lower bit.
---
 arch/lm32/include/asm/irqflags.h |   39 ++++++++++++++-----------------------
 1 files changed, 15 insertions(+), 24 deletions(-)

diff --git a/arch/lm32/include/asm/irqflags.h b/arch/lm32/include/asm/irqflags.h
index ff7688f..22157a6 100644
--- a/arch/lm32/include/asm/irqflags.h
+++ b/arch/lm32/include/asm/irqflags.h
@@ -3,38 +3,36 @@
 
 static inline void arch_local_irq_disable(void)
 {
-       unsigned int ie;
+       unsigned long ie;
        asm volatile (
-               "rcsr %0, IE\n" \
-               "andi %0, %0, 0xfffe\n" \
-               "wcsr IE, %0\n" \
-               : "=r"(ie) \
+               "rcsr %0, IE\n"
+               "andi %0, %0, 0xfffe\n"
+               "wcsr IE, %0\n"
+               : "=r"(ie)
        );
 }
 
 static inline unsigned long arch_local_save_flags(void)
 {
-       unsigned long ie;
-       asm volatile ("rcsr %0, IE\n" : "=r" (ie));
-       return ie;
+       unsigned long flags;
+       asm volatile ("rcsr %0, IE\n" : "=r" (flags));
+       return flags;
 }
 
 static inline unsigned long arch_local_irq_save(void)
 {
-       unsigned int old_ie, new_ie;
+       unsigned long flags;
        asm volatile (
-               "rcsr %1, IE\n" \
-               "andi %0, %1, 0xfffe\n" \
-               "wcsr IE, %0\n" \
-               "andi %1, %1, 1\n" \
-               : "=r"(new_ie), "=r"(old_ie) \
+               "rcsr %0, IE\n"
+               "wcsr IE, r0\n"
+               : "=r"(flags)
        );
-       return old_ie;
+       return flags;
 }
 
 static inline void arch_local_irq_enable(void)
 {
-       unsigned int ie;
+       unsigned long ie;
        asm volatile (
                "rcsr %0, IE\n"
                "ori %0, %0, 1\n"
@@ -44,14 +42,7 @@ static inline void arch_local_irq_enable(void)
 
 static inline void arch_local_irq_restore(unsigned long flags)
 {
-       unsigned int ie;
-       asm volatile ( \
-               "andi %1, %1, 0x0001\n" \
-               "rcsr %0, IE\n" \
-               "andi %0, %0, 0xfffe\n" \
-               "or %0, %0, %1\n" \
-               "wcsr IE, %0\n": \
-                "=&r" (ie): "r" (flags) );
+       asm volatile ("wcsr IE, %0\n" : : "r"(flags));
 }
 
 static inline int arch_irqs_disabled_flags(unsigned long flags)
-- 
1.7.2.5

_______________________________________________
http://lists.milkymist.org/listinfo.cgi/devel-milkymist.org
IRC: #milkymist@Freenode
Twitter: www.twitter.com/milkymistvj
Ideas? http://milkymist.uservoice.com

Reply via email to