From 27bfcd88f7e65c81b406afa85d81b060e2ea24e3 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 25 Jan 2017 14:32:02 +0100 Subject: score: Delete _CPU_Context_Fp_start() 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 | 25 +++++++------------------ 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, 14 insertions(+), 288 deletions(-) (limited to 'cpukit') diff --git a/cpukit/score/cpu/arm/rtems/score/cpu.h b/cpukit/score/cpu/arm/rtems/score/cpu.h index cdffc9c1e9..9f321acc0a 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 cdefedf60d..7c90fc6575 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 55faefa186..020d949586 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 052e53f5e3..ace26f396c 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 87cfd9e889..9d229948aa 100644 --- a/cpukit/score/cpu/lm32/rtems/score/cpu.h +++ b/cpukit/score/cpu/lm32/rtems/score/cpu.h @@ -748,33 +748,6 @@ extern char _gp[]; #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 ) -#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 diff --git a/cpukit/score/cpu/m32c/rtems/score/cpu.h b/cpukit/score/cpu/m32c/rtems/score/cpu.h index 8dd8c414aa..af1c3412ea 100644 --- a/cpukit/score/cpu/m32c/rtems/score/cpu.h +++ b/cpukit/score/cpu/m32c/rtems/score/cpu.h @@ -739,32 +739,6 @@ void _CPU_Context_Restart_self( Context_Control *the_context ) 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 diff --git a/cpukit/score/cpu/m68k/rtems/score/cpu.h b/cpukit/score/cpu/m68k/rtems/score/cpu.h index 0b9aa2df6d..2be10c9638 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,15 @@ 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 \ - ) \ - ) - + /* + * The floating-point context is saved/restored via FSAVE/FRESTORE which + * use a growing down stack. Initialize the stack and adjust the FP area + * pointer accordingly. + */ #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 9a45d0b920..74afc800b9 100644 --- a/cpukit/score/cpu/mips/rtems/score/cpu.h +++ b/cpukit/score/cpu/mips/rtems/score/cpu.h @@ -791,23 +791,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) ) ) - /* * This routine initializes the FP context area passed to it to. * There are a few standard ways in which to initialize the diff --git a/cpukit/score/cpu/moxie/rtems/score/cpu.h b/cpukit/score/cpu/moxie/rtems/score/cpu.h index b77083db95..a8b2263fb7 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 372b01fc43..62e1a91cb9 100644 --- a/cpukit/score/cpu/no_cpu/rtems/score/cpu.h +++ b/cpukit/score/cpu/no_cpu/rtems/score/cpu.h @@ -875,32 +875,6 @@ uint32_t _CPU_ISR_Get_level( void ); #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) ) ) - /** * This routine initializes the FP context area passed to it to. * There are a few standard ways in which to initialize the diff --git a/cpukit/score/cpu/or1k/rtems/score/cpu.h b/cpukit/score/cpu/or1k/rtems/score/cpu.h index 4a643c7e0e..3d4a6e003a 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 93d620eaf6..a8476674ba 100644 --- a/cpukit/score/cpu/powerpc/rtems/score/cpu.h +++ b/cpukit/score/cpu/powerpc/rtems/score/cpu.h @@ -830,23 +830,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) ) ) - /* * This routine initializes the FP context area passed to it to. * There are a few standard ways in which to initialize the diff --git a/cpukit/score/cpu/sh/rtems/score/cpu.h b/cpukit/score/cpu/sh/rtems/score/cpu.h index 0ad38296cf..c2b7081e9e 100644 --- a/cpukit/score/cpu/sh/rtems/score/cpu.h +++ b/cpukit/score/cpu/sh/rtems/score/cpu.h @@ -549,23 +549,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) ) ) - /* * This routine initializes the FP context area passed to it to. * There are a few standard ways in which to initialize the diff --git a/cpukit/score/cpu/sparc/rtems/score/cpu.h b/cpukit/score/cpu/sparc/rtems/score/cpu.h index a59fc36e7d..7c81f07400 100644 --- a/cpukit/score/cpu/sparc/rtems/score/cpu.h +++ b/cpukit/score/cpu/sparc/rtems/score/cpu.h @@ -955,13 +955,6 @@ void _CPU_Context_Initialize( #define _CPU_Context_Restart_self( _the_context ) \ _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. * diff --git a/cpukit/score/cpu/sparc64/rtems/score/cpu.h b/cpukit/score/cpu/sparc64/rtems/score/cpu.h index 9926ebbcf6..47041e7d5e 100644 --- a/cpukit/score/cpu/sparc64/rtems/score/cpu.h +++ b/cpukit/score/cpu/sparc64/rtems/score/cpu.h @@ -823,14 +823,6 @@ void _CPU_Context_Initialize( #define _CPU_Context_Restart_self( _the_context ) \ _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. * diff --git a/cpukit/score/cpu/v850/rtems/score/cpu.h b/cpukit/score/cpu/v850/rtems/score/cpu.h index 6c77f5160c..d3cdf0514a 100644 --- a/cpukit/score/cpu/v850/rtems/score/cpu.h +++ b/cpukit/score/cpu/v850/rtems/score/cpu.h @@ -696,34 +696,6 @@ void _CPU_Context_Initialize( #define _CPU_Context_Restart_self( _the_context ) \ _CPU_Context_restore( (_the_context) ); -/* 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 /** diff --git a/cpukit/score/include/rtems/score/context.h b/cpukit/score/include/rtems/score/context.h index 7e59f05d60..46cb4606b1 100644 --- a/cpukit/score/include/rtems/score/context.h +++ b/cpukit/score/include/rtems/score/context.h @@ -110,22 +110,6 @@ extern "C" { #define _Context_Restart_self( _the_context ) \ _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. * diff --git a/cpukit/score/src/threadinitialize.c b/cpukit/score/src/threadinitialize.c index 9ae2acb9a0..5725c6eac8 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; -- cgit v1.2.3