Index: cpukit/ChangeLog
===================================================================
--- cpukit/ChangeLog	(revision d81d05783944cadfb13df29effc61c0c16034745)
+++ cpukit/ChangeLog	(revision c3db01d0f37921ba809825e9c6b7fbe86b8fae5d)
@@ -1,2 +1,28 @@
+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>
 
Index: cpukit/libcsupport/include/rtems/libcsupport.h
===================================================================
--- cpukit/libcsupport/include/rtems/libcsupport.h	(revision d81d05783944cadfb13df29effc61c0c16034745)
+++ cpukit/libcsupport/include/rtems/libcsupport.h	(revision c3db01d0f37921ba809825e9c6b7fbe86b8fae5d)
@@ -40,4 +40,36 @@
 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
 }
Index: cpukit/libcsupport/src/newlibc.c
===================================================================
--- cpukit/libcsupport/src/newlibc.c	(revision d81d05783944cadfb13df29effc61c0c16034745)
+++ cpukit/libcsupport/src/newlibc.c	(revision c3db01d0f37921ba809825e9c6b7fbe86b8fae5d)
@@ -51,6 +51,6 @@
 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);
 
 /*
@@ -72,52 +72,22 @@
    */
 
-#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)
-  {
+  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
-
+      _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;
 }
 
@@ -134,25 +104,7 @@
 
 /*
- *  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.
  *
  */
@@ -223,62 +175,23 @@
 
 /*
- *  Function:   libc_init
- *  Created:    94/12/10
+ *  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)
  *
- *  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.
- *
- *  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);
 }
 
Index: cpukit/sapi/Makefile.am
===================================================================
--- cpukit/sapi/Makefile.am	(revision d81d05783944cadfb13df29effc61c0c16034745)
+++ cpukit/sapi/Makefile.am	(revision c3db01d0f37921ba809825e9c6b7fbe86b8fae5d)
@@ -23,5 +23,5 @@
 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)
 
Index: cpukit/sapi/include/confdefs.h
===================================================================
--- cpukit/sapi/include/confdefs.h	(revision d81d05783944cadfb13df29effc61c0c16034745)
+++ cpukit/sapi/include/confdefs.h	(revision c3db01d0f37921ba809825e9c6b7fbe86b8fae5d)
@@ -65,8 +65,8 @@
  */
 
-#ifdef RTEMS_NEWLIB
-#define CONFIGURE_NEWLIB_EXTENSION 1
-#else
-#define CONFIGURE_NEWLIB_EXTENSION 0
+#if (defined(RTEMS_NEWLIB) && defined(CONFIGURE_DISABLE_NEWLIB_REENTRANCY))
+  #define CONFIGURE_NEWLIB_EXTENSION 1
+#else
+  #define CONFIGURE_NEWLIB_EXTENSION 0
 #endif
 
@@ -131,23 +131,21 @@
 
 #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
-
-#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
 
 /*
@@ -511,23 +509,28 @@
 #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)))
-#else
-#define CONFIGURE_INITIAL_EXTENSION_TABLE NULL
-#define CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS 0
+    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
 #endif
 
Index: cpukit/sapi/src/exinit.c
===================================================================
--- cpukit/sapi/src/exinit.c	(revision d81d05783944cadfb13df29effc61c0c16034745)
+++ cpukit/sapi/src/exinit.c	(revision c3db01d0f37921ba809825e9c6b7fbe86b8fae5d)
@@ -106,5 +106,7 @@
 
   _Configuration_Table    = configuration_table;
+#if defined(RTEMS_MULTIPROCESSING)
   _Configuration_MP_table = multiprocessing_table;
+#endif
 
   /*
@@ -278,25 +280,2 @@
   _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();
-  }
-}
Index: cpukit/sapi/src/exshutdown.c
===================================================================
--- cpukit/sapi/src/exshutdown.c	(revision c3db01d0f37921ba809825e9c6b7fbe86b8fae5d)
+++ cpukit/sapi/src/exshutdown.c	(revision c3db01d0f37921ba809825e9c6b7fbe86b8fae5d)
@@ -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();
+  }
+}
Index: cpukit/score/Makefile.am
===================================================================
--- cpukit/score/Makefile.am	(revision d81d05783944cadfb13df29effc61c0c16034745)
+++ cpukit/score/Makefile.am	(revision c3db01d0f37921ba809825e9c6b7fbe86b8fae5d)
@@ -52,5 +52,5 @@
     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
 
@@ -159,7 +159,15 @@
     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
Index: cpukit/score/include/rtems/score/userext.h
===================================================================
--- cpukit/score/include/rtems/score/userext.h	(revision d81d05783944cadfb13df29effc61c0c16034745)
+++ cpukit/score/include/rtems/score/userext.h	(revision c3db01d0f37921ba809825e9c6b7fbe86b8fae5d)
@@ -203,4 +203,45 @@
 /*@{*/
 
+/** @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
  *
@@ -259,4 +300,18 @@
 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
 );
 
@@ -287,8 +342,4 @@
 );
 
-#ifndef __RTEMS_APPLICATION__
-#include <rtems/score/userext.inl>
-#endif
-
 #ifdef __cplusplus
 }
Index: ukit/score/inline/rtems/score/userext.inl
===================================================================
--- cpukit/score/inline/rtems/score/userext.inl	(revision d81d05783944cadfb13df29effc61c0c16034745)
+++ 	(revision )
@@ -1,156 +1,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 */
Index: cpukit/score/preinstall.am
===================================================================
--- cpukit/score/preinstall.am	(revision d81d05783944cadfb13df29effc61c0c16034745)
+++ cpukit/score/preinstall.am	(revision c3db01d0f37921ba809825e9c6b7fbe86b8fae5d)
@@ -253,8 +253,4 @@
 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
Index: cpukit/score/src/chain.c
===================================================================
--- cpukit/score/src/chain.c	(revision d81d05783944cadfb13df29effc61c0c16034745)
+++ cpukit/score/src/chain.c	(revision c3db01d0f37921ba809825e9c6b7fbe86b8fae5d)
@@ -1,11 +1,4 @@
 /*
- *  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).
  *
@@ -66,118 +59,2 @@
   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 );
-}
Index: cpukit/score/src/chainappend.c
===================================================================
--- cpukit/score/src/chainappend.c	(revision c3db01d0f37921ba809825e9c6b7fbe86b8fae5d)
+++ cpukit/score/src/chainappend.c	(revision c3db01d0f37921ba809825e9c6b7fbe86b8fae5d)
@@ -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 );
+}
Index: cpukit/score/src/chainextract.c
===================================================================
--- cpukit/score/src/chainextract.c	(revision c3db01d0f37921ba809825e9c6b7fbe86b8fae5d)
+++ cpukit/score/src/chainextract.c	(revision c3db01d0f37921ba809825e9c6b7fbe86b8fae5d)
@@ -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 );
+}
Index: cpukit/score/src/chainget.c
===================================================================
--- cpukit/score/src/chainget.c	(revision c3db01d0f37921ba809825e9c6b7fbe86b8fae5d)
+++ cpukit/score/src/chainget.c	(revision c3db01d0f37921ba809825e9c6b7fbe86b8fae5d)
@@ -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;
+}
Index: cpukit/score/src/chaininsert.c
===================================================================
--- cpukit/score/src/chaininsert.c	(revision c3db01d0f37921ba809825e9c6b7fbe86b8fae5d)
+++ cpukit/score/src/chaininsert.c	(revision c3db01d0f37921ba809825e9c6b7fbe86b8fae5d)
@@ -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 );
+}
Index: cpukit/score/src/userext.c
===================================================================
--- cpukit/score/src/userext.c	(revision d81d05783944cadfb13df29effc61c0c16034745)
+++ cpukit/score/src/userext.c	(revision c3db01d0f37921ba809825e9c6b7fbe86b8fae5d)
@@ -1,8 +1,4 @@
 /*
- *  User Extension Handler
- *
- *  NOTE: XXX
- *
- *  COPYRIGHT (c) 1989-1999.
+ *  COPYRIGHT (c) 1989-2007.
  *  On-Line Applications Research Corporation (OAR).
  *
@@ -20,186 +16,39 @@
 #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 );
-  }
-}
Index: cpukit/score/src/userextaddapiset.c
===================================================================
--- cpukit/score/src/userextaddapiset.c	(revision c3db01d0f37921ba809825e9c6b7fbe86b8fae5d)
+++ cpukit/score/src/userextaddapiset.c	(revision c3db01d0f37921ba809825e9c6b7fbe86b8fae5d)
@@ -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 );
+  }
+}
Index: cpukit/score/src/userextaddset.c
===================================================================
--- cpukit/score/src/userextaddset.c	(revision c3db01d0f37921ba809825e9c6b7fbe86b8fae5d)
+++ cpukit/score/src/userextaddset.c	(revision c3db01d0f37921ba809825e9c6b7fbe86b8fae5d)
@@ -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
+    );
+  }
+}
Index: cpukit/score/src/userextremoveset.c
===================================================================
--- cpukit/score/src/userextremoveset.c	(revision c3db01d0f37921ba809825e9c6b7fbe86b8fae5d)
+++ cpukit/score/src/userextremoveset.c	(revision c3db01d0f37921ba809825e9c6b7fbe86b8fae5d)
@@ -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 );
+}
Index: cpukit/score/src/userextthreadbegin.c
===================================================================
--- cpukit/score/src/userextthreadbegin.c	(revision c3db01d0f37921ba809825e9c6b7fbe86b8fae5d)
+++ cpukit/score/src/userextthreadbegin.c	(revision c3db01d0f37921ba809825e9c6b7fbe86b8fae5d)
@@ -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 );
+  }
+}
Index: cpukit/score/src/userextthreadcreate.c
===================================================================
--- cpukit/score/src/userextthreadcreate.c	(revision c3db01d0f37921ba809825e9c6b7fbe86b8fae5d)
+++ cpukit/score/src/userextthreadcreate.c	(revision c3db01d0f37921ba809825e9c6b7fbe86b8fae5d)
@@ -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;
+}
Index: cpukit/score/src/userextthreaddelete.c
===================================================================
--- cpukit/score/src/userextthreaddelete.c	(revision c3db01d0f37921ba809825e9c6b7fbe86b8fae5d)
+++ cpukit/score/src/userextthreaddelete.c	(revision c3db01d0f37921ba809825e9c6b7fbe86b8fae5d)
@@ -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
+      );
+  }
+}
Index: cpukit/score/src/userextthreadrestart.c
===================================================================
--- cpukit/score/src/userextthreadrestart.c	(revision c3db01d0f37921ba809825e9c6b7fbe86b8fae5d)
+++ cpukit/score/src/userextthreadrestart.c	(revision c3db01d0f37921ba809825e9c6b7fbe86b8fae5d)
@@ -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
+      );
+  }
+}
Index: cpukit/score/src/userextthreadstart.c
===================================================================
--- cpukit/score/src/userextthreadstart.c	(revision c3db01d0f37921ba809825e9c6b7fbe86b8fae5d)
+++ cpukit/score/src/userextthreadstart.c	(revision c3db01d0f37921ba809825e9c6b7fbe86b8fae5d)
@@ -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
+      );
+  }
+}
Index: cpukit/score/src/userextthreadswitch.c
===================================================================
--- cpukit/score/src/userextthreadswitch.c	(revision c3db01d0f37921ba809825e9c6b7fbe86b8fae5d)
+++ cpukit/score/src/userextthreadswitch.c	(revision c3db01d0f37921ba809825e9c6b7fbe86b8fae5d)
@@ -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 );
+  }
+}
