Skip to content

Size and alignment of CFE_ES_MemHandle_t vary depending on platform; ground-visible structures affected #322

@skliper

Description

@skliper

CFE_ES_MemHandle_t is [https://babelfish.arc.nasa.gov/trac/cfs_cfe/browser/fsw/cfe-core/src/inc/cfe_es.h#5098 defined] as
typedef cpuaddr CFE_ES_MemHandle_t; and the size and alignment of cpuaddr vary by platform.

This type is used as a member in (at least) the following telemetry structures:

  • [https://babelfish.arc.nasa.gov/trac/cfs_cfe/browser/fsw/cfe-core/src/inc/cfe_sb_msg.h#8870 CFE_SB_HousekeepingTlm_Payload_t]
  • [https://babelfish.arc.nasa.gov/trac/cfs_cfe/browser/fsw/cfe-core/src/inc/cfe_tbl_msg.h#10547 CFE_TBL_HousekeepingTlm_Payload_t]
  • [https://babelfish.arc.nasa.gov/trac/cfs_cfe/browser/fsw/cfe-core/src/inc/cfe_es_msg.h#45469 CFE_ES_PoolStatsTlm_Payload_t]

It is also used in (at least) the following command structure:

  • [https://babelfish.arc.nasa.gov/trac/cfs_cfe/browser/fsw/cfe-core/src/inc/cfe_es_msg.h#45416 CFE_ES_SendMemPoolStatsCmd_Payload_t]

On 64-bit platforms which require self-alignment (e.g. x86_64, aarch64), the presence of a CFE_ES_MemHandle_t member causes the structure to require 8 byte alignment. This results in a 4 byte hole between the 12 byte telemetry header and payload when the payload is defined as a separate structure, such as the cases noted above.

Note that unlike the various address values in CFE_ES_AppInfo_t, the actual value of these handles is needed on the ground for use in the ES "send MemPool stats" command, which takes a handle as its argument. In addition, these telemetry structures don't have a field indicating the validity of the handle.

Both of these factors suggest the fix accepted by the CCB for CFE_ES_AppInfo_t, populating the fields with the low bytes of the value and marking them invalid when the fields are too small to hold the actual value, may not be viable for these structures.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions