Changeset 95d0c98 in rtems


Ignore:
Timestamp:
Feb 24, 2014, 9:13:32 AM (8 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, 5, master
Children:
a4bc90af
Parents:
07dc970
git-author:
Sebastian Huber <sebastian.huber@…> (02/24/14 09:13:32)
git-committer:
Sebastian Huber <sebastian.huber@…> (02/24/14 11:50:32)
Message:

score: Fix thread TLS area initialization

Do not use _TLS_Size here since this will lead GCC to assume that this
symbol is not 0 and the later > 0 test will be optimized away.

Files:
4 added
5 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/src/threadinitialize.c

    r07dc970 r95d0c98  
    4141)
    4242{
    43   size_t               actual_stack_size = 0;
    44   void                *stack = NULL;
    45   #if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
    46     void              *fp_area;
    47   #endif
    48   void                *sched = NULL;
    49   void                *extensions_area;
    50   bool                 extension_status;
    51   int                  i;
    52   uintptr_t            tls_size = (uintptr_t) _TLS_Size;
     43  size_t     actual_stack_size = 0;
     44  void      *stack = NULL;
     45  #if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
     46    void    *fp_area;
     47  #endif
     48  void      *sched = NULL;
     49  void      *extensions_area;
     50  bool       extension_status;
     51  int        i;
     52
     53  /*
     54   * Do not use _TLS_Size here since this will lead GCC to assume that this
     55   * symbol is not 0 and the later > 0 test will be optimized away.
     56   */
     57  uintptr_t  tls_size = (uintptr_t) _TLS_BSS_end - (uintptr_t) _TLS_Data_begin;
    5358
    5459#if defined( RTEMS_SMP )
  • testsuites/sptests/Makefile.am

    r07dc970 r95d0c98  
    3131    spcbssched01 spcbssched02 spcbssched03 spqreslib sptimespec01 \
    3232    spregion_err01 sppartition_err01
     33SUBDIRS += sptls03
    3334SUBDIRS += spcpucounter01
    3435if HAS_CPLUSPLUS
  • testsuites/sptests/configure.ac

    r07dc970 r95d0c98  
    3737# Explicitly list all Makefiles here
    3838AC_CONFIG_FILES([Makefile
     39sptls03/Makefile
    3940spcpucounter01/Makefile
    4041sptls02/Makefile
  • testsuites/sptests/sptls01/init.c

    r07dc970 r95d0c98  
    2525static __thread volatile char tls_item = 123;
    2626
     27static volatile int read_write_small = 0xdeadbeef;
     28
     29static const volatile int read_only_small = 0x601dc0fe;
     30
    2731static void check_tls_item(int expected)
    2832{
     
    3741  check_tls_item(123);
    3842
    39         sc = rtems_event_transient_send(master_task);
    40         rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     43  sc = rtems_event_transient_send(master_task);
     44  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    4145
    42         sc = rtems_task_suspend(RTEMS_SELF);
    43         rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     46  sc = rtems_task_suspend(RTEMS_SELF);
     47  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    4448}
    4549
    4650static void test(void)
    4751{
    48         rtems_id id;
    49         rtems_status_code sc;
     52  rtems_id id;
     53  rtems_status_code sc;
    5054
    51         master_task = rtems_task_self();
     55  master_task = rtems_task_self();
     56
     57  rtems_test_assert(read_write_small == 0xdeadbeef);
     58  rtems_test_assert(read_only_small == 0x601dc0fe);
    5259
    5360  check_tls_item(123);
     
    5562
    5663  sc = rtems_task_create(
    57                 rtems_build_name('T', 'A', 'S', 'K'),
    58                 RTEMS_MINIMUM_PRIORITY,
    59                 RTEMS_MINIMUM_STACK_SIZE,
    60                 RTEMS_DEFAULT_MODES,
    61                 RTEMS_DEFAULT_ATTRIBUTES,
    62                 &id
    63         );
    64         rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     64    rtems_build_name('T', 'A', 'S', 'K'),
     65    RTEMS_MINIMUM_PRIORITY,
     66    RTEMS_MINIMUM_STACK_SIZE,
     67    RTEMS_DEFAULT_MODES,
     68    RTEMS_DEFAULT_ATTRIBUTES,
     69    &id
     70  );
     71  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    6572
    66         sc = rtems_task_start(id, task, 0);
    67         rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     73  sc = rtems_task_start(id, task, 0);
     74  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    6875
    69         sc = rtems_event_transient_receive(RTEMS_WAIT, RTEMS_NO_TIMEOUT);
    70         rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     76  sc = rtems_event_transient_receive(RTEMS_WAIT, RTEMS_NO_TIMEOUT);
     77  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    7178
    72         sc = rtems_task_delete(id);
    73         rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     79  sc = rtems_task_delete(id);
     80  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    7481
    7582  check_tls_item(5);
Note: See TracChangeset for help on using the changeset viewer.