forked from Imagelibrary/rtems
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.
This commit is contained in:
@@ -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; \
|
||||
|
||||
@@ -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 );
|
||||
|
||||
|
||||
@@ -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 );
|
||||
|
||||
|
||||
@@ -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 ); \
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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); \
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 );
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 */
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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
|
||||
/**
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user