[En-Nut-Discussion] Register overwriting in interrupted code

Harald Kipp harald.kipp at egnite.de
Sun Jul 25 10:46:00 CEST 2004


Gordian,

sorry for not answering your question about register usage
in interrupt routines. It's compiler related and I need to
know at least which compiler and version your are using.

But the other one is simple:

At 17:44 22.07.2004 +0200, you wrote:

>     NutEnterCritical();
>...
>             rc = NutEventWait(&dcb->dcb_rx_rdy, dcb->dcb_rtimeout);
>...
>    NutExitCritical();
>
>How can that work? Or rather: does it make sense to enter a critical
>section (disabling interrupts) and then wait for interrupt driven events
>(I know that this usually works, but how)?

In general, when the context is switched, then the new context
may have interrupts enabled or disabled independently from the
old context.

Nut/OS is a bit special: Interrupts are enabled after each
context switch. This may look inconsistent, but in real
world applications there is typically no need to keep
interrupts blocked _after_ the event has been received.

Harald




More information about the En-Nut-Discussion mailing list