patacongo edited a comment on issue #802:
URL: https://github.com/apache/incubator-nuttx/issues/802#issuecomment-616561874


   Hmmm... just looking at the code, it looks like arm_decode_irq() would be a 
bad place to put any debug output.  That is because arm_decode_irq() calls 
arm_doirq() and is where the interrupt mode is set:
   
        88   /* Current regs non-zero indicates that we are processing an 
interrupt;
        89    * CURRENT_REGS is also used to manage interrupt level context 
switches.
        90    */
        91
       92   CURRENT_REGS = regs;
   
   Prior to that, the system has no idea that it is in an interrupt handler.  
Syslog will think it is in a normal task mode and will almost certainly do the 
wrong thing.  I have not tracked down all of that, but I have looked at enough 
to see that arm_decode_irq() is not a valid place to call syslog() functions.  
All of these tests would to the incorrect thing:
   
       ramlog.c:  DEBUGASSERT(!up_interrupt_context());
       syslog_device.c:  if (up_interrupt_context() || getpid() == 0)
       syslog_putc.c:  if (up_interrupt_context() || sched_idletask())
       syslog_putc.c:      if (up_interrupt_context())
       syslog_write.c:  if (up_interrupt_context() || sched_idletask())
       syslog_write.c:          if (up_interrupt_context())
       syslog_write.c:  if (!up_interrupt_context() && !sched_idletask())
   
   If you move the __err to _arm_doirq() after CURRENT_REGS is set, it may 
work.  It should also work if you add logic to set CURRENT_REGS in 
arm_decode_irq() too.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to