Changeset 5fe6d07a in rtems


Ignore:
Timestamp:
Aug 1, 2016, 11:16:57 AM (3 years ago)
Author:
Christian Mauderer <Christian.Mauderer@…>
Branches:
master
Children:
ec735c6a
Parents:
501b11b
git-author:
Christian Mauderer <Christian.Mauderer@…> (08/01/16 11:16:57)
git-committer:
Sebastian Huber <sebastian.huber@…> (08/02/16 05:47:04)
Message:

linker set: Allow adding any variable into content

The newly created macro adds any kind of variable into a linker set. It
allows (for example) the saving an execution state of a function using
the following method:

  • put a group of different variables into one linker set
  • save the memory area containing the group of variables before the execution of a function
  • restore the memory area after the function has been executed
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/include/rtems/linkersets.h

    r501b11b r5fe6d07a  
    5858  RTEMS_SECTION( ".rtemsroset." #set ".content.1" ) RTEMS_USED
    5959
     60#define RTEMS_LINKER_ROSET_CONTENT( set, decl ) \
     61  decl \
     62  RTEMS_SECTION( ".rtemsroset." #set ".content" )
     63
    6064#define RTEMS_LINKER_RWSET_DECLARE( set, type ) \
    6165  extern type volatile RTEMS_LINKER_SET_BEGIN( set )[0]; \
     
    9094  RTEMS_SECTION( ".rtemsrwset." #set ".content.1" ) RTEMS_USED
    9195
     96#define RTEMS_LINKER_RWSET_CONTENT( set, decl ) \
     97  decl \
     98  RTEMS_SECTION( ".rtemsrwset." #set ".content" )
     99
    92100#ifdef __cplusplus
    93101}
  • testsuites/sptests/splinkersets01/init.c

    r501b11b r5fe6d07a  
    131131}
    132132
     133static void test_content(void)
     134{
     135  void volatile *b_rw = RTEMS_LINKER_SET_BEGIN(test_content_rw);
     136  void volatile *e_rw = RTEMS_LINKER_SET_END(test_content_rw);
     137
     138  void volatile const *b_ro = RTEMS_LINKER_SET_BEGIN(test_content_ro);
     139  void volatile const *e_ro = RTEMS_LINKER_SET_END(test_content_ro);
     140
     141  rtems_test_assert(&content_rw_1 >= b_rw);
     142  rtems_test_assert(&content_rw_2 >= b_rw);
     143  rtems_test_assert(&content_rw_3 >= b_rw);
     144  rtems_test_assert(&content_rw_1 <= e_rw);
     145  rtems_test_assert(&content_rw_2 <= e_rw);
     146  rtems_test_assert(&content_rw_3 <= e_rw);
     147
     148  rtems_test_assert(&content_ro_1 >= b_ro);
     149  rtems_test_assert(&content_ro_2 >= b_ro);
     150  rtems_test_assert(&content_ro_3 >= b_ro);
     151  rtems_test_assert(&content_ro_1 <= e_ro);
     152  rtems_test_assert(&content_ro_2 <= e_ro);
     153  rtems_test_assert(&content_ro_3 <= e_ro);
     154}
     155
    133156static void Init(rtems_task_argument arg)
    134157{
     
    136159
    137160  test();
     161  test_content();
    138162
    139163  TEST_END();
  • testsuites/sptests/splinkersets01/items.c

    r501b11b r5fe6d07a  
    2222
    2323RTEMS_LINKER_ROSET_ITEM_ORDERED(test_ro, const int *, ca2, OC) = &ca[2];
     24
     25int content_rw_1;
     26char content_rw_2;
     27char content_rw_3;
     28
     29const int content_ro_1;
     30const char content_ro_2;
     31const char content_ro_3;
  • testsuites/sptests/splinkersets01/sets.c

    r501b11b r5fe6d07a  
    2222
    2323RTEMS_LINKER_ROSET(test_ro, const int *);
     24
     25RTEMS_LINKER_RWSET(test_content_rw, char);
     26
     27RTEMS_LINKER_ROSET(test_content_ro, char);
  • testsuites/sptests/splinkersets01/splinkersets01.h

    r501b11b r5fe6d07a  
    3030RTEMS_LINKER_ROSET_DECLARE(test_ro, const int *);
    3131
     32RTEMS_LINKER_RWSET_DECLARE(test_content_rw, char);
     33
     34RTEMS_LINKER_ROSET_DECLARE(test_content_ro, char);
     35
    3236RTEMS_LINKER_RWSET_ITEM_DECLARE(test_rw, const int *, a1);
    3337
    3438RTEMS_LINKER_ROSET_ITEM_DECLARE(test_ro, const int *, ca2);
     39
     40RTEMS_LINKER_RWSET_CONTENT(test_content_rw, extern int content_rw_1);
     41RTEMS_LINKER_RWSET_CONTENT(test_content_rw, extern char content_rw_2);
     42RTEMS_LINKER_RWSET_CONTENT(test_content_rw, extern char content_rw_3);
     43
     44RTEMS_LINKER_ROSET_CONTENT(test_content_ro, extern const int content_ro_1);
     45RTEMS_LINKER_ROSET_CONTENT(test_content_ro, extern const char content_ro_2);
     46RTEMS_LINKER_ROSET_CONTENT(test_content_ro, extern const char content_ro_3);
    3547
    3648#ifdef __cplusplus
Note: See TracChangeset for help on using the changeset viewer.