Changeset b2de426 in rtems


Ignore:
Timestamp:
Aug 6, 2018, 9:53:42 AM (2 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
5, master
Children:
0fc87d47
Parents:
66cb142
git-author:
Sebastian Huber <sebastian.huber@…> (08/06/18 09:53:42)
git-committer:
Sebastian Huber <sebastian.huber@…> (08/10/18 05:14:43)
Message:

score: Fix _Addresses_Subtract()

Use architecture-specific integer type for an address difference.

Update #3486.

Location:
cpukit
Files:
4 edited

Legend:

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

    r66cb142 rb2de426  
    7878)
    7979{
    80   uint32_t    offset;
    81 
    82   offset = (uint32_t) _Addresses_Subtract(
     80  intptr_t offset;
     81
     82  offset = _Addresses_Subtract(
    8383    the_buffer,
    8484    the_partition->starting_address
  • cpukit/include/rtems/score/address.h

    r66cb142 rb2de426  
    7878
    7979/**
    80  * @brief Subtract two offsets.
     80 * @brief Subtract two addresses.
    8181 *
    8282 * This function is used to subtract two addresses.  It returns the
     
    8787 *
    8888 * @return This method returns the resulting address.
    89  *
    90  * @note  The cast of an address to an uint32_t makes this code
    91  *        dependent on an addresses being thirty two bits.
    9289 */
    93 RTEMS_INLINE_ROUTINE int32_t _Addresses_Subtract (
     90RTEMS_INLINE_ROUTINE intptr_t _Addresses_Subtract(
    9491  const void *left,
    9592  const void *right
    9693)
    9794{
    98   return (int32_t) ((const char *) left - (const char *) right);
     95  return (intptr_t) ( (const char *) left - (const char *) right );
    9996}
    10097
  • cpukit/rtems/src/dpmemexternal2internal.c

    r66cb142 rb2de426  
    3030  Dual_ported_memory_Control *the_port;
    3131  ISR_lock_Context            lock_context;
    32   uint32_t                    ending;
     32  uintptr_t                   length;
    3333
    3434  if ( internal == NULL ) {
     
    4242  }
    4343
    44   ending = _Addresses_Subtract( external, the_port->external_base );
     44  length = (uintptr_t) _Addresses_Subtract( external, the_port->external_base );
    4545
    46   if ( ending > the_port->length ) {
     46  if ( length > the_port->length ) {
    4747    *internal = external;
    4848  } else {
    49     *internal = _Addresses_Add_offset( the_port->internal_base, ending );
     49    *internal = _Addresses_Add_offset( the_port->internal_base, length );
    5050  }
    5151
  • cpukit/rtems/src/dpmeminternal2external.c

    r66cb142 rb2de426  
    3030  Dual_ported_memory_Control *the_port;
    3131  ISR_lock_Context            lock_context;
    32   uint32_t                    ending;
     32  uintptr_t                   length;
    3333
    3434  if ( external == NULL ) {
     
    4242  }
    4343
    44   ending = _Addresses_Subtract( internal, the_port->internal_base );
     44  length = (uintptr_t) _Addresses_Subtract( internal, the_port->internal_base );
    4545
    46   if ( ending > the_port->length ) {
     46  if ( length > the_port->length ) {
    4747    *external = internal;
    4848  } else {
    49     *external = _Addresses_Add_offset( the_port->external_base, ending );
     49    *external = _Addresses_Add_offset( the_port->external_base, length );
    5050  }
    5151
Note: See TracChangeset for help on using the changeset viewer.