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

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

Re: [avr-gcc-list] gcc prolog incorrect?


From: Ben L. Titzer
Subject: Re: [avr-gcc-list] gcc prolog incorrect?
Date: Mon, 7 Mar 2005 09:50:56 -0800


On Mar 7, 2005, at 8:45 AM, address@hidden wrote:

So what happens if we get interrupt between 69 and 70? And that interrupt disables interrupts?


In that case, the interrupt handler is broken, since when it returns it should restore the interrupt mask to the value it had before the interrupt was taken.



HutchinsonAndy wrote:

As you describe is exactly what I am concerned about!


"Ben L. Titzer" <address@hidden> wrote:

It seems as though the code restores the interrupt mask to exactly as
it was before the call; if the cli were to come first, the I flag would
be written to 0 and thus would not be restored correctly.

The thing I wonder about is what happens if there is an interrupt
between 72 and 73....It seems to me that those two instructions should
be swapped...

On Mar 6, 2005, at 6:12 PM, address@hidden wrote:

Is it possible that gcc prolog is incorrect?

  69 000a 0FB6              in __tmp_reg__,__SREG__
  70 000c F894              cli
  71 000e DEBF              out __SP_H__,r29
  72 0010 0FBE              out __SREG__,__tmp_reg__
  73 0012 CDBF              out __SP_L__,r28

This is the code used to adjust the stack pointer for a regular
function with interrupts active. Basically it turns of interupts so it
can chnage both bytes of SP without a problem.

But saved BEFORE interrupts are disabled. Doesn't that mean that if
interrupts were disabled during ISR, a function could re-enabled them
when SREG is restored?



--
Andy Hutchinson


__________________________________________________________________
Switch to Netscape Internet Service.
As low as $9.95 a month -- Sign up today at
http://isp.netscape.com/register

Netscape. Just the Net You Need.

New! Netscape Toolbar for Internet Explorer
Search from anywhere on the Web and block those annoying pop-ups.
Download now at http://channels.netscape.com/ns/search/install.jsp


_______________________________________________
AVR-GCC-list mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list


======================================================
Imagination is more important than knowledge.
-- Albert Einstein




--
Andy Hutchinson


__________________________________________________________________
Switch to Netscape Internet Service.
As low as $9.95 a month -- Sign up today at http://isp.netscape.com/register

Netscape. Just the Net You Need.

New! Netscape Toolbar for Internet Explorer
Search from anywhere on the Web and block those annoying pop-ups.
Download now at http://channels.netscape.com/ns/search/install.jsp



--
Andy Hutchinson


__________________________________________________________________
Switch to Netscape Internet Service.
As low as $9.95 a month -- Sign up today at http://isp.netscape.com/register

Netscape. Just the Net You Need.

New! Netscape Toolbar for Internet Explorer
Search from anywhere on the Web and block those annoying pop-ups.
Download now at http://channels.netscape.com/ns/search/install.jsp


_______________________________________________
AVR-GCC-list mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list


========================================================
The tools we use have a profound and devious influence on our thinking habits, and therefore on our thinking abilities.
--Edsgar W. Dijkstra





reply via email to

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