[Top][All Lists]

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

Re: [avr-gcc-list] COMPILER Frame pointer bug!!!

From: Bernd Felsche
Subject: Re: [avr-gcc-list] COMPILER Frame pointer bug!!!
Date: Sun, 18 Nov 2001 21:52:41 +0800 (WST)

Christoph Plattner tapped away at the keyboard with:

> No the code is OK, you simple have overseen the interrupt handling.
> Using cli/sei is ALWAYS WRONG and many old operating system errors
> have to be searched. The correct handling is (used C style to 
> explain):
> flags = save_cpu_flags ();    /* inlcuding Interrupt Enable bit */
> cli ();                               /* disable interrupts */
> < critical code >
> restore_cpu_flags (flags);    /* set the old IE state !!! */

Unfortunately, there's the opportunity for an interrupt to occur
between the save and the interrupt disable. Or did I miss something
in the instruction set details?

This is pretty much a short-coming of the AVR. If the cli() and
sei() were both save the previous status of the interrupt flag to
(say) the carry bit, then the previous state could be restored
reliably, under all circumstances.


 /"\  Bernd Felsche - Innovative Reckoning, Perth, Western Australia
 \ /      ASCII ribbon campaign | I'm a .signature virus!       |
  X       against HTML mail     | Copy me into your ~/.signature|
 / \      and postings          | to help me spread!            |

reply via email to

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