[PATCH] score: Delete _CPU_Context_Fp_start()
Sebastian Huber
sebastian.huber at embedded-brains.de
Wed Jan 25 13:35:12 UTC 2017
Since the FP area pointer is passed by reference in
_CPU_Context_Initialize_fp() the optional FP area adjustment via
_CPU_Context_Fp_start() is superfluous. It is also wrong with respect
to memory management, e.g. pointer passed to _Workspace_Free() may be
not the one returned by _Workspace_Allocate().
Close #1400.
---
cpukit/score/cpu/arm/rtems/score/cpu.h | 3 ---
cpukit/score/cpu/bfin/rtems/score/cpu.h | 25 -------------------------
cpukit/score/cpu/epiphany/rtems/score/cpu.h | 18 ------------------
cpukit/score/cpu/i386/rtems/score/cpu.h | 3 ---
cpukit/score/cpu/lm32/rtems/score/cpu.h | 27 ---------------------------
cpukit/score/cpu/m32c/rtems/score/cpu.h | 26 --------------------------
cpukit/score/cpu/m68k/rtems/score/cpu.h | 20 ++------------------
cpukit/score/cpu/mips/rtems/score/cpu.h | 17 -----------------
cpukit/score/cpu/moxie/rtems/score/cpu.h | 20 --------------------
cpukit/score/cpu/no_cpu/rtems/score/cpu.h | 26 --------------------------
cpukit/score/cpu/or1k/rtems/score/cpu.h | 18 +++++++-----------
cpukit/score/cpu/powerpc/rtems/score/cpu.h | 17 -----------------
cpukit/score/cpu/sh/rtems/score/cpu.h | 17 -----------------
cpukit/score/cpu/sparc/rtems/score/cpu.h | 7 -------
cpukit/score/cpu/sparc64/rtems/score/cpu.h | 8 --------
cpukit/score/cpu/v850/rtems/score/cpu.h | 28 ----------------------------
cpukit/score/include/rtems/score/context.h | 16 ----------------
cpukit/score/src/threadinitialize.c | 1 -
18 files changed, 9 insertions(+), 288 deletions(-)
diff --git a/cpukit/score/cpu/arm/rtems/score/cpu.h b/cpukit/score/cpu/arm/rtems/score/cpu.h
index cdffc9c..9f321ac 100644
--- a/cpukit/score/cpu/arm/rtems/score/cpu.h
+++ b/cpukit/score/cpu/arm/rtems/score/cpu.h
@@ -458,9 +458,6 @@ void _CPU_Context_Initialize(
#define _CPU_Context_Restart_self( _the_context ) \
_CPU_Context_restore( (_the_context) );
-#define _CPU_Context_Fp_start( _base, _offset ) \
- ( (void *) _Addresses_Add_offset( (_base), (_offset) ) )
-
#define _CPU_Context_Initialize_fp( _destination ) \
do { \
*(*(_destination)) = _CPU_Null_fp_context; \
diff --git a/cpukit/score/cpu/bfin/rtems/score/cpu.h b/cpukit/score/cpu/bfin/rtems/score/cpu.h
index cdefedf..7c90fc6 100644
--- a/cpukit/score/cpu/bfin/rtems/score/cpu.h
+++ b/cpukit/score/cpu/bfin/rtems/score/cpu.h
@@ -734,31 +734,6 @@ void _CPU_Context_Initialize(
#define _CPU_Context_Restart_self( _the_context ) \
_CPU_Context_restore( (_the_context) );
-/**
- * @ingroup CPUContext
- * The purpose of this macro is to allow the initial pointer into
- * a floating point context area (used to save the floating point
- * context) to be at an arbitrary place in the floating point
- * context area.
- *
- * This is necessary because some FP units are designed to have
- * their context saved as a stack which grows into lower addresses.
- * Other FP units can be saved by simply moving registers into offsets
- * from the base of the context area. Finally some FP units provide
- * a "dump context" instruction which could fill in from high to low
- * or low to high based on the whim of the CPU designers.
- *
- * @param[in] _base is the lowest physical address of the floating point
- * context area
- * @param[in] _offset is the offset into the floating point area
- *
- * Port Specific Information:
- *
- * XXX document implementation including references if appropriate
- */
-#define _CPU_Context_Fp_start( _base, _offset ) \
- ( (void *) _Addresses_Add_offset( (_base), (_offset) ) )
-
#define _CPU_Context_Initialize_fp( _destination ) \
memset( *( _destination ), 0, CPU_CONTEXT_FP_SIZE );
diff --git a/cpukit/score/cpu/epiphany/rtems/score/cpu.h b/cpukit/score/cpu/epiphany/rtems/score/cpu.h
index 55faefa..020d949 100644
--- a/cpukit/score/cpu/epiphany/rtems/score/cpu.h
+++ b/cpukit/score/cpu/epiphany/rtems/score/cpu.h
@@ -624,24 +624,6 @@ void _CPU_Context_Initialize(
#define _CPU_Context_Restart_self( _the_context ) \
_CPU_Context_restore( (_the_context) )
-/*
- * The purpose of this macro is to allow the initial pointer into
- * a floating point context area (used to save the floating point
- * context) to be at an arbitrary place in the floating point
- * context area.
- *
- * This is necessary because some FP units are designed to have
- * their context saved as a stack which grows into lower addresses.
- * Other FP units can be saved by simply moving registers into offsets
- * from the base of the context area. Finally some FP units provide
- * a "dump context" instruction which could fill in from high to low
- * or low to high based on the whim of the CPU designers.
- *
- */
-
-#define _CPU_Context_Fp_start( _base, _offset ) \
- ( (void *) _Addresses_Add_offset( (_base), (_offset) ) )
-
#define _CPU_Context_Initialize_fp( _destination ) \
memset( *( _destination ), 0, CPU_CONTEXT_FP_SIZE );
diff --git a/cpukit/score/cpu/i386/rtems/score/cpu.h b/cpukit/score/cpu/i386/rtems/score/cpu.h
index 052e53f..ace26f3 100644
--- a/cpukit/score/cpu/i386/rtems/score/cpu.h
+++ b/cpukit/score/cpu/i386/rtems/score/cpu.h
@@ -508,9 +508,6 @@ uint32_t _CPU_ISR_Get_level( void );
}
#endif
-#define _CPU_Context_Fp_start( _base, _offset ) \
- ( (void *) _Addresses_Add_offset( (_base), (_offset) ) )
-
#define _CPU_Context_Initialize_fp( _fp_area ) \
{ \
memcpy( *_fp_area, &_CPU_Null_fp_context, CPU_CONTEXT_FP_SIZE ); \
diff --git a/cpukit/score/cpu/lm32/rtems/score/cpu.h b/cpukit/score/cpu/lm32/rtems/score/cpu.h
index 87cfd9e..9d22994 100644
--- a/cpukit/score/cpu/lm32/rtems/score/cpu.h
+++ b/cpukit/score/cpu/lm32/rtems/score/cpu.h
@@ -749,33 +749,6 @@ extern char _gp[];
_CPU_Context_restore( (_the_context) );
/**
- * @ingroup CPUContext
- * The purpose of this macro is to allow the initial pointer into
- * a floating point context area (used to save the floating point
- * context) to be at an arbitrary place in the floating point
- * context area.
- *
- * This is necessary because some FP units are designed to have
- * their context saved as a stack which grows into lower addresses.
- * Other FP units can be saved by simply moving registers into offsets
- * from the base of the context area. Finally some FP units provide
- * a "dump context" instruction which could fill in from high to low
- * or low to high based on the whim of the CPU designers.
- *
- * @param[in] _base is the lowest physical address of the floating point
- * context area
- * @param[in] _offset is the offset into the floating point area
- *
- * Port Specific Information:
- *
- * XXX document implementation including references if appropriate
- */
-#define _CPU_Context_Fp_start( _base, _offset )
-#if 0
- ( (void *) _Addresses_Add_offset( (_base), (_offset) ) )
-#endif
-
-/**
* This routine initializes the FP context area passed to it to.
* There are a few standard ways in which to initialize the
* floating point context. The code included for this macro assumes
diff --git a/cpukit/score/cpu/m32c/rtems/score/cpu.h b/cpukit/score/cpu/m32c/rtems/score/cpu.h
index 8dd8c41..af1c341 100644
--- a/cpukit/score/cpu/m32c/rtems/score/cpu.h
+++ b/cpukit/score/cpu/m32c/rtems/score/cpu.h
@@ -740,32 +740,6 @@ void _CPU_Context_Restart_self(
) RTEMS_NO_RETURN;
/**
- * @ingroup CPUContext
- *
- * The purpose of this macro is to allow the initial pointer into
- * a floating point context area (used to save the floating point
- * context) to be at an arbitrary place in the floating point
- * context area.
- *
- * This is necessary because some FP units are designed to have
- * their context saved as a stack which grows into lower addresses.
- * Other FP units can be saved by simply moving registers into offsets
- * from the base of the context area. Finally some FP units provide
- * a "dump context" instruction which could fill in from high to low
- * or low to high based on the whim of the CPU designers.
- *
- * @param[in] _base is the lowest physical address of the floating point
- * context area
- * @param[in] _offset is the offset into the floating point area
- *
- * Port Specific Information:
- *
- * XXX document implementation including references if appropriate
- */
-#define _CPU_Context_Fp_start( _base, _offset ) \
- ( (void *) _Addresses_Add_offset( (_base), (_offset) ) )
-
-/**
* This routine initializes the FP context area passed to it to.
* There are a few standard ways in which to initialize the
* floating point context. The code included for this macro assumes
diff --git a/cpukit/score/cpu/m68k/rtems/score/cpu.h b/cpukit/score/cpu/m68k/rtems/score/cpu.h
index 0b9aa2d..ec6fd2e 100644
--- a/cpukit/score/cpu/m68k/rtems/score/cpu.h
+++ b/cpukit/score/cpu/m68k/rtems/score/cpu.h
@@ -172,12 +172,6 @@ typedef struct {
} _operand2;
} Context_Control_fp;
- /*
- * This software FP implementation is only for GCC.
- */
- #define _CPU_Context_Fp_start( _base, _offset ) \
- ((void *) _Addresses_Add_offset( (_base), (_offset) ) )
-
#define _CPU_Context_Initialize_fp( _fp_area ) \
{ \
Context_Control_fp *_fp; \
@@ -234,9 +228,6 @@ typedef struct {
#endif
} Context_Control_fp;
- #define _CPU_Context_Fp_start( _base, _offset ) \
- ((void *) _Addresses_Add_offset( (_base), (_offset) ))
-
/*
* The reset value for all context relevant registers except the FP data
* registers is zero. The reset value of the FP data register is NAN. The
@@ -260,17 +251,10 @@ typedef struct {
uint8_t fp_save_area [M68K_FP_STATE_SIZE + 112];
} Context_Control_fp;
- #define _CPU_Context_Fp_start( _base, _offset ) \
- ( \
- (void *) _Addresses_Add_offset( \
- (_base), \
- (_offset) + CPU_CONTEXT_FP_SIZE - 4 \
- ) \
- )
-
#define _CPU_Context_Initialize_fp( _fp_area ) \
{ \
- uint32_t *_fp_context = (uint32_t *)*(_fp_area); \
+ uint32_t *_fp_context = _Addresses_Add_offset( \
+ *(_fp_area), CPU_CONTEXT_FP_SIZE - 4); \
*(--(_fp_context)) = 0; \
*(_fp_area) = (void *)(_fp_context); \
}
diff --git a/cpukit/score/cpu/mips/rtems/score/cpu.h b/cpukit/score/cpu/mips/rtems/score/cpu.h
index 9a45d0b..74afc80 100644
--- a/cpukit/score/cpu/mips/rtems/score/cpu.h
+++ b/cpukit/score/cpu/mips/rtems/score/cpu.h
@@ -792,23 +792,6 @@ void _CPU_Context_Initialize(
_CPU_Context_restore( (_the_context) );
/*
- * The purpose of this macro is to allow the initial pointer into
- * A floating point context area (used to save the floating point
- * context) to be at an arbitrary place in the floating point
- * context area.
- *
- * This is necessary because some FP units are designed to have
- * their context saved as a stack which grows into lower addresses.
- * Other FP units can be saved by simply moving registers into offsets
- * from the base of the context area. Finally some FP units provide
- * a "dump context" instruction which could fill in from high to low
- * or low to high based on the whim of the CPU designers.
- */
-
-#define _CPU_Context_Fp_start( _base, _offset ) \
- ( (void *) _Addresses_Add_offset( (_base), (_offset) ) )
-
-/*
* This routine initializes the FP context area passed to it to.
* There are a few standard ways in which to initialize the
* floating point context. The code included for this macro assumes
diff --git a/cpukit/score/cpu/moxie/rtems/score/cpu.h b/cpukit/score/cpu/moxie/rtems/score/cpu.h
index b77083d..a8b2263 100644
--- a/cpukit/score/cpu/moxie/rtems/score/cpu.h
+++ b/cpukit/score/cpu/moxie/rtems/score/cpu.h
@@ -608,26 +608,6 @@ uint32_t _CPU_ISR_Get_level( void );
#define _CPU_Context_Restart_self( _the_context ) \
_CPU_Context_restore( (_the_context) );
-/*
- * The purpose of this macro is to allow the initial pointer into
- * a floating point context area (used to save the floating point
- * context) to be at an arbitrary place in the floating point
- * context area.
- *
- * This is necessary because some FP units are designed to have
- * their context saved as a stack which grows into lower addresses.
- * Other FP units can be saved by simply moving registers into offsets
- * from the base of the context area. Finally some FP units provide
- * a "dump context" instruction which could fill in from high to low
- * or low to high based on the whim of the CPU designers.
- *
- * MOXIE Specific Information:
- *
- * XXX
- */
-#define _CPU_Context_Fp_start( _base, _offset ) \
- ( (void *) (_base) + (_offset) )
-
#define _CPU_Context_Initialize_fp( _destination ) \
memset( *( _destination ), 0, CPU_CONTEXT_FP_SIZE );
diff --git a/cpukit/score/cpu/no_cpu/rtems/score/cpu.h b/cpukit/score/cpu/no_cpu/rtems/score/cpu.h
index 372b01f..62e1a91 100644
--- a/cpukit/score/cpu/no_cpu/rtems/score/cpu.h
+++ b/cpukit/score/cpu/no_cpu/rtems/score/cpu.h
@@ -876,32 +876,6 @@ uint32_t _CPU_ISR_Get_level( void );
_CPU_Context_restore( (_the_context) );
/**
- * @ingroup CPUContext
- *
- * The purpose of this macro is to allow the initial pointer into
- * a floating point context area (used to save the floating point
- * context) to be at an arbitrary place in the floating point
- *context area.
- *
- * This is necessary because some FP units are designed to have
- * their context saved as a stack which grows into lower addresses.
- * Other FP units can be saved by simply moving registers into offsets
- * from the base of the context area. Finally some FP units provide
- * a "dump context" instruction which could fill in from high to low
- * or low to high based on the whim of the CPU designers.
- *
- * @param[in] _base is the lowest physical address of the floating point
- * context area
- * @param[in] _offset is the offset into the floating point area
- *
- * Port Specific Information:
- *
- * XXX document implementation including references if appropriate
- */
-#define _CPU_Context_Fp_start( _base, _offset ) \
- ( (void *) _Addresses_Add_offset( (_base), (_offset) ) )
-
-/**
* This routine initializes the FP context area passed to it to.
* There are a few standard ways in which to initialize the
* floating point context. The code included for this macro assumes
diff --git a/cpukit/score/cpu/or1k/rtems/score/cpu.h b/cpukit/score/cpu/or1k/rtems/score/cpu.h
index 4a643c7..3d4a6e0 100644
--- a/cpukit/score/cpu/or1k/rtems/score/cpu.h
+++ b/cpukit/score/cpu/or1k/rtems/score/cpu.h
@@ -620,10 +620,11 @@ void _CPU_Context_Initialize(
_CPU_Context_restore( (_the_context) );
/*
- * The purpose of this macro is to allow the initial pointer into
- * a floating point context area (used to save the floating point
- * context) to be at an arbitrary place in the floating point
- * context area.
+ * This routine is responsible to initialize the FP context.
+ *
+ * The FP area pointer is passed by reference to allow the initial pointer
+ * into a floating point context area (used to save the floating point
+ * context) to be at an arbitrary place in the floating point context area.
*
* This is necessary because some FP units are designed to have
* their context saved as a stack which grows into lower addresses.
@@ -631,14 +632,9 @@ void _CPU_Context_Initialize(
* from the base of the context area. Finally some FP units provide
* a "dump context" instruction which could fill in from high to low
* or low to high based on the whim of the CPU designers.
- *
*/
-
-#define _CPU_Context_Fp_start( _base, _offset ) \
- ( (void *) _Addresses_Add_offset( (_base), (_offset) ) )
-
-#define _CPU_Context_Initialize_fp( _destination ) \
- memset( *( _destination ), 0, CPU_CONTEXT_FP_SIZE );
+#define _CPU_Context_Initialize_fp( _fp_area_p ) \
+ memset( *( _fp_area_p ), 0, CPU_CONTEXT_FP_SIZE )
/* end of Context handler macros */
diff --git a/cpukit/score/cpu/powerpc/rtems/score/cpu.h b/cpukit/score/cpu/powerpc/rtems/score/cpu.h
index 93d620e..a847667 100644
--- a/cpukit/score/cpu/powerpc/rtems/score/cpu.h
+++ b/cpukit/score/cpu/powerpc/rtems/score/cpu.h
@@ -831,23 +831,6 @@ void _CPU_Context_Initialize(
_CPU_Context_restore( (_the_context) );
/*
- * The purpose of this macro is to allow the initial pointer into
- * a floating point context area (used to save the floating point
- * context) to be at an arbitrary place in the floating point
- * context area.
- *
- * This is necessary because some FP units are designed to have
- * their context saved as a stack which grows into lower addresses.
- * Other FP units can be saved by simply moving registers into offsets
- * from the base of the context area. Finally some FP units provide
- * a "dump context" instruction which could fill in from high to low
- * or low to high based on the whim of the CPU designers.
- */
-
-#define _CPU_Context_Fp_start( _base, _offset ) \
- ( (void *) _Addresses_Add_offset( (_base), (_offset) ) )
-
-/*
* This routine initializes the FP context area passed to it to.
* There are a few standard ways in which to initialize the
* floating point context. The code included for this macro assumes
diff --git a/cpukit/score/cpu/sh/rtems/score/cpu.h b/cpukit/score/cpu/sh/rtems/score/cpu.h
index 0ad3829..c2b7081 100644
--- a/cpukit/score/cpu/sh/rtems/score/cpu.h
+++ b/cpukit/score/cpu/sh/rtems/score/cpu.h
@@ -550,23 +550,6 @@ void _CPU_Context_Initialize(
_CPU_Context_restore( (_the_context) );
/*
- * The purpose of this macro is to allow the initial pointer into
- * a floating point context area (used to save the floating point
- * context) to be at an arbitrary place in the floating point
- * context area.
- *
- * This is necessary because some FP units are designed to have
- * their context saved as a stack which grows into lower addresses.
- * Other FP units can be saved by simply moving registers into offsets
- * from the base of the context area. Finally some FP units provide
- * a "dump context" instruction which could fill in from high to low
- * or low to high based on the whim of the CPU designers.
- */
-
-#define _CPU_Context_Fp_start( _base, _offset ) \
- ( (void *) _Addresses_Add_offset( (_base), (_offset) ) )
-
-/*
* This routine initializes the FP context area passed to it to.
* There are a few standard ways in which to initialize the
* floating point context. The code included for this macro assumes
diff --git a/cpukit/score/cpu/sparc/rtems/score/cpu.h b/cpukit/score/cpu/sparc/rtems/score/cpu.h
index a59fc36..7c81f07 100644
--- a/cpukit/score/cpu/sparc/rtems/score/cpu.h
+++ b/cpukit/score/cpu/sparc/rtems/score/cpu.h
@@ -956,13 +956,6 @@ void _CPU_Context_Initialize(
_CPU_Context_restore( (_the_context) );
/**
- * The FP context area for the SPARC is a simple structure and nothing
- * special is required to find the "starting load point"
- */
-#define _CPU_Context_Fp_start( _base, _offset ) \
- ( (void *) _Addresses_Add_offset( (_base), (_offset) ) )
-
-/**
* This routine initializes the FP context area passed to it to.
*
* The SPARC allows us to use the simple initialization model
diff --git a/cpukit/score/cpu/sparc64/rtems/score/cpu.h b/cpukit/score/cpu/sparc64/rtems/score/cpu.h
index 9926ebb..47041e7 100644
--- a/cpukit/score/cpu/sparc64/rtems/score/cpu.h
+++ b/cpukit/score/cpu/sparc64/rtems/score/cpu.h
@@ -824,14 +824,6 @@ void _CPU_Context_Initialize(
_CPU_Context_restore( (_the_context) );
/*
- * The FP context area for the SPARC is a simple structure and nothing
- * special is required to find the "starting load point"
- */
-
-#define _CPU_Context_Fp_start( _base, _offset ) \
- ( (void *) _Addresses_Add_offset( (_base), (_offset) ) )
-
-/*
* This routine initializes the FP context area passed to it to.
*
* The SPARC allows us to use the simple initialization model
diff --git a/cpukit/score/cpu/v850/rtems/score/cpu.h b/cpukit/score/cpu/v850/rtems/score/cpu.h
index 6c77f51..d3cdf05 100644
--- a/cpukit/score/cpu/v850/rtems/score/cpu.h
+++ b/cpukit/score/cpu/v850/rtems/score/cpu.h
@@ -699,34 +699,6 @@ void _CPU_Context_Initialize(
/* XXX this should be possible to remove */
#if 0
/**
- * @ingroup CPUContext
- * The purpose of this macro is to allow the initial pointer into
- * a floating point context area (used to save the floating point
- * context) to be at an arbitrary place in the floating point
- * context area.
- *
- * This is necessary because some FP units are designed to have
- * their context saved as a stack which grows into lower addresses.
- * Other FP units can be saved by simply moving registers into offsets
- * from the base of the context area. Finally some FP units provide
- * a "dump context" instruction which could fill in from high to low
- * or low to high based on the whim of the CPU designers.
- *
- * @param[in] _base is the lowest physical address of the floating point
- * context area
- * @param[in] _offset is the offset into the floating point area
- *
- * Port Specific Information:
- *
- * XXX document implementation including references if appropriate
- */
-#define _CPU_Context_Fp_start( _base, _offset ) \
- ( (void *) _Addresses_Add_offset( (_base), (_offset) ) )
-#endif
-
-/* XXX this should be possible to remove */
-#if 0
-/**
* This routine initializes the FP context area passed to it to.
* There are a few standard ways in which to initialize the
* floating point context. The code included for this macro assumes
diff --git a/cpukit/score/include/rtems/score/context.h b/cpukit/score/include/rtems/score/context.h
index 7e59f05..46cb460 100644
--- a/cpukit/score/include/rtems/score/context.h
+++ b/cpukit/score/include/rtems/score/context.h
@@ -111,22 +111,6 @@ extern "C" {
_CPU_Context_Restart_self( _the_context )
/**
- * @brief Return starting address of floating point context.
- *
- * This function returns the starting address of the floating
- * point context save area. It is assumed that the are reserved
- * for the floating point save area is large enough.
- *
- * @param[in] _base is lowest physical address of the floating point
- * context save area.
- * @param[in] _offset is the offset into the floating point area
- *
- * @retval the initial FP context pointer
- */
-#define _Context_Fp_start( _base, _offset ) \
- _CPU_Context_Fp_start( (_base), (_offset) )
-
-/**
* @brief Initialize floating point context area.
*
* This routine initializes the floating point context save
diff --git a/cpukit/score/src/threadinitialize.c b/cpukit/score/src/threadinitialize.c
index 9ae2acb..5725c6e 100644
--- a/cpukit/score/src/threadinitialize.c
+++ b/cpukit/score/src/threadinitialize.c
@@ -137,7 +137,6 @@ bool _Thread_Initialize(
fp_area = _Workspace_Allocate( CONTEXT_FP_SIZE );
if ( !fp_area )
goto failed;
- fp_area = _Context_Fp_start( fp_area, 0 );
}
the_thread->fp_context = fp_area;
the_thread->Start.fp_context = fp_area;
--
1.8.4.5
More information about the devel
mailing list