Serious Bug All Targets -- Please Read

Till Straumann strauman at slac.stanford.edu
Mon Mar 2 19:29:44 UTC 2009


Hmm - AFAIK, c99 doesn't specify the exact representation
of 'bool' / '_Bool'. It only says that

"An object declared as type _Bool is large enough to store the values 0 
and 1"

Hence, there is no really safe way to access such
an object from assembly code.

I wonder if it wouldn't be better to change the
type of _Context_Switch_necessary & friends
to a type of known width. If we sacrifice 6 bytes
we could simply use e.g., 'int32_t' and live
with the existing assembly code.

We'd have to be careful about constructs like

_Context_Switch_necessary == true

(since nonzero is not necessarily == 'true' ) and use e.g.,

_Context_Switch_necessary != 0

instead.

-- Till

Joel Sherrill wrote:
> Hi,
>
> There is a serious bug in all RTEMS 4.9 and newer
> versions including CVS.  It does not impact 4.8 and
> older. 
>
> With RTEMS 4.9 , we converted from using an internal
> RTEMS boolean type to the C99 standard bool.  This
> changed the size of the variables from four bytes to
> one byte. 
>
> The CPU dependent code references two boolean variables
> related to scheduling: _Context_Switch_necessary and
> _ISR_Signals_to_thread_executing.  Anywhere these
> are referenced in ASSEMBLY LANGUAGE is most likely
> broken.
>
> I desperately need help in reviewing and correcting
> my first (uncompiled) attempt at fixing it.  I went
> through the impacted assembly code and mechanically
> tried to convert long/word operations into byte ones.
> I may or may not have gotten it right on any target.
>
> The first patch version is at:
>
> https://www.rtems.org/bugzilla/show_bug.cgi?id=1385
>
> Please help!!! I want to cut a 4.9.2 ASAP!!!
>
>   





More information about the users mailing list