avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] About context saving in Vectors


From: Paulo Marques
Subject: Re: [avr-gcc-list] About context saving in Vectors
Date: Thu, 15 Jan 2009 16:27:51 +0000
User-agent: Thunderbird 2.0.0.19 (X11/20081227)

Stu Bell wrote:
> Jim Brain wrote:
> [...]
>> Can someone clarify why these macros are preferred over doing 
>> cli()/sei()/SREG=sreg in code?  I'm not trying to troll, but 
>> wonder if there is something I am missing.
> [...]
> More important, in my mind, is that the macros are written in such a way
> that the enclosed code is guaranteed not to be optimized out of the
> block.

This for me is the most important and most surprising point to newbies:
code can be moved out of a cli() / sei() block by compiler optimizations
because sei() is not a compiler barrier at all (just search for a
previous thread '"cli" and "sei" should clobber memory').

> [...nice sum up of atomic_* advantages trimmed...]

-- 
Paulo Marques
Software Development Department - Grupo PIE, S.A.
Phone: +351 252 290600, Fax: +351 252 290601
Web: www.grupopie.com

"All I ask is a chance to prove that money can't make me happy."




reply via email to

[Prev in Thread] Current Thread [Next in Thread]