Index: schedsim/rtems/rtems_init.c
===================================================================
--- schedsim/rtems/rtems_init.c	(revision 11c5571d3616452fd6b7237ad1b30151236e003b)
+++ schedsim/rtems/rtems_init.c	(revision abb18dc4eb102a15a67990ad1b0c515176808a5b)
@@ -1,8 +1,6 @@
 /*
  *  BASED UPON SOURCE IN RTEMS, MODIFIED FOR SIMULATOR
- */
-
-/*
- *  COPYRIGHT (c) 1989-2014.
+ *
+ *  COPYRIGHT (c) 1989-2010.
  *  On-Line Applications Research Corporation (OAR).
  *
@@ -10,52 +8,22 @@
  *  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
 
 #define SAPI_INIT
 #define SCORE_INIT
 #define RTEMS_API_INIT
-#define POSIX_API_INIT
 
-#include <rtems/system.h>
-#include <rtems/score/assert.h>
-#include <rtems/config.h>
-#include <rtems/debug.h>
-#include <rtems/extensionimpl.h>
-#include <rtems/fatal.h>
-#include <rtems/init.h>
-#include <rtems/io.h>
-#include <rtems/score/sysstate.h>
-
+#include <rtems.h> 
 #include <rtems/score/apiext.h>
+#include <rtems/score/bitfield.h>
 #include <rtems/score/apimutex.h>
-#include <rtems/score/cpusetimpl.h>
-#include <rtems/score/userextimpl.h>
-#include <rtems/score/schedulerimpl.h>
-#include <rtems/score/smpimpl.h>
-#include <rtems/score/threadimpl.h>
-#include <rtems/score/todimpl.h>
-#include <rtems/score/watchdogimpl.h>
 #include <rtems/score/wkspace.h>
 
-#include <rtems/rtems/tasksimpl.h>
-#include <rtems/rtems/semimpl.h>
-
-#include <rtems/posix/keyimpl.h>
-
-void Init__wrap__Thread_Dispatch();
-
-/*
- *  Declare Object Information tables directly here instead of API
- *  specific initialization files as in cpukit/sapi/src.
- */
 Objects_Information *_Internal_Objects[ OBJECTS_INTERNAL_CLASSES_LAST + 1 ];
 
 Objects_Information *_RTEMS_Objects[ OBJECTS_RTEMS_CLASSES_LAST + 1 ];
-
-Objects_Information *_POSIX_Objects[ OBJECTS_POSIX_CLASSES_LAST + 1 ];
 
 extern void check_heir_and_executing(void);
@@ -64,6 +32,4 @@
 {
   _System_state_Handler_initialization( FALSE );
-
-  _CPU_Initialize();
 
   /*
@@ -77,6 +43,13 @@
   _Thread_Dispatch_initialization();
 
+  /*
+   *  Before this is called, we are not allowed to allocate memory
+   *  from the Workspace because it is not initialized.
+   */
+  _Workspace_Handler_initialization();
+
   _User_extensions_Handler_initialization();
-  _ISR_Handler_initialization();
+
+  // _ISR_Handler_initialization();
 
   /*
@@ -85,8 +58,8 @@
   _Objects_Information_table[OBJECTS_INTERNAL_API] = _Internal_Objects;
 
-  _API_Mutex_Initialization( 2 );
+  _API_Mutex_Initialization( 1 );
   _API_Mutex_Allocate( &_RTEMS_Allocator_Mutex );
-  _API_Mutex_Allocate( &_Once_Mutex );
 
+  _Priority_bit_map_Handler_initialization();
   _Watchdog_Handler_initialization();
   _TOD_Handler_initialization();
@@ -96,7 +69,4 @@
   _Scheduler_Handler_initialization();
 
-  _SMP_Handler_initialize();
-
-  _CPU_set_Handler_initialization();
 
 /* MANAGERS */
@@ -109,17 +79,4 @@
   _RTEMS_tasks_Manager_initialization();
   _Semaphore_Manager_initialization();
-
-  /*
-   * Install our API Object Management Table and initialize the
-   * various managers.
-   */
-  _Objects_Information_table[OBJECTS_POSIX_API] = _POSIX_Objects;
-
-  _POSIX_Key_Manager_initialization();
-
-  /*
-   * Discover and initialize the secondary cores in an SMP system.
-   */
-  _SMP_Handler_initialize();
 
   _System_state_Set( SYSTEM_STATE_BEFORE_MULTITASKING );
@@ -138,50 +95,12 @@
    */
 
-  _System_state_Set( SYSTEM_STATE_UP );
-
-  _SMP_Request_start_multitasking();
+  _System_state_Set( SYSTEM_STATE_BEGIN_MULTITASKING );
 
   _Thread_Start_multitasking();
-
-  /* Add Initialization of the Thread_Dispatch wrapper */
-  Init__wrap__Thread_Dispatch();
 
   /*
    *  Now we are back in a non-dispatching critical section
    */
-  #if defined(RTEMS_SMP)
-   {
-      ISR_Level  level;
-
-      /*
-       * On SMP we enter _Thread_Handler() with interrupts disabled and
-       * _Thread_Dispatch() obtained the per-CPU lock for us.  We have to
-       * release it here and set the desired interrupt level of the thread.
-       */
-      Per_CPU_Control *cpu_self = _Per_CPU_Get();
-
-      _Assert( cpu_self->thread_dispatch_disable_level == 1 );
-      _Assert( _ISR_Get_level() != 0 );
-
-      cpu_self->thread_dispatch_disable_level = 0;
-      _Profiling_Thread_dispatch_enable( cpu_self, 0 );
-
-      /* For whatever reason, we haven't locked our per cpu yet in the
-       * Scheduler Simulator. Until this is done, this release is not needed.
-       */
-      /* _Per_CPU_Release( cpu_self ); */
-
-      level =  _Thread_Executing->Start.isr_level;
-      _ISR_Set_level( level);
-
-      /*
-       * The thread dispatch level changed from one to zero.  Make sure we lose
-       * no thread dispatch necessary update.
-       */
-      _Thread_Dispatch();
-    }
-  #else
-    _Thread_Enable_dispatch();
-  #endif
+  _Thread_Dispatch_set_disable_level(0);
 
   /*
