Changeset 27bbc05 in rtems


Ignore:
Timestamp:
Aug 2, 2018, 12:49:01 PM (16 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
83ca9f0a
Parents:
141d502
git-author:
Sebastian Huber <sebastian.huber@…> (08/02/18 12:49:01)
git-committer:
Sebastian Huber <sebastian.huber@…> (08/02/18 13:33:00)
Message:

score: Remove CPU_PARTITION_ALIGNMENT

Use the CPU_SIZEOF_POINTER alignment instead. The internal alignment
requirement is defined by the use of Chain_Node (consisting of two
pointers) to manage the free chain of partitions.

It seems that previously the condition

CPU_PARTITION_ALIGNMENT >= sizeof(Chain_Node)

was true on all CPU ports. Now, we need an additional check.

Update #3482.

Location:
cpukit
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • cpukit/include/rtems/rtems/partimpl.h

    r141d502 r27bbc05  
    111111}
    112112
    113 /**
    114  *  @brief Checks if partition is buffer size aligned.
    115  *
    116  *  This function returns TRUE if the use of the specified buffer_size
    117  *  will result in the allocation of buffers whose first byte is
    118  *  properly aligned, and FALSE otherwise.
    119  */
    120 RTEMS_INLINE_ROUTINE bool _Partition_Is_buffer_size_aligned (
    121    uint32_t   buffer_size
    122 )
    123 {
    124   return ((buffer_size % CPU_PARTITION_ALIGNMENT) == 0);
     113RTEMS_INLINE_ROUTINE bool _Partition_Is_buffer_size_aligned(
     114  uint32_t buffer_size
     115)
     116{
     117  return (buffer_size % CPU_SIZEOF_POINTER) == 0;
     118}
     119
     120RTEMS_INLINE_ROUTINE bool _Partition_Is_buffer_area_aligned(
     121  const void *starting_address
     122)
     123{
     124  return (((uintptr_t) starting_address) % CPU_SIZEOF_POINTER) == 0;
    125125}
    126126
  • cpukit/rtems/src/partcreate.c

    r141d502 r27bbc05  
    6565    return RTEMS_INVALID_ADDRESS;
    6666
    67   if ( length == 0 || buffer_size == 0 || length < buffer_size ||
    68          !_Partition_Is_buffer_size_aligned( buffer_size ) )
     67  if ( length == 0 )
     68    return RTEMS_INVALID_SIZE;
     69
     70  if ( buffer_size == 0 )
     71    return RTEMS_INVALID_SIZE;
     72
     73  if ( length < buffer_size )
     74    return RTEMS_INVALID_SIZE;
     75
     76  if ( !_Partition_Is_buffer_size_aligned( buffer_size ) )
     77    return RTEMS_INVALID_SIZE;
     78
     79  if ( buffer_size < sizeof( Chain_Node ) )
    6980    return RTEMS_INVALID_SIZE;
    7081
  • cpukit/score/cpu/arm/include/rtems/score/cpu.h

    r141d502 r27bbc05  
    153153
    154154#define CPU_HEAP_ALIGNMENT CPU_ALIGNMENT
    155 
    156 /* AAPCS, section 4.3.1, Aggregates */
    157 #define CPU_PARTITION_ALIGNMENT 4
    158155
    159156/* AAPCS, section 5.2.1.2, Stack constraints at a public interface */
  • cpukit/score/cpu/bfin/include/rtems/score/cpu.h

    r141d502 r27bbc05  
    452452 */
    453453#define CPU_HEAP_ALIGNMENT         CPU_ALIGNMENT
    454 
    455 /**
    456  * This number corresponds to the byte alignment requirement for memory
    457  * buffers allocated by the partition manager.  This alignment requirement
    458  * may be stricter than that for the data types alignment specified by
    459  * @ref CPU_ALIGNMENT.  It is common for the partition to follow the same
    460  * alignment requirement as @ref CPU_ALIGNMENT.  If the @ref CPU_ALIGNMENT is
    461  * strict enough for the partition, then this should be set to
    462  * @ref CPU_ALIGNMENT.
    463  *
    464  * @note  This does not have to be a power of 2.  It does have to
    465  *        be greater or equal to than @ref CPU_ALIGNMENT.
    466  *
    467  * Port Specific Information:
    468  *
    469  * XXX document implementation including references if appropriate
    470  */
    471 #define CPU_PARTITION_ALIGNMENT    CPU_ALIGNMENT
    472454
    473455/**
  • cpukit/score/cpu/epiphany/include/rtems/score/cpu.h

    r141d502 r27bbc05  
    364364
    365365/*
    366  *  This number corresponds to the byte alignment requirement for memory
    367  *  buffers allocated by the partition manager.  This alignment requirement
    368  *  may be stricter than that for the data types alignment specified by
    369  *  CPU_ALIGNMENT.  It is common for the partition to follow the same
    370  *  alignment requirement as CPU_ALIGNMENT.  If the CPU_ALIGNMENT is strict
    371  *  enough for the partition, then this should be set to CPU_ALIGNMENT.
    372  *
    373  *  NOTE:  This does not have to be a power of 2.  It does have to
    374  *         be greater or equal to than CPU_ALIGNMENT.
    375  *
    376  */
    377 
    378 #define CPU_PARTITION_ALIGNMENT    CPU_ALIGNMENT
    379 
    380 /*
    381366 *  This number corresponds to the byte alignment requirement for the
    382367 *  stack.  This alignment requirement may be stricter than that for the
  • cpukit/score/cpu/i386/include/rtems/score/cpu.h

    r141d502 r27bbc05  
    363363#define CPU_ALIGNMENT                    4
    364364#define CPU_HEAP_ALIGNMENT               CPU_ALIGNMENT
    365 #define CPU_PARTITION_ALIGNMENT          CPU_ALIGNMENT
    366365
    367366/*
  • cpukit/score/cpu/lm32/include/rtems/score/cpu.h

    r141d502 r27bbc05  
    475475
    476476/**
    477  * This number corresponds to the byte alignment requirement for memory
    478  * buffers allocated by the partition manager.  This alignment requirement
    479  * may be stricter than that for the data types alignment specified by
    480  * @ref CPU_ALIGNMENT.  It is common for the partition to follow the same
    481  * alignment requirement as @ref CPU_ALIGNMENT.  If the @ref CPU_ALIGNMENT is
    482  * strict enough for the partition, then this should be set to
    483  * @ref CPU_ALIGNMENT.
    484  *
    485  * NOTE:  This does not have to be a power of 2.  It does have to
    486  *        be greater or equal to than @ref CPU_ALIGNMENT.
    487  *
    488  * Port Specific Information:
    489  *
    490  * XXX document implementation including references if appropriate
    491  */
    492 #define CPU_PARTITION_ALIGNMENT    CPU_ALIGNMENT
    493 
    494 /**
    495477 * This number corresponds to the byte alignment requirement for the
    496478 * stack.  This alignment requirement may be stricter than that for the
  • cpukit/score/cpu/m32c/include/rtems/score/cpu.h

    r141d502 r27bbc05  
    444444 */
    445445#define CPU_HEAP_ALIGNMENT         4
    446 
    447 /**
    448  * This number corresponds to the byte alignment requirement for memory
    449  * buffers allocated by the partition manager.  This alignment requirement
    450  * may be stricter than that for the data types alignment specified by
    451  * @ref CPU_ALIGNMENT.  It is common for the partition to follow the same
    452  * alignment requirement as @ref CPU_ALIGNMENT.  If the @ref CPU_ALIGNMENT is
    453  * strict enough for the partition, then this should be set to
    454  * @ref CPU_ALIGNMENT.
    455  *
    456  * NOTE:  This does not have to be a power of 2.  It does have to
    457  *        be greater or equal to than @ref CPU_ALIGNMENT.
    458  *
    459  * Port Specific Information:
    460  *
    461  * XXX document implementation including references if appropriate
    462  */
    463 #define CPU_PARTITION_ALIGNMENT    CPU_ALIGNMENT
    464446
    465447/**
  • cpukit/score/cpu/m68k/include/rtems/score/cpu.h

    r141d502 r27bbc05  
    332332#define CPU_ALIGNMENT                    4
    333333#define CPU_HEAP_ALIGNMENT               CPU_ALIGNMENT
    334 #define CPU_PARTITION_ALIGNMENT          CPU_ALIGNMENT
    335334
    336335/*
  • cpukit/score/cpu/mips/include/rtems/score/cpu.h

    r141d502 r27bbc05  
    554554
    555555/*
    556  *  This number corresponds to the byte alignment requirement for memory
    557  *  buffers allocated by the partition manager.  This alignment requirement
    558  *  may be stricter than that for the data types alignment specified by
    559  *  CPU_ALIGNMENT.  It is common for the partition to follow the same
    560  *  alignment requirement as CPU_ALIGNMENT.  If the CPU_ALIGNMENT is strict
    561  *  enough for the partition, then this should be set to CPU_ALIGNMENT.
    562  *
    563  *  NOTE:  This does not have to be a power of 2.  It does have to
    564  *         be greater or equal to than CPU_ALIGNMENT.
    565  */
    566 
    567 #define CPU_PARTITION_ALIGNMENT    CPU_ALIGNMENT
    568 
    569 /*
    570556 *  This number corresponds to the byte alignment requirement for the
    571557 *  stack.  This alignment requirement may be stricter than that for the
  • cpukit/score/cpu/moxie/include/rtems/score/cpu.h

    r141d502 r27bbc05  
    373373
    374374/*
    375  *  This number corresponds to the byte alignment requirement for memory
    376  *  buffers allocated by the partition manager.  This alignment requirement
    377  *  may be stricter than that for the data types alignment specified by
    378  *  CPU_ALIGNMENT.  It is common for the partition to follow the same
    379  *  alignment requirement as CPU_ALIGNMENT.  If the CPU_ALIGNMENT is strict
    380  *  enough for the partition, then this should be set to CPU_ALIGNMENT.
    381  *
    382  *  NOTE:  This does not have to be a power of 2.  It does have to
    383  *         be greater or equal to than CPU_ALIGNMENT.
    384  *
    385  *  MOXIE Specific Information:
    386  *
    387  *  XXX
    388  */
    389 #define CPU_PARTITION_ALIGNMENT    CPU_ALIGNMENT
    390 
    391 /*
    392375 *  This number corresponds to the byte alignment requirement for the
    393376 *  stack.  This alignment requirement may be stricter than that for the
  • cpukit/score/cpu/nios2/include/rtems/score/cpu.h

    r141d502 r27bbc05  
    7373
    7474#define CPU_HEAP_ALIGNMENT CPU_ALIGNMENT
    75 
    76 #define CPU_PARTITION_ALIGNMENT CPU_ALIGNMENT
    7775
    7876/*
  • cpukit/score/cpu/no_cpu/include/rtems/score/cpu.h

    r141d502 r27bbc05  
    598598
    599599/**
    600  * This number corresponds to the byte alignment requirement for memory
    601  * buffers allocated by the partition manager.  This alignment requirement
    602  * may be stricter than that for the data types alignment specified by
    603  * @ref CPU_ALIGNMENT.  It is common for the partition to follow the same
    604  * alignment requirement as @ref CPU_ALIGNMENT.  If the @ref CPU_ALIGNMENT is
    605  * strict enough for the partition, then this should be set to
    606  * @ref CPU_ALIGNMENT.
    607  *
    608  * NOTE:  This does not have to be a power of 2.  It does have to
    609  *        be greater or equal to than @ref CPU_ALIGNMENT.
    610  *
    611  * Port Specific Information:
    612  *
    613  * XXX document implementation including references if appropriate
    614  */
    615 #define CPU_PARTITION_ALIGNMENT    CPU_ALIGNMENT
    616 
    617 /**
    618600 * This number corresponds to the byte alignment requirement for the
    619601 * stack.  This alignment requirement may be stricter than that for the
  • cpukit/score/cpu/or1k/include/rtems/score/cpu.h

    r141d502 r27bbc05  
    361361
    362362/*
    363  *  This number corresponds to the byte alignment requirement for memory
    364  *  buffers allocated by the partition manager.  This alignment requirement
    365  *  may be stricter than that for the data types alignment specified by
    366  *  CPU_ALIGNMENT.  It is common for the partition to follow the same
    367  *  alignment requirement as CPU_ALIGNMENT.  If the CPU_ALIGNMENT is strict
    368  *  enough for the partition, then this should be set to CPU_ALIGNMENT.
    369  *
    370  *  NOTE:  This does not have to be a power of 2.  It does have to
    371  *         be greater or equal to than CPU_ALIGNMENT.
    372  *
    373  */
    374 
    375 #define CPU_PARTITION_ALIGNMENT    CPU_ALIGNMENT
    376 
    377 /*
    378363 *  This number corresponds to the byte alignment requirement for the
    379364 *  stack.  This alignment requirement may be stricter than that for the
  • cpukit/score/cpu/powerpc/include/rtems/score/cpu.h

    r141d502 r27bbc05  
    684684
    685685/*
    686  *  This number corresponds to the byte alignment requirement for memory
    687  *  buffers allocated by the partition manager.  This alignment requirement
    688  *  may be stricter than that for the data types alignment specified by
    689  *  CPU_ALIGNMENT.  It is common for the partition to follow the same
    690  *  alignment requirement as CPU_ALIGNMENT.  If the CPU_ALIGNMENT is strict
    691  *  enough for the partition, then this should be set to CPU_ALIGNMENT.
    692  *
    693  *  NOTE:  This does not have to be a power of 2.  It does have to
    694  *         be greater or equal to than CPU_ALIGNMENT.
    695  */
    696 
    697 #define CPU_PARTITION_ALIGNMENT    (PPC_ALIGNMENT)
    698 
    699 /*
    700686 *  This number corresponds to the byte alignment requirement for the
    701687 *  stack.  This alignment requirement may be stricter than that for the
  • cpukit/score/cpu/riscv/include/rtems/score/cpu.h

    r141d502 r27bbc05  
    8181
    8282#define CPU_HEAP_ALIGNMENT CPU_ALIGNMENT
    83 
    84 #define CPU_PARTITION_ALIGNMENT CPU_ALIGNMENT
    8583
    8684/* RISC-V ELF psABI specification */
  • cpukit/score/cpu/sh/include/rtems/score/cpu.h

    r141d502 r27bbc05  
    381381
    382382#define CPU_HEAP_ALIGNMENT         CPU_ALIGNMENT
    383 
    384 /*
    385  *  This number corresponds to the byte alignment requirement for memory
    386  *  buffers allocated by the partition manager.  This alignment requirement
    387  *  may be stricter than that for the data types alignment specified by
    388  *  CPU_ALIGNMENT.  It is common for the partition to follow the same
    389  *  alignment requirement as CPU_ALIGNMENT.  If the CPU_ALIGNMENT is strict
    390  *  enough for the partition, then this should be set to CPU_ALIGNMENT.
    391  *
    392  *  NOTE:  This does not have to be a power of 2.  It does have to
    393  *         be greater or equal to than CPU_ALIGNMENT.
    394  */
    395 
    396 #define CPU_PARTITION_ALIGNMENT    CPU_ALIGNMENT
    397383
    398384/*
  • cpukit/score/cpu/sparc/include/rtems/score/cpu.h

    r141d502 r27bbc05  
    772772
    773773/**
    774  * This number corresponds to the byte alignment requirement for memory
    775  * buffers allocated by the partition manager.  This alignment requirement
    776  * may be stricter than that for the data types alignment specified by
    777  * CPU_ALIGNMENT.  It is common for the partition to follow the same
    778  * alignment requirement as CPU_ALIGNMENT.  If the CPU_ALIGNMENT is strict
    779  * enough for the partition, then this should be set to CPU_ALIGNMENT.
    780  *
    781  * NOTE:  This does not have to be a power of 2.  It does have to
    782  *        be greater or equal to than CPU_ALIGNMENT.
    783  */
    784 #define CPU_PARTITION_ALIGNMENT    CPU_ALIGNMENT
    785 
    786 /**
    787774 * Stack frames must be doubleword aligned according to the System V ABI for
    788775 * SPARC.
  • cpukit/score/cpu/sparc64/include/rtems/score/cpu.h

    r141d502 r27bbc05  
    649649
    650650/*
    651  *  This number corresponds to the byte alignment requirement for memory
    652  *  buffers allocated by the partition manager.  This alignment requirement
    653  *  may be stricter than that for the data types alignment specified by
    654  *  CPU_ALIGNMENT.  It is common for the partition to follow the same
    655  *  alignment requirement as CPU_ALIGNMENT.  If the CPU_ALIGNMENT is strict
    656  *  enough for the partition, then this should be set to CPU_ALIGNMENT.
    657  *
    658  *  NOTE:  This does not have to be a power of 2.  It does have to
    659  *         be greater or equal to than CPU_ALIGNMENT.
    660  */
    661 
    662 #define CPU_PARTITION_ALIGNMENT    CPU_ALIGNMENT
    663 
    664 /*
    665651 *  This number corresponds to the byte alignment requirement for the
    666652 *  stack.  This alignment requirement may be stricter than that for the
  • cpukit/score/cpu/v850/include/rtems/score/cpu.h

    r141d502 r27bbc05  
    414414
    415415/**
    416  * This number corresponds to the byte alignment requirement for memory
    417  * buffers allocated by the partition manager.  This alignment requirement
    418  * may be stricter than that for the data types alignment specified by
    419  * @ref CPU_ALIGNMENT.  It is common for the partition to follow the same
    420  * alignment requirement as @ref CPU_ALIGNMENT.  If the @ref CPU_ALIGNMENT is
    421  * strict enough for the partition, then this should be set to
    422  * @ref CPU_ALIGNMENT.
    423  *
    424  * @note  This does not have to be a power of 2.  It does have to
    425  *        be greater or equal to than @ref CPU_ALIGNMENT.
    426  *
    427  * Port Specific Information:
    428  *
    429  * There is no apparent reason why this should be larger than CPU_ALIGNMENT.
    430  */
    431 #define CPU_PARTITION_ALIGNMENT    CPU_ALIGNMENT
    432 
    433 /**
    434416 * This number corresponds to the byte alignment requirement for the
    435417 * stack.  This alignment requirement may be stricter than that for the
  • cpukit/score/cpu/x86_64/include/rtems/score/cpu.h

    r141d502 r27bbc05  
    115115#define CPU_ALIGNMENT              8
    116116#define CPU_HEAP_ALIGNMENT         CPU_ALIGNMENT
    117 #define CPU_PARTITION_ALIGNMENT    CPU_ALIGNMENT
    118117#define CPU_STACK_ALIGNMENT        16
    119118#define CPU_INTERRUPT_STACK_ALIGNMENT CPU_CACHE_LINE_BYTES
Note: See TracChangeset for help on using the changeset viewer.