From 3560f994810b28b7106994ae68b4b6a7afc8e6f3 Mon Sep 17 00:00:00 2001 From: "Gerardo E. Cruz-Ortiz" <59618057+astrogeco@users.noreply.github.com> Date: Wed, 9 Mar 2022 10:26:50 -0500 Subject: [PATCH] HotFix #1221, OS_Impl_Loader on RTEMS - Add aliased typedef to handle renames from RTEMS 4.11 to RTEMS 5 - Cast to cpuaddress before assignment to `OS_module_address_t` elements --- src/os/rtems/inc/os-rtems.h | 16 ++++++++++++++++ src/os/rtems/src/os-impl-loader.c | 14 +++++++------- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/src/os/rtems/inc/os-rtems.h b/src/os/rtems/inc/os-rtems.h index b22abbe87..8b2eed570 100644 --- a/src/os/rtems/inc/os-rtems.h +++ b/src/os/rtems/inc/os-rtems.h @@ -47,6 +47,12 @@ #include #include +#ifndef _RTEMS_5_ + +#include /* needed for RTEMS 4.11 alias */ + +#endif + #include "os-shared-globaldefs.h" /**************************************************************************************** @@ -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; diff --git a/src/os/rtems/src/os-impl-loader.c b/src/os/rtems/src/os-impl-loader.c index 93b864dc6..14562d0c3 100644 --- a/src/os/rtems/src/os-impl-loader.c +++ b/src/os/rtems/src/os-impl-loader.c @@ -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; @@ -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; }