[PATCH 1/4] score: Add optional _CPU_Context_Destroy()

Gedare Bloom gedare at rtems.org
Wed Jul 19 14:13:35 UTC 2017


On Wed, Jul 19, 2017 at 4:21 AM, Sebastian Huber
<sebastian.huber at embedded-brains.de> wrote:
> Update #3077.
> ---
>  cpukit/score/cpu/no_cpu/rtems/score/cpu.h  | 19 +++++++++++++++++++
>  cpukit/score/include/rtems/score/context.h |  7 +++++++
>  cpukit/score/src/threadrestart.c           |  2 +-
>  3 files changed, 27 insertions(+), 1 deletion(-)
>
> diff --git a/cpukit/score/cpu/no_cpu/rtems/score/cpu.h b/cpukit/score/cpu/no_cpu/rtems/score/cpu.h
> index 62e1a91cb9..c16adc7327 100644
> --- a/cpukit/score/cpu/no_cpu/rtems/score/cpu.h
> +++ b/cpukit/score/cpu/no_cpu/rtems/score/cpu.h
> @@ -816,6 +816,25 @@ uint32_t   _CPU_ISR_Get_level( void );
>  /* Context handler macros */
>
>  /**
> + * @ingroup CPUContext
> + *
> + * @brief Destroys the context of the thread.
> + *
> + * It must be implemented as a macro and an implementation is optional.  The
> + * default implementation does nothing.
> + *
> + * @param[in] _the_thread The corresponding thread.
> + * @param[in] _the_context The context to destroy.
> + *
> + * Port Specific Information:
> + *
> + * XXX document implementation including references if appropriate
> + */
> +#define _CPU_Context_Destroy( _the_thread, _the_context ) \
> +  { \
> +  }
> +
> +/**
>   *  @ingroup CPUContext
>   *
>   * Initialize the context to a state suitable for starting a
> diff --git a/cpukit/score/include/rtems/score/context.h b/cpukit/score/include/rtems/score/context.h
> index 46cb4606b1..4795d2ea67 100644
> --- a/cpukit/score/include/rtems/score/context.h
> +++ b/cpukit/score/include/rtems/score/context.h
> @@ -146,6 +146,13 @@ extern "C" {
>  #define _Context_Save_fp( _fp ) \
>     _CPU_Context_save_fp( _fp )
>
> +#if defined(_CPU_Context_Destroy)
> +  #define _Context_Destory( _the_thread, _the_context ) \
typo: s/Destory/Destroy

What is the point of this function/macro?

> +    _CPU_Context_Destroy( _the_thread, _the_context )
> +#else
> +  #define _Context_Destory( _the_thread, _the_context )
> +#endif
> +
>  #ifdef __cplusplus
>  }
>  #endif
> diff --git a/cpukit/score/src/threadrestart.c b/cpukit/score/src/threadrestart.c
> index 5938dcfecf..adb6be71bf 100644
> --- a/cpukit/score/src/threadrestart.c
> +++ b/cpukit/score/src/threadrestart.c
> @@ -205,7 +205,7 @@ static void _Thread_Free( Thread_Control *the_thread )
>  #endif
>
>    _Thread_queue_Destroy( &the_thread->Join_queue );
> -
> +  _Context_Destory( the_thread, &the_thread->Registers );
>    _Objects_Free( &information->Objects, &the_thread->Object );
>  }
>
> --
> 2.12.3
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel



More information about the devel mailing list