Skip to content

Commit

Permalink
HotFix nasa#1221, OS_Impl_Loader on RTEMS
Browse files Browse the repository at this point in the history
- Add aliased typedef to handle renames from RTEMS 4.11 to RTEMS 5
- Cast to cpuaddress before assignment to `OS_module_address_t` elements
  • Loading branch information
astrogeco committed Mar 10, 2022
1 parent 75fe674 commit fdd768b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
16 changes: 16 additions & 0 deletions src/os/rtems/inc/os-rtems.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@
#include <rtems/malloc.h>
#include <rtems/rtems/intr.h>

#ifndef _RTEMS_5_

#include <rtems/rtl/rtl.h> /* needed for RTEMS 4.11 alias */

#endif

#include "os-shared-globaldefs.h"

/****************************************************************************************
Expand All @@ -60,17 +66,27 @@
#define OSAL_UNRESOLV_REC_TYPE rtems_rtl_unresolv_rec
#define OSAL_UNRESOLVED_SYMBOL rtems_rtl_unresolved_symbol
#define OSAL_UNRESOLVED_ITERATE rtems_rtl_unresolved_iterate

#else

#define OSAL_HEAP_INFO_BLOCK region_information_block
#define OSAL_UNRESOLV_REC_TYPE rtems_rtl_unresolv_rec_t
#define OSAL_UNRESOLVED_SYMBOL rtems_rtl_unresolved_name
#define OSAL_UNRESOLVED_ITERATE rtems_rtl_unresolved_interate

#endif


/****************************************************************************************
TYPEDEFS
***************************************************************************************/

#ifndef _RTEMS_5_

typedef rtems_rtl_obj_t rtems_rtl_obj; /* Alias for RTEMS 4.11 */

#endif

typedef struct
{
uint32 ClockAccuracyNsec;
Expand Down
14 changes: 7 additions & 7 deletions src/os/rtems/src/os-impl-loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ int32 OS_ModuleUnload_Impl(const OS_object_token_t *token)
*-----------------------------------------------------------------*/
int32 OS_ModuleGetInfo_Impl(const OS_object_token_t *token, OS_module_prop_t *module_prop)
{
rtems_rtl_obj * obj;
rtems_rtl_obj *obj;
OS_impl_module_internal_record_t *impl;
int32 status = OS_ERROR;

Expand All @@ -232,12 +232,12 @@ int32 OS_ModuleGetInfo_Impl(const OS_object_token_t *token, OS_module_prop_t *mo
if (obj != NULL)
{
module_prop->addr.valid = true;
module_prop->addr.code_address = obj->text_base;
module_prop->addr.code_size = rtems_rtl_obj_text_size(obj);
module_prop->addr.data_address = obj->data_base;
module_prop->addr.data_size = rtems_rtl_obj_data_size(obj);
module_prop->addr.bss_address = obj->bss_base;
module_prop->addr.bss_size = rtems_rtl_obj_bss_size(obj);
module_prop->addr.code_address = (cpuaddr) obj->text_base;
module_prop->addr.code_size = (cpuaddr) rtems_rtl_obj_text_size(obj);
module_prop->addr.data_address = (cpuaddr) obj->data_base;
module_prop->addr.data_size = (cpuaddr) rtems_rtl_obj_data_size(obj);
module_prop->addr.bss_address = (cpuaddr) obj->bss_base;
module_prop->addr.bss_size = (cpuaddr) rtems_rtl_obj_bss_size(obj);

status = OS_SUCCESS;
}
Expand Down

0 comments on commit fdd768b

Please sign in to comment.