From fad01e6cf95f98adaca3157faa8b96c19296a68e Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 10 Jun 2021 09:55:42 +0200 Subject: score: Add PER_CPU_DATA_NEED_INITIALIZATION() Make the initialization of the per-CPU data optional. Change license to BSD-2-Clause according to file history and re-licensing agreement. Update #3053. --- cpukit/include/rtems/score/percpudata.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'cpukit/include/rtems/score/percpudata.h') diff --git a/cpukit/include/rtems/score/percpudata.h b/cpukit/include/rtems/score/percpudata.h index cae73a62b0..da454fd7bf 100644 --- a/cpukit/include/rtems/score/percpudata.h +++ b/cpukit/include/rtems/score/percpudata.h @@ -50,6 +50,20 @@ extern "C" { RTEMS_LINKER_RWSET_DECLARE( _Per_CPU_Data, char ); +/** + * @brief Translation units which define per-CPU items shall call this macro + * exactly once at file scope. + */ +#ifdef RTEMS_SMP +#define PER_CPU_DATA_NEED_INITIALIZATION() \ + static const char * const _Per_CPU_Data_reference \ + RTEMS_SECTION( ".rtemsroset.reference" ) RTEMS_USED = \ + RTEMS_LINKER_SET_BEGIN( _Per_CPU_Data ) +#else +#define PER_CPU_DATA_NEED_INITIALIZATION() \ + RTEMS_LINKER_RWSET_DECLARE( _Per_CPU_Data, char ) +#endif + /** * @brief Declares a per-CPU item of the specified type. * -- cgit v1.2.3