#$%^... sorry. Mea culpa. Joerg, would you please fix it? Thanks.
Jan On Thu, 10 Jun 2010 22:25:12 +0200 Wouter van Gulik <[email protected]> wrote: > Joerg Wunsch schreef: > > > > + > > +\code > > +#define cli() __asm volatile( "cli" ::: "memory" ) > > +#define sei() __asm volatile( "sei" ::: "memory" ) > > + > > +unsigned int ivar; > > + > > +void test2( unsigned int val ) > > +{ > > + val = 65535U / val; > > + > > + cli(); > > + > > + ivar = val; > > + > > + sei(); > > +} > > +\endcode > > + > > +compiles with optimisations switched on (-Os) to > > + > > +\verbatim > > +00000112 <test2>: > > + 112: bc 01 movw r22, r24 > > + 114: f8 94 cli > > + 116: 8f ef ldi r24, 0xFF ; 255 > > + 118: 9f ef ldi r25, 0xFF ; 255 > > + 11a: 0e 94 96 00 call 0x12c ; 0x12c <__udivmodhi4> > > + 11e: 70 93 01 02 sts 0x0201, r23 > > + 122: 60 93 00 02 sts 0x0200, r22 > > + 126: 78 94 sei > > + 128: 08 95 ret > > +\endverbatim > > + > > +where the potentially slow multiplication is moved across cli(), > > +resulting in interrupts to be disabled longer than intended. > There is "typo", the texts talks about multiplication instead of divide. > > HTH, > > Wouter > _______________________________________________ AVR-libc-dev mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/avr-libc-dev
