<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=US-ASCII">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2653.12">
<TITLE>Re: Is there any Guru who knows why interrupts are disabled in ISR?</TITLE>
</HEAD>
<BODY>
<P><FONT SIZE=2>On Thu, Mar 07, 2002 at 10:57:14PM +0200, Leon Pollak wrote:</FONT>
<BR><FONT SIZE=2>> Hello Gurus,</FONT>
<BR><FONT SIZE=2>> I shall be very thankful for the explanation of the following moment:</FONT>
<BR><FONT SIZE=2>> I look into PPC code file irq_stub.S routine __ISR_handler I see that </FONT>
<BR><FONT SIZE=2>> all </FONT>
<BR><FONT SIZE=2>> interrupts are disabled almost immediatly. They are reenabled at the end of </FONT>
<BR><FONT SIZE=2>> the ISR, after the user ISR has finished its processing, almost at the point </FONT>
<BR><FONT SIZE=2>> of exit from __ISR_handler.</FONT>
<BR><FONT SIZE=2>> This text contains the comment after the _ISR_NestLevel incrementing:</FONT>
<BR><FONT SIZE=2>> "From here on out, interrupts can be re-enabled, RTEMS convention says not".</FONT>
<BR><FONT SIZE=2>> Can somebody explain me why interrupts must be disabled inside the </FONT>
<BR><FONT SIZE=2>> user ISR?</FONT>
</P>
<P><FONT SIZE=2>All of the right code is already in place to do the nesting, but no one ever</FONT>
<BR><FONT SIZE=2>turns the interrupt enable bit back on. I tried enabling interrupts right</FONT>
<BR><FONT SIZE=2>below that comment, but found that some interrupts (like the PIT) will</FONT>
<BR><FONT SIZE=2>fire again immediately if their event bit hasn't been turned of by the ISR.</FONT>
<BR><FONT SIZE=2>So, we now use a macro that sets MSR[EE] in each ISR; everyone has been told</FONT>
<BR><FONT SIZE=2>to insert that macro in their ISRs after it's safe to re-enable interrupts.</FONT>
</P>
<P><FONT SIZE=2>-Phil</FONT>
</P>
<P><FONT SIZE=2>-- </FONT>
</P>
<P><FONT SIZE=2>=====================================================================</FONT>
<BR><FONT SIZE=2>Phil Torre phone: 425-820-6363 x234</FONT>
<BR><FONT SIZE=2>Design Engineer email: ptorre@zetron.com</FONT>
<BR><FONT SIZE=2>Switching Systems Group fax: 425-820-7031</FONT>
<BR><FONT SIZE=2>Zetron, Inc. web: <A HREF="http://www.zetron.com" TARGET="_blank">http://www.zetron.com</A></FONT>
</P>
<BR>
<P><B><FONT SIZE=2> </FONT></B>
</P>
</BODY>
</HTML>