summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cpukit/ChangeLog26
-rw-r--r--cpukit/libcsupport/include/rtems/libcsupport.h32
-rw-r--r--cpukit/libcsupport/src/newlibc.c141
-rw-r--r--cpukit/sapi/Makefile.am2
-rw-r--r--cpukit/sapi/include/confdefs.h77
-rw-r--r--cpukit/sapi/src/exinit.c25
-rw-r--r--cpukit/sapi/src/exshutdown.c51
-rw-r--r--cpukit/score/Makefile.am14
-rw-r--r--cpukit/score/include/rtems/score/userext.h59
-rw-r--r--cpukit/score/inline/rtems/score/userext.inl156
-rw-r--r--cpukit/score/preinstall.am4
-rw-r--r--cpukit/score/src/chain.c125
-rw-r--r--cpukit/score/src/chainappend.c46
-rw-r--r--cpukit/score/src/chainextract.c44
-rw-r--r--cpukit/score/src/chainget.c51
-rw-r--r--cpukit/score/src/chaininsert.c47
-rw-r--r--cpukit/score/src/userext.c203
-rw-r--r--cpukit/score/src/userextaddapiset.c38
-rw-r--r--cpukit/score/src/userextaddset.c46
-rw-r--r--cpukit/score/src/userextremoveset.c35
-rw-r--r--cpukit/score/src/userextthreadbegin.c89
-rw-r--r--cpukit/score/src/userextthreadcreate.c49
-rw-r--r--cpukit/score/src/userextthreaddelete.c43
-rw-r--r--cpukit/score/src/userextthreadrestart.c44
-rw-r--r--cpukit/score/src/userextthreadstart.c44
-rw-r--r--cpukit/score/src/userextthreadswitch.c39
26 files changed, 887 insertions, 643 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog
index fa3712a4cc..de9d113bc7 100644
--- a/cpukit/ChangeLog
+++ b/cpukit/ChangeLog
@@ -1,5 +1,31 @@
2007-05-09 Joel Sherrill <joel.sherrill@OARcorp.com>
+ * libcsupport/include/rtems/libcsupport.h, libcsupport/src/newlibc.c,
+ sapi/Makefile.am, sapi/include/confdefs.h, sapi/src/exinit.c,
+ score/Makefile.am, score/preinstall.am,
+ score/include/rtems/score/userext.h, score/src/chain.c,
+ score/src/userext.c: Switch to newlib reentrancy extension being
+ installed in the initial set instead of using rtems_extension_create.
+ While implementing this, noticed that user extensions and chain code
+ had multiple functions in a single file which is not desirable in the
+ SuperCore and API portions of RTEMS, so split these into multiple
+ files with one function per file. Also noticed that some of user
+ extension code was inlined for no particular reason so moved that to
+ C bodies. Split executive shutdown from initialization since not
+ every application shuts down. Moved __fini call to executive shutdown
+ to be more symmetrical with where it is called at startup.
+ * sapi/src/exshutdown.c, score/src/chainappend.c,
+ score/src/chainextract.c, score/src/chainget.c,
+ score/src/chaininsert.c, score/src/userextaddapiset.c,
+ score/src/userextaddset.c, score/src/userextremoveset.c,
+ score/src/userextthreadbegin.c, score/src/userextthreadcreate.c,
+ score/src/userextthreaddelete.c, score/src/userextthreadrestart.c,
+ score/src/userextthreadstart.c, score/src/userextthreadswitch.c: New
+ files.
+ * score/inline/rtems/score/userext.inl: Removed.
+
+2007-05-09 Joel Sherrill <joel.sherrill@OARcorp.com>
+
* libcsupport/src/error.c, sapi/include/rtems/config.h: Do not
reference _Configuration_MP_table if multiprocessing is disabled.
diff --git a/cpukit/libcsupport/include/rtems/libcsupport.h b/cpukit/libcsupport/include/rtems/libcsupport.h
index bdd13c5136..817e9d8a5b 100644
--- a/cpukit/libcsupport/include/rtems/libcsupport.h
+++ b/cpukit/libcsupport/include/rtems/libcsupport.h
@@ -39,6 +39,38 @@ extern int host_errno(void);
extern void fix_syscall_errno(void);
extern size_t malloc_free_space();
+/*
+ * Prototypes required to install newlib reentrancy user extension
+ */
+rtems_boolean libc_create_hook(
+ rtems_tcb *current_task,
+ rtems_tcb *creating_task
+);
+
+#if defined(RTEMS_UNIX) && !defined(hpux)
+ rtems_extension libc_begin_hook(rtems_tcb *current_task);
+ #define __RTEMS_NEWLIB_BEGIN libc_begin_hook
+#else
+ #define __RTEMS_NEWLIB_BEGIN 0
+#endif
+
+rtems_extension libc_delete_hook(
+ rtems_tcb *current_task,
+ rtems_tcb *deleted_task
+);
+
+#define RTEMS_NEWLIB_EXTENSION \
+{ \
+ libc_create_hook, /* rtems_task_create */ \
+ 0, /* rtems_task_start */ \
+ 0, /* rtems_task_restart */ \
+ libc_delete_hook, /* rtems_task_delete */ \
+ 0, /* task_switch */ \
+ __RTEMS_NEWLIB_BEGIN, /* task_begin */ \
+ 0, /* task_exitted */ \
+ 0 /* fatal */ \
+}
+
#ifdef __cplusplus
}
#endif
diff --git a/cpukit/libcsupport/src/newlibc.c b/cpukit/libcsupport/src/newlibc.c
index 80c5cd07ea..ff0ef21403 100644
--- a/cpukit/libcsupport/src/newlibc.c
+++ b/cpukit/libcsupport/src/newlibc.c
@@ -50,8 +50,8 @@
int _fwalk(struct _reent *ptr, int (*function) (FILE *) );
-int libc_reentrant; /* do we think we are reentrant? */
-struct _reent libc_global_reent __ATTRIBUTE_IMPURE_PTR__ = _REENT_INIT(libc_global_reent);
+struct _reent libc_global_reent
+ __ATTRIBUTE_IMPURE_PTR__ = _REENT_INIT(libc_global_reent);
/*
* reent struct allocation moved here from libc_start_hook() to avoid
@@ -71,54 +71,24 @@ rtems_boolean libc_create_hook(
* it is based on the Classic API Region Manager.
*/
-#define REENT_MALLOCED 0
-#if REENT_MALLOCED
- ptr = (struct _reent *) calloc(1, sizeof(struct _reent));
-#else
- /* It is OK to allocate from the workspace because these
- * hooks run with thread dispatching disabled.
- */
- ptr = (struct _reent *) _Workspace_Allocate(sizeof(struct _reent));
-#endif
+ #define REENT_MALLOCED 0
+ #if REENT_MALLOCED
+ ptr = (struct _reent *) calloc(1, sizeof(struct _reent));
+ #else
+ /* It is OK to allocate from the workspace because these
+ * hooks run with thread dispatching disabled.
+ */
+ ptr = (struct _reent *) _Workspace_Allocate(sizeof(struct _reent));
+ #endif
- if (ptr)
- {
-
-#ifdef __GNUC__
- /* GCC extension: structure constants */
- _REENT_INIT_PTR((ptr));
-#else
- /*
- * WARNING: THIS IS VERY DEPENDENT ON NEWLIB!!!
- * Last visual check was against newlib 1.8.2 but last known
- * use was against 1.7.0. This is basically an exansion of
- * REENT_INIT() in <sys/reent.h>.
- */
- memset(ptr, 0, sizeof(*ptr));
- ptr->_stdin = &ptr->__sf[0];
- ptr->_stdout = &ptr->__sf[1];
- ptr->_stderr = &ptr->__sf[2];
- ptr->_current_locale = "C";
- ptr->_new._reent._rand_next = 1;
-#endif
+ if (ptr) {
+ _REENT_INIT_PTR((ptr)); /* GCC extension: structure constants */
creating_task->libc_reent = ptr;
return TRUE;
}
else
- return FALSE;
-
-}
-
-/*
- * Called for all user TASKS (system tasks are MPCI Receive Server and IDLE)
- */
-
-rtems_extension libc_start_hook(
- rtems_tcb *current_task,
- rtems_tcb *starting_task
-)
-{
+ return FALSE;
}
/*
@@ -133,27 +103,9 @@ rtems_extension libc_begin_hook(rtems_tcb *current_task)
#endif
/*
- * Function: libc_delete_hook
- * Created: 94/12/10
- *
- * Description:
- * Called when a task is deleted.
- * Must restore the new lib reentrancy state for the new current
- * task.
- *
- * Parameters:
- *
- *
- * Returns:
- *
- *
- * Side Effects:
- *
- * Notes:
- *
- *
- * Deficiencies/ToDo:
- *
+ * Called when a task is deleted.
+ * Must restore the new lib reentrancy state for the new current
+ * task.
*
*/
@@ -222,64 +174,25 @@ rtems_extension libc_delete_hook(
}
/*
- * Function: libc_init
- * Created: 94/12/10
- *
- * Description:
- * Init libc for CYGNUS newlib
- * Set up _REENT to use our global libc_global_reent.
- * (newlib provides a global of its own, but we prefer our
- * own name for it)
- *
- * If reentrancy is desired (which it should be), then
- * we install the task extension hooks to maintain the
- * newlib reentrancy global variable _REENT on task
- * create, delete, switch, exit, etc.
- *
- * Parameters:
- * reentrant non-zero if reentrant library desired.
- *
- * Returns:
- *
- * Side Effects:
- * installs libc extensions if reentrant.
+ * Init libc for CYGNUS newlib
+ *
+ * Set up _REENT to use our global libc_global_reent.
+ * (newlib provides a global of its own, but we prefer our own name for it)
*
- * Notes:
- *
- *
- * Deficiencies/ToDo:
+ * If reentrancy is desired (which it should be), then
+ * we install the task extension hooks to maintain the
+ * newlib reentrancy global variable _REENT on task
+ * create, delete, switch, exit, etc.
*
*/
+
void
libc_init(int reentrant)
{
- rtems_extensions_table libc_extension;
- rtems_status_code rc;
- rtems_id extension_id;
-
-/* libc_global_reent = _REENT_INIT(libc_global_reent); */
_REENT = &libc_global_reent;
- if (reentrant) {
- memset(&libc_extension, 0, sizeof(libc_extension));
-
- libc_extension.thread_create = libc_create_hook;
- libc_extension.thread_start = libc_start_hook;
-#ifdef NEED_SETVBUF
- libc_extension.thread_begin = libc_begin_hook;
-#endif
- libc_extension.thread_delete = libc_delete_hook;
-
- _Thread_Set_libc_reent (&_REENT);
-
- rc = rtems_extension_create(rtems_build_name('L', 'I', 'B', 'C'),
- &libc_extension, &extension_id);
- if (rc != RTEMS_SUCCESSFUL)
- rtems_fatal_error_occurred( rc );
-
- libc_reentrant = reentrant;
- }
+ _Thread_Set_libc_reent (&_REENT);
}
#endif
diff --git a/cpukit/sapi/Makefile.am b/cpukit/sapi/Makefile.am
index 4dfcf72cf4..edb845aca2 100644
--- a/cpukit/sapi/Makefile.am
+++ b/cpukit/sapi/Makefile.am
@@ -22,7 +22,7 @@ AM_CPPFLAGS += -D__RTEMS_INSIDE__
noinst_LIBRARIES = libsapi.a
libsapi_a_SOURCES = src/debug.c src/extension.c src/extensioncreate.c \
src/extensiondelete.c src/extensionident.c src/fatal.c src/exinit.c \
- src/io.c src/itronapi.c src/posixapi.c src/rtemsapi.c
+ src/exshutdown.c src/io.c src/itronapi.c src/posixapi.c src/rtemsapi.c
libsapi_a_CPPFLAGS = $(AM_CPPFLAGS)
include $(srcdir)/preinstall.am
diff --git a/cpukit/sapi/include/confdefs.h b/cpukit/sapi/include/confdefs.h
index 5eb86065e7..b32d9a84ac 100644
--- a/cpukit/sapi/include/confdefs.h
+++ b/cpukit/sapi/include/confdefs.h
@@ -64,10 +64,10 @@ extern itron_api_configuration_table Configuration_ITRON_API;
* RTEMS C Library and Newlib support
*/
-#ifdef RTEMS_NEWLIB
-#define CONFIGURE_NEWLIB_EXTENSION 1
+#if (defined(RTEMS_NEWLIB) && defined(CONFIGURE_DISABLE_NEWLIB_REENTRANCY))
+ #define CONFIGURE_NEWLIB_EXTENSION 1
#else
-#define CONFIGURE_NEWLIB_EXTENSION 0
+ #define CONFIGURE_NEWLIB_EXTENSION 0
#endif
/*
@@ -130,26 +130,24 @@ extern int rtems_telnetd_maximum_ptys;
#endif /* CONFIGURE_INIT */
#ifdef CONFIGURE_INIT
-#ifndef CONFIGURE_HAS_OWN_MOUNT_TABLE
-rtems_filesystem_mount_table_t configuration_mount_table = {
-#ifdef CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
- &IMFS_ops,
-#else /* using miniIMFS as base filesystem */
- &miniIMFS_ops,
-#endif
- RTEMS_FILESYSTEM_READ_WRITE,
- NULL,
- NULL
-};
-
-rtems_filesystem_mount_table_t
- *rtems_filesystem_mount_table = &configuration_mount_table;
-int rtems_filesystem_mount_table_size = 1;
-#endif
-
+ #ifndef CONFIGURE_HAS_OWN_MOUNT_TABLE
+ rtems_filesystem_mount_table_t configuration_mount_table = {
+ #ifdef CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
+ &IMFS_ops,
+ #else /* using miniIMFS as base filesystem */
+ &miniIMFS_ops,
+ #endif
+ RTEMS_FILESYSTEM_READ_WRITE,
+ NULL,
+ NULL
+ };
+
+ rtems_filesystem_mount_table_t
+ *rtems_filesystem_mount_table = &configuration_mount_table;
+ int rtems_filesystem_mount_table_size = 1;
+ #endif
#endif
-
/*
* Stack Checker Requirements
*
@@ -510,25 +508,30 @@ rtems_multiprocessing_table Multiprocessing_configuration = {
#ifdef STACK_CHECKER_ON
#include <rtems/stackchk.h>
#endif
+#include <rtems/libcsupport.h>
#if defined(CONFIGURE_INITIAL_EXTENSIONS) || \
- defined(STACK_CHECKER_ON)
-rtems_extensions_table Configuration_Initial_Extensions[] = {
-#ifdef CONFIGURE_INITIAL_EXTENSIONS
- CONFIGURE_INITIAL_EXTENSIONS,
-#endif
-#ifdef STACK_CHECKER_ON
- RTEMS_STACK_CHECKER_EXTENSION,
-#endif
-};
-
-#define CONFIGURE_INITIAL_EXTENSION_TABLE Configuration_Initial_Extensions
-#define CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS \
- ((sizeof(Configuration_Initial_Extensions) / \
- sizeof(rtems_extensions_table)))
+ defined(STACK_CHECKER_ON) || \
+ (defined(RTEMS_NEWLIB) && !defined(CONFIGURE_DISABLE_NEWLIB_REENTRANCY))
+ rtems_extensions_table Configuration_Initial_Extensions[] = {
+ #if !defined(CONFIGURE_DISABLE_NEWLIB_REENTRANCY)
+ RTEMS_NEWLIB_EXTENSION,
+ #endif
+ #if defined(STACK_CHECKER_ON)
+ RTEMS_STACK_CHECKER_EXTENSION,
+ #endif
+ #if defined(CONFIGURE_INITIAL_EXTENSIONS)
+ CONFIGURE_INITIAL_EXTENSIONS,
+ #endif
+ };
+
+ #define CONFIGURE_INITIAL_EXTENSION_TABLE Configuration_Initial_Extensions
+ #define CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS \
+ ((sizeof(Configuration_Initial_Extensions) / \
+ sizeof(rtems_extensions_table)))
#else
-#define CONFIGURE_INITIAL_EXTENSION_TABLE NULL
-#define CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS 0
+ #define CONFIGURE_INITIAL_EXTENSION_TABLE NULL
+ #define CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS 0
#endif
diff --git a/cpukit/sapi/src/exinit.c b/cpukit/sapi/src/exinit.c
index 04dc3c33de..109826a132 100644
--- a/cpukit/sapi/src/exinit.c
+++ b/cpukit/sapi/src/exinit.c
@@ -105,7 +105,9 @@ rtems_interrupt_level rtems_initialize_executive_early(
*/
_Configuration_Table = configuration_table;
+#if defined(RTEMS_MULTIPROCESSING)
_Configuration_MP_table = multiprocessing_table;
+#endif
/*
* Internally we view single processor systems as a very restricted
@@ -277,26 +279,3 @@ void rtems_initialize_executive_late(
_ISR_Enable( bsp_level );
}
-
-/*PAGE
- *
- * rtems_shutdown_executive
- *
- * This kernel routine shutdowns the executive. It halts multitasking
- * and returns control to the application execution "thread" which
- * initialially invoked the rtems_initialize_executive directive.
- *
- * Input parameters: NONE
- *
- * Output parameters: NONE
- */
-
-void rtems_shutdown_executive(
- uint32_t result
-)
-{
- if ( _System_state_Current != SYSTEM_STATE_SHUTDOWN ) {
- _System_state_Set( SYSTEM_STATE_SHUTDOWN );
- _Thread_Stop_multitasking();
- }
-}
diff --git a/cpukit/sapi/src/exshutdown.c b/cpukit/sapi/src/exshutdown.c
new file mode 100644
index 0000000000..5db40afa97
--- /dev/null
+++ b/cpukit/sapi/src/exshutdown.c
@@ -0,0 +1,51 @@
+/*
+ * Initialization Manager
+ *
+ * COPYRIGHT (c) 1989-1999.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/sysstate.h>
+#include <rtems/score/thread.h>
+
+#if defined(__USE_INIT_FINI__)
+#include <stdlib.h> /* for atexit() */
+#endif
+
+/*
+ * rtems_shutdown_executive
+ *
+ * This kernel routine shutdowns the executive. It halts multitasking
+ * and returns control to the application execution "thread" which
+ * initialially invoked the rtems_initialize_executive directive.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ */
+
+void rtems_shutdown_executive(
+ uint32_t result
+)
+{
+ if ( _System_state_Current != SYSTEM_STATE_SHUTDOWN ) {
+
+ #if defined(__USE_INIT_FINI__)
+ extern void _fini( void );
+ atexit( _fini );
+ #endif
+ _System_state_Set( SYSTEM_STATE_SHUTDOWN );
+ _Thread_Stop_multitasking();
+ }
+}
diff --git a/cpukit/score/Makefile.am b/cpukit/score/Makefile.am
index 342244f65c..9c9fd67919 100644
--- a/cpukit/score/Makefile.am
+++ b/cpukit/score/Makefile.am
@@ -51,7 +51,7 @@ include_rtems_score_HEADERS += inline/rtems/score/address.inl \
inline/rtems/score/stack.inl inline/rtems/score/states.inl \
inline/rtems/score/sysstate.inl inline/rtems/score/thread.inl \
inline/rtems/score/threadq.inl inline/rtems/score/tod.inl \
- inline/rtems/score/tqdata.inl inline/rtems/score/userext.inl \
+ inline/rtems/score/tqdata.inl \
inline/rtems/score/watchdog.inl inline/rtems/score/wkspace.inl
if HAS_MP
@@ -158,9 +158,17 @@ libscore_a_SOURCES += src/coretod.c src/coretodset.c src/coretodget.c \
libscore_a_SOURCES += src/watchdog.c src/watchdogadjust.c \
src/watchdoginsert.c src/watchdogremove.c src/watchdogtickle.c
+## USEREXT_C_FILES
+libscore_a_SOURCES += src/userextaddapiset.c src/userextaddset.c \
+ src/userext.c src/userextremoveset.c src/userextthreadbegin.c \
+ src/userextthreadcreate.c src/userextthreaddelete.c \
+ src/userextthreadrestart.c src/userextthreadstart.c \
+ src/userextthreadswitch.c
+
## STD_C_FILES
-libscore_a_SOURCES += src/apiext.c src/chain.c \
- src/interr.c src/isr.c src/userext.c src/wkspace.c
+libscore_a_SOURCES += src/apiext.c src/chain.c src/chainappend.c \
+ src/chainextract.c src/chainget.c src/chaininsert.c \
+ src/interr.c src/isr.c src/wkspace.c
EXTRA_DIST = src/Unlimited.txt
diff --git a/cpukit/score/include/rtems/score/userext.h b/cpukit/score/include/rtems/score/userext.h
index dcc8c80031..b8bcc0c2ff 100644
--- a/cpukit/score/include/rtems/score/userext.h
+++ b/cpukit/score/include/rtems/score/userext.h
@@ -202,6 +202,47 @@ SCORE_EXTERN Chain_Control _User_extensions_Switches_list;
/*@{*/
+/** @brief User extensions Handler Initialization
+ *
+ * This routine performs the initialization necessary for this handler.
+ *
+ * @param[in] number_of_extensions is the number of extensions
+ * @param[in] initial_extensions is the initial extension set
+ */
+void _User_extensions_Handler_initialization (
+ uint32_t number_of_extensions,
+ User_extensions_Table *initial_extensions
+);
+
+/** @brief User extensions Add to API extension set
+ *
+ * This routine is used to add an API extension set to the active list.
+ *
+ * @param[in] the_extension is the extension set to add
+ */
+void _User_extensions_Add_API_set (
+ User_extensions_Control *the_extension
+);
+
+/** @brief User extensions Add extension set
+ *
+ * This routine is used to add a user extension set to the active list.
+ *
+ * @param[in] the_extension is the extension set to add
+ * @param[in] extension_table is the user's extension set
+ */
+void _User_extensions_Add_set (
+ User_extensions_Control *the_extension,
+ User_extensions_Table *extension_table
+);
+
+/**
+ * This routine is used to remove a user extension set from the active list.
+ */
+void _User_extensions_Remove_set (
+ User_extensions_Control *the_extension
+);
+
/** @brief User extensions Thread create
*
* This routine is used to invoke the user extension for
@@ -260,6 +301,20 @@ void _User_extensions_Thread_begin (
Thread_Control *executing
);
+
+/** @brief User extensions Thread switch
+ *
+ * This routine is used to invoke the user extension which
+ * is invoked when a context switch occurs.
+ *
+ * @param[in] executing is the thread currently executing.
+ * @param[in] heir is the thread which will execute.
+ */
+void _User_extensions_Thread_switch (
+ Thread_Control *executing,
+ Thread_Control *heir
+);
+
/** @brief User extensions Thread exitted
*
* This routine is used to invoke the user extension which
@@ -286,10 +341,6 @@ void _User_extensions_Fatal (
uint32_t the_error
);
-#ifndef __RTEMS_APPLICATION__
-#include <rtems/score/userext.inl>
-#endif
-
#ifdef __cplusplus
}
#endif
diff --git a/cpukit/score/inline/rtems/score/userext.inl b/cpukit/score/inline/rtems/score/userext.inl
deleted file mode 100644
index 6dd5cb6fff..0000000000
--- a/cpukit/score/inline/rtems/score/userext.inl
+++ /dev/null
@@ -1,156 +0,0 @@
-/**
- * @file rtems/score/userext.inl
- *
- * This file contains the macro implementation of the inlined routines
- * from the User Extension Handler
- */
-
-/*
- * COPYRIGHT (c) 1989-2004.
- * On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.com/license/LICENSE.
- *
- * $Id$
- */
-
-#ifndef _RTEMS_SCORE_USEREXT_INL
-#define _RTEMS_SCORE_USEREXT_INL
-
-#include <rtems/score/wkspace.h>
-
-#include <string.h> /* memset */
-
-/**
- * @addtogroup ScoreUserExt
- * @{
- */
-
-/**
- * This routine is used to add a user extension set to the active list.
- *
- * @note Must be before _User_extensions_Handler_initialization to
- * ensure proper inlining.
- */
-
-RTEMS_INLINE_ROUTINE void _User_extensions_Add_set (
- User_extensions_Control *the_extension,
- User_extensions_Table *extension_table
-)
-{
- the_extension->Callouts = *extension_table;
-
- _Chain_Append( &_User_extensions_List, &the_extension->Node );
-
- /*
- * If a switch handler is present, append it to the switch chain.
- */
-
- if ( extension_table->thread_switch != NULL ) {
- the_extension->Switch.thread_switch = extension_table->thread_switch;
- _Chain_Append( &_User_extensions_Switches_list, &the_extension->Switch.Node );
- }
-}
-
-/**
- * This routine performs the initialization necessary for this handler.
- */
-
-RTEMS_INLINE_ROUTINE void _User_extensions_Handler_initialization (
- uint32_t number_of_extensions,
- User_extensions_Table *initial_extensions
-)
-{
- User_extensions_Control *extension;
- uint32_t i;
-
- _Chain_Initialize_empty( &_User_extensions_List );
- _Chain_Initialize_empty( &_User_extensions_Switches_list );
-
- if ( initial_extensions ) {
- extension = (User_extensions_Control *)
- _Workspace_Allocate_or_fatal_error(
- number_of_extensions * sizeof( User_extensions_Control )
- );
-
- memset (
- extension,
- 0,
- number_of_extensions * sizeof( User_extensions_Control )
- );
-
- for ( i = 0 ; i < number_of_extensions ; i++ ) {
- _User_extensions_Add_set (extension, &initial_extensions[i]);
- extension++;
- }
- }
-}
-
-/**
- * This routine is used to add an API extension set to the active list.
- */
-
-RTEMS_INLINE_ROUTINE void _User_extensions_Add_API_set (
- User_extensions_Control *the_extension
-)
-{
- _Chain_Append( &_User_extensions_List, &the_extension->Node );
-
- /*
- * If a switch handler is present, append it to the switch chain.
- */
-
- if ( the_extension->Callouts.thread_switch != NULL ) {
- the_extension->Switch.thread_switch = the_extension->Callouts.thread_switch;
- _Chain_Append(
- &_User_extensions_Switches_list, &the_extension->Switch.Node );
- }
-}
-
-/**
- * This routine is used to remove a user extension set from the active list.
- */
-
-RTEMS_INLINE_ROUTINE void _User_extensions_Remove_set (
- User_extensions_Control *the_extension
-)
-{
- _Chain_Extract( &the_extension->Node );
-
- /*
- * If a switch handler is present, remove it.
- */
-
- if ( the_extension->Callouts.thread_switch != NULL )
- _Chain_Extract( &the_extension->Switch.Node );
-}
-
-/**
- * This routine is used to invoke the user extension which
- * is invoked when a context switch occurs.
- */
-
-RTEMS_INLINE_ROUTINE void _User_extensions_Thread_switch (
- Thread_Control *executing,
- Thread_Control *heir
-)
-{
- Chain_Node *the_node;
- User_extensions_Switch_control *the_extension_switch;
-
- for ( the_node = _User_extensions_Switches_list.first ;
- !_Chain_Is_tail( &_User_extensions_Switches_list, the_node ) ;
- the_node = the_node->next ) {
-
- the_extension_switch = (User_extensions_Switch_control *) the_node;
-
- (*the_extension_switch->thread_switch)( executing, heir );
- }
-}
-
-/**@}*/
-
-#endif
-/* end of include file */
diff --git a/cpukit/score/preinstall.am b/cpukit/score/preinstall.am
index a43bc4da11..040616aa6a 100644
--- a/cpukit/score/preinstall.am
+++ b/cpukit/score/preinstall.am
@@ -252,10 +252,6 @@ $(PROJECT_INCLUDE)/rtems/score/tqdata.inl: inline/rtems/score/tqdata.inl $(PROJE
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/tqdata.inl
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/tqdata.inl
-$(PROJECT_INCLUDE)/rtems/score/userext.inl: inline/rtems/score/userext.inl $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/userext.inl
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/userext.inl
-
$(PROJECT_INCLUDE)/rtems/score/watchdog.inl: inline/rtems/score/watchdog.inl $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/watchdog.inl
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/watchdog.inl
diff --git a/cpukit/score/src/chain.c b/cpukit/score/src/chain.c
index d9248ea794..c44d6201a3 100644
--- a/cpukit/score/src/chain.c
+++ b/cpukit/score/src/chain.c
@@ -1,12 +1,5 @@
/*
- * Chain Handler
- *
- * NOTE:
- *
- * The order of this file is to allow proper compilation due to the
- * order of inlining required by the compiler.
- *
- * COPYRIGHT (c) 1989-1999.
+ * COPYRIGHT (c) 1989-2007.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -65,119 +58,3 @@ void _Chain_Initialize(
current->next = _Chain_Tail( the_chain );
the_chain->last = current;
}
-
-/*PAGE
- *
- * _Chain_Get
- *
- * This kernel routine returns a pointer to a node taken from the
- * given chain.
- *
- * Input parameters:
- * the_chain - pointer to chain header
- *
- * Output parameters:
- * return_node - pointer to node in chain allocated
- * CHAIN_END - if no nodes available
- *
- * INTERRUPT LATENCY:
- * only case
- */
-
-Chain_Node *_Chain_Get(
- Chain_Control *the_chain
-)
-{
- ISR_Level level;
- Chain_Node *return_node;
-
- return_node = NULL;
- _ISR_Disable( level );
- if ( !_Chain_Is_empty( the_chain ) )
- return_node = _Chain_Get_first_unprotected( the_chain );
- _ISR_Enable( level );
- return return_node;
-}
-
-/*PAGE
- *
- * _Chain_Append
- *
- * This kernel routine puts a node on the end of the specified chain.
- *
- * Input parameters:
- * the_chain - pointer to chain header
- * node - address of node to put at rear of chain
- *
- * Output parameters: NONE
- *
- * INTERRUPT LATENCY:
- * only case
- */
-
-void _Chain_Append(
- Chain_Control *the_chain,
- Chain_Node *node
-)
-{
- ISR_Level level;
-
- _ISR_Disable( level );
- _Chain_Append_unprotected( the_chain, node );
- _ISR_Enable( level );
-}
-
-/*PAGE
- *
- * _Chain_Extract
- *
- * This kernel routine deletes the given node from a chain.
- *
- * Input parameters:
- * node - pointer to node in chain to be deleted
- *
- * Output parameters: NONE
- *
- * INTERRUPT LATENCY:
- * only case
- */
-
-void _Chain_Extract(
- Chain_Node *node
-)
-{
- ISR_Level level;
-
- _ISR_Disable( level );
- _Chain_Extract_unprotected( node );
- _ISR_Enable( level );
-}
-
-/*PAGE
- *
- * _Chain_Insert
- *
- * This kernel routine inserts a given node after a specified node
- * a requested chain.
- *
- * Input parameters:
- * after_node - pointer to node in chain to be inserted after
- * node - pointer to node to be inserted
- *
- * Output parameters: NONE
- *
- * INTERRUPT LATENCY:
- * only case
- */
-
-void _Chain_Insert(
- Chain_Node *after_node,
- Chain_Node *node
-)
-{
- ISR_Level level;
-
- _ISR_Disable( level );
- _Chain_Insert_unprotected( after_node, node );
- _ISR_Enable( level );
-}
diff --git a/cpukit/score/src/chainappend.c b/cpukit/score/src/chainappend.c
new file mode 100644
index 0000000000..f5287a450f
--- /dev/null
+++ b/cpukit/score/src/chainappend.c
@@ -0,0 +1,46 @@
+/*
+ * COPYRIGHT (c) 1989-2007.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/address.h>
+#include <rtems/score/chain.h>
+#include <rtems/score/isr.h>
+
+/*
+ * _Chain_Append
+ *
+ * This kernel routine puts a node on the end of the specified chain.
+ *
+ * Input parameters:
+ * the_chain - pointer to chain header
+ * node - address of node to put at rear of chain
+ *
+ * Output parameters: NONE
+ *
+ * INTERRUPT LATENCY:
+ * only case
+ */
+
+void _Chain_Append(
+ Chain_Control *the_chain,
+ Chain_Node *node
+)
+{
+ ISR_Level level;
+
+ _ISR_Disable( level );
+ _Chain_Append_unprotected( the_chain, node );
+ _ISR_Enable( level );
+}
diff --git a/cpukit/score/src/chainextract.c b/cpukit/score/src/chainextract.c
new file mode 100644
index 0000000000..deb537ed85
--- /dev/null
+++ b/cpukit/score/src/chainextract.c
@@ -0,0 +1,44 @@
+/*
+ * COPYRIGHT (c) 1989-2007.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/address.h>
+#include <rtems/score/chain.h>
+#include <rtems/score/isr.h>
+
+/*
+ * _Chain_Extract
+ *
+ * This kernel routine deletes the given node from a chain.
+ *
+ * Input parameters:
+ * node - pointer to node in chain to be deleted
+ *
+ * Output parameters: NONE
+ *
+ * INTERRUPT LATENCY:
+ * only case
+ */
+
+void _Chain_Extract(
+ Chain_Node *node
+)
+{
+ ISR_Level level;
+
+ _ISR_Disable( level );
+ _Chain_Extract_unprotected( node );
+ _ISR_Enable( level );
+}
diff --git a/cpukit/score/src/chainget.c b/cpukit/score/src/chainget.c
new file mode 100644
index 0000000000..4ec11c112e
--- /dev/null
+++ b/cpukit/score/src/chainget.c
@@ -0,0 +1,51 @@
+/*
+ * COPYRIGHT (c) 1989-2007.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/address.h>
+#include <rtems/score/chain.h>
+#include <rtems/score/isr.h>
+
+/*
+ * _Chain_Get
+ *
+ * This kernel routine returns a pointer to a node taken from the
+ * given chain.
+ *
+ * Input parameters:
+ * the_chain - pointer to chain header
+ *
+ * Output parameters:
+ * return_node - pointer to node in chain allocated
+ * CHAIN_END - if no nodes available
+ *
+ * INTERRUPT LATENCY:
+ * only case
+ */
+
+Chain_Node *_Chain_Get(
+ Chain_Control *the_chain
+)
+{
+ ISR_Level level;
+ Chain_Node *return_node;
+
+ return_node = NULL;
+ _ISR_Disable( level );
+ if ( !_Chain_Is_empty( the_chain ) )
+ return_node = _Chain_Get_first_unprotected( the_chain );
+ _ISR_Enable( level );
+ return return_node;
+}
diff --git a/cpukit/score/src/chaininsert.c b/cpukit/score/src/chaininsert.c
new file mode 100644
index 0000000000..0f5cdd25ab
--- /dev/null
+++ b/cpukit/score/src/chaininsert.c
@@ -0,0 +1,47 @@
+/*
+ * COPYRIGHT (c) 1989-2007.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/address.h>
+#include <rtems/score/chain.h>
+#include <rtems/score/isr.h>
+
+/*
+ * _Chain_Insert
+ *
+ * This kernel routine inserts a given node after a specified node
+ * a requested chain.
+ *
+ * Input parameters:
+ * after_node - pointer to node in chain to be inserted after
+ * node - pointer to node to be inserted
+ *
+ * Output parameters: NONE
+ *
+ * INTERRUPT LATENCY:
+ * only case
+ */
+
+void _Chain_Insert(
+ Chain_Node *after_node,
+ Chain_Node *node
+)
+{
+ ISR_Level level;
+
+ _ISR_Disable( level );
+ _Chain_Insert_unprotected( after_node, node );
+ _ISR_Enable( level );
+}
diff --git a/cpukit/score/src/userext.c b/cpukit/score/src/userext.c
index 469200ef76..c23e63f40d 100644
--- a/cpukit/score/src/userext.c
+++ b/cpukit/score/src/userext.c
@@ -1,9 +1,5 @@
/*
- * User Extension Handler
- *
- * NOTE: XXX
- *
- * COPYRIGHT (c) 1989-1999.
+ * COPYRIGHT (c) 1989-2007.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -19,187 +15,40 @@
#include <rtems/system.h>
#include <rtems/score/userext.h>
+#include <rtems/score/wkspace.h>
+#include <string.h>
-/*PAGE
- *
- * _User_extensions_Thread_create
+/**
+ * This routine performs the initialization necessary for this handler.
*/
-boolean _User_extensions_Thread_create (
- Thread_Control *the_thread
+void _User_extensions_Handler_initialization (
+ uint32_t number_of_extensions,
+ User_extensions_Table *initial_extensions
)
{
- Chain_Node *the_node;
- User_extensions_Control *the_extension;
- boolean status;
+ User_extensions_Control *extension;
+ uint32_t i;
- for ( the_node = _User_extensions_List.first ;
- !_Chain_Is_tail( &_User_extensions_List, the_node ) ;
- the_node = the_node->next ) {
+ _Chain_Initialize_empty( &_User_extensions_List );
+ _Chain_Initialize_empty( &_User_extensions_Switches_list );
- the_extension = (User_extensions_Control *) the_node;
-
- if ( the_extension->Callouts.thread_create != NULL ) {
- status = (*the_extension->Callouts.thread_create)(
- _Thread_Executing,
- the_thread
+ if ( initial_extensions ) {
+ extension = (User_extensions_Control *)
+ _Workspace_Allocate_or_fatal_error(
+ number_of_extensions * sizeof( User_extensions_Control )
);
- if ( !status )
- return FALSE;
+
+ memset (
+ extension,
+ 0,
+ number_of_extensions * sizeof( User_extensions_Control )
+ );
+
+ for ( i = 0 ; i < number_of_extensions ; i++ ) {
+ _User_extensions_Add_set (extension, &initial_extensions[i]);
+ extension++;
}
}
-
- return TRUE;
-}
-
-/*PAGE
- *
- * _User_extensions_Thread_delete
- */
-
-void _User_extensions_Thread_delete (
- Thread_Control *the_thread
-)
-{
- Chain_Node *the_node;
- User_extensions_Control *the_extension;
-
- for ( the_node = _User_extensions_List.last ;
- !_Chain_Is_head( &_User_extensions_List, the_node ) ;
- the_node = the_node->previous ) {
-
- the_extension = (User_extensions_Control *) the_node;
-
- if ( the_extension->Callouts.thread_delete != NULL )
- (*the_extension->Callouts.thread_delete)(
- _Thread_Executing,
- the_thread
- );
- }
-}
-
-/*PAGE
- *
- * _User_extensions_Thread_start
- *
- */
-
-void _User_extensions_Thread_start (
- Thread_Control *the_thread
-)
-{
- Chain_Node *the_node;
- User_extensions_Control *the_extension;
-
- for ( the_node = _User_extensions_List.first ;
- !_Chain_Is_tail( &_User_extensions_List, the_node ) ;
- the_node = the_node->next ) {
-
- the_extension = (User_extensions_Control *) the_node;
-
- if ( the_extension->Callouts.thread_start != NULL )
- (*the_extension->Callouts.thread_start)(
- _Thread_Executing,
- the_thread
- );
- }
-}
-
-/*PAGE
- *
- * _User_extensions_Thread_restart
- *
- */
-
-void _User_extensions_Thread_restart (
- Thread_Control *the_thread
-)
-{
- Chain_Node *the_node;
- User_extensions_Control *the_extension;
-
- for ( the_node = _User_extensions_List.first ;
- !_Chain_Is_tail( &_User_extensions_List, the_node ) ;
- the_node = the_node->next ) {
-
- the_extension = (User_extensions_Control *) the_node;
-
- if ( the_extension->Callouts.thread_restart != NULL )
- (*the_extension->Callouts.thread_restart)(
- _Thread_Executing,
- the_thread
- );
- }
-}
-
-/*PAGE
- *
- * _User_extensions_Thread_begin
- *
- */
-
-void _User_extensions_Thread_begin (
- Thread_Control *executing
-)
-{
- Chain_Node *the_node;
- User_extensions_Control *the_extension;
-
- for ( the_node = _User_extensions_List.first ;
- !_Chain_Is_tail( &_User_extensions_List, the_node ) ;
- the_node = the_node->next ) {
-
- the_extension = (User_extensions_Control *) the_node;
-
- if ( the_extension->Callouts.thread_begin != NULL )
- (*the_extension->Callouts.thread_begin)( executing );
- }
-}
-
-/*PAGE
- *
- * _User_extensions_Thread_exitted
- */
-
-void _User_extensions_Thread_exitted (
- Thread_Control *executing
-)
-{
- Chain_Node *the_node;
- User_extensions_Control *the_extension;
-
- for ( the_node = _User_extensions_List.last ;
- !_Chain_Is_head( &_User_extensions_List, the_node ) ;
- the_node = the_node->previous ) {
-
- the_extension = (User_extensions_Control *) the_node;
-
- if ( the_extension->Callouts.thread_exitted != NULL )
- (*the_extension->Callouts.thread_exitted)( executing );
- }
}
-/*PAGE
- *
- * _User_extensions_Fatal
- */
-
-void _User_extensions_Fatal (
- Internal_errors_Source the_source,
- boolean is_internal,
- uint32_t the_error
-)
-{
- Chain_Node *the_node;
- User_extensions_Control *the_extension;
-
- for ( the_node = _User_extensions_List.last ;
- !_Chain_Is_head( &_User_extensions_List, the_node ) ;
- the_node = the_node->previous ) {
-
- the_extension = (User_extensions_Control *) the_node;
-
- if ( the_extension->Callouts.fatal != NULL )
- (*the_extension->Callouts.fatal)( the_source, is_internal, the_error );
- }
-}
diff --git a/cpukit/score/src/userextaddapiset.c b/cpukit/score/src/userextaddapiset.c
new file mode 100644
index 0000000000..db2670f5e0
--- /dev/null
+++ b/cpukit/score/src/userextaddapiset.c
@@ -0,0 +1,38 @@
+/*
+ * COPYRIGHT (c) 1989-2007.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/userext.h>
+
+/**
+ * This routine is used to add an API extension set to the active list.
+ */
+
+void _User_extensions_Add_API_set (
+ User_extensions_Control *the_extension
+)
+{
+ _Chain_Append( &_User_extensions_List, &the_extension->Node );
+
+ /*
+ * If a switch handler is present, append it to the switch chain.
+ */
+
+ if ( the_extension->Callouts.thread_switch != NULL ) {
+ the_extension->Switch.thread_switch = the_extension->Callouts.thread_switch;
+ _Chain_Append(
+ &_User_extensions_Switches_list, &the_extension->Switch.Node );
+ }
+}
diff --git a/cpukit/score/src/userextaddset.c b/cpukit/score/src/userextaddset.c
new file mode 100644
index 0000000000..516477a50e
--- /dev/null
+++ b/cpukit/score/src/userextaddset.c
@@ -0,0 +1,46 @@
+/*
+ * COPYRIGHT (c) 1989-2007.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/userext.h>
+
+/**
+ * This routine is used to add a user extension set to the active list.
+ *
+ * @note Must be before _User_extensions_Handler_initialization to
+ * ensure proper inlining.
+ */
+
+void _User_extensions_Add_set (
+ User_extensions_Control *the_extension,
+ User_extensions_Table *extension_table
+)
+{
+ the_extension->Callouts = *extension_table;
+
+ _Chain_Append( &_User_extensions_List, &the_extension->Node );
+
+ /*
+ * If a switch handler is present, append it to the switch chain.
+ */
+
+ if ( extension_table->thread_switch != NULL ) {
+ the_extension->Switch.thread_switch = extension_table->thread_switch;
+ _Chain_Append(
+ &_User_extensions_Switches_list,
+ &the_extension->Switch.Node
+ );
+ }
+}
diff --git a/cpukit/score/src/userextremoveset.c b/cpukit/score/src/userextremoveset.c
new file mode 100644
index 0000000000..dcff2ef626
--- /dev/null
+++ b/cpukit/score/src/userextremoveset.c
@@ -0,0 +1,35 @@
+/*
+ * COPYRIGHT (c) 1989-2007.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/userext.h>
+
+/**
+ * This routine is used to remove a user extension set from the active list.
+ */
+
+void _User_extensions_Remove_set (
+ User_extensions_Control *the_extension
+)
+{
+ _Chain_Extract( &the_extension->Node );
+
+ /*
+ * If a switch handler is present, remove it.
+ */
+
+ if ( the_extension->Callouts.thread_switch != NULL )
+ _Chain_Extract( &the_extension->Switch.Node );
+}
diff --git a/cpukit/score/src/userextthreadbegin.c b/cpukit/score/src/userextthreadbegin.c
new file mode 100644
index 0000000000..bf2cc1a1af
--- /dev/null
+++ b/cpukit/score/src/userextthreadbegin.c
@@ -0,0 +1,89 @@
+/*
+ * COPYRIGHT (c) 1989-2007.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/userext.h>
+
+/*PAGE
+ *
+ * _User_extensions_Thread_begin
+ *
+ */
+
+void _User_extensions_Thread_begin (
+ Thread_Control *executing
+)
+{
+ Chain_Node *the_node;
+ User_extensions_Control *the_extension;
+
+ for ( the_node = _User_extensions_List.first ;
+ !_Chain_Is_tail( &_User_extensions_List, the_node ) ;
+ the_node = the_node->next ) {
+
+ the_extension = (User_extensions_Control *) the_node;
+
+ if ( the_extension->Callouts.thread_begin != NULL )
+ (*the_extension->Callouts.thread_begin)( executing );
+ }
+}
+
+/*PAGE
+ *
+ * _User_extensions_Thread_exitted
+ */
+
+void _User_extensions_Thread_exitted (
+ Thread_Control *executing
+)
+{
+ Chain_Node *the_node;
+ User_extensions_Control *the_extension;
+
+ for ( the_node = _User_extensions_List.last ;
+ !_Chain_Is_head( &_User_extensions_List, the_node ) ;
+ the_node = the_node->previous ) {
+
+ the_extension = (User_extensions_Control *) the_node;
+
+ if ( the_extension->Callouts.thread_exitted != NULL )
+ (*the_extension->Callouts.thread_exitted)( executing );
+ }
+}
+
+/*PAGE
+ *
+ * _User_extensions_Fatal
+ */
+
+void _User_extensions_Fatal (
+ Internal_errors_Source the_source,
+ boolean is_internal,
+ uint32_t the_error
+)
+{
+ Chain_Node *the_node;
+ User_extensions_Control *the_extension;
+
+ for ( the_node = _User_extensions_List.last ;
+ !_Chain_Is_head( &_User_extensions_List, the_node ) ;
+ the_node = the_node->previous ) {
+
+ the_extension = (User_extensions_Control *) the_node;
+
+ if ( the_extension->Callouts.fatal != NULL )
+ (*the_extension->Callouts.fatal)( the_source, is_internal, the_error );
+ }
+}
diff --git a/cpukit/score/src/userextthreadcreate.c b/cpukit/score/src/userextthreadcreate.c
new file mode 100644
index 0000000000..3d9caca174
--- /dev/null
+++ b/cpukit/score/src/userextthreadcreate.c
@@ -0,0 +1,49 @@
+/*
+ * COPYRIGHT (c) 1989-2007.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/userext.h>
+
+/*PAGE
+ *
+ * _User_extensions_Thread_create
+ */
+
+boolean _User_extensions_Thread_create (
+ Thread_Control *the_thread
+)
+{
+ Chain_Node *the_node;
+ User_extensions_Control *the_extension;
+ boolean status;
+
+ for ( the_node = _User_extensions_List.first ;
+ !_Chain_Is_tail( &_User_extensions_List, the_node ) ;
+ the_node = the_node->next ) {
+
+ the_extension = (User_extensions_Control *) the_node;
+
+ if ( the_extension->Callouts.thread_create != NULL ) {
+ status = (*the_extension->Callouts.thread_create)(
+ _Thread_Executing,
+ the_thread
+ );
+ if ( !status )
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+}
diff --git a/cpukit/score/src/userextthreaddelete.c b/cpukit/score/src/userextthreaddelete.c
new file mode 100644
index 0000000000..4f7214805b
--- /dev/null
+++ b/cpukit/score/src/userextthreaddelete.c
@@ -0,0 +1,43 @@
+/*
+ * COPYRIGHT (c) 1989-2007.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/userext.h>
+
+/*PAGE
+ *
+ * _User_extensions_Thread_delete
+ */
+
+void _User_extensions_Thread_delete (
+ Thread_Control *the_thread
+)
+{
+ Chain_Node *the_node;
+ User_extensions_Control *the_extension;
+
+ for ( the_node = _User_extensions_List.last ;
+ !_Chain_Is_head( &_User_extensions_List, the_node ) ;
+ the_node = the_node->previous ) {
+
+ the_extension = (User_extensions_Control *) the_node;
+
+ if ( the_extension->Callouts.thread_delete != NULL )
+ (*the_extension->Callouts.thread_delete)(
+ _Thread_Executing,
+ the_thread
+ );
+ }
+}
diff --git a/cpukit/score/src/userextthreadrestart.c b/cpukit/score/src/userextthreadrestart.c
new file mode 100644
index 0000000000..d8af932cf2
--- /dev/null
+++ b/cpukit/score/src/userextthreadrestart.c
@@ -0,0 +1,44 @@
+/*
+ * COPYRIGHT (c) 1989-2007.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/userext.h>
+
+/*PAGE
+ *
+ * _User_extensions_Thread_restart
+ *
+ */
+
+void _User_extensions_Thread_restart (
+ Thread_Control *the_thread
+)
+{
+ Chain_Node *the_node;
+ User_extensions_Control *the_extension;
+
+ for ( the_node = _User_extensions_List.first ;
+ !_Chain_Is_tail( &_User_extensions_List, the_node ) ;
+ the_node = the_node->next ) {
+
+ the_extension = (User_extensions_Control *) the_node;
+
+ if ( the_extension->Callouts.thread_restart != NULL )
+ (*the_extension->Callouts.thread_restart)(
+ _Thread_Executing,
+ the_thread
+ );
+ }
+}
diff --git a/cpukit/score/src/userextthreadstart.c b/cpukit/score/src/userextthreadstart.c
new file mode 100644
index 0000000000..1534571344
--- /dev/null
+++ b/cpukit/score/src/userextthreadstart.c
@@ -0,0 +1,44 @@
+/*
+ * COPYRIGHT (c) 1989-2007.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/userext.h>
+
+/*PAGE
+ *
+ * _User_extensions_Thread_start
+ *
+ */
+
+void _User_extensions_Thread_start (
+ Thread_Control *the_thread
+)
+{
+ Chain_Node *the_node;
+ User_extensions_Control *the_extension;
+
+ for ( the_node = _User_extensions_List.first ;
+ !_Chain_Is_tail( &_User_extensions_List, the_node ) ;
+ the_node = the_node->next ) {
+
+ the_extension = (User_extensions_Control *) the_node;
+
+ if ( the_extension->Callouts.thread_start != NULL )
+ (*the_extension->Callouts.thread_start)(
+ _Thread_Executing,
+ the_thread
+ );
+ }
+}
diff --git a/cpukit/score/src/userextthreadswitch.c b/cpukit/score/src/userextthreadswitch.c
new file mode 100644
index 0000000000..2a88c9f4f9
--- /dev/null
+++ b/cpukit/score/src/userextthreadswitch.c
@@ -0,0 +1,39 @@
+/*
+ * COPYRIGHT (c) 1989-2007.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/userext.h>
+
+/**
+ * This routine is used to invoke the user extension which
+ * is invoked when a context switch occurs.
+ */
+void _User_extensions_Thread_switch (
+ Thread_Control *executing,
+ Thread_Control *heir
+)
+{
+ Chain_Node *the_node;
+ User_extensions_Switch_control *the_extension_switch;
+
+ for ( the_node = _User_extensions_Switches_list.first ;
+ !_Chain_Is_tail( &_User_extensions_Switches_list, the_node ) ;
+ the_node = the_node->next ) {
+
+ the_extension_switch = (User_extensions_Switch_control *) the_node;
+
+ (*the_extension_switch->thread_switch)( executing, heir );
+ }
+}