Changeset 1fe1b820 in rtems


Ignore:
Timestamp:
Sep 10, 2018, 9:47:24 AM (7 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
aaa6653
Parents:
e58f1cd3
git-author:
Sebastian Huber <sebastian.huber@…> (09/10/18 09:47:24)
git-committer:
Sebastian Huber <sebastian.huber@…> (09/10/18 10:01:50)
Message:

score: Fix PER_CPU_DATA_GET_BY_OFFSET()

Add uniprocessor version for PER_CPU_DATA_GET_BY_OFFSET(). Fix warnings
in uniprocessor configurations.

Update #3507.

Files:
2 edited

Legend:

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

    re58f1cd3 r1fe1b820  
    7777 * @param offset The offset of the item.
    7878 */
     79#ifdef RTEMS_SMP
    7980#define PER_CPU_DATA_GET_BY_OFFSET( cpu, type, offset ) \
    8081  (type *) ( cpu->data + offset )
     82#else
     83#define PER_CPU_DATA_GET_BY_OFFSET( cpu, type, offset ) \
     84  (type *) ( (uintptr_t) RTEMS_LINKER_SET_BEGIN( _Per_CPU_Data ) + offset ), \
     85    (void) cpu
     86#endif
    8187
    8288/**
     
    9399#else
    94100#define PER_CPU_DATA_GET( cpu, type, item ) \
    95   &_Linker_set__Per_CPU_Data_##item
     101  &_Linker_set__Per_CPU_Data_##item, (void) cpu
    96102#endif
    97103
  • testsuites/sptests/sppercpudata01/init.c

    re58f1cd3 r1fe1b820  
    7575    unsigned int *i;
    7676    unsigned long *l;
     77    uintptr_t off;
    7778    t *pt;
    7879
    7980    set_affinity(cpu_index);
    8081    cpu = _Per_CPU_Get_by_index(cpu_index);
     82
     83    off = PER_CPU_DATA_OFFSET(c);
     84    c = PER_CPU_DATA_GET_BY_OFFSET(cpu, unsigned char, off);
     85    rtems_test_assert(*c == 1);
    8186
    8287    c = PER_CPU_DATA_GET(cpu, unsigned char, c);
     
    198203    unsigned int *i;
    199204    unsigned long *l;
     205    uintptr_t off;
    200206    t *pt;
    201207
     
    205211    c = PER_CPU_DATA_GET(cpu, unsigned char, c);
    206212    ++v;
     213    rtems_test_assert(*c == (unsigned char) v);
     214
     215    off = PER_CPU_DATA_OFFSET(c);
     216    c = PER_CPU_DATA_GET_BY_OFFSET(cpu, unsigned char, off);
    207217    rtems_test_assert(*c == (unsigned char) v);
    208218
Note: See TracChangeset for help on using the changeset viewer.