Joel Sherrill 38bfb0db72 Patch from Eric Valette <valette@crf.canon.fr> based on a tremendous
bug report from David Decotigny <David.Decotigny@irisa.fr>:

  During the last few days, I've been back working on RTEMS. Let me
  remind you that RTEMS didn't boot on our (old) Dell P90 machines (ref:
  PC 590) : we could only get a reboot out of them.

  1/ The symptoms
  ---------------

  Hopefully, the problem was rather deterministic. The stack couldn't be
  written correctly : issueing one or more "push" would always push '0'
  onto the stack. The way to solve this was to issue a "pop", such as
  "pushl eax ; popl eax". After this "pop", the stack would be writeable
  again.

  BUT, it will be writable for 8 consecutive "push"s. After these 8
  "push"s, the other "push"s are wrong again, and a blank push/pop is
  needed.

  Considering that the L1 cache lines of this pentium are 32 bytes long,
  and that 8 long int are 32 bytes long too, it came to us that there
  was a problem with the cache.

  Actually, the bug of the push could be shown through memory accesses
  directly : writing on an not-in-cache mem location would put 0 until
  this mem location is accessed through a single "read". Then, the whole
  cache line would be right again.

  2/ The consequences
  -------------------

  Of course, that was the first thing that we've been able to observe ;)
  RTEMS could not boot. Actually, when a "call" pushed 0 onto the stack,
  the ret could only lead to raise an exception a bit later. Since, in
  the early stage, the Interrupt vector points to 0, averything couldn't
  get worse : triple fault + reboot.

  3/ Explanation
  --------------

  This cache mechanism corruption only appeared after load_segment()
  returned (through a jump). Investigating a bit further shows that this
  appears /sometimes/ during the PICs initialization.

  "Sometimes" proved to be "When writing something with the 4th bit of
  %al set". That is "when writing 0x28 or 0xff" for example. Clearing
  this bit would just make the things work right.

  Actually, this isn't a bug in the proper PIC initialization (which is
  quite academic). It came from the "delay" routine, which theoretically
  does nothing but writing to an "inexistant" port (0xed), in order to
  lose some time.

  BUT, in the special case of our Dell P90, it appears that this 0xed
  port does something cruel with the cache mechanism when its 4th bit
  (aka bit 3 or 0x8) is set.

  I didn't investigate this non-standard behaviour of the P90 any
  further : I don't know if this is documented, or if it is just another
  (known ?) bug of the early Pentiums. Just notice that we have 5 such
  machines, and it has the same effect on the cache mechanism.

----------------------------------------------------------------------
1999-07-26 21:35:15 +00:00
1998-02-04 15:54:31 +00:00
1997-04-22 13:07:36 +00:00
1997-04-22 16:50:29 +00:00
1997-04-22 16:50:29 +00:00
1999-07-09 19:27:43 +00:00

#
#  $Id$
#

Building RTEMS
==============
See the file README.configure.

Directory Overview
==================

This is the top level of the RTEMS directory structure.  The following 
is a description of the files and directories in this directory:

  INSTALL
    Rudimentary installation instructions.  For more detailed
    information please see the Release Notes.  The Postscript 
    version of this manual can be found in the file
    c_or_ada/doc/relnotes.tgz.

  LICENSE
    Required legalese.

  README
    This file.

  c
    This directory contains the source code for the C 
    implementation of RTEMS as well as the test suites, sample 
    applications, Board Support Packages, Device Drivers, and 
    support libraries.

  doc
    This directory contains the PDL for the RTEMS executive.

Ada versus C
============

There are two implementations of RTEMS in this source tree -- 
in Ada and in C.  These two implementations are functionally
and structurally equivalent.  The C implementation follows
the packaging conventions and hiearchical nature of the Ada 
implementation.  In addition, a style has been followed which 
allows one to easily find the corresponding Ada and C 
implementations.  

File names in C and code placement was carefully designed to insure
a close mapping to the Ada implementation.  The following file name 
extensions are used:

   .adb - Ada body
   .ads - Ada specification
   .adp - Ada body requiring preprocessing
   .inc - include file for .adp files

   .c   - C body (non-inlined routines)
   .inl - C body (inlined routines)
   .h   - C specification

In the executive source, XYZ.c and XYZ.inl correspond directly to a 
single XYZ.adb or XYZ.adp file.  A .h file corresponds directly to
the .ads file.  There are only a handful of .inc files in the 
Ada source and these are used to insure that the desired simple 
inline textual expansion is performed.  This avoids scoping and
calling convention side-effects in carefully constructed tests 
which usually test context switch behavior.

In addition, in Ada code and data name references are always fully
qualified as PACKAGE.NAME.  In C, this convention is followed 
by having the package name as part of the name itself and using a
capital letter to indicate the presence of a "." level.  So we have
PACKAGE.NAME in Ada and _Package_Name in C.  The leading "_" in C
is used to avoid naming conflicts between RTEMS and user variables.
By using these conventions, one can easily compare the C and Ada
implementations.

The most noticeable difference between the C and Ada83 code is 
the inability to easily obtain a "typed pointer" in Ada83.  
Using the "&" operator in C yields a pointer with a specific type.
The 'Address attribute is the closest feature in Ada83.  This
returns a System.Address and this must be coerced via Unchecked_Conversion
into an access type of the desired type.  It is easy to view 
System.Address as similar to a "void *" in C, but this is not the case.
A "void *" can be assigned to any other pointer type without an
explicit conversion.  

The solution adopted to this problem was to provide two routines for
each access type in the Ada implementation -- one to convert from
System.Address to the access type and another to go the opposite
direction.  This results in code which accomplishes the same thing
as the corresponding C but it is easier to get lost in the clutter
of the apparent subprogram invocations than the "less bulky"
C equivalent.

A related difference is the types which are only in Ada which are used 
for pointers to arrays.  These types do not exist and are not needed 
in the C implementation.
Description
RTEMS is a ​real-time executive in use by embedded systems applications around the world and beyond
Readme 126 MiB
Languages
C 93.9%
Assembly 3.4%
Ada 1.4%
Python 0.3%
HTML 0.3%
Other 0.4%