Changeset 335e5ca in rtems


Ignore:
Timestamp:
Jun 2, 2015, 7:43:54 PM (4 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
a51b352
Parents:
b2765075
git-author:
Sebastian Huber <sebastian.huber@…> (06/02/15 19:43:54)
git-committer:
Sebastian Huber <sebastian.huber@…> (06/09/15 07:05:50)
Message:

score: Add Thread_Control::is_fp

Store the floating-point unit property in the thread control block
regardless of the CPU_HARDWARE_FP and CPU_SOFTWARE_FP settings. Make
sure the floating-point unit is only enabled for the corresponding
multilibs. This helps targets which have a volatile only floating point
context like SPARC for example.

Files:
6 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libcpu/powerpc/new-exceptions/cpu.c

    rb2765075 r335e5ca  
    9999
    100100#ifdef PPC_MULTILIB_FPU
    101   msr_value |= MSR_FP;
    102 #else
    103101  /*
    104102   *  The FP bit of the MSR should only be enabled if this is a floating
     
    109107   *  time (7 July 1997), this restructuring is not being done.
    110108   */
    111 
    112   /* Make sure integer tasks have no FPU access in order to
    113    * catch violations. Gcc may implicitely use the FPU and
    114    * data corruption may happen.
    115    * Since we set the_contex->msr using our current MSR,
    116    * we must make sure MSR_FP is off if (!is_fp)...
    117    * Unfortunately, this means that users of vfprintf_r have to use FP
    118    * tasks or fix vfprintf. Furthermore, users of int-only tasks
    119    * must prevent gcc from using the FPU (currently -msoft-float is the
    120    * only way...)
    121    */
    122   if ( is_fp )
    123     msr_value |= PPC_MSR_FP;
    124   else
    125     msr_value &= ~PPC_MSR_FP;
     109  msr_value |= MSR_FP;
    126110#endif
    127111
  • cpukit/posix/src/pthreadcreate.c

    rb2765075 r335e5ca  
    156156   *  supports it.
    157157   */
    158   #if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
    159     is_fp = true;
    160   #else
    161     is_fp = false;
    162   #endif
     158  is_fp = true;
    163159
    164160  /*
  • cpukit/score/cpu/mips/cpu.c

    rb2765075 r335e5ca  
    180180  uintptr_t             stack_tmp;
    181181  __MIPS_REGISTER_TYPE  intlvl = new_level & 0xff;
     182  __MIPS_REGISTER_TYPE  c0_sr;
    182183
    183184  stack_tmp  = (uintptr_t)stack_base;
     
    188189  the_context->fp = (__MIPS_REGISTER_TYPE) stack_tmp;
    189190  the_context->ra = (__MIPS_REGISTER_TYPE) (uintptr_t)entry_point;
    190   the_context->c0_sr =
     191
     192  c0_sr =
    191193    ((intlvl==0)? (mips_interrupt_mask() | 0x300 | _INTON):
    192194      ( ((intlvl<<9) & mips_interrupt_mask()) | 0x300 |
    193195      ((intlvl & 1)?_INTON:0)) ) |
    194       SR_CU0 | ((is_fp)?SR_CU1:0) | _EXTRABITS;
     196      SR_CU0 | _EXTRABITS;
     197#if MIPS_HAS_FPU == 1
     198  if ( is_fp ) {
     199    c0_sr |= SR_CU1;
     200  }
     201#endif
     202  the_context->c0_sr = c0_sr;
    195203}
    196204/*
  • cpukit/score/include/rtems/score/thread.h

    rb2765075 r335e5ca  
    751751  /** This field is true if the thread is preemptible. */
    752752  bool                                  is_preemptible;
     753  /** This field is true if the thread uses the floating point unit. */
     754  bool                                  is_fp;
    753755
    754756  /**
  • cpukit/score/src/threadinitialize.c

    rb2765075 r335e5ca  
    160160   */
    161161
     162  the_thread->is_fp                  = is_fp;
    162163  the_thread->Start.isr_level        = isr_level;
    163164  the_thread->Start.is_preemptible   = is_preemptible;
  • cpukit/score/src/threadloadenv.c

    rb2765075 r335e5ca  
    2626)
    2727{
    28   bool is_fp;
    2928  uint32_t isr_level;
    3029
     
    3332    the_thread->fp_context = the_thread->Start.fp_context;
    3433    _Context_Initialize_fp( &the_thread->fp_context );
    35     is_fp = true;
    36   } else
     34  }
    3735#endif
    38     is_fp = false;
    3936
    4037  the_thread->is_preemptible   = the_thread->Start.is_preemptible;
     
    5956    isr_level,
    6057    _Thread_Handler,
    61     is_fp,
     58    the_thread->is_fp,
    6259    the_thread->Start.tls_area
    6360  );
Note: See TracChangeset for help on using the changeset viewer.