[En-Nut-Discussion] Not fixed!!!: Re: confirmed!!! Re: NutOS 4.4.0 on ARM7: possibly bug in NutEnterCritical / NutExitCritical

Ole Reinhardt ole.reinhardt at embedded-it.de
Mon Feb 25 17:46:18 CET 2008


Hi Henrik,

> The only reason why we would have to involve the stack is
> a) to allow nesting of critical sections
> or
> b) we don't know the interrupt state before entering the section

with your simple solution you assume two things:

- Software developers always know what they do :)
- You may not nest critical sections
- You may never call any function you did not write yourself from within
  a critical section.

All these assumptions might be ok for 90% of the people but if 10% fail
because they don't think about this problem your design does not work.

Next problem is that caused by historical reasons there might be several
applications out there that still use NutEnterCritical at points where
no critical section would be needed. Will say: In reality we need a good
working critical section routine.

The other point is, that you have to take care if you call a function
from within an interrupt context or from outside. In other words a
ringbuffer for example using the critical section would need two pairs
of functions to read and write from within interrupt conetext and from
outside.

You are totaly right that normaly nobody needs critical section (where
global interrupts are swiched off) but in real world there _will_ come
up cases where you need them. And then you also need good working
functions. Latest when NutOS learns using caches and mmu we will need
these functions.

Bye,

Ole

-- 
 _____________________________________________________________
|                                                             |
| Embedded-IT          Hard- und Softwarelösungen             |
|                                                             |
| Ole Reinhardt        Tel. / Fax:        +49 (0)271  7420433 |
| Luisenstraße 29      Mobil:             +49 (0)177  7420433 |
| 57076 Siegen         eMail:    ole.reinhardt at embedded-it.de |
| Germany              Web:         http://www.embedded-it.de |
|                      UstID / VAT:       DE198944716         |
|_____________________________________________________________|




More information about the En-Nut-Discussion mailing list