2002-05-15 Chris Johns <ccj@acm.org>

* include/rtems/score/thread.h, inline/rtems/score/thread.inl,
	src/threaddispatch.c, src/threadinitialize.c:
	Move the C library re-enterrant support directly into
	the thread dispatch code. RTEMS needs libc and so requiring
	libc to use a user extension with its overhead is not the best
	solution. This patch lowers the overhead to 2 pointer moves.
This commit is contained in:
Joel Sherrill
2002-05-15 15:14:58 +00:00
parent fe36c01739
commit 0df8293e2b
10 changed files with 126 additions and 0 deletions

View File

@@ -1,3 +1,12 @@
2002-05-15 Chris Johns <ccj@acm.org>
* include/rtems/score/thread.h, inline/rtems/score/thread.inl,
src/threaddispatch.c, src/threadinitialize.c:
Move the C library re-enterrant support directly into
the thread dispatch code. RTEMS needs libc and so requiring
libc to use a user extension with its overhead is not the best
solution. This patch lowers the overhead to 2 pointer moves.
2002-05-03 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* include/Makefile.am: Work-around to autoconf-2.53 adding PACKAGE_*

View File

@@ -220,6 +220,7 @@ struct Thread_Control_struct {
#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
void *fp_context;
#endif
void *libc_reent;
void *API_Extensions[ THREAD_API_LAST + 1 ];
void **extensions;
rtems_task_variable_t *task_variables;
@@ -316,6 +317,15 @@ SCORE_EXTERN Thread_Control *_Thread_Heir;
SCORE_EXTERN Thread_Control *_Thread_Allocated_fp;
#endif
/*
* The C library re-enter-rant global pointer. Some C library implementations
* such as newlib have a single global pointer that changed during a context
* switch. The pointer points to that global pointer. The Thread control block
* holds a pointer to the task specific data.
*/
SCORE_EXTERN void **_Thread_libc_reent;
/*
* _Thread_Handler_initialization
*

View File

@@ -387,5 +387,35 @@ RTEMS_INLINE_ROUTINE void _Thread_Internal_free (
_Objects_Free( &_Thread_Internal_information, &the_task->Object );
}
/*PAGE
*
* _Thread_Get_libc_reent
*
* DESCRIPTION:
*
* This routine returns the C library re-enterant pointer.
*/
RTEMS_INLINE_ROUTINE void **_Thread_Get_libc_reent( void )
{
return _Thread_libc_reent;
}
/*PAGE
*
* _Thread_Set_libc_reent
*
* DESCRIPTION:
*
* This routine set the C library re-enterant pointer.
*/
RTEMS_INLINE_ROUTINE void _Thread_Set_libc_reent (
void **libc_reent
)
{
_Thread_libc_reent = libc_reent;
}
#endif
/* end of include file */

View File

@@ -74,6 +74,14 @@ void _Thread_Dispatch( void )
heir->ticks_executed++;
/*
* Switch libc's task specific data.
*/
if ( _Thread_libc_reent ) {
executing->libc_reent = *_Thread_libc_reent;
*_Thread_libc_reent = heir->libc_reent;
}
_User_extensions_Thread_switch( executing, heir );
if ( heir->budget_algorithm == THREAD_CPU_BUDGET_ALGORITHM_RESET_TIMESLICE )

View File

@@ -114,6 +114,12 @@ boolean _Thread_Initialize(
the_thread->Start.fp_context = fp_area;
#endif
/*
* Clear the libc reent hook.
*/
the_thread->libc_reent = NULL;
/*
* Allocate the extensions area for this thread
*/