I've been complaining about sloppy use of macros a few time.
In lm32.h, the chicken are finally coming home to roost.
What happened there was that in one case an
lm32_interrupt_mask(1 << X)
turned into
im &= ~1 << X;
while it should be
im &= ~(1 << X);
This patch adds proper protection to the arguments. This makes the
"lag" (which was in fact the disabling of the interrupt that made
system time tick) disappear.
There are some more things that are odd but not incorrect, such as
the parentheses around ~0x0001, so I didn't touch them.
- Werner
Index: cpukit/score/cpu/lm32/rtems/score/lm32.h
===================================================================
RCS file: /usr1/CVS/rtems/cpukit/score/cpu/lm32/rtems/score/lm32.h,v
retrieving revision 1.4
diff -u -r1.4 lm32.h
--- cpukit/score/cpu/lm32/rtems/score/lm32.h 11 Feb 2011 08:57:36 -0000
1.4
+++ cpukit/score/cpu/lm32/rtems/score/lm32.h 8 Nov 2011 18:27:45 -0000
@@ -74,7 +74,7 @@
#define lm32_disable_interrupts( _level ) \
do { register uint32_t ie; \
__asm__ volatile ("rcsr %0,ie":"=r"(ie)); \
- _level = ie; \
+ (_level) = ie; \
ie &= (~0x0001); \
__asm__ volatile ("wcsr ie,%0"::"r"(ie)); \
} while (0)
@@ -85,7 +85,7 @@
#define lm32_flash_interrupts( _level ) \
do { register uint32_t ie; \
__asm__ volatile ("wcsr ie,%0"::"r"(_level)); \
- ie = _level & (~0x0001); \
+ ie = (_level) & (~0x0001); \
__asm__ volatile ("wcsr ie,%0"::"r"(ie)); \
} while (0)
@@ -99,7 +99,7 @@
#define lm32_interrupt_mask( _mask ) \
do { register uint32_t im; \
__asm__ volatile ("rcsr %0,im":"=r"(im)); \
- im &= ~_mask; \
+ im &= ~(_mask); \
__asm__ volatile ("wcsr im,%0"::"r"(im)); \
} while (0)
_______________________________________________
http://lists.milkymist.org/listinfo.cgi/devel-milkymist.org
IRC: #milkymist@Freenode