Changeset 00d2a828 in rtems


Ignore:
Timestamp:
05/28/97 20:36:35 (27 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
3a8256d
Parents:
5c995d7
Message:

Added support for context switching the data used by the gcc m68k
software floating point emulation code. Code implemented by
Karen Sara Looney <Karen.Looney@…> with much
email assistance from Joel.

Files:
9 edited

Legend:

Unmodified
Added
Removed
  • c/src/exec/rtems/headers/attr.h

    r5c995d7 r00d2a828  
    4848#define RTEMS_PRIORITY_CEILING    0x00000040
    4949
    50 #if ( CPU_HARDWARE_FP == TRUE )
     50#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
    5151#define ATTRIBUTES_NOT_SUPPORTED       0
    5252#else
  • c/src/exec/rtems/include/rtems/rtems/attr.h

    r5c995d7 r00d2a828  
    4848#define RTEMS_PRIORITY_CEILING    0x00000040
    4949
    50 #if ( CPU_HARDWARE_FP == TRUE )
     50#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
    5151#define ATTRIBUTES_NOT_SUPPORTED       0
    5252#else
  • c/src/exec/score/cpu/m68k/cpu.c

    r5c995d7 r00d2a828  
    178178};
    179179#endif
     180
     181/*PAGE
     182 *
     183 *  The following code context switches the software FPU emulation
     184 *  code provided with GCC.
     185 */
     186
     187#if (CPU_SOFTWARE_FP == TRUE)
     188extern Context_Control_fp _fpCCR;
     189
     190void CPU_Context_save_fp (void **fp_context_ptr)
     191{
     192  Context_Control_fp *fp;
     193
     194  fp = (Context_Control_fp *) *fp_context_ptr;
     195
     196  *fp = _fpCCR;
     197}
     198
     199void CPU_Context_restore_fp (void **fp_context_ptr)
     200{
     201  Context_Control_fp *fp;
     202
     203  fp = (Context_Control_fp *) *fp_context_ptr;
     204
     205  _fpCCR = *fp;
     206}
     207#endif
     208
  • c/src/exec/score/cpu/m68k/cpu.h

    r5c995d7 r00d2a828  
    5353 *  Some family members have no FP, some have an FPU such as the
    5454 *  MC68881/MC68882 for the MC68020, others have it built in (MC68030, 040).
     55 *
     56 *  NOTE:  If on a CPU without hardware FP, then one can use software
     57 *         emulation.  The gcc software FP emulation code has data which
     58 *         must be contexted switched on a per task basis.
    5559 */
    5660
    5761#if ( M68K_HAS_FPU == 1 )
    5862#define CPU_HARDWARE_FP     TRUE
     63#define CPU_SOFTWARE_FP     FALSE
    5964#else
    6065#define CPU_HARDWARE_FP     FALSE
     66#if defined(__GCC__)
     67#define CPU_SOFTWARE_FP     TRUE
     68#else
     69#define CPU_SOFTWARE_FP     FALSE
     70#endif
    6171#endif
    6272
     
    109119
    110120/*
     121 *  Floating point context ares
     122 */
     123
     124#if (CPU_SOFTWARE_FP == TRUE)
     125
     126/*
     127 *  This is the same as gcc's view of the software FP condition code
     128 *  register _fpCCR.  The implementation of the emulation code is
     129 *  in the gcc-VERSION/config/m68k directory.  This structure is
     130 *  correct as of gcc 2.7.2.2.
     131 */
     132
     133typedef struct {
     134  unsigned16   _exception_bits;
     135  unsigned16   _trap_enable_bits;
     136  unsigned16   _sticky_bits;
     137  unsigned16   _rounding_mode;
     138  unsigned16   _format;
     139  unsigned16   _last_operation;
     140  union {
     141    float sf;
     142    double df;
     143  } _operand1;
     144  union {
     145    float sf;
     146    double df;
     147  } _operand2;
     148} Context_Control_fp;
     149
     150#else
     151
     152/*
    111153 *  FP context save area for the M68881/M68882 numeric coprocessors.
    112154 */
     
    118160                                    /*     4 bytes for non-null flag     */
    119161} Context_Control_fp;
     162#endif
    120163
    121164/*
     
    292335  }
    293336
     337/*
     338 *  Floating Point Context Area Support routines
     339 */
     340
     341#if (CPU_SOFTWARE_FP == TRUE)
     342
     343/*
     344 *  This software FP implementation is only for GCC.
     345 */
     346
     347#define _CPU_Context_Fp_start( _base, _offset ) \
     348   ((void *) _Addresses_Add_offset( (_base), (_offset) ) )
     349
     350
     351#define _CPU_Context_Initialize_fp( _fp_area ) \
     352   { \
     353   Context_Control_fp *_fp; \
     354   _fp = *(Context_Control_fp **)_fp_area; \
     355   _fp->_exception_bits = 0; \
     356   _fp->_trap_enable_bits = 0; \
     357   _fp->_sticky_bits = 0; \
     358   _fp->_rounding_mode = 0;  /* ROUND_TO_NEAREST */ \
     359   _fp->_format = 0;         /* NIL */ \
     360   _fp->_last_operation = 0;  /* NOOP */ \
     361   _fp->_operand1.df = 0; \
     362   _fp->_operand2.df = 0; \
     363   }
     364#else
    294365#define _CPU_Context_Fp_start( _base, _offset ) \
    295366   ((void *) \
     
    306377     *(_fp_area) = (unsigned8 *)(_fp_context); \
    307378   }
     379#endif
    308380
    309381/* end of Context handler macros */
  • c/src/exec/score/cpu/m68k/cpu_asm.s

    r5c995d7 r00d2a828  
    5252 *         CPU_FP_CONTEXT_SIZE is higher than expected to account for the
    5353 *         -1 pushed at end of this sequence.
    54  */
     54 *
     55 *         Neither of these entries is required if we have software FPU
     56 *         emulation.  But if we don't have an FPU or emulation, then
     57 *         we need the stub versions of these routines.
     58 */
     59
     60#if (CPU_SOFTWARE_FP == FALSE)
    5561
    5662.set FPCONTEXT_ARG,   4                    | save FP context argument
     
    8793#endif
    8894        rts
     95#endif
    8996
    9097/*PAGE
  • c/src/exec/score/src/thread.c

    r5c995d7 r00d2a828  
    213213 
    214214
    215 #if ( CPU_HARDWARE_FP == TRUE )
     215#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
    216216   /*
    217217    *  don't need to worry about saving BSP's floating point state
  • cpukit/rtems/include/rtems/rtems/attr.h

    r5c995d7 r00d2a828  
    4848#define RTEMS_PRIORITY_CEILING    0x00000040
    4949
    50 #if ( CPU_HARDWARE_FP == TRUE )
     50#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
    5151#define ATTRIBUTES_NOT_SUPPORTED       0
    5252#else
  • cpukit/score/cpu/m68k/cpu.c

    r5c995d7 r00d2a828  
    178178};
    179179#endif
     180
     181/*PAGE
     182 *
     183 *  The following code context switches the software FPU emulation
     184 *  code provided with GCC.
     185 */
     186
     187#if (CPU_SOFTWARE_FP == TRUE)
     188extern Context_Control_fp _fpCCR;
     189
     190void CPU_Context_save_fp (void **fp_context_ptr)
     191{
     192  Context_Control_fp *fp;
     193
     194  fp = (Context_Control_fp *) *fp_context_ptr;
     195
     196  *fp = _fpCCR;
     197}
     198
     199void CPU_Context_restore_fp (void **fp_context_ptr)
     200{
     201  Context_Control_fp *fp;
     202
     203  fp = (Context_Control_fp *) *fp_context_ptr;
     204
     205  _fpCCR = *fp;
     206}
     207#endif
     208
  • cpukit/score/src/thread.c

    r5c995d7 r00d2a828  
    213213 
    214214
    215 #if ( CPU_HARDWARE_FP == TRUE )
     215#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
    216216   /*
    217217    *  don't need to worry about saving BSP's floating point state
Note: See TracChangeset for help on using the changeset viewer.