Index: schedsim/rtems/Makefile.am
===================================================================
--- schedsim/rtems/Makefile.am	(revision 9a34e3a2736ea5f2b58db325c72140f7d95e78ee)
+++ schedsim/rtems/Makefile.am	(revision 726b27c5bf4b2f4200953950b985b6e0fb7ce20f)
@@ -9,9 +9,6 @@
 librtems_a_CPPFLAGS += -I$(cpukitdir)/include
 librtems_a_CPPFLAGS += -I$(cpukitdir)/score/include
-librtems_a_CPPFLAGS += -I$(cpukitdir)/score/inline
 librtems_a_CPPFLAGS += -I$(cpukitdir)/rtems/include
-librtems_a_CPPFLAGS += -I$(cpukitdir)/rtems/inline
 librtems_a_CPPFLAGS += -I$(cpukitdir)/sapi/include
-librtems_a_CPPFLAGS += -I$(cpukitdir)/sapi/inline
 librtems_a_CPPFLAGS += -I$(cpukitdir)/libcsupport/include
 librtems_a_CPPFLAGS += -I$(cpukitdir)/libmisc/stringto
@@ -32,5 +29,4 @@
 librtems_a_SOURCES += $(cpukitdir)/score/src/percpu.c
 librtems_a_SOURCES += $(cpukitdir)/score/src/apiext.c
-librtems_a_SOURCES += $(cpukitdir)/score/src/apimutexallocate.c
 librtems_a_SOURCES += $(cpukitdir)/score/src/apimutex.c
 librtems_a_SOURCES += $(cpukitdir)/score/src/apimutexlock.c
@@ -53,9 +49,11 @@
 librtems_a_SOURCES += $(cpukitdir)/score/src/coretodget.c
 librtems_a_SOURCES += $(cpukitdir)/score/src/coretodgetuptimetimespec.c
+librtems_a_SOURCES += $(cpukitdir)/score/src/coretodsecondssinceepoch.c
 librtems_a_SOURCES += $(cpukitdir)/score/src/coretodset.c
 librtems_a_SOURCES += $(cpukitdir)/score/src/coretodtickle.c
 librtems_a_SOURCES += $(cpukitdir)/score/src/coretodtickspersec.c
-librtems_a_SOURCES += $(cpukitdir)/score/src/coretodusectoticks.c
+librtems_a_SOURCES += $(cpukitdir)/score/src/freechain.c
 librtems_a_SOURCES += $(cpukitdir)/score/src/isr.c
+librtems_a_SOURCES += $(cpukitdir)/score/src/log2table.c
 librtems_a_SOURCES += $(cpukitdir)/score/src/objectallocate.c
 librtems_a_SOURCES += $(cpukitdir)/score/src/objectapimaximumclass.c
@@ -77,19 +75,30 @@
 librtems_a_SOURCES += $(cpukitdir)/score/src/objectsetname.c
 librtems_a_SOURCES += $(cpukitdir)/score/src/objectshrinkinformation.c
+librtems_a_SOURCES += $(cpukitdir)/score/src/rbtree.c
+librtems_a_SOURCES += $(cpukitdir)/score/src/rbtreeextract.c
+librtems_a_SOURCES += $(cpukitdir)/score/src/rbtreefind.c
+librtems_a_SOURCES += $(cpukitdir)/score/src/rbtreeinsert.c
+librtems_a_SOURCES += $(cpukitdir)/score/src/rbtreeiterate.c
+librtems_a_SOURCES += $(cpukitdir)/score/src/rbtreenext.c
 librtems_a_SOURCES += $(cpukitdir)/score/src/scheduler.c
-librtems_a_SOURCES += $(cpukitdir)/score/src/schedulerpriorityallocate.c
+librtems_a_SOURCES += $(cpukitdir)/score/src/schedulerdefaultallocatefree.c
+librtems_a_SOURCES += $(cpukitdir)/score/src/schedulerdefaultreleasejob.c
+librtems_a_SOURCES += $(cpukitdir)/score/src/schedulerdefaultstartidle.c
+librtems_a_SOURCES += $(cpukitdir)/score/src/schedulerdefaulttick.c
+librtems_a_SOURCES += $(cpukitdir)/score/src/schedulerdefaultupdate.c
+
+# Uniprocessor Deterministic Scheduler 
 librtems_a_SOURCES += $(cpukitdir)/score/src/schedulerpriorityblock.c
 librtems_a_SOURCES += $(cpukitdir)/score/src/schedulerpriority.c
-librtems_a_SOURCES += $(cpukitdir)/score/src/schedulerprioritytick.c
 librtems_a_SOURCES += $(cpukitdir)/score/src/schedulerpriorityenqueue.c
 librtems_a_SOURCES += $(cpukitdir)/score/src/schedulerpriorityenqueuefirst.c
 librtems_a_SOURCES += $(cpukitdir)/score/src/schedulerpriorityextract.c
-librtems_a_SOURCES += $(cpukitdir)/score/src/schedulerpriorityfree.c
 librtems_a_SOURCES += $(cpukitdir)/score/src/schedulerpriorityprioritycompare.c
-librtems_a_SOURCES += $(cpukitdir)/score/src/schedulerpriorityreleasejob.c
 librtems_a_SOURCES += $(cpukitdir)/score/src/schedulerpriorityschedule.c
 librtems_a_SOURCES += $(cpukitdir)/score/src/schedulerpriorityunblock.c
 librtems_a_SOURCES += $(cpukitdir)/score/src/schedulerpriorityupdate.c
 librtems_a_SOURCES += $(cpukitdir)/score/src/schedulerpriorityyield.c
+
+# Uniprocessor Scheduler Simple
 librtems_a_SOURCES += $(cpukitdir)/score/src/schedulersimpleblock.c
 librtems_a_SOURCES += $(cpukitdir)/score/src/schedulersimple.c
@@ -102,8 +111,8 @@
 librtems_a_SOURCES += $(cpukitdir)/score/src/schedulersimpleunblock.c
 librtems_a_SOURCES += $(cpukitdir)/score/src/schedulersimpleyield.c
+
 librtems_a_SOURCES += $(cpukitdir)/score/src/thread.c
 librtems_a_SOURCES += $(cpukitdir)/score/src/threadchangepriority.c
 librtems_a_SOURCES += $(cpukitdir)/score/src/threadclearstate.c
-librtems_a_SOURCES += $(cpukitdir)/score/src/threadclose.c
 librtems_a_SOURCES += $(cpukitdir)/score/src/threadcreateidle.c
 librtems_a_SOURCES += $(cpukitdir)/score/src/threaddelayended.c
@@ -114,5 +123,4 @@
 librtems_a_SOURCES += $(cpukitdir)/score/src/threadloadenv.c
 librtems_a_SOURCES += $(cpukitdir)/score/src/threadready.c
-librtems_a_SOURCES += $(cpukitdir)/score/src/threadreset.c
 librtems_a_SOURCES += $(cpukitdir)/score/src/threadrestart.c
 librtems_a_SOURCES += $(cpukitdir)/score/src/threadsetpriority.c
@@ -159,8 +167,5 @@
 librtems_a_SOURCES += $(cpukitdir)/score/src/watchdog.c
 librtems_a_SOURCES += $(cpukitdir)/score/src/watchdoginsert.c
-librtems_a_SOURCES += $(cpukitdir)/score/src/watchdognanoseconds.c
 librtems_a_SOURCES += $(cpukitdir)/score/src/watchdogremove.c
-librtems_a_SOURCES += $(cpukitdir)/score/src/watchdogreport.c
-librtems_a_SOURCES += $(cpukitdir)/score/src/watchdogreportchain.c
 librtems_a_SOURCES += $(cpukitdir)/score/src/watchdogtickle.c
 librtems_a_SOURCES += $(cpukitdir)/sapi/src/debug.c
@@ -185,5 +190,7 @@
 librtems_a_SOURCES += $(cpukitdir)/rtems/src/semrelease.c
 librtems_a_SOURCES += $(cpukitdir)/rtems/src/semtranslatereturncode.c
+librtems_a_SOURCES += $(cpukitdir)/rtems/src/signalcatch.c
 librtems_a_SOURCES += $(cpukitdir)/rtems/src/status.c
+librtems_a_SOURCES += $(cpukitdir)/rtems/src/statustext.c
 librtems_a_SOURCES += $(cpukitdir)/rtems/src/tasks.c
 librtems_a_SOURCES += $(cpukitdir)/rtems/src/taskdata.c
@@ -199,4 +206,7 @@
 librtems_a_SOURCES += $(cpukitdir)/rtems/src/taskmode.c
 librtems_a_SOURCES += $(cpukitdir)/rtems/src/taskwakeafter.c
+librtems_a_SOURCES += $(cpukitdir)/posix/src/key.c
+librtems_a_SOURCES += $(cpukitdir)/posix/src/keyfreememory.c
+librtems_a_SOURCES += $(cpukitdir)/posix/src/keyrundestructors.c
 librtems_a_SOURCES += $(cpukitdir)/libcsupport/src/assoclocalbyname.c
 librtems_a_SOURCES += $(cpukitdir)/libcsupport/src/assoclocalbyremotebitfield.c
@@ -229,13 +239,10 @@
 if HAS_SMP
 librtems_a_SOURCES += $(cpukitdir)/score/src/smp.c
-librtems_a_SOURCES += $(cpukitdir)/score/src/smplock.c
-librtems_a_SOURCES += $(cpukitdir)/score/src/isrsmp.c
 librtems_a_SOURCES += $(cpukitdir)/score/src/threaddisabledispatch.c
 librtems_a_SOURCES += $(cpukitdir)/score/src/threadenabledispatch.c
 librtems_a_SOURCES += $(cpukitdir)/score/src/threaddispatchdisablelevel.c
-librtems_a_SOURCES += $(cpukitdir)/score/src/schedulersimplesmpblock.c
-librtems_a_SOURCES += $(cpukitdir)/score/src/schedulersimplesmpschedule.c
-librtems_a_SOURCES += $(cpukitdir)/score/src/schedulersimplesmptick.c
-librtems_a_SOURCES += $(cpukitdir)/score/src/schedulersimplesmpunblock.c
+librtems_a_SOURCES += $(cpukitdir)/score/src/schedulerprioritysmp.c
+librtems_a_SOURCES += $(cpukitdir)/score/src/schedulersimplesmp.c
+librtems_a_SOURCES += $(cpukitdir)/score/src/schedulersmpstartidle.c
 endif
 
@@ -252,5 +259,4 @@
   ${cpukitdir}/score/include/rtems/system.h \
   ${cpukitdir}/score/include/rtems/debug.h \
-  ${cpukitdir}/score/include/rtems/bspsmp.h \
   ${cpukitdir}/include/rtems/bspIo.h \
   $(cpukitdir)/sapi/include/rtems/fatal.h \
@@ -323,34 +329,5 @@
   ${cpukitdir}/score/include/rtems/score/schedulersimple.h \
   ${cpukitdir}/score/include/rtems/score/timespec.h \
-  ${cpukitdir}/score/include/rtems/score/tqdata.h \
-  ${cpukitdir}/score/include/rtems/score/bitfield.h \
   ${cpukitdir}/score/include/rtems/score/interr.h \
-  $(cpukitdir)/score/inline/rtems/score/address.inl \
-  $(cpukitdir)/score/inline/rtems/score/corespinlock.inl \
-  $(cpukitdir)/score/inline/rtems/score/priority.inl \
-  $(cpukitdir)/score/inline/rtems/score/threadmp.inl \
-  $(cpukitdir)/score/inline/rtems/score/chain.inl \
-  $(cpukitdir)/score/inline/rtems/score/heap.inl \
-  $(cpukitdir)/score/inline/rtems/score/scheduler.inl \
-  $(cpukitdir)/score/inline/rtems/score/threadq.inl \
-  $(cpukitdir)/score/inline/rtems/score/corebarrier.inl \
-  $(cpukitdir)/score/inline/rtems/score/isr.inl \
-  $(cpukitdir)/score/inline/rtems/score/schedulerpriority.inl \
-  $(cpukitdir)/score/inline/rtems/score/tod.inl \
-  $(cpukitdir)/score/inline/rtems/score/coremsg.inl \
-  $(cpukitdir)/score/inline/rtems/score/mppkt.inl \
-  $(cpukitdir)/score/inline/rtems/score/stack.inl \
-  $(cpukitdir)/score/inline/rtems/score/tqdata.inl \
-  $(cpukitdir)/score/inline/rtems/score/coremutex.inl \
-  $(cpukitdir)/score/inline/rtems/score/object.inl \
-  $(cpukitdir)/score/inline/rtems/score/states.inl \
-  $(cpukitdir)/score/inline/rtems/score/watchdog.inl \
-  $(cpukitdir)/score/inline/rtems/score/corerwlock.inl \
-  $(cpukitdir)/score/inline/rtems/score/objectmp.inl \
-  $(cpukitdir)/score/inline/rtems/score/sysstate.inl \
-  $(cpukitdir)/score/inline/rtems/score/wkspace.inl \
-  $(cpukitdir)/score/inline/rtems/score/coresem.inl \
-  $(cpukitdir)/score/inline/rtems/score/prioritybitmap.inl \
-  $(cpukitdir)/score/inline/rtems/score/thread.inl \
   sched_cpu/rtems/score/cpu_asm.h \
   $(top_builddir)/score/include/rtems/score/cpuopts.h \
@@ -368,5 +345,4 @@
   ${cpukitdir}/rtems/include/rtems/rtems/ratemon.h \
   ${cpukitdir}/rtems/include/rtems/rtems/rtemsapi.h \
-  ${cpukitdir}/rtems/include/rtems/rtems/eventset.h \
   ${cpukitdir}/rtems/include/rtems/rtems/mp.h \
   ${cpukitdir}/rtems/include/rtems/rtems/dpmem.h \
@@ -394,22 +370,5 @@
   ${cpukitdir}/rtems/include/rtems/rtems/signal.h \
   ${cpukitdir}/rtems/include/rtems/rtems/barrier.h \
-  ${cpukitdir}/rtems/include/rtems/rtems/tasks.h \
-  $(cpukitdir)/rtems/inline/rtems/rtems/asr.inl  \
-  $(cpukitdir)/rtems/inline/rtems/rtems/eventset.inl \
-  $(cpukitdir)/rtems/inline/rtems/rtems/ratemon.inl \
-  $(cpukitdir)/rtems/inline/rtems/rtems/tasks.inl \
-  $(cpukitdir)/rtems/inline/rtems/rtems/attr.inl \
-  $(cpukitdir)/rtems/inline/rtems/rtems/message.inl \
-  $(cpukitdir)/rtems/inline/rtems/rtems/region.inl \
-  $(cpukitdir)/rtems/inline/rtems/rtems/timer.inl \
-  $(cpukitdir)/rtems/inline/rtems/rtems/barrier.inl \
-  $(cpukitdir)/rtems/inline/rtems/rtems/modes.inl \
-  $(cpukitdir)/rtems/inline/rtems/rtems/sem.inl \
-  $(cpukitdir)/rtems/inline/rtems/rtems/dpmem.inl \
-  $(cpukitdir)/rtems/inline/rtems/rtems/options.inl \
-  $(cpukitdir)/rtems/inline/rtems/rtems/status.inl \
-  $(cpukitdir)/rtems/inline/rtems/rtems/event.inl \
-  $(cpukitdir)/rtems/inline/rtems/rtems/part.inl \
-  $(cpukitdir)/rtems/inline/rtems/rtems/support.inl
+  ${cpukitdir}/rtems/include/rtems/rtems/tasks.h
 
 schedsim_include_HEADERS += rtems_sched.h
Index: schedsim/rtems/rtems_init.c
===================================================================
--- schedsim/rtems/rtems_init.c	(revision 9a34e3a2736ea5f2b58db325c72140f7d95e78ee)
+++ schedsim/rtems/rtems_init.c	(revision 726b27c5bf4b2f4200953950b985b6e0fb7ce20f)
@@ -1,6 +1,8 @@
 /*
  *  BASED UPON SOURCE IN RTEMS, MODIFIED FOR SIMULATOR
- *
- *  COPYRIGHT (c) 1989-2013.
+ */
+
+/*
+ *  COPYRIGHT (c) 1989-2014.
  *  On-Line Applications Research Corporation (OAR).
  *
@@ -13,15 +15,40 @@
 #define SCORE_INIT
 #define RTEMS_API_INIT
+#define POSIX_API_INIT
 
-#include <rtems.h> 
+#include <rtems/system.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/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>
+
+/*
+ *  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);
@@ -41,16 +68,5 @@
   _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(NULL, 0, NULL);
-
-  #if defined(RTEMS_SMP)
-    _SMP_Handler_initialize();
-  #endif
-
   _User_extensions_Handler_initialization();
-
   _ISR_Handler_initialization();
 
@@ -60,8 +76,8 @@
   _Objects_Information_table[OBJECTS_INTERNAL_API] = _Internal_Objects;
 
-  _API_Mutex_Initialization( 1 );
+  _API_Mutex_Initialization( 2 );
   _API_Mutex_Allocate( &_RTEMS_Allocator_Mutex );
+  _API_Mutex_Allocate( &_Once_Mutex );
 
-  _Priority_bit_map_Handler_initialization();
   _Watchdog_Handler_initialization();
   _TOD_Handler_initialization();
@@ -71,4 +87,7 @@
   _Scheduler_Handler_initialization();
 
+  _SMP_Handler_initialize();
+
+  _CPU_set_Handler_initialization();
 
 /* MANAGERS */
@@ -83,10 +102,15 @@
 
   /*
+   * 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.
    */
-  #if defined(RTEMS_SMP)
-    _SMP_Processor_count =
-      bsp_smp_initialize( rtems_configuration_smp_maximum_processors );
-  #endif
+  _SMP_Handler_initialize();
 
   _System_state_Set( SYSTEM_STATE_BEFORE_MULTITASKING );
@@ -105,5 +129,7 @@
    */
 
-  _System_state_Set( SYSTEM_STATE_BEGIN_MULTITASKING );
+  _System_state_Set( SYSTEM_STATE_UP );
+
+ _SMP_Request_start_multitasking();
 
   _Thread_Start_multitasking();
@@ -112,5 +138,9 @@
    *  Now we are back in a non-dispatching critical section
    */
-  _Thread_Dispatch_set_disable_level(0);
+  #if defined(RTEMS_SMP)
+    #error "NOT IMPLEMENTED"
+  #else
+    _Thread_Enable_dispatch();
+  #endif
 
   /*
Index: schedsim/rtems/sched_cpu/cpu_asm.c
===================================================================
--- schedsim/rtems/sched_cpu/cpu_asm.c	(revision 9a34e3a2736ea5f2b58db325c72140f7d95e78ee)
+++ schedsim/rtems/sched_cpu/cpu_asm.c	(revision 726b27c5bf4b2f4200953950b985b6e0fb7ce20f)
@@ -1,13 +1,13 @@
-/*  cpu_asm.c  ===> cpu_asm.S or cpu_asm.s
+/**
+ *  @file
+ *
  *  BASED UPON SOURCE IN RTEMS, MODIFIED FOR SIMULATOR
  *
- *
- *  This file contains the basic algorithms for all assembly code used
- *  in an specific CPU port of RTEMS.  These algorithms must be implemented
- *  in assembly language
- *
- *  NOTE:  This is supposed to be a .S or .s file NOT a C file.
- *
- *  COPYRIGHT (c) 1989-2013.
+ *  Every method in this file is stubbed. There are no real
+ *  context switches or interrupts.
+ */
+
+/*
+ *  COPYRIGHT (c) 1989-2014.
  *  On-Line Applications Research Corporation (OAR).
  *
@@ -15,10 +15,4 @@
  *  found in the file LICENSE in this distribution or at
  *  http://www.rtems.com/license/LICENSE.
- */
-
-/*
- *  This is supposed to be an assembly file.  This means that system.h
- *  and cpu.h should not be included in a "real" cpu_asm file.  An
- *  implementation in assembly should include "cpu_asm.h>
  */
 
@@ -29,22 +23,4 @@
 #include <rtems/system.h>
 #include <rtems/score/cpu.h>
-/* #include "cpu_asm.h> */
-
-/*
- *  _CPU_Context_save_fp_context
- *
- *  This routine is responsible for saving the FP context
- *  at *fp_context_ptr.  If the point to load the FP context
- *  from is changed then the pointer is modified by this routine.
- *
- *  Sometimes a macro implementation of this is in cpu.h which dereferences
- *  the ** and a similarly named routine in this file is passed something
- *  like a (Context_Control_fp *).  The general rule on making this decision
- *  is to avoid writing assembly language.
- *
- *  NO_CPU Specific Information:
- *
- *  XXX document implementation including references if appropriate
- */
 
 void _CPU_Context_save_fp(
@@ -54,21 +30,4 @@
 }
 
-/*
- *  _CPU_Context_restore_fp_context
- *
- *  This routine is responsible for restoring the FP context
- *  at *fp_context_ptr.  If the point to load the FP context
- *  from is changed then the pointer is modified by this routine.
- *
- *  Sometimes a macro implementation of this is in cpu.h which dereferences
- *  the ** and a similarly named routine in this file is passed something
- *  like a (Context_Control_fp *).  The general rule on making this decision
- *  is to avoid writing assembly language.
- *
- *  NO_CPU Specific Information:
- *
- *  XXX document implementation including references if appropriate
- */
-
 void _CPU_Context_restore_fp(
   Context_Control_fp **fp_context_ptr
@@ -76,13 +35,4 @@
 {
 }
-
-/*  _CPU_Context_switch
- *
- *  This routine performs a normal non-FP context switch.
- *
- *  NO_CPU Specific Information:
- *
- *  XXX document implementation including references if appropriate
- */
 
 void _CPU_Context_switch(
@@ -93,17 +43,4 @@
 }
 
-/*
- *  _CPU_Context_restore
- *
- *  This routine is generally used only to restart self in an
- *  efficient manner.  It may simply be a label in _CPU_Context_switch.
- *
- *  NOTE: May be unnecessary to reload some registers.
- *
- *  NO_CPU Specific Information:
- *
- *  XXX document implementation including references if appropriate
- */
-
 void _CPU_Context_restore(
   Context_Control *new_context
@@ -112,75 +49,5 @@
 }
 
-/*  void __ISR_Handler()
- *
- *  This routine provides the RTEMS interrupt management.
- *
- *  NO_CPU Specific Information:
- *
- *  XXX document implementation including references if appropriate
- */
-
 void _ISR_Handler(void)
 {
-   /*
-    *  This discussion ignores a lot of the ugly details in a real
-    *  implementation such as saving enough registers/state to be
-    *  able to do something real.  Keep in mind that the goal is
-    *  to invoke a user's ISR handler which is written in C and
-    *  uses a certain set of registers.
-    *
-    *  Also note that the exact order is to a large extent flexible.
-    *  Hardware will dictate a sequence for a certain subset of
-    *  _ISR_Handler while requirements for setting
-    */
-
-  /*
-   *  At entry to "common" _ISR_Handler, the vector number must be
-   *  available.  On some CPUs the hardware puts either the vector
-   *  number or the offset into the vector table for this ISR in a
-   *  known place.  If the hardware does not give us this information,
-   *  then the assembly portion of RTEMS for this port will contain
-   *  a set of distinct interrupt entry points which somehow place
-   *  the vector number in a known place (which is safe if another
-   *  interrupt nests this one) and branches to _ISR_Handler.
-   *
-   *  save some or all context on stack
-   *  may need to save some special interrupt information for exit
-   *
-   *  #if ( CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE )
-   *    if ( _ISR_Nest_level == 0 )
-   *      switch to software interrupt stack
-   *  #endif
-   *
-   *  _ISR_Nest_level++;
-   *
-   *  _Thread_Dispatch_disable_level++;
-   *
-   *  (*_ISR_Vector_table[ vector ])( vector );
-   *
-   *  _Thread_Dispatch_disable_level--;
-   *
-   *  --_ISR_Nest_level;
-   *
-   *  if ( _ISR_Nest_level )
-   *    goto the label "exit interrupt (simple case)"
-   *
-   *  if ( _Thread_Dispatch_disable_level )
-   *    _ISR_Signals_to_thread_executing = FALSE;
-   *    goto the label "exit interrupt (simple case)"
-   *
-   *  if ( _Context_Switch_necessary || _ISR_Signals_to_thread_executing ) {
-   *    _ISR_Signals_to_thread_executing = FALSE;
-   *    call _Thread_Dispatch() or prepare to return to _ISR_Dispatch
-   *    prepare to get out of interrupt
-   *    return from interrupt  (maybe to _ISR_Dispatch)
-   *
-   *  LABEL "exit interrupt (simple case):
-   *  #if ( CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE )
-   *    if outermost interrupt
-   *      restore stack
-   *  #endif
-   *  prepare to get out of interrupt
-   *  return from interrupt
-   */
 }
Index: schedsim/rtems/sched_cpu/rtems/score/cpu.h
===================================================================
--- schedsim/rtems/sched_cpu/rtems/score/cpu.h	(revision 9a34e3a2736ea5f2b58db325c72140f7d95e78ee)
+++ schedsim/rtems/sched_cpu/rtems/score/cpu.h	(revision 726b27c5bf4b2f4200953950b985b6e0fb7ce20f)
@@ -292,5 +292,5 @@
  *  XXX document implementation including references if appropriate
  */
-#define CPU_USE_DEFERRED_FP_SWITCH       TRUE
+#define CPU_USE_DEFERRED_FP_SWITCH       FALSE
 
 /**
@@ -461,4 +461,8 @@
  *  XXX document implementation including references if appropriate
  */
+
+typedef struct {
+  /* There is no CPU specific per-CPU state */
+} CPU_Per_CPU_control;
 
 /**
@@ -835,5 +839,5 @@
  */
 #define _CPU_Context_Initialize( _the_context, _stack_base, _size, \
-                                 _isr, _entry_point, _is_fp ) \
+                                 _isr, _entry_point, _is_fp, tls_area ) \
   { \
   }
@@ -1124,4 +1128,13 @@
 void _CPU_Install_interrupt_stack( void );
 
+typedef uint32_t CPU_Counter_ticks;
+
+CPU_Counter_ticks _CPU_Counter_read( void );
+
+CPU_Counter_ticks _CPU_Counter_difference(
+  CPU_Counter_ticks second,
+  CPU_Counter_ticks first
+);
+
 /**
  *  This routine is the CPU dependent IDLE thread body.
@@ -1205,4 +1218,23 @@
 );
 
+#ifdef RTEMS_SMP
+  #define _CPU_Context_switch_to_first_task_smp(_context ) 
+
+  RTEMS_COMPILER_PURE_ATTRIBUTE static inline uint32_t
+    _CPU_SMP_Get_current_processor( void )
+  {
+    return 0;
+  }
+
+  #define _CPU_SMP_Send_interrupt( dest);
+
+  static inline void _CPU_SMP_Processor_event_broadcast( void )
+  {
+  }
+
+  static inline void _CPU_SMP_Processor_event_receive( void )
+  {
+  }
+#endif
 typedef struct {
   uint32_t trap;
@@ -1284,6 +1316,4 @@
   } while (0)
 
-#define _CPU_Context_switch_to_first_task_smp(_ignored) 
-
 #ifdef __cplusplus
 }
Index: schedsim/rtems/sched_cpu/rtems/score/cpusmplock.h
===================================================================
--- schedsim/rtems/sched_cpu/rtems/score/cpusmplock.h	(revision 726b27c5bf4b2f4200953950b985b6e0fb7ce20f)
+++ schedsim/rtems/sched_cpu/rtems/score/cpusmplock.h	(revision 726b27c5bf4b2f4200953950b985b6e0fb7ce20f)
@@ -0,0 +1,118 @@
+/**
+ * @file
+ *
+ * @ingroup ScoreSMPLockCPU
+ *
+ * @brief CPU SMP Lock Implementation
+ */
+
+/*
+ * Copyright (c) 2013 embedded brains GmbH
+ *
+ * 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.
+ */
+
+#ifndef _RTEMS_SCORE_NO_CPU_SMPLOCK_H
+#define _RTEMS_SCORE_NO_CPU_SMPLOCK_H
+
+#include <rtems/score/cpu.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * @defgroup ScoreSMPLockCPU CPU SMP Locks
+ *
+ * @ingroup ScoreSMPLock
+ *
+ * This example will implement a ticket lock.
+ *
+ * @{
+ */
+
+/**
+ * @brief CPU SMP lock control.
+ */
+typedef struct {
+  unsigned int next_ticket;
+  unsigned int now_serving;
+} CPU_SMP_lock_Control;
+
+/**
+ * @brief CPU SMP lock control initializer for static initialization.
+ */
+#define CPU_SMP_LOCK_INITIALIZER { 0, 0 }
+
+/**
+ * @brief Initializes a CPU SMP lock control.
+ *
+ * @param[out] lock The CPU SMP lock control.
+ */
+static inline void _CPU_SMP_lock_Initialize( CPU_SMP_lock_Control *lock )
+{
+  lock->next_ticket = 0;
+  lock->now_serving = 0;
+}
+
+/**
+ * @brief Acquires a CPU SMP lock.
+ *
+ * @param[in,out] lock The CPU SMP lock control.
+ */
+static inline void _CPU_SMP_lock_Acquire( CPU_SMP_lock_Control *lock )
+{
+#if 0
+  unsigned int my_ticket = _Atomic_Fetch_and_increment( &lock->next_ticket );
+
+  while ( _Atomic_Load_and_acquire( &lock->now_serving ) != my_ticket ) {
+    _Wait_some_time();
+  }
+#endif
+}
+
+/**
+ * @brief Releases a CPU SMP lock.
+ *
+ * @param[in,out] lock The CPU SMP lock control.
+ */
+static inline void _CPU_SMP_lock_Release( CPU_SMP_lock_Control *lock )
+{
+#if 0
+  _Atomic_Store_and_release( &lock->now_serving, lock->now_serving + 1 );
+#endif
+}
+
+/**
+ * @brief Disables interrupts and acquires the CPU SMP lock.
+ *
+ * @param[in,out] lock The CPU SMP lock control.
+ * @param[out] isr_cookie The ISR cookie.
+ */
+#define _CPU_SMP_lock_ISR_disable_and_acquire( lock, isr_cookie ) \
+  do { \
+    _CPU_ISR_Disable( isr_cookie ); \
+    _CPU_SMP_lock_Acquire( lock ); \
+  } while (0)
+
+/**
+ * @brief Releases the CPU SMP lock and enables interrupts.
+ *
+ * @param[in,out] lock The CPU SMP lock control.
+ * @param[in] isr_cookie The ISR cookie.
+ */
+#define _CPU_SMP_lock_Release_and_ISR_enable( lock, isr_cookie ) \
+  do { \
+    _CPU_SMP_lock_Release( lock ); \
+    _CPU_ISR_Enable( isr_cookie ); \
+  } while (0)
+
+/**@}*/
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* _RTEMS_SCORE_NO_CPU_SMPLOCK_H */
Index: schedsim/rtems/sched_cpu/rtems/score/types.h
===================================================================
--- schedsim/rtems/sched_cpu/rtems/score/types.h	(revision 9a34e3a2736ea5f2b58db325c72140f7d95e78ee)
+++ schedsim/rtems/sched_cpu/rtems/score/types.h	(revision 726b27c5bf4b2f4200953950b985b6e0fb7ce20f)
@@ -32,6 +32,5 @@
  */
 
-/** This defines the type for a priority bit map entry. */
-typedef uint16_t Priority_bit_map_Control;
+typedef uint16_t Priority_bit_map_Word;
 
 /** This defines the return type for an ISR entry point. */
Index: schedsim/rtems/wkspace.c
===================================================================
--- schedsim/rtems/wkspace.c	(revision 9a34e3a2736ea5f2b58db325c72140f7d95e78ee)
+++ schedsim/rtems/wkspace.c	(revision 726b27c5bf4b2f4200953950b985b6e0fb7ce20f)
@@ -21,5 +21,7 @@
 
 #include <stdlib.h>
+#include <malloc.h>
 
+#define DEBUG_WORKSPACE
 #if defined(DEBUG_WORKSPACE)
   #include <stdio.h>
@@ -59,4 +61,25 @@
   return memory;
 }
+
+void *_Workspace_Allocate_aligned( size_t size, size_t alignment )
+{
+  void *memory;
+  int   sc;
+
+  memory = memalign( alignment, size );
+  #if defined(DEBUG_WORKSPACE)
+    fprintf(
+      stderr,
+      "Workspace_Allocate_aligned(%d, %d) from %p/%p -> %p\n",
+      size,
+      alignment,
+      __builtin_return_address( 0 ),
+      __builtin_return_address( 1 ),
+      memory
+    );
+  #endif
+  return memory;
+}
+
 
 /*
Index: schedsim/shell/schedsim_priority/Makefile.am
===================================================================
--- schedsim/shell/schedsim_priority/Makefile.am	(revision 9a34e3a2736ea5f2b58db325c72140f7d95e78ee)
+++ schedsim/shell/schedsim_priority/Makefile.am	(revision 726b27c5bf4b2f4200953950b985b6e0fb7ce20f)
@@ -27,5 +27,14 @@
 endif
 
-schedsim_priority_LDFLAGS =-Wl,--wrap=_Thread_Dispatch
+## Ensure all linker provided symbols are available
+schedsim_priority_LDFLAGS = 
+schedsim_priority_LDFLAGS += -Wl,--defsym=_TLS_Data_begin=0
+schedsim_priority_LDFLAGS += -Wl,--defsym=_TLS_BSS_end=0
+schedsim_priority_LDFLAGS += -Wl,--defsym=_TLS_Alignment=4
+
+## Wrap _Thread_Dispatch so we can see context switches
+schedsim_priority_LDFLAGS += -Wl,--wrap=_Thread_Dispatch
+
+## Link in all support libraries
 ## schedsim_priorityLDADD +=-Wl,--start-group
 schedsim_priority_LDADD = ../shared/libschedsim.a
Index: schedsim/shell/schedsim_priority/smp_stub.c
===================================================================
--- schedsim/shell/schedsim_priority/smp_stub.c	(revision 9a34e3a2736ea5f2b58db325c72140f7d95e78ee)
+++ schedsim/shell/schedsim_priority/smp_stub.c	(revision 726b27c5bf4b2f4200953950b985b6e0fb7ce20f)
@@ -25,10 +25,10 @@
 }
 
-int bsp_smp_initialize(
-  int maximum
+uint32_t bsp_smp_initialize(
+  uint32_t configured_cpu_count
 )
 {
   /* return the number of CPUs */
-  return maximum;
+  return configured_cpu_count;
 }
 
Index: schedsim/shell/schedsim_smpsimple/main_dispatch.c
===================================================================
--- schedsim/shell/schedsim_smpsimple/main_dispatch.c	(revision 9a34e3a2736ea5f2b58db325c72140f7d95e78ee)
+++ schedsim/shell/schedsim_smpsimple/main_dispatch.c	(revision 726b27c5bf4b2f4200953950b985b6e0fb7ce20f)
@@ -32,5 +32,5 @@
   current_cpu = Schedsim_Current_cpu;
   for ( cpu=0 ; cpu < _SMP_Processor_count ; cpu++ ) {
-    if ( _Per_CPU_Information[cpu].dispatch_necessary ) {
+    if ( _Per_CPU_Information[cpu].per_cpu.dispatch_necessary ) {
       printf( "=== Invoke Thread Dispatch on CPU %d\n", cpu );
        Schedsim_Current_cpu = cpu;
Index: schedsim/shell/schedsim_smpsimple/main_dump_all_cpus.c
===================================================================
--- schedsim/shell/schedsim_smpsimple/main_dump_all_cpus.c	(revision 9a34e3a2736ea5f2b58db325c72140f7d95e78ee)
+++ schedsim/shell/schedsim_smpsimple/main_dump_all_cpus.c	(revision 726b27c5bf4b2f4200953950b985b6e0fb7ce20f)
@@ -37,14 +37,13 @@
   );
   for ( cpu=0 ; cpu < _SMP_Processor_count ; cpu++ ) {
-    e = _Per_CPU_Information[cpu].executing;
-    h = _Per_CPU_Information[cpu].heir;
-    i = _Per_CPU_Information[cpu].idle;
+    e = _Per_CPU_Information[cpu].per_cpu.executing;
+    h = _Per_CPU_Information[cpu].per_cpu.heir;
     printf(
-      "  CPU %d: 0x%08x @%3ld / 0x%08x @%3ld / 0x%08x @%3ld         %s\n",
+      "  CPU %d: 0x%08x @%3ld / 0x%08x @%3ld          %s\n",
       cpu,
       e->Object.id, (long) e->current_priority,
       h->Object.id, (long) h->current_priority,
-      i->Object.id, (long) i->current_priority,
-      ((_Per_CPU_Information[cpu].dispatch_necessary) ? "true" : "false")
+      ((_Per_CPU_Information[cpu].per_cpu.dispatch_necessary) ?
+         "true" : "false")
     );
   }
Index: schedsim/shell/schedsim_smpsimple/main_dump_ready_tasks.c
===================================================================
--- schedsim/shell/schedsim_smpsimple/main_dump_ready_tasks.c	(revision 9a34e3a2736ea5f2b58db325c72140f7d95e78ee)
+++ schedsim/shell/schedsim_smpsimple/main_dump_ready_tasks.c	(revision 726b27c5bf4b2f4200953950b985b6e0fb7ce20f)
@@ -16,4 +16,6 @@
 #include "shell.h"
 #include "rtems_sched.h"
+#include <rtems/score/chainimpl.h>
+#include <rtems/score/thread.h>
 
 #include <rtems/score/schedulerpriority.h>
Index: schedsim/shell/schedsim_smpsimple/smp_stub.c
===================================================================
--- schedsim/shell/schedsim_smpsimple/smp_stub.c	(revision 9a34e3a2736ea5f2b58db325c72140f7d95e78ee)
+++ schedsim/shell/schedsim_smpsimple/smp_stub.c	(revision 726b27c5bf4b2f4200953950b985b6e0fb7ce20f)
@@ -16,4 +16,5 @@
 
 uint32_t Schedsim_Current_cpu;
+extern uint32_t Schedsim_Maximum_CPUs_From_Command_Line;
 
 void bsp_smp_secondary_cpu_initialize(int cpu)
@@ -27,10 +28,18 @@
 }
 
-int bsp_smp_initialize(
-  int maximum
+uint32_t bsp_smp_initialize(
+  uint32_t configured_cpu_count
 )
 {
+  if ( configured_cpu_count < Schedsim_Maximum_CPUs_From_Command_Line ) {
+    printf(
+      "ERROR - Maximum cores per confdefs.h is %d\n",
+      configured_cpu_count
+    );
+    exit( 1 );
+  }
+
   /* return the number of CPUs */
-  return maximum;
+  return Schedsim_Maximum_CPUs_From_Command_Line;
 }
 
Index: schedsim/shell/shared/main_rtemsinit.c
===================================================================
--- schedsim/shell/shared/main_rtemsinit.c	(revision 9a34e3a2736ea5f2b58db325c72140f7d95e78ee)
+++ schedsim/shell/shared/main_rtemsinit.c	(revision 726b27c5bf4b2f4200953950b985b6e0fb7ce20f)
@@ -23,5 +23,8 @@
 #if defined(RTEMS_SMP)
   #include <rtems/score/smp.h>
+
+  uint32_t Schedsim_Maximum_CPUs_From_Command_Line;
 #endif
+
 
 int rtems_shell_main_rtems_init(
@@ -38,5 +41,5 @@
       return -1;
     }
-    rtems_configuration_smp_maximum_processors = cpus;
+    Schedsim_Maximum_CPUs_From_Command_Line = cpus;
   }
 #endif
Index: schedsim/shell/shared/schedsim_shell.h
===================================================================
--- schedsim/shell/shared/schedsim_shell.h	(revision 9a34e3a2736ea5f2b58db325c72140f7d95e78ee)
+++ schedsim/shell/shared/schedsim_shell.h	(revision 726b27c5bf4b2f4200953950b985b6e0fb7ce20f)
@@ -14,4 +14,5 @@
 
 #include <rtems.h>
+#include <rtems/score/sysstate.h>
 
 #ifdef __cplusplus
