Index: schedsim/shell/schedsim_smpsimple/.cvsignore
===================================================================
--- schedsim/shell/schedsim_smpsimple/.cvsignore	(revision f40778b48660b589278898593c62cf2250d3fbab)
+++ schedsim/shell/schedsim_smpsimple/.cvsignore	(revision f40778b48660b589278898593c62cf2250d3fbab)
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
Index: schedsim/shell/schedsim_smpsimple/ChangeLog
===================================================================
--- schedsim/shell/schedsim_smpsimple/ChangeLog	(revision f40778b48660b589278898593c62cf2250d3fbab)
+++ schedsim/shell/schedsim_smpsimple/ChangeLog	(revision f40778b48660b589278898593c62cf2250d3fbab)
@@ -0,0 +1,170 @@
+2011-05-17	Joel Sherrill <joel.sherrill@oarcorp.com>
+
+	* .cvsignore, ChangeLog, Makefile.am, README, TODO, add_commands.c,
+	config.c, main_current_cpu.c, main_dispatch.c, main_dump_all_cpus.c,
+	main_dump_ready_tasks.c, printheir_executing.c, schedsim.cc,
+	smp_stub.c, wrap_thread_dispatch.c, scenarios/.cvsignore,
+	scenarios/cpus1_mode.expected, scenarios/cpus1_mode.scen,
+	scenarios/cpus1_priority.expected, scenarios/cpus1_priority.scen,
+	scenarios/cpus1_resume_on_primary.expected,
+	scenarios/cpus1_resume_on_primary.scen,
+	scenarios/cpus1_suspend_on_primary.expected,
+	scenarios/cpus1_suspend_on_primary.scen,
+	scenarios/cpus4_mode_case1.expected, scenarios/cpus4_mode_case1.scen,
+	scenarios/cpus4_mode_case2.expected, scenarios/cpus4_mode_case2.scen,
+	scenarios/cpus4_nonpreempt_case1.expected,
+	scenarios/cpus4_nonpreempt_case1.scen,
+	scenarios/cpus4_pick_older.expected, scenarios/cpus4_pick_older.scen,
+	scenarios/cpus4_priority.expected, scenarios/cpus4_priority.scen,
+	scenarios/cpus4_simple_nopreempt.expected,
+	scenarios/cpus4_simple_nopreempt.scen,
+	scenarios/cpus4_simple_preemption.expected,
+	scenarios/cpus4_simple_preemption.scen,
+	scenarios/cpus4_suspend_on_all.expected,
+	scenarios/cpus4_suspend_on_all.scen,
+	scenarios/cpus4_suspend_on_primary.expected,
+	scenarios/cpus4_suspend_on_primary.scen,
+	scenarios/cpus4_suspend_on_secondary.expected,
+	scenarios/cpus4_suspend_on_secondary.scen: New files.
+
+2011-04-22	Joel Sherrill <joel.sherrill@oarcorp.com>
+
+	* smp_stub.c, scenarios/cpus4_mode_case1.expected,
+	scenarios/cpus4_mode_case2.expected,
+	scenarios/cpus4_nonpreempt_case1.expected,
+	scenarios/cpus4_pick_older.expected,
+	scenarios/cpus4_priority.expected,
+	scenarios/cpus4_simple_nopreempt.expected,
+	scenarios/cpus4_simple_preemption.expected,
+	scenarios/cpus4_suspend_on_all.expected,
+	scenarios/cpus4_suspend_on_primary.expected,
+	scenarios/cpus4_suspend_on_secondary.expected: Builds against latest
+	changes.
+
+2011-04-22	Joel Sherrill <joel.sherrill@oarcorp.com>
+
+	* main_dispatch.c, main_dump_all_cpus.c: Builds again and passes all
+	tests.
+
+2011-04-20	Joel Sherrill <joel.sherrill@oarcorp.com>
+
+	* config.c, scenarios/cpus1_resume_on_primary.expected,
+	scenarios/cpus1_suspend_on_primary.expected,
+	scenarios/cpus4_suspend_on_all.expected,
+	scenarios/cpus4_suspend_on_primary.expected,
+	scenarios/cpus4_suspend_on_secondary.expected: Now runs with Simple
+	SMP Scheduler merged into SuperCore.
+
+2011-04-20	Joel Sherrill <joel.sherrill@oarcorp.com>
+
+	* Makefile: Begin to merge Scheduler Simple SMP to score.
+	* schedulersimplesmpblock.c, schedulersimplesmpschedule.c,
+	schedulersimplesmpunblock.c, rtems/score/schedulersimplesmp.h:
+	Removed.
+
+2011-04-20	Joel Sherrill <joel.sherrill@oarcorp.com>
+
+	* scenarios/cpus4_pick_older.expected: Fix test name.
+
+2011-04-19	Joel Sherrill <joel.sherrill@oarcorp.com>
+
+	* schedulersimplesmpschedule.c, scenarios/cpus4_mode_case1.expected,
+	scenarios/cpus4_mode_case1.scen,
+	scenarios/cpus4_nonpreempt_case1.expected,
+	scenarios/cpus4_nonpreempt_case1.scen: Preemptible tasks favored over
+	non-preemptible.
+
+2011-04-19	Joel Sherrill <joel.sherrill@oarcorp.com>
+
+	* scenarios/cpus4_mode_case2.expected: New file.
+
+2011-04-19	Joel Sherrill <joel.sherrill@oarcorp.com>
+
+	* TODO: Add test cases that work.
+
+2011-04-19	Joel Sherrill <joel.sherrill@oarcorp.com>
+
+	* scenarios/cpus1_priority.expected, scenarios/cpus1_priority.scen,
+	scenarios/cpus1_resume_on_primary.expected,
+	scenarios/cpus1_resume_on_primary.scen: Add mode test cases. Fix use
+	of task_mode.
+	* scenarios/cpus1_mode.expected, scenarios/cpus1_mode.scen,
+	scenarios/cpus4_mode_case1.expected, scenarios/cpus4_mode_case1.scen,
+	scenarios/cpus4_mode_case2.scen: New files.
+
+2011-04-19	Joel Sherrill <joel.sherrill@oarcorp.com>
+
+	* TODO, run_scenarios: New test case.
+	* scenarios/cpus4_suspend_on_all.expected,
+	scenarios/cpus4_suspend_on_all.scen: New files.
+
+2011-04-19	Joel Sherrill <joel.sherrill@oarcorp.com>
+
+	* TODO, schedulersimplesmpschedule.c,
+	scenarios/cpus4_simple_nopreempt.expected,
+	scenarios/cpus4_simple_nopreempt.scen: More test cases working.
+	* scenarios/cpus4_nonpreempt_case1.expected,
+	scenarios/cpus4_nonpreempt_case1.scen,
+	scenarios/cpus4_priority.expected, scenarios/cpus4_priority.scen: New
+	files.
+
+2011-04-19	Joel Sherrill <joel.sherrill@oarcorp.com>
+
+	* TODO, schedulersimplesmpschedule.c: Now behaves like Deterministic
+	Priority Scheduler on priority lowering.
+
+2011-04-19	Joel Sherrill <joel.sherrill@oarcorp.com>
+
+	* TODO, run_scenarios, schedulersimplesmpschedule.c: Priority changes
+	on single CPU works like regular scheduler.
+	* scenarios/.cvsignore, scenarios/cpus1_priority.expected,
+	scenarios/cpus1_priority.scen: New files.
+
+2011-04-19	Joel Sherrill <joel.sherrill@oarcorp.com>
+
+	* run_scenarios, scenarios/cpus1_resume_on_primary.expected,
+	scenarios/cpus1_suspend_on_primary.expected,
+	scenarios/cpus4_picker_older.expected,
+	scenarios/cpus4_simple_nopreempt.expected,
+	scenarios/cpus4_simple_preemption.expected,
+	scenarios/cpus4_suspend_on_primary.expected,
+	scenarios/cpus4_suspend_on_secondary.expected: All pass again after
+	placing them in a subdirectory.
+
+2011-04-18	Joel Sherrill <joel.sherrill@oarcorp.com>
+
+	* .cvsignore, TODO, main_current_cpu.c, main_dispatch.c,
+	main_dump_all_cpus.c, main_dump_ready_tasks.c,
+	scen_cpus1_resume_on_primary, scen_cpus1_suspend_on_primary,
+	scen_cpus4_picker_older, scen_cpus4_simple_nopreempt,
+	scen_cpus4_suspend_on_secondary, schedsim.cc: Six scenrarios run
+	correctly. Added script to automate checking again.
+	* run_scenarios, scen_cpus1_resume_on_primary.expected,
+	scen_cpus1_suspend_on_primary.expected,
+	scen_cpus4_simple_nopreempt.expected,
+	scen_cpus4_simple_preemption.expected,
+	scen_cpus4_suspend_on_primary.expected,
+	scen_cpus4_suspend_on_secondary.expected: New files.
+
+2011-04-15	Joel Sherrill <joel.sherrill@oarcorp.com>
+
+	* Makefile, add_commands.c, getcpuid.c, schedsim.cc,
+	schedulersimplesmpschedule.c, schedulersimplesmpunblock.c,
+	smp_stub.c, rtems/score/schedulersimplesmp.h: Now supports the first
+	scenarios for initial version of Simple SMP scheduler. Not all pass.
+	* .cvsignore, TODO, main_current_cpu.c, main_dispatch.c,
+	scen_cpus1_resume_on_primary, scen_cpus1_suspend_on_primary,
+	scen_cpus4_picker_older, scen_cpus4_simple_nopreempt,
+	scen_cpus4_simple_preemption, scen_cpus4_suspend_on_primary,
+	scen_cpus4_suspend_on_secondary, schedulersimplesmpblock.c: New
+	files.
+
+2011-04-12	Joel Sherrill <joel.sherrill@oarcorp.com>
+
+	* ChangeLog, Makefile, README, add_commands.c, config.c, debugio.c,
+	example_script, getcpuid.c, main_dump_all_cpus.c,
+	main_dump_ready_tasks.c, printheir_executing.c, schedsim.cc,
+	schedulersimplesmpschedule.c, schedulersimplesmpunblock.c,
+	smp_stub.c, wrap_thread_dispatch.c, rtems/score/schedulersimplesmp.h:
+	New files.
+
Index: schedsim/shell/schedsim_smpsimple/Makefile.am
===================================================================
--- schedsim/shell/schedsim_smpsimple/Makefile.am	(revision f40778b48660b589278898593c62cf2250d3fbab)
+++ schedsim/shell/schedsim_smpsimple/Makefile.am	(revision f40778b48660b589278898593c62cf2250d3fbab)
@@ -0,0 +1,35 @@
+##
+## $Id$
+##
+
+bin_PROGRAMS = schedsim
+schedsim_SOURCES = add_commands.c config.c \
+  main_current_cpu.c main_dispatch.c main_dump_all_cpus.c \
+  main_dump_ready_tasks.c printheir_executing.c smp_stub.c \
+  wrap_thread_dispatch.c schedsim.cc
+
+cpukitdir=@rtems_srcdir@/cpukit
+schedsim_CPPFLAGS  = -I$(top_builddir)/score/include
+schedsim_CPPFLAGS += -I$(srcdir)/sched_cpu
+schedsim_CPPFLAGS += -I$(srcdir)/../../rtems
+schedsim_CPPFLAGS += -I$(cpukitdir)/include
+schedsim_CPPFLAGS += -I$(cpukitdir)/score/include
+schedsim_CPPFLAGS += -I$(cpukitdir)/score/inline
+schedsim_CPPFLAGS += -I$(cpukitdir)/rtems/include
+schedsim_CPPFLAGS += -I$(cpukitdir)/rtems/inline
+schedsim_CPPFLAGS += -I$(cpukitdir)/sapi/include
+schedsim_CPPFLAGS += -I$(cpukitdir)/sapi/inline
+schedsim_CPPFLAGS += -I$(cpukitdir)/libcsupport/include
+schedsim_CPPFLAGS += -I$(cpukitdir)/libmisc/stringto
+schedsim_CPPFLAGS += -I$(srcdir)/../../rtems/sched_cpu
+schedsim_CPPFLAGS += -I$(srcdir)/../shared/include
+schedsim_CPPFLAGS += -I$(srcdir)/../shared
+
+schedsim_LDFLAGS =-Wl,--wrap=_Thread_Dispatch
+## schedsim_LDADD +=-Wl,--start-group
+schedsim_LDADD = ../shared/libschedsim.a
+schedsim_LDADD += ../../rtems/librtems.a
+schedsim_LDADD += ../shared/libschedsim.a
+## schedsim_LDADD +=-Wl,--end-group
+
+include $(top_srcdir)/../automake/host.am
Index: schedsim/shell/schedsim_smpsimple/README
===================================================================
--- schedsim/shell/schedsim_smpsimple/README	(revision f40778b48660b589278898593c62cf2250d3fbab)
+++ schedsim/shell/schedsim_smpsimple/README	(revision f40778b48660b589278898593c62cf2250d3fbab)
@@ -0,0 +1,8 @@
+#
+#  $Id$
+#
+
+This is a scheduler simulator instance for developing the
+Simple SMP Scheduler.  Once this scheduler is completed,
+it will be integrated into the proper locations of the 
+main RTEMS development tree.
Index: schedsim/shell/schedsim_smpsimple/TODO
===================================================================
--- schedsim/shell/schedsim_smpsimple/TODO	(revision f40778b48660b589278898593c62cf2250d3fbab)
+++ schedsim/shell/schedsim_smpsimple/TODO	(revision f40778b48660b589278898593c62cf2250d3fbab)
@@ -0,0 +1,22 @@
+#
+#  $Id$
+#
+
+Working As of 19 April 2011
+===========================
+cpus1_mode
+cpus1_priority
+cpus1_resume_on_primary
+cpus1_suspend_on_primary
+
+cpus4_mode_case1
+cpus4_mode_case2
+cpus4_nonpreempt_case1
+cpus4_picker_older
+cpus4_priority
+cpus4_simple_nopreempt
+cpus4_simple_preemption
+cpus4_suspend_on_all
+cpus4_suspend_on_primary
+cpus4_suspend_on_secondary
+
Index: schedsim/shell/schedsim_smpsimple/add_commands.c
===================================================================
--- schedsim/shell/schedsim_smpsimple/add_commands.c	(revision f40778b48660b589278898593c62cf2250d3fbab)
+++ schedsim/shell/schedsim_smpsimple/add_commands.c	(revision f40778b48660b589278898593c62cf2250d3fbab)
@@ -0,0 +1,63 @@
+/*
+ *  COPYRIGHT (c) 1989-2011.
+ *  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$
+ */
+
+#include <newlib/getopt.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <assert.h>
+
+#include "shell.h"
+#include "rtems_sched.h"
+
+extern int main_dump_ready_tasks(int argc, char **argv);
+extern int main_dump_all_cpus(int argc, char **argv);
+extern int main_set_current_cpu(int argc, char **argv);
+extern int main_dispatch(int argc, char **argv);
+
+void add_commands(void)
+{
+  rtems_shell_cmd_t *cmd;
+
+  cmd = rtems_shell_add_cmd(
+    "ready_tasks",
+    "rtems",
+    "no args",
+    main_dump_ready_tasks
+  );
+  assert( cmd );
+
+  cmd = rtems_shell_add_cmd(
+    "cpus",
+    "rtems",
+    "no args",
+    main_dump_all_cpus
+  );
+  assert( cmd );
+
+  cmd = rtems_shell_add_cmd(
+    "current_cpu",
+    "rtems",
+    "number",
+    main_set_current_cpu
+  );
+  assert( cmd );
+
+  cmd = rtems_shell_add_cmd(
+    "dispatch",
+    "rtems",
+    "",
+    main_dispatch
+  );
+  assert( cmd );
+
+}
Index: schedsim/shell/schedsim_smpsimple/config.c
===================================================================
--- schedsim/shell/schedsim_smpsimple/config.c	(revision f40778b48660b589278898593c62cf2250d3fbab)
+++ schedsim/shell/schedsim_smpsimple/config.c	(revision f40778b48660b589278898593c62cf2250d3fbab)
@@ -0,0 +1,15 @@
+/*
+ *  $Id$
+ */
+
+#include <rtems.h>
+
+#define CONFIGURE_INIT
+#define CONFIGURE_MAXIMUM_TASKS             1000
+#define CONFIGURE_MAXIMUM_SEMAPHORES        1000
+
+#define CONFIGURE_SMP_APPLICATION
+#define CONFIGURE_SMP_MAXIMUM_PROCESSORS 4
+
+#include <rtems/confdefs.h>
+
Index: schedsim/shell/schedsim_smpsimple/main_current_cpu.c
===================================================================
--- schedsim/shell/schedsim_smpsimple/main_current_cpu.c	(revision f40778b48660b589278898593c62cf2250d3fbab)
+++ schedsim/shell/schedsim_smpsimple/main_current_cpu.c	(revision f40778b48660b589278898593c62cf2250d3fbab)
@@ -0,0 +1,48 @@
+/*
+ *  COPYRIGHT (c) 1989-2011.
+ *  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$
+ */
+
+#include <newlib/getopt.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
+#include "shell.h"
+#include "rtems_sched.h"
+
+#include <rtems.h>
+#include <rtems/bspsmp.h>
+#include <rtems/score/percpu.h>
+#include <rtems/score/schedulerpriority.h>
+
+extern uint32_t Schedsim_Current_cpu;
+
+int main_set_current_cpu(int argc, char **argv)
+{
+  long cpu;
+
+  if ( argc >= 2 ) {
+    if ( rtems_string_to_long(argv[1], &cpu, NULL, 0) ) {
+      printf( "CPU argument (%s) is not a number\n", argv[1] );
+      return -1;
+    }
+    printf(
+      "Changing current CPU from %d to %d\n",
+      Schedsim_Current_cpu,
+      cpu
+    );
+    Schedsim_Current_cpu = cpu;
+  } else {
+    printf( "Current CPU is %d\n", Schedsim_Current_cpu );
+  }
+
+  return 0;
+}
Index: schedsim/shell/schedsim_smpsimple/main_dispatch.c
===================================================================
--- schedsim/shell/schedsim_smpsimple/main_dispatch.c	(revision f40778b48660b589278898593c62cf2250d3fbab)
+++ schedsim/shell/schedsim_smpsimple/main_dispatch.c	(revision f40778b48660b589278898593c62cf2250d3fbab)
@@ -0,0 +1,45 @@
+/*
+ *  COPYRIGHT (c) 1989-2011.
+ *  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$
+ */
+
+#include <newlib/getopt.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
+#include "shell.h"
+#include "rtems_sched.h"
+
+#include <rtems.h>
+#include <rtems/bspsmp.h>
+#include <rtems/score/percpu.h>
+#include <rtems/score/smp.h>
+#include <rtems/score/schedulersimplesmp.h>
+
+extern uint32_t Schedsim_Current_cpu;
+
+int main_dispatch(int argc, char **argv)
+{
+  uint32_t   cpu;
+  uint32_t   current_cpu;
+
+  current_cpu = Schedsim_Current_cpu;
+  for ( cpu=0 ; cpu < _SMP_Processor_count ; cpu++ ) {
+    if ( _Per_CPU_Information[cpu].dispatch_necessary ) {
+      printf( "=== Invoke Thread Dispatch on CPU %d\n", cpu );
+       Schedsim_Current_cpu = cpu;
+      _Thread_Dispatch();
+    }
+  }
+  
+  Schedsim_Current_cpu = current_cpu;
+  return 0;
+}
Index: schedsim/shell/schedsim_smpsimple/main_dump_all_cpus.c
===================================================================
--- schedsim/shell/schedsim_smpsimple/main_dump_all_cpus.c	(revision f40778b48660b589278898593c62cf2250d3fbab)
+++ schedsim/shell/schedsim_smpsimple/main_dump_all_cpus.c	(revision f40778b48660b589278898593c62cf2250d3fbab)
@@ -0,0 +1,56 @@
+/*
+ *  COPYRIGHT (c) 1989-2011.
+ *  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$
+ */
+
+#include <newlib/getopt.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
+#include "shell.h"
+#include "rtems_sched.h"
+
+// #define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
+#include <rtems.h>
+#include <rtems/bspsmp.h>
+#include <rtems/score/percpu.h>
+#include <rtems/score/smp.h>
+#include <rtems/score/schedulerpriority.h>
+
+int main_dump_all_cpus(int argc, char **argv)
+{
+  uint32_t        cpu;
+  Thread_Control *h;
+  Thread_Control *i;
+  Thread_Control *e;
+
+  printf(
+    "=== CPU Status\n"
+    "            EXECUTING    /     HEIR         /    IDLE        / "
+      " SWITCH NEEDED\n"
+  );
+  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;
+    printf(
+      "  CPU %d: 0x%08x @%3ld / 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")
+    );
+  }
+  printf( "=== End of Ready Set of Threads\n" );
+  
+  return 0;
+}
Index: schedsim/shell/schedsim_smpsimple/main_dump_ready_tasks.c
===================================================================
--- schedsim/shell/schedsim_smpsimple/main_dump_ready_tasks.c	(revision f40778b48660b589278898593c62cf2250d3fbab)
+++ schedsim/shell/schedsim_smpsimple/main_dump_ready_tasks.c	(revision f40778b48660b589278898593c62cf2250d3fbab)
@@ -0,0 +1,42 @@
+/*
+ *  COPYRIGHT (c) 1989-2011.
+ *  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$
+ */
+
+#include <newlib/getopt.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
+#include "shell.h"
+#include "rtems_sched.h"
+
+#include <rtems/score/schedulerpriority.h>
+
+int main_dump_ready_tasks(int argc, char **argv)
+{
+  Chain_Control  *chain;
+  Chain_Node     *n;
+  Thread_Control *t;
+
+  printf( "=== Ready Set of Threads\n" );
+  chain = (Chain_Control *)_Scheduler.information;
+  for (n = _Chain_First( chain ); !_Chain_Is_tail(chain, n); n = n->next) {
+    t = (Thread_Control *)n;
+    printf(
+      "  0x%08x priority=%ld\n",
+      t->Object.id,
+      (long) t->current_priority
+    );
+  }
+  printf( "=== End of Ready Set of Threads\n" );
+  
+  return 0;
+}
Index: schedsim/shell/schedsim_smpsimple/printheir_executing.c
===================================================================
--- schedsim/shell/schedsim_smpsimple/printheir_executing.c	(revision f40778b48660b589278898593c62cf2250d3fbab)
+++ schedsim/shell/schedsim_smpsimple/printheir_executing.c	(revision f40778b48660b589278898593c62cf2250d3fbab)
@@ -0,0 +1,31 @@
+/*
+ *  printheir_executing
+ *
+ *  COPYRIGHT (c) 1989-2010.
+ *  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$
+ */
+
+#include <stdio.h>
+#include <rtems.h>
+
+void PRINT_EXECUTING() {
+  printf(
+    "  Thread Executing: 0x%08x priority=%ld\n",
+    _Thread_Executing->Object.id,
+    (long) _Thread_Executing->current_priority
+  );
+}
+
+void PRINT_HEIR() {
+  printf( 
+    "  Thread Heir: 0x%08x priority=%ld\n", 
+    _Thread_Heir->Object.id, 
+    (long) _Thread_Heir->current_priority 
+  );
+}
Index: schedsim/shell/schedsim_smpsimple/scenarios/.cvsignore
===================================================================
--- schedsim/shell/schedsim_smpsimple/scenarios/.cvsignore	(revision f40778b48660b589278898593c62cf2250d3fbab)
+++ schedsim/shell/schedsim_smpsimple/scenarios/.cvsignore	(revision f40778b48660b589278898593c62cf2250d3fbab)
@@ -0,0 +1,1 @@
+*.output
Index: schedsim/shell/schedsim_smpsimple/scenarios/cpus1_mode.expected
===================================================================
--- schedsim/shell/schedsim_smpsimple/scenarios/cpus1_mode.expected	(revision f40778b48660b589278898593c62cf2250d3fbab)
+++ schedsim/shell/schedsim_smpsimple/scenarios/cpus1_mode.expected	(revision f40778b48660b589278898593c62cf2250d3fbab)
@@ -0,0 +1,42 @@
+Script File               : scenarios/cpus1_mode.scen
+verbose                   : 1
+==> 1: #
+==> 2: #  Check increasing and decrease priority self with no change
+==> 3: #
+==> 4: rtems_init 1
+  Thread Heir: 0x09010001 priority=255
+  Thread Executing: 0x09010001 priority=255
+==> 5: task_create -p smp1 5
+Creating task with:  Preemption: no Timeslicing: no
+Task (smp1) created: id=0x0a010001, priority=5
+Task (smp1) starting: id=0x0a010001, priority=5
+  Thread Heir: 0x0a010001 priority=5
+  Thread Executing: 0x0a010001 priority=5
+==> 6: # GOAL: 0x0a010001 is heir and executing on CPU 0
+==> 7: cpus
+=== CPU Status
+            EXECUTING    /     HEIR         /    IDLE        /  SWITCH NEEDED
+  CPU 0: 0x0a010001 @  5 / 0x0a010001 @  5 / 0x09010001 @255         false
+=== End of Ready Set of Threads
+==> 8: task_create smp2 4
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp2) created: id=0x0a010002, priority=4
+Task (smp2) starting: id=0x0a010002, priority=4
+  Thread Heir: 0x0a010002 priority=4
+==> 9: # GOAL: 0x0a010001 is executing and 0x0a010002 is heir on CPU 0
+==> 10: cpus
+=== CPU Status
+            EXECUTING    /     HEIR         /    IDLE        /  SWITCH NEEDED
+  CPU 0: 0x0a010001 @  5 / 0x0a010002 @  4 / 0x09010001 @255         false
+=== End of Ready Set of Threads
+==> 11: 
+==> 12: task_mode -P
+  Thread Executing: 0x0a010002 priority=4
+Previous Mode: Preemption: no Timeslicing: no
+Current Mode:  Preemption: yes Timeslicing: no
+==> 13: # GOAL: 0x0a010002 is heir and executing on CPU 0
+==> 14: cpus
+=== CPU Status
+            EXECUTING    /     HEIR         /    IDLE        /  SWITCH NEEDED
+  CPU 0: 0x0a010002 @  4 / 0x0a010002 @  4 / 0x09010001 @255         false
+=== End of Ready Set of Threads
Index: schedsim/shell/schedsim_smpsimple/scenarios/cpus1_mode.scen
===================================================================
--- schedsim/shell/schedsim_smpsimple/scenarios/cpus1_mode.scen	(revision f40778b48660b589278898593c62cf2250d3fbab)
+++ schedsim/shell/schedsim_smpsimple/scenarios/cpus1_mode.scen	(revision f40778b48660b589278898593c62cf2250d3fbab)
@@ -0,0 +1,14 @@
+#
+#  Check increasing and decrease priority self with no change
+#
+rtems_init 1
+task_create -p smp1 5
+# GOAL: 0x0a010001 is heir and executing on CPU 0
+cpus
+task_create smp2 4
+# GOAL: 0x0a010001 is executing and 0x0a010002 is heir on CPU 0
+cpus
+
+task_mode -P
+# GOAL: 0x0a010002 is heir and executing on CPU 0
+cpus
Index: schedsim/shell/schedsim_smpsimple/scenarios/cpus1_priority.expected
===================================================================
--- schedsim/shell/schedsim_smpsimple/scenarios/cpus1_priority.expected	(revision f40778b48660b589278898593c62cf2250d3fbab)
+++ schedsim/shell/schedsim_smpsimple/scenarios/cpus1_priority.expected	(revision f40778b48660b589278898593c62cf2250d3fbab)
@@ -0,0 +1,69 @@
+Script File               : scenarios/cpus1_priority.scen
+verbose                   : 1
+==> 1: #
+==> 2: #  Check increasing and decrease priority self with no change
+==> 3: #
+==> 4: rtems_init 1
+  Thread Heir: 0x09010001 priority=255
+  Thread Executing: 0x09010001 priority=255
+==> 5: task_create smp1 5
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp1) created: id=0x0a010001, priority=5
+Task (smp1) starting: id=0x0a010001, priority=5
+  Thread Heir: 0x0a010001 priority=5
+  Thread Executing: 0x0a010001 priority=5
+==> 6: task_create smp2 8
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp2) created: id=0x0a010002, priority=8
+Task (smp2) starting: id=0x0a010002, priority=8
+==> 7: dispatch
+==> 8: # GOAL: 0x0a010001 is heir and executing on CPU 0
+==> 9: cpus
+=== CPU Status
+            EXECUTING    /     HEIR         /    IDLE        /  SWITCH NEEDED
+  CPU 0: 0x0a010001 @  5 / 0x0a010001 @  5 / 0x09010001 @255         false
+=== End of Ready Set of Threads
+==> 10: 
+==> 11: task_priority smp1 4
+Task (0x0a010001) Change Priority from 5 to 4
+==> 12: dispatch
+==> 13: # GOAL: 0x0a010001 is still heir and executing on CPU 0
+==> 14: cpus
+=== CPU Status
+            EXECUTING    /     HEIR         /    IDLE        /  SWITCH NEEDED
+  CPU 0: 0x0a010001 @  4 / 0x0a010001 @  4 / 0x09010001 @255         false
+=== End of Ready Set of Threads
+==> 15: 
+==> 16: task_priority smp1 7
+Task (0x0a010001) Change Priority from 4 to 7
+==> 17: dispatch
+==> 18: # GOAL: 0x0a010001 is still heir and executing on CPU 0
+==> 19: cpus
+=== CPU Status
+            EXECUTING    /     HEIR         /    IDLE        /  SWITCH NEEDED
+  CPU 0: 0x0a010001 @  7 / 0x0a010001 @  7 / 0x09010001 @255         false
+=== End of Ready Set of Threads
+==> 20: 
+==> 21: task_priority smp1 8
+  Thread Heir: 0x0a010002 priority=8
+  Thread Executing: 0x0a010002 priority=8
+Task (0x0a010001) Change Priority from 7 to 8
+==> 22: dispatch
+==> 23: # GOAL: 0x0a010002 is now heir and executing on CPU 0
+==> 24: cpus
+=== CPU Status
+            EXECUTING    /     HEIR         /    IDLE        /  SWITCH NEEDED
+  CPU 0: 0x0a010002 @  8 / 0x0a010002 @  8 / 0x09010001 @255         false
+=== End of Ready Set of Threads
+==> 25: 
+==> 26: task_priority smp1 5
+  Thread Heir: 0x0a010001 priority=5
+  Thread Executing: 0x0a010001 priority=5
+Task (0x0a010001) Change Priority from 8 to 5
+==> 27: dispatch
+==> 28: # GOAL: 0x0a010001 is now heir and executing on CPU 0
+==> 29: cpus
+=== CPU Status
+            EXECUTING    /     HEIR         /    IDLE        /  SWITCH NEEDED
+  CPU 0: 0x0a010001 @  5 / 0x0a010001 @  5 / 0x09010001 @255         false
+=== End of Ready Set of Threads
Index: schedsim/shell/schedsim_smpsimple/scenarios/cpus1_priority.scen
===================================================================
--- schedsim/shell/schedsim_smpsimple/scenarios/cpus1_priority.scen	(revision f40778b48660b589278898593c62cf2250d3fbab)
+++ schedsim/shell/schedsim_smpsimple/scenarios/cpus1_priority.scen	(revision f40778b48660b589278898593c62cf2250d3fbab)
@@ -0,0 +1,29 @@
+#
+#  Check increasing and decrease priority self with no change
+#
+rtems_init 1
+task_create smp1 5
+task_create smp2 8
+dispatch
+# GOAL: 0x0a010001 is heir and executing on CPU 0
+cpus
+
+task_priority smp1 4
+dispatch
+# GOAL: 0x0a010001 is still heir and executing on CPU 0
+cpus
+
+task_priority smp1 7
+dispatch
+# GOAL: 0x0a010001 is still heir and executing on CPU 0
+cpus
+
+task_priority smp1 8
+dispatch
+# GOAL: 0x0a010002 is now heir and executing on CPU 0
+cpus
+
+task_priority smp1 5
+dispatch
+# GOAL: 0x0a010001 is now heir and executing on CPU 0
+cpus
Index: schedsim/shell/schedsim_smpsimple/scenarios/cpus1_resume_on_primary.expected
===================================================================
--- schedsim/shell/schedsim_smpsimple/scenarios/cpus1_resume_on_primary.expected	(revision f40778b48660b589278898593c62cf2250d3fbab)
+++ schedsim/shell/schedsim_smpsimple/scenarios/cpus1_resume_on_primary.expected	(revision f40778b48660b589278898593c62cf2250d3fbab)
@@ -0,0 +1,57 @@
+Script File               : scenarios/cpus1_resume_on_primary.scen
+verbose                   : 1
+==> 1: #
+==> 2: #  Check suspending self, then resuming on primary CPU
+==> 3: #
+==> 4: rtems_init 1
+  Thread Heir: 0x09010001 priority=255
+  Thread Executing: 0x09010001 priority=255
+==> 5: task_create smp1 5
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp1) created: id=0x0a010001, priority=5
+Task (smp1) starting: id=0x0a010001, priority=5
+  Thread Heir: 0x0a010001 priority=5
+  Thread Executing: 0x0a010001 priority=5
+==> 6: dispatch
+==> 7: # GOAL: 0x0a010001 is heir and executing on CPU 0
+==> 8: cpus
+=== CPU Status
+            EXECUTING    /     HEIR         /    IDLE        /  SWITCH NEEDED
+  CPU 0: 0x0a010001 @  5 / 0x0a010001 @  5 / 0x09010001 @255         false
+=== End of Ready Set of Threads
+==> 9: # suspend running task
+==> 10: task_suspend smp1
+Suspending task (0x0a010001)
+  Thread Heir: 0x09010001 priority=255
+  Thread Executing: 0x09010001 priority=255
+==> 11: # GOAL: 0x09010001 is heir and executing on CPU 0
+==> 12: cpus
+=== CPU Status
+            EXECUTING    /     HEIR         /    IDLE        /  SWITCH NEEDED
+  CPU 0: 0x09010001 @255 / 0x09010001 @255 / 0x09010001 @255         false
+=== End of Ready Set of Threads
+==> 13: dispatch
+==> 14: # GOAL: 0x09010001 is heir and executing on CPU 0
+==> 15: cpus
+=== CPU Status
+            EXECUTING    /     HEIR         /    IDLE        /  SWITCH NEEDED
+  CPU 0: 0x09010001 @255 / 0x09010001 @255 / 0x09010001 @255         false
+=== End of Ready Set of Threads
+==> 16: # resume suspended task
+==> 17: task_resume smp1
+Resuming task (0x0a010001)
+  Thread Heir: 0x0a010001 priority=5
+  Thread Executing: 0x0a010001 priority=5
+==> 18: # GOAL: 0x0a010001 is heir and executing on CPU 0
+==> 19: cpus
+=== CPU Status
+            EXECUTING    /     HEIR         /    IDLE        /  SWITCH NEEDED
+  CPU 0: 0x0a010001 @  5 / 0x0a010001 @  5 / 0x09010001 @255         false
+=== End of Ready Set of Threads
+==> 20: dispatch
+==> 21: # GOAL: 0x0a010001 is heir and executing on CPU 0
+==> 22: cpus
+=== CPU Status
+            EXECUTING    /     HEIR         /    IDLE        /  SWITCH NEEDED
+  CPU 0: 0x0a010001 @  5 / 0x0a010001 @  5 / 0x09010001 @255         false
+=== End of Ready Set of Threads
Index: schedsim/shell/schedsim_smpsimple/scenarios/cpus1_resume_on_primary.scen
===================================================================
--- schedsim/shell/schedsim_smpsimple/scenarios/cpus1_resume_on_primary.scen	(revision f40778b48660b589278898593c62cf2250d3fbab)
+++ schedsim/shell/schedsim_smpsimple/scenarios/cpus1_resume_on_primary.scen	(revision f40778b48660b589278898593c62cf2250d3fbab)
@@ -0,0 +1,22 @@
+#
+#  Check suspending self, then resuming on primary CPU
+#
+rtems_init 1
+task_create smp1 5
+dispatch
+# GOAL: 0x0a010001 is heir and executing on CPU 0
+cpus
+# suspend running task
+task_suspend smp1
+# GOAL: 0x09010001 is heir and executing on CPU 0
+cpus
+dispatch
+# GOAL: 0x09010001 is heir and executing on CPU 0
+cpus
+# resume suspended task
+task_resume smp1
+# GOAL: 0x0a010001 is heir and executing on CPU 0
+cpus
+dispatch
+# GOAL: 0x0a010001 is heir and executing on CPU 0
+cpus
Index: schedsim/shell/schedsim_smpsimple/scenarios/cpus1_suspend_on_primary.expected
===================================================================
--- schedsim/shell/schedsim_smpsimple/scenarios/cpus1_suspend_on_primary.expected	(revision f40778b48660b589278898593c62cf2250d3fbab)
+++ schedsim/shell/schedsim_smpsimple/scenarios/cpus1_suspend_on_primary.expected	(revision f40778b48660b589278898593c62cf2250d3fbab)
@@ -0,0 +1,37 @@
+Script File               : scenarios/cpus1_suspend_on_primary.scen
+verbose                   : 1
+==> 1: #
+==> 2: #  Check blocking self on primary CPU
+==> 3: #
+==> 4: rtems_init 1
+  Thread Heir: 0x09010001 priority=255
+  Thread Executing: 0x09010001 priority=255
+==> 5: task_create smp1 5
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp1) created: id=0x0a010001, priority=5
+Task (smp1) starting: id=0x0a010001, priority=5
+  Thread Heir: 0x0a010001 priority=5
+  Thread Executing: 0x0a010001 priority=5
+==> 6: dispatch
+==> 7: cpus
+=== CPU Status
+            EXECUTING    /     HEIR         /    IDLE        /  SWITCH NEEDED
+  CPU 0: 0x0a010001 @  5 / 0x0a010001 @  5 / 0x09010001 @255         false
+=== End of Ready Set of Threads
+==> 8: # GOAL: 0x0a010001 is heir and executing on CPU 0
+==> 9: task_suspend SELF
+Suspending task (0x0a010001)
+  Thread Heir: 0x09010001 priority=255
+  Thread Executing: 0x09010001 priority=255
+==> 10: cpus
+=== CPU Status
+            EXECUTING    /     HEIR         /    IDLE        /  SWITCH NEEDED
+  CPU 0: 0x09010001 @255 / 0x09010001 @255 / 0x09010001 @255         false
+=== End of Ready Set of Threads
+==> 11: dispatch
+==> 12: # GOAL: 0x09010001 is heir and executing on CPU 0
+==> 13: cpus
+=== CPU Status
+            EXECUTING    /     HEIR         /    IDLE        /  SWITCH NEEDED
+  CPU 0: 0x09010001 @255 / 0x09010001 @255 / 0x09010001 @255         false
+=== End of Ready Set of Threads
Index: schedsim/shell/schedsim_smpsimple/scenarios/cpus1_suspend_on_primary.scen
===================================================================
--- schedsim/shell/schedsim_smpsimple/scenarios/cpus1_suspend_on_primary.scen	(revision f40778b48660b589278898593c62cf2250d3fbab)
+++ schedsim/shell/schedsim_smpsimple/scenarios/cpus1_suspend_on_primary.scen	(revision f40778b48660b589278898593c62cf2250d3fbab)
@@ -0,0 +1,13 @@
+#
+#  Check blocking self on primary CPU
+#
+rtems_init 1
+task_create smp1 5
+dispatch
+cpus
+# GOAL: 0x0a010001 is heir and executing on CPU 0
+task_suspend SELF
+cpus
+dispatch
+# GOAL: 0x09010001 is heir and executing on CPU 0
+cpus
Index: schedsim/shell/schedsim_smpsimple/scenarios/cpus4_mode_case1.expected
===================================================================
--- schedsim/shell/schedsim_smpsimple/scenarios/cpus4_mode_case1.expected	(revision f40778b48660b589278898593c62cf2250d3fbab)
+++ schedsim/shell/schedsim_smpsimple/scenarios/cpus4_mode_case1.expected	(revision f40778b48660b589278898593c62cf2250d3fbab)
@@ -0,0 +1,87 @@
+Script File               : scenarios/cpus4_mode_case1.scen
+verbose                   : 1
+==> 1: #
+==> 2: #  Show how having a non-preemptive task can create a
+==> 3: #  priority inversion and changing the mode to preemptive
+==> 4: #  resolves it.
+==> 5: #
+==> 6: rtems_init 4
+  Thread Heir: 0x09010001 priority=255
+  Thread Executing: 0x09010001 priority=255
+==> 7: task_create -p smp1 5
+Creating task with:  Preemption: no Timeslicing: no
+Task (smp1) created: id=0x0a010001, priority=5
+Task (smp1) starting: id=0x0a010001, priority=5
+  Thread Heir: 0x0a010001 priority=5
+  Thread Executing: 0x0a010001 priority=5
+==> 8: task_create smp2 5
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp2) created: id=0x0a010002, priority=5
+Task (smp2) starting: id=0x0a010002, priority=5
+==> 9: task_create smp3 5
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp3) created: id=0x0a010003, priority=5
+Task (smp3) starting: id=0x0a010003, priority=5
+==> 10: task_create smp4 5
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp4) created: id=0x0a010004, priority=5
+Task (smp4) starting: id=0x0a010004, priority=5
+==> 11: dispatch
+=== Invoke Thread Dispatch on CPU 1
+  Thread Heir: 0x0a010002 priority=5
+  Thread Executing: 0x09010002 priority=255
+  Thread Executing: 0x0a010002 priority=5
+=== Invoke Thread Dispatch on CPU 2
+  Thread Heir: 0x0a010003 priority=5
+  Thread Executing: 0x09010003 priority=255
+  Thread Executing: 0x0a010003 priority=5
+=== Invoke Thread Dispatch on CPU 3
+  Thread Heir: 0x0a010004 priority=5
+  Thread Executing: 0x09010004 priority=255
+  Thread Executing: 0x0a010004 priority=5
+==> 12: # GOAL: 0x0a010001 - 0x0a010004 are heir and executing
+==> 13: # GOAL:   on CPUs 0 - 3 respectively
+==> 14: cpus
+=== CPU Status
+            EXECUTING    /     HEIR         /    IDLE        /  SWITCH NEEDED
+  CPU 0: 0x0a010001 @  5 / 0x0a010001 @  5 / 0x09010001 @255         false
+  CPU 1: 0x0a010002 @  5 / 0x0a010002 @  5 / 0x09010002 @255         false
+  CPU 2: 0x0a010003 @  5 / 0x0a010003 @  5 / 0x09010003 @255         false
+  CPU 3: 0x0a010004 @  5 / 0x0a010004 @  5 / 0x09010004 @255         false
+=== End of Ready Set of Threads
+==> 15: 
+==> 16: task_create smp5 3
+Creating task with:  Preemption: yes Timeslicing: no
+  Thread Heir: 0x0a010001 priority=5
+  Thread Executing: 0x0a010001 priority=5
+Task (smp5) created: id=0x0a010005, priority=3
+Task (smp5) starting: id=0x0a010005, priority=3
+==> 17: dispatch
+=== Invoke Thread Dispatch on CPU 1
+  Thread Heir: 0x0a010005 priority=3
+  Thread Executing: 0x0a010002 priority=5
+  Thread Executing: 0x0a010005 priority=3
+==> 18: # GOAL: 0x0a010001, 0x0a010005, 0x0a010003, and 0x0a010004 are heir
+==> 19: # GOAL:   and executing on CPUs 0 - 3
+==> 20: cpus
+=== CPU Status
+            EXECUTING    /     HEIR         /    IDLE        /  SWITCH NEEDED
+  CPU 0: 0x0a010001 @  5 / 0x0a010001 @  5 / 0x09010001 @255         false
+  CPU 1: 0x0a010005 @  3 / 0x0a010005 @  3 / 0x09010002 @255         false
+  CPU 2: 0x0a010003 @  5 / 0x0a010003 @  5 / 0x09010003 @255         false
+  CPU 3: 0x0a010004 @  5 / 0x0a010004 @  5 / 0x09010004 @255         false
+=== End of Ready Set of Threads
+==> 21: 
+==> 22: task_mode -P
+Previous Mode: Preemption: no Timeslicing: no
+Current Mode:  Preemption: yes Timeslicing: no
+==> 23: # GOAL: 0x0a010001, 0x0a010005, 0x0a010003, and 0x0a010004 are heir
+==> 24: # GOAL:   and executing on CPUs 0 - 3
+==> 25: cpus
+=== CPU Status
+            EXECUTING    /     HEIR         /    IDLE        /  SWITCH NEEDED
+  CPU 0: 0x0a010001 @  5 / 0x0a010001 @  5 / 0x09010001 @255         false
+  CPU 1: 0x0a010005 @  3 / 0x0a010005 @  3 / 0x09010002 @255         false
+  CPU 2: 0x0a010003 @  5 / 0x0a010003 @  5 / 0x09010003 @255         false
+  CPU 3: 0x0a010004 @  5 / 0x0a010004 @  5 / 0x09010004 @255         false
+=== End of Ready Set of Threads
Index: schedsim/shell/schedsim_smpsimple/scenarios/cpus4_mode_case1.scen
===================================================================
--- schedsim/shell/schedsim_smpsimple/scenarios/cpus4_mode_case1.scen	(revision f40778b48660b589278898593c62cf2250d3fbab)
+++ schedsim/shell/schedsim_smpsimple/scenarios/cpus4_mode_case1.scen	(revision f40778b48660b589278898593c62cf2250d3fbab)
@@ -0,0 +1,25 @@
+#
+#  Show how having a non-preemptive task can create a
+#  priority inversion and changing the mode to preemptive
+#  resolves it.
+#
+rtems_init 4
+task_create -p smp1 5
+task_create smp2 5
+task_create smp3 5
+task_create smp4 5
+dispatch
+# GOAL: 0x0a010001 - 0x0a010004 are heir and executing
+# GOAL:   on CPUs 0 - 3 respectively
+cpus
+
+task_create smp5 3
+dispatch
+# GOAL: 0x0a010001, 0x0a010005, 0x0a010003, and 0x0a010004 are heir
+# GOAL:   and executing on CPUs 0 - 3
+cpus
+
+task_mode -P
+# GOAL: 0x0a010001, 0x0a010005, 0x0a010003, and 0x0a010004 are heir
+# GOAL:   and executing on CPUs 0 - 3
+cpus
Index: schedsim/shell/schedsim_smpsimple/scenarios/cpus4_mode_case2.expected
===================================================================
--- schedsim/shell/schedsim_smpsimple/scenarios/cpus4_mode_case2.expected	(revision f40778b48660b589278898593c62cf2250d3fbab)
+++ schedsim/shell/schedsim_smpsimple/scenarios/cpus4_mode_case2.expected	(revision f40778b48660b589278898593c62cf2250d3fbab)
@@ -0,0 +1,89 @@
+Script File               : scenarios/cpus4_mode_case2.scen
+verbose                   : 1
+==> 1: #
+==> 2: #  Show how having a non-preemptive task can create a
+==> 3: #  priority inversion
+==> 4: #
+==> 5: rtems_init 4
+  Thread Heir: 0x09010001 priority=255
+  Thread Executing: 0x09010001 priority=255
+==> 6: task_create -p smp1 4
+Creating task with:  Preemption: no Timeslicing: no
+Task (smp1) created: id=0x0a010001, priority=4
+Task (smp1) starting: id=0x0a010001, priority=4
+  Thread Heir: 0x0a010001 priority=4
+  Thread Executing: 0x0a010001 priority=4
+==> 7: task_create -p smp2 5
+Creating task with:  Preemption: no Timeslicing: no
+Task (smp2) created: id=0x0a010002, priority=5
+Task (smp2) starting: id=0x0a010002, priority=5
+==> 8: task_create -p smp3 4
+Creating task with:  Preemption: no Timeslicing: no
+Task (smp3) created: id=0x0a010003, priority=4
+Task (smp3) starting: id=0x0a010003, priority=4
+==> 9: task_create -p smp4 4
+Creating task with:  Preemption: no Timeslicing: no
+Task (smp4) created: id=0x0a010004, priority=4
+Task (smp4) starting: id=0x0a010004, priority=4
+==> 10: dispatch
+=== Invoke Thread Dispatch on CPU 1
+  Thread Heir: 0x0a010002 priority=5
+  Thread Executing: 0x09010002 priority=255
+  Thread Executing: 0x0a010002 priority=5
+=== Invoke Thread Dispatch on CPU 2
+  Thread Heir: 0x0a010003 priority=4
+  Thread Executing: 0x09010003 priority=255
+  Thread Executing: 0x0a010003 priority=4
+=== Invoke Thread Dispatch on CPU 3
+  Thread Heir: 0x0a010004 priority=4
+  Thread Executing: 0x09010004 priority=255
+  Thread Executing: 0x0a010004 priority=4
+==> 11: # GOAL: 0x0a010001 - 0x0a010004 are heir and executing
+==> 12: # GOAL:   on CPUs 0 - 3 respectively
+==> 13: cpus
+=== CPU Status
+            EXECUTING    /     HEIR         /    IDLE        /  SWITCH NEEDED
+  CPU 0: 0x0a010001 @  4 / 0x0a010001 @  4 / 0x09010001 @255         false
+  CPU 1: 0x0a010002 @  5 / 0x0a010002 @  5 / 0x09010002 @255         false
+  CPU 2: 0x0a010003 @  4 / 0x0a010003 @  4 / 0x09010003 @255         false
+  CPU 3: 0x0a010004 @  4 / 0x0a010004 @  4 / 0x09010004 @255         false
+=== End of Ready Set of Threads
+==> 14: 
+==> 15: task_create smp5 3
+Creating task with:  Preemption: yes Timeslicing: no
+  Thread Heir: 0x0a010001 priority=4
+  Thread Executing: 0x0a010001 priority=4
+Task (smp5) created: id=0x0a010005, priority=3
+Task (smp5) starting: id=0x0a010005, priority=3
+==> 16: dispatch
+==> 17: # GOAL: 0x0a010001 - 0x0a010004 are executing on CPUs 0 - 3.
+==> 18: # GOAL:   All are also heir EXCEPT 0x0a010005 is heir on CPU 1.
+==> 19: # GOAL: **** SHOWS INVERSION - CPU 1 has NO PREEMPT TASK ****
+==> 20: cpus
+=== CPU Status
+            EXECUTING    /     HEIR         /    IDLE        /  SWITCH NEEDED
+  CPU 0: 0x0a010001 @  4 / 0x0a010001 @  4 / 0x09010001 @255         false
+  CPU 1: 0x0a010002 @  5 / 0x0a010005 @  3 / 0x09010002 @255         false
+  CPU 2: 0x0a010003 @  4 / 0x0a010003 @  4 / 0x09010003 @255         false
+  CPU 3: 0x0a010004 @  4 / 0x0a010004 @  4 / 0x09010004 @255         false
+=== End of Ready Set of Threads
+==> 21: 
+==> 22: current_cpu 1
+Changing current CPU from 0 to 1
+==> 23: task_mode -P
+  Thread Heir: 0x0a010005 priority=3
+  Thread Executing: 0x0a010002 priority=5
+  Thread Executing: 0x0a010005 priority=3
+Previous Mode: Preemption: no Timeslicing: no
+Current Mode:  Preemption: yes Timeslicing: no
+==> 24: dispatch
+==> 25: # GOAL: 0x0a010001, 0x0a010005, 0x0a010003, and 0x0a010004 are
+==> 26: # GOAL:   heir and executing on CPUs 0 - 3
+==> 27: cpus
+=== CPU Status
+            EXECUTING    /     HEIR         /    IDLE        /  SWITCH NEEDED
+  CPU 0: 0x0a010001 @  4 / 0x0a010001 @  4 / 0x09010001 @255         false
+  CPU 1: 0x0a010005 @  3 / 0x0a010005 @  3 / 0x09010002 @255         false
+  CPU 2: 0x0a010003 @  4 / 0x0a010003 @  4 / 0x09010003 @255         false
+  CPU 3: 0x0a010004 @  4 / 0x0a010004 @  4 / 0x09010004 @255         false
+=== End of Ready Set of Threads
Index: schedsim/shell/schedsim_smpsimple/scenarios/cpus4_mode_case2.scen
===================================================================
--- schedsim/shell/schedsim_smpsimple/scenarios/cpus4_mode_case2.scen	(revision f40778b48660b589278898593c62cf2250d3fbab)
+++ schedsim/shell/schedsim_smpsimple/scenarios/cpus4_mode_case2.scen	(revision f40778b48660b589278898593c62cf2250d3fbab)
@@ -0,0 +1,27 @@
+#
+#  Show how having a non-preemptive task can create a
+#  priority inversion
+#
+rtems_init 4
+task_create -p smp1 4
+task_create -p smp2 5
+task_create -p smp3 4
+task_create -p smp4 4
+dispatch
+# GOAL: 0x0a010001 - 0x0a010004 are heir and executing
+# GOAL:   on CPUs 0 - 3 respectively
+cpus
+
+task_create smp5 3
+dispatch
+# GOAL: 0x0a010001 - 0x0a010004 are executing on CPUs 0 - 3.
+# GOAL:   All are also heir EXCEPT 0x0a010005 is heir on CPU 1.
+# GOAL: **** SHOWS INVERSION - CPU 1 has NO PREEMPT TASK ****
+cpus
+
+current_cpu 1
+task_mode -P
+dispatch
+# GOAL: 0x0a010001, 0x0a010005, 0x0a010003, and 0x0a010004 are
+# GOAL:   heir and executing on CPUs 0 - 3
+cpus
Index: schedsim/shell/schedsim_smpsimple/scenarios/cpus4_nonpreempt_case1.expected
===================================================================
--- schedsim/shell/schedsim_smpsimple/scenarios/cpus4_nonpreempt_case1.expected	(revision f40778b48660b589278898593c62cf2250d3fbab)
+++ schedsim/shell/schedsim_smpsimple/scenarios/cpus4_nonpreempt_case1.expected	(revision f40778b48660b589278898593c62cf2250d3fbab)
@@ -0,0 +1,72 @@
+Script File               : scenarios/cpus4_nonpreempt_case1.scen
+verbose                   : 1
+==> 1: #
+==> 2: #  Show how having a non-preemptive task can create a
+==> 3: #  priority inversion
+==> 4: #
+==> 5: rtems_init 4
+  Thread Heir: 0x09010001 priority=255
+  Thread Executing: 0x09010001 priority=255
+==> 6: task_create -p smp1 5
+Creating task with:  Preemption: no Timeslicing: no
+Task (smp1) created: id=0x0a010001, priority=5
+Task (smp1) starting: id=0x0a010001, priority=5
+  Thread Heir: 0x0a010001 priority=5
+  Thread Executing: 0x0a010001 priority=5
+==> 7: task_create smp2 5
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp2) created: id=0x0a010002, priority=5
+Task (smp2) starting: id=0x0a010002, priority=5
+==> 8: task_create smp3 5
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp3) created: id=0x0a010003, priority=5
+Task (smp3) starting: id=0x0a010003, priority=5
+==> 9: task_create smp4 5
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp4) created: id=0x0a010004, priority=5
+Task (smp4) starting: id=0x0a010004, priority=5
+==> 10: dispatch
+=== Invoke Thread Dispatch on CPU 1
+  Thread Heir: 0x0a010002 priority=5
+  Thread Executing: 0x09010002 priority=255
+  Thread Executing: 0x0a010002 priority=5
+=== Invoke Thread Dispatch on CPU 2
+  Thread Heir: 0x0a010003 priority=5
+  Thread Executing: 0x09010003 priority=255
+  Thread Executing: 0x0a010003 priority=5
+=== Invoke Thread Dispatch on CPU 3
+  Thread Heir: 0x0a010004 priority=5
+  Thread Executing: 0x09010004 priority=255
+  Thread Executing: 0x0a010004 priority=5
+==> 11: # GOAL: 0x0a010001 - 0x0a010004 are heir and executing
+==> 12: # GOAL:   on CPUs 0 - 3 respectively
+==> 13: cpus
+=== CPU Status
+            EXECUTING    /     HEIR         /    IDLE        /  SWITCH NEEDED
+  CPU 0: 0x0a010001 @  5 / 0x0a010001 @  5 / 0x09010001 @255         false
+  CPU 1: 0x0a010002 @  5 / 0x0a010002 @  5 / 0x09010002 @255         false
+  CPU 2: 0x0a010003 @  5 / 0x0a010003 @  5 / 0x09010003 @255         false
+  CPU 3: 0x0a010004 @  5 / 0x0a010004 @  5 / 0x09010004 @255         false
+=== End of Ready Set of Threads
+==> 14: 
+==> 15: task_create smp5 3
+Creating task with:  Preemption: yes Timeslicing: no
+  Thread Heir: 0x0a010001 priority=5
+  Thread Executing: 0x0a010001 priority=5
+Task (smp5) created: id=0x0a010005, priority=3
+Task (smp5) starting: id=0x0a010005, priority=3
+==> 16: dispatch
+=== Invoke Thread Dispatch on CPU 1
+  Thread Heir: 0x0a010005 priority=3
+  Thread Executing: 0x0a010002 priority=5
+  Thread Executing: 0x0a010005 priority=3
+==> 17: # GOAL: 0x0a010001, 0x0a010005, 0x0a010003, and 0x0a010004 are heir
+==> 18: # GOAL:   and executing on CPUs 0 - 3
+==> 19: cpus
+=== CPU Status
+            EXECUTING    /     HEIR         /    IDLE        /  SWITCH NEEDED
+  CPU 0: 0x0a010001 @  5 / 0x0a010001 @  5 / 0x09010001 @255         false
+  CPU 1: 0x0a010005 @  3 / 0x0a010005 @  3 / 0x09010002 @255         false
+  CPU 2: 0x0a010003 @  5 / 0x0a010003 @  5 / 0x09010003 @255         false
+  CPU 3: 0x0a010004 @  5 / 0x0a010004 @  5 / 0x09010004 @255         false
+=== End of Ready Set of Threads
Index: schedsim/shell/schedsim_smpsimple/scenarios/cpus4_nonpreempt_case1.scen
===================================================================
--- schedsim/shell/schedsim_smpsimple/scenarios/cpus4_nonpreempt_case1.scen	(revision f40778b48660b589278898593c62cf2250d3fbab)
+++ schedsim/shell/schedsim_smpsimple/scenarios/cpus4_nonpreempt_case1.scen	(revision f40778b48660b589278898593c62cf2250d3fbab)
@@ -0,0 +1,19 @@
+#
+#  Show how having a non-preemptive task can create a
+#  priority inversion
+#
+rtems_init 4
+task_create -p smp1 5
+task_create smp2 5
+task_create smp3 5
+task_create smp4 5
+dispatch
+# GOAL: 0x0a010001 - 0x0a010004 are heir and executing
+# GOAL:   on CPUs 0 - 3 respectively
+cpus
+
+task_create smp5 3
+dispatch
+# GOAL: 0x0a010001, 0x0a010005, 0x0a010003, and 0x0a010004 are heir
+# GOAL:   and executing on CPUs 0 - 3
+cpus
Index: schedsim/shell/schedsim_smpsimple/scenarios/cpus4_pick_older.expected
===================================================================
--- schedsim/shell/schedsim_smpsimple/scenarios/cpus4_pick_older.expected	(revision f40778b48660b589278898593c62cf2250d3fbab)
+++ schedsim/shell/schedsim_smpsimple/scenarios/cpus4_pick_older.expected	(revision f40778b48660b589278898593c62cf2250d3fbab)
@@ -0,0 +1,156 @@
+Script File               : scenarios/cpus4_pick_older.scen
+verbose                   : 1
+==> 1: #
+==> 2: #  Verify we select the oldest task at a priority
+==> 3: #
+==> 4: rtems_init 4
+  Thread Heir: 0x09010001 priority=255
+  Thread Executing: 0x09010001 priority=255
+==> 5: task_create smp1 3
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp1) created: id=0x0a010001, priority=3
+Task (smp1) starting: id=0x0a010001, priority=3
+  Thread Heir: 0x0a010001 priority=3
+  Thread Executing: 0x0a010001 priority=3
+==> 6: task_create smp2 6
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp2) created: id=0x0a010002, priority=6
+Task (smp2) starting: id=0x0a010002, priority=6
+==> 7: task_create smp3 7
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp3) created: id=0x0a010003, priority=7
+Task (smp3) starting: id=0x0a010003, priority=7
+==> 8: task_create smp4 8
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp4) created: id=0x0a010004, priority=8
+Task (smp4) starting: id=0x0a010004, priority=8
+==> 9: dispatch
+=== Invoke Thread Dispatch on CPU 1
+  Thread Heir: 0x0a010002 priority=6
+  Thread Executing: 0x09010002 priority=255
+  Thread Executing: 0x0a010002 priority=6
+=== Invoke Thread Dispatch on CPU 2
+  Thread Heir: 0x0a010003 priority=7
+  Thread Executing: 0x09010003 priority=255
+  Thread Executing: 0x0a010003 priority=7
+=== Invoke Thread Dispatch on CPU 3
+  Thread Heir: 0x0a010004 priority=8
+  Thread Executing: 0x09010004 priority=255
+  Thread Executing: 0x0a010004 priority=8
+==> 10: # GOAL: Tasks 0x0a010001 - 0x0a010004 as heir and executing
+==> 11: # GOAL:    on CPUs 1 - 4 respectively
+==> 12: cpus
+=== CPU Status
+            EXECUTING    /     HEIR         /    IDLE        /  SWITCH NEEDED
+  CPU 0: 0x0a010001 @  3 / 0x0a010001 @  3 / 0x09010001 @255         false
+  CPU 1: 0x0a010002 @  6 / 0x0a010002 @  6 / 0x09010002 @255         false
+  CPU 2: 0x0a010003 @  7 / 0x0a010003 @  7 / 0x09010003 @255         false
+  CPU 3: 0x0a010004 @  8 / 0x0a010004 @  8 / 0x09010004 @255         false
+=== End of Ready Set of Threads
+==> 13: 
+==> 14: task_create smp5 5
+Creating task with:  Preemption: yes Timeslicing: no
+  Thread Heir: 0x0a010001 priority=3
+  Thread Executing: 0x0a010001 priority=3
+Task (smp5) created: id=0x0a010005, priority=5
+Task (smp5) starting: id=0x0a010005, priority=5
+==> 15: clock_tick 1
+ClockTick (1) ...
+==> 16: dispatch
+=== Invoke Thread Dispatch on CPU 3
+  Thread Heir: 0x0a010005 priority=5
+  Thread Executing: 0x0a010004 priority=8
+  Thread Executing: 0x0a010005 priority=5
+==> 17: # GOAL: Tasks 0x0a010001, 0x0a010002, 0x0a010003, and 0x0a010005 are
+==> 18: # GOAL:    heir and executing on CPUs 1 - 4 respectively
+==> 19: cpus
+=== CPU Status
+            EXECUTING    /     HEIR         /    IDLE        /  SWITCH NEEDED
+  CPU 0: 0x0a010001 @  3 / 0x0a010001 @  3 / 0x09010001 @255         false
+  CPU 1: 0x0a010002 @  6 / 0x0a010002 @  6 / 0x09010002 @255         false
+  CPU 2: 0x0a010003 @  7 / 0x0a010003 @  7 / 0x09010003 @255         false
+  CPU 3: 0x0a010005 @  5 / 0x0a010005 @  5 / 0x09010004 @255         false
+=== End of Ready Set of Threads
+==> 20: 
+==> 21: task_create smp6 5
+Creating task with:  Preemption: yes Timeslicing: no
+  Thread Heir: 0x0a010001 priority=3
+  Thread Executing: 0x0a010001 priority=3
+Task (smp6) created: id=0x0a010006, priority=5
+Task (smp6) starting: id=0x0a010006, priority=5
+==> 22: clock_tick 1
+ClockTick (1) ...
+==> 23: dispatch
+=== Invoke Thread Dispatch on CPU 2
+  Thread Heir: 0x0a010006 priority=5
+  Thread Executing: 0x0a010003 priority=7
+  Thread Executing: 0x0a010006 priority=5
+==> 24: # GOAL: Tasks 0x0a010001, 0x0a010002, 0x0a010006, and 0x0a010005 are
+==> 25: # GOAL:    heir and executing on CPUs 1 - 4 respectively
+==> 26: cpus
+=== CPU Status
+            EXECUTING    /     HEIR         /    IDLE        /  SWITCH NEEDED
+  CPU 0: 0x0a010001 @  3 / 0x0a010001 @  3 / 0x09010001 @255         false
+  CPU 1: 0x0a010002 @  6 / 0x0a010002 @  6 / 0x09010002 @255         false
+  CPU 2: 0x0a010006 @  5 / 0x0a010006 @  5 / 0x09010003 @255         false
+  CPU 3: 0x0a010005 @  5 / 0x0a010005 @  5 / 0x09010004 @255         false
+=== End of Ready Set of Threads
+==> 27: 
+==> 28: task_create smp7 5
+Creating task with:  Preemption: yes Timeslicing: no
+  Thread Heir: 0x0a010001 priority=3
+  Thread Executing: 0x0a010001 priority=3
+Task (smp7) created: id=0x0a010007, priority=5
+Task (smp7) starting: id=0x0a010007, priority=5
+==> 29: clock_tick 1
+ClockTick (1) ...
+==> 30: dispatch
+=== Invoke Thread Dispatch on CPU 1
+  Thread Heir: 0x0a010007 priority=5
+  Thread Executing: 0x0a010002 priority=6
+  Thread Executing: 0x0a010007 priority=5
+==> 31: # GOAL: Tasks 0x0a010001, 0x0a010007, 0x0a010006, and 0x0a010005 are
+==> 32: # GOAL:    heir and executing on CPUs 1 - 4 respectively
+==> 33: cpus
+=== CPU Status
+            EXECUTING    /     HEIR         /    IDLE        /  SWITCH NEEDED
+  CPU 0: 0x0a010001 @  3 / 0x0a010001 @  3 / 0x09010001 @255         false
+  CPU 1: 0x0a010007 @  5 / 0x0a010007 @  5 / 0x09010002 @255         false
+  CPU 2: 0x0a010006 @  5 / 0x0a010006 @  5 / 0x09010003 @255         false
+  CPU 3: 0x0a010005 @  5 / 0x0a010005 @  5 / 0x09010004 @255         false
+=== End of Ready Set of Threads
+==> 34: 
+==> 35: # We should pick task smp4 on the 4th core
+==> 36: task_create smp8 4
+Creating task with:  Preemption: yes Timeslicing: no
+  Thread Heir: 0x0a010001 priority=3
+  Thread Executing: 0x0a010001 priority=3
+Task (smp8) created: id=0x0a010008, priority=4
+Task (smp8) starting: id=0x0a010008, priority=4
+==> 37: # GOAL: Tasks 0x0a010001, 0x0a010007, and 0x0a010006 
+==> 38: # GOAL:    heir and executing on CPUs 1 - 3 respectively
+==> 39: # GOAL: Task 0x0a010005 is executing on CPU 4
+==> 40: # GOAL: Task 0x0a010008 is heir on CPU 4
+==> 41: cpus
+=== CPU Status
+            EXECUTING    /     HEIR         /    IDLE        /  SWITCH NEEDED
+  CPU 0: 0x0a010001 @  3 / 0x0a010001 @  3 / 0x09010001 @255         false
+  CPU 1: 0x0a010007 @  5 / 0x0a010007 @  5 / 0x09010002 @255         false
+  CPU 2: 0x0a010006 @  5 / 0x0a010006 @  5 / 0x09010003 @255         false
+  CPU 3: 0x0a010005 @  5 / 0x0a010008 @  4 / 0x09010004 @255         true
+=== End of Ready Set of Threads
+==> 42: dispatch
+=== Invoke Thread Dispatch on CPU 3
+  Thread Heir: 0x0a010008 priority=4
+  Thread Executing: 0x0a010005 priority=5
+  Thread Executing: 0x0a010008 priority=4
+==> 43: # GOAL: Tasks 0x0a010001, 0x0a010007, 0x0a010006, and 0x0a010008 are
+==> 44: # GOAL:    heir and executing on CPUs 1 - 4 respectively
+==> 45: cpus
+=== CPU Status
+            EXECUTING    /     HEIR         /    IDLE        /  SWITCH NEEDED
+  CPU 0: 0x0a010001 @  3 / 0x0a010001 @  3 / 0x09010001 @255         false
+  CPU 1: 0x0a010007 @  5 / 0x0a010007 @  5 / 0x09010002 @255         false
+  CPU 2: 0x0a010006 @  5 / 0x0a010006 @  5 / 0x09010003 @255         false
+  CPU 3: 0x0a010008 @  4 / 0x0a010008 @  4 / 0x09010004 @255         false
+=== End of Ready Set of Threads
Index: schedsim/shell/schedsim_smpsimple/scenarios/cpus4_pick_older.scen
===================================================================
--- schedsim/shell/schedsim_smpsimple/scenarios/cpus4_pick_older.scen	(revision f40778b48660b589278898593c62cf2250d3fbab)
+++ schedsim/shell/schedsim_smpsimple/scenarios/cpus4_pick_older.scen	(revision f40778b48660b589278898593c62cf2250d3fbab)
@@ -0,0 +1,45 @@
+#
+#  Verify we select the oldest task at a priority
+#
+rtems_init 4
+task_create smp1 3
+task_create smp2 6
+task_create smp3 7
+task_create smp4 8
+dispatch
+# GOAL: Tasks 0x0a010001 - 0x0a010004 as heir and executing
+# GOAL:    on CPUs 1 - 4 respectively
+cpus
+
+task_create smp5 5
+clock_tick 1
+dispatch
+# GOAL: Tasks 0x0a010001, 0x0a010002, 0x0a010003, and 0x0a010005 are
+# GOAL:    heir and executing on CPUs 1 - 4 respectively
+cpus
+
+task_create smp6 5
+clock_tick 1
+dispatch
+# GOAL: Tasks 0x0a010001, 0x0a010002, 0x0a010006, and 0x0a010005 are
+# GOAL:    heir and executing on CPUs 1 - 4 respectively
+cpus
+
+task_create smp7 5
+clock_tick 1
+dispatch
+# GOAL: Tasks 0x0a010001, 0x0a010007, 0x0a010006, and 0x0a010005 are
+# GOAL:    heir and executing on CPUs 1 - 4 respectively
+cpus
+
+# We should pick task smp4 on the 4th core
+task_create smp8 4
+# GOAL: Tasks 0x0a010001, 0x0a010007, and 0x0a010006 
+# GOAL:    heir and executing on CPUs 1 - 3 respectively
+# GOAL: Task 0x0a010005 is executing on CPU 4
+# GOAL: Task 0x0a010008 is heir on CPU 4
+cpus
+dispatch
+# GOAL: Tasks 0x0a010001, 0x0a010007, 0x0a010006, and 0x0a010008 are
+# GOAL:    heir and executing on CPUs 1 - 4 respectively
+cpus
Index: schedsim/shell/schedsim_smpsimple/scenarios/cpus4_priority.expected
===================================================================
--- schedsim/shell/schedsim_smpsimple/scenarios/cpus4_priority.expected	(revision f40778b48660b589278898593c62cf2250d3fbab)
+++ schedsim/shell/schedsim_smpsimple/scenarios/cpus4_priority.expected	(revision f40778b48660b589278898593c62cf2250d3fbab)
@@ -0,0 +1,115 @@
+Script File               : scenarios/cpus4_priority.scen
+verbose                   : 1
+==> 1: #
+==> 2: #  Check increasing and decrease priority
+==> 3: #
+==> 4: rtems_init 4
+  Thread Heir: 0x09010001 priority=255
+  Thread Executing: 0x09010001 priority=255
+==> 5: task_create smp1 5
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp1) created: id=0x0a010001, priority=5
+Task (smp1) starting: id=0x0a010001, priority=5
+  Thread Heir: 0x0a010001 priority=5
+  Thread Executing: 0x0a010001 priority=5
+==> 6: task_create smp2 8
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp2) created: id=0x0a010002, priority=8
+Task (smp2) starting: id=0x0a010002, priority=8
+==> 7: task_create smp3 8
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp3) created: id=0x0a010003, priority=8
+Task (smp3) starting: id=0x0a010003, priority=8
+==> 8: task_create smp4 8
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp4) created: id=0x0a010004, priority=8
+Task (smp4) starting: id=0x0a010004, priority=8
+==> 9: task_create smp5 8
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp5) created: id=0x0a010005, priority=8
+Task (smp5) starting: id=0x0a010005, priority=8
+==> 10: dispatch
+=== Invoke Thread Dispatch on CPU 1
+  Thread Heir: 0x0a010002 priority=8
+  Thread Executing: 0x09010002 priority=255
+  Thread Executing: 0x0a010002 priority=8
+=== Invoke Thread Dispatch on CPU 2
+  Thread Heir: 0x0a010003 priority=8
+  Thread Executing: 0x09010003 priority=255
+  Thread Executing: 0x0a010003 priority=8
+=== Invoke Thread Dispatch on CPU 3
+  Thread Heir: 0x0a010004 priority=8
+  Thread Executing: 0x09010004 priority=255
+  Thread Executing: 0x0a010004 priority=8
+==> 11: # GOAL: 0x0a010001 - 0x0a010004 are heir and executing
+==> 12: # GOAL:   on CPUs 0 - 3 respectively
+==> 13: cpus
+=== CPU Status
+            EXECUTING    /     HEIR         /    IDLE        /  SWITCH NEEDED
+  CPU 0: 0x0a010001 @  5 / 0x0a010001 @  5 / 0x09010001 @255         false
+  CPU 1: 0x0a010002 @  8 / 0x0a010002 @  8 / 0x09010002 @255         false
+  CPU 2: 0x0a010003 @  8 / 0x0a010003 @  8 / 0x09010003 @255         false
+  CPU 3: 0x0a010004 @  8 / 0x0a010004 @  8 / 0x09010004 @255         false
+=== End of Ready Set of Threads
+==> 14: 
+==> 15: task_priority smp1 4
+  Thread Heir: 0x0a010001 priority=4
+  Thread Executing: 0x0a010001 priority=4
+Task (0x0a010001) Change Priority from 5 to 4
+==> 16: dispatch
+==> 17: # GOAL: 0x0a010001 - 0x0a010004 are heir and executing
+==> 18: # GOAL:   on CPUs 0 - 3 respectively (no change)
+==> 19: cpus
+=== CPU Status
+            EXECUTING    /     HEIR         /    IDLE        /  SWITCH NEEDED
+  CPU 0: 0x0a010001 @  4 / 0x0a010001 @  4 / 0x09010001 @255         false
+  CPU 1: 0x0a010002 @  8 / 0x0a010002 @  8 / 0x09010002 @255         false
+  CPU 2: 0x0a010003 @  8 / 0x0a010003 @  8 / 0x09010003 @255         false
+  CPU 3: 0x0a010004 @  8 / 0x0a010004 @  8 / 0x09010004 @255         false
+=== End of Ready Set of Threads
+==> 20: 
+==> 21: task_priority smp1 7
+Task (0x0a010001) Change Priority from 4 to 7
+==> 22: dispatch
+==> 23: # GOAL: 0x0a010001 - 0x0a010004 are heir and executing
+==> 24: # GOAL:   on CPUs 0 - 3 respectively (no change)
+==> 25: cpus
+=== CPU Status
+            EXECUTING    /     HEIR         /    IDLE        /  SWITCH NEEDED
+  CPU 0: 0x0a010001 @  7 / 0x0a010001 @  7 / 0x09010001 @255         false
+  CPU 1: 0x0a010002 @  8 / 0x0a010002 @  8 / 0x09010002 @255         false
+  CPU 2: 0x0a010003 @  8 / 0x0a010003 @  8 / 0x09010003 @255         false
+  CPU 3: 0x0a010004 @  8 / 0x0a010004 @  8 / 0x09010004 @255         false
+=== End of Ready Set of Threads
+==> 26: 
+==> 27: task_priority smp1 8
+  Thread Heir: 0x0a010005 priority=8
+  Thread Executing: 0x0a010005 priority=8
+Task (0x0a010001) Change Priority from 7 to 8
+==> 28: dispatch
+==> 29: # GOAL: 0x0a010005, 0x0a010002 - 0x0a010004 are heir and executing
+==> 30: # GOAL:   on CPUs 0 - 3 respectively
+==> 31: cpus
+=== CPU Status
+            EXECUTING    /     HEIR         /    IDLE        /  SWITCH NEEDED
+  CPU 0: 0x0a010005 @  8 / 0x0a010005 @  8 / 0x09010001 @255         false
+  CPU 1: 0x0a010002 @  8 / 0x0a010002 @  8 / 0x09010002 @255         false
+  CPU 2: 0x0a010003 @  8 / 0x0a010003 @  8 / 0x09010003 @255         false
+  CPU 3: 0x0a010004 @  8 / 0x0a010004 @  8 / 0x09010004 @255         false
+=== End of Ready Set of Threads
+==> 32: 
+==> 33: task_priority smp1 5
+  Thread Heir: 0x0a010001 priority=5
+  Thread Executing: 0x0a010001 priority=5
+Task (0x0a010001) Change Priority from 8 to 5
+==> 34: dispatch
+==> 35: # GOAL: 0x0a010001 - 0x0a010004 are heir and executing
+==> 36: # GOAL:   on CPUs 0 - 3 respectively
+==> 37: cpus
+=== CPU Status
+            EXECUTING    /     HEIR         /    IDLE        /  SWITCH NEEDED
+  CPU 0: 0x0a010001 @  5 / 0x0a010001 @  5 / 0x09010001 @255         false
+  CPU 1: 0x0a010002 @  8 / 0x0a010002 @  8 / 0x09010002 @255         false
+  CPU 2: 0x0a010003 @  8 / 0x0a010003 @  8 / 0x09010003 @255         false
+  CPU 3: 0x0a010004 @  8 / 0x0a010004 @  8 / 0x09010004 @255         false
+=== End of Ready Set of Threads
Index: schedsim/shell/schedsim_smpsimple/scenarios/cpus4_priority.scen
===================================================================
--- schedsim/shell/schedsim_smpsimple/scenarios/cpus4_priority.scen	(revision f40778b48660b589278898593c62cf2250d3fbab)
+++ schedsim/shell/schedsim_smpsimple/scenarios/cpus4_priority.scen	(revision f40778b48660b589278898593c62cf2250d3fbab)
@@ -0,0 +1,37 @@
+#
+#  Check increasing and decrease priority
+#
+rtems_init 4
+task_create smp1 5
+task_create smp2 8
+task_create smp3 8
+task_create smp4 8
+task_create smp5 8
+dispatch
+# GOAL: 0x0a010001 - 0x0a010004 are heir and executing
+# GOAL:   on CPUs 0 - 3 respectively
+cpus
+
+task_priority smp1 4
+dispatch
+# GOAL: 0x0a010001 - 0x0a010004 are heir and executing
+# GOAL:   on CPUs 0 - 3 respectively (no change)
+cpus
+
+task_priority smp1 7
+dispatch
+# GOAL: 0x0a010001 - 0x0a010004 are heir and executing
+# GOAL:   on CPUs 0 - 3 respectively (no change)
+cpus
+
+task_priority smp1 8
+dispatch
+# GOAL: 0x0a010005, 0x0a010002 - 0x0a010004 are heir and executing
+# GOAL:   on CPUs 0 - 3 respectively
+cpus
+
+task_priority smp1 5
+dispatch
+# GOAL: 0x0a010001 - 0x0a010004 are heir and executing
+# GOAL:   on CPUs 0 - 3 respectively
+cpus
Index: schedsim/shell/schedsim_smpsimple/scenarios/cpus4_simple_nopreempt.expected
===================================================================
--- schedsim/shell/schedsim_smpsimple/scenarios/cpus4_simple_nopreempt.expected	(revision f40778b48660b589278898593c62cf2250d3fbab)
+++ schedsim/shell/schedsim_smpsimple/scenarios/cpus4_simple_nopreempt.expected	(revision f40778b48660b589278898593c62cf2250d3fbab)
@@ -0,0 +1,75 @@
+Script File               : scenarios/cpus4_simple_nopreempt.scen
+verbose                   : 1
+==> 1: #
+==> 2: #  Verify no-preempt is honored
+==> 3: #
+==> 4: rtems_init 4
+  Thread Heir: 0x09010001 priority=255
+  Thread Executing: 0x09010001 priority=255
+==> 5: task_create -p smp1 5
+Creating task with:  Preemption: no Timeslicing: no
+Task (smp1) created: id=0x0a010001, priority=5
+Task (smp1) starting: id=0x0a010001, priority=5
+  Thread Heir: 0x0a010001 priority=5
+  Thread Executing: 0x0a010001 priority=5
+==> 6: task_create -p smp2 6
+Creating task with:  Preemption: no Timeslicing: no
+Task (smp2) created: id=0x0a010002, priority=6
+Task (smp2) starting: id=0x0a010002, priority=6
+==> 7: task_create -p smp3 7
+Creating task with:  Preemption: no Timeslicing: no
+Task (smp3) created: id=0x0a010003, priority=7
+Task (smp3) starting: id=0x0a010003, priority=7
+==> 8: task_create -p smp4 8
+Creating task with:  Preemption: no Timeslicing: no
+Task (smp4) created: id=0x0a010004, priority=8
+Task (smp4) starting: id=0x0a010004, priority=8
+==> 9: dispatch
+=== Invoke Thread Dispatch on CPU 1
+  Thread Heir: 0x0a010002 priority=6
+  Thread Executing: 0x09010002 priority=255
+  Thread Executing: 0x0a010002 priority=6
+=== Invoke Thread Dispatch on CPU 2
+  Thread Heir: 0x0a010003 priority=7
+  Thread Executing: 0x09010003 priority=255
+  Thread Executing: 0x0a010003 priority=7
+=== Invoke Thread Dispatch on CPU 3
+  Thread Heir: 0x0a010004 priority=8
+  Thread Executing: 0x09010004 priority=255
+  Thread Executing: 0x0a010004 priority=8
+==> 10: # GOAL: Tasks 0x0a010001 to 0x0a010004 as heir and executing on
+==> 11: # GOAL:    CPUs 1 - 4, respectively.
+==> 12: cpus
+=== CPU Status
+            EXECUTING    /     HEIR         /    IDLE        /  SWITCH NEEDED
+  CPU 0: 0x0a010001 @  5 / 0x0a010001 @  5 / 0x09010001 @255         false
+  CPU 1: 0x0a010002 @  6 / 0x0a010002 @  6 / 0x09010002 @255         false
+  CPU 2: 0x0a010003 @  7 / 0x0a010003 @  7 / 0x09010003 @255         false
+  CPU 3: 0x0a010004 @  8 / 0x0a010004 @  8 / 0x09010004 @255         false
+=== End of Ready Set of Threads
+==> 13: # Tasks are created and distributed across CPUs
+==> 14: task_create smp5 1
+Creating task with:  Preemption: yes Timeslicing: no
+  Thread Heir: 0x0a010001 priority=5
+  Thread Executing: 0x0a010001 priority=5
+Task (smp5) created: id=0x0a010005, priority=1
+Task (smp5) starting: id=0x0a010005, priority=1
+==> 15: # GOAL: Task 0x0a010005 is heir but 0x0a010004 is executing on CPU 4
+==> 16: cpus
+=== CPU Status
+            EXECUTING    /     HEIR         /    IDLE        /  SWITCH NEEDED
+  CPU 0: 0x0a010001 @  5 / 0x0a010001 @  5 / 0x09010001 @255         false
+  CPU 1: 0x0a010002 @  6 / 0x0a010002 @  6 / 0x09010002 @255         false
+  CPU 2: 0x0a010003 @  7 / 0x0a010003 @  7 / 0x09010003 @255         false
+  CPU 3: 0x0a010004 @  8 / 0x0a010005 @  1 / 0x09010004 @255         false
+=== End of Ready Set of Threads
+==> 17: dispatch
+==> 18: # GOAL: Task 0x0a010005 is heir but 0x0a010004 is executing on CPU 4
+==> 19: cpus
+=== CPU Status
+            EXECUTING    /     HEIR         /    IDLE        /  SWITCH NEEDED
+  CPU 0: 0x0a010001 @  5 / 0x0a010001 @  5 / 0x09010001 @255         false
+  CPU 1: 0x0a010002 @  6 / 0x0a010002 @  6 / 0x09010002 @255         false
+  CPU 2: 0x0a010003 @  7 / 0x0a010003 @  7 / 0x09010003 @255         false
+  CPU 3: 0x0a010004 @  8 / 0x0a010005 @  1 / 0x09010004 @255         false
+=== End of Ready Set of Threads
Index: schedsim/shell/schedsim_smpsimple/scenarios/cpus4_simple_nopreempt.scen
===================================================================
--- schedsim/shell/schedsim_smpsimple/scenarios/cpus4_simple_nopreempt.scen	(revision f40778b48660b589278898593c62cf2250d3fbab)
+++ schedsim/shell/schedsim_smpsimple/scenarios/cpus4_simple_nopreempt.scen	(revision f40778b48660b589278898593c62cf2250d3fbab)
@@ -0,0 +1,19 @@
+#
+#  Verify no-preempt is honored
+#
+rtems_init 4
+task_create -p smp1 5
+task_create -p smp2 6
+task_create -p smp3 7
+task_create -p smp4 8
+dispatch
+# GOAL: Tasks 0x0a010001 to 0x0a010004 as heir and executing on
+# GOAL:    CPUs 1 - 4, respectively.
+cpus
+# Tasks are created and distributed across CPUs
+task_create smp5 1
+# GOAL: Task 0x0a010005 is heir but 0x0a010004 is executing on CPU 4
+cpus
+dispatch
+# GOAL: Task 0x0a010005 is heir but 0x0a010004 is executing on CPU 4
+cpus
Index: schedsim/shell/schedsim_smpsimple/scenarios/cpus4_simple_preemption.expected
===================================================================
--- schedsim/shell/schedsim_smpsimple/scenarios/cpus4_simple_preemption.expected	(revision f40778b48660b589278898593c62cf2250d3fbab)
+++ schedsim/shell/schedsim_smpsimple/scenarios/cpus4_simple_preemption.expected	(revision f40778b48660b589278898593c62cf2250d3fbab)
@@ -0,0 +1,79 @@
+Script File               : scenarios/cpus4_simple_preemption.scen
+verbose                   : 1
+==> 1: #
+==> 2: #  Ensure lowest priority is preempted
+==> 3: #
+==> 4: rtems_init 4
+  Thread Heir: 0x09010001 priority=255
+  Thread Executing: 0x09010001 priority=255
+==> 5: task_create smp1 5
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp1) created: id=0x0a010001, priority=5
+Task (smp1) starting: id=0x0a010001, priority=5
+  Thread Heir: 0x0a010001 priority=5
+  Thread Executing: 0x0a010001 priority=5
+==> 6: task_create smp2 6
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp2) created: id=0x0a010002, priority=6
+Task (smp2) starting: id=0x0a010002, priority=6
+==> 7: task_create smp3 7
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp3) created: id=0x0a010003, priority=7
+Task (smp3) starting: id=0x0a010003, priority=7
+==> 8: task_create smp4 8
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp4) created: id=0x0a010004, priority=8
+Task (smp4) starting: id=0x0a010004, priority=8
+==> 9: dispatch
+=== Invoke Thread Dispatch on CPU 1
+  Thread Heir: 0x0a010002 priority=6
+  Thread Executing: 0x09010002 priority=255
+  Thread Executing: 0x0a010002 priority=6
+=== Invoke Thread Dispatch on CPU 2
+  Thread Heir: 0x0a010003 priority=7
+  Thread Executing: 0x09010003 priority=255
+  Thread Executing: 0x0a010003 priority=7
+=== Invoke Thread Dispatch on CPU 3
+  Thread Heir: 0x0a010004 priority=8
+  Thread Executing: 0x09010004 priority=255
+  Thread Executing: 0x0a010004 priority=8
+==> 10: # GOAL: want 0x0a010001 - 0x0a010004 as heir and executings
+==> 11: # GOAL:   on CPUs 1-4 respectively
+==> 12: cpus
+=== CPU Status
+            EXECUTING    /     HEIR         /    IDLE        /  SWITCH NEEDED
+  CPU 0: 0x0a010001 @  5 / 0x0a010001 @  5 / 0x09010001 @255         false
+  CPU 1: 0x0a010002 @  6 / 0x0a010002 @  6 / 0x09010002 @255         false
+  CPU 2: 0x0a010003 @  7 / 0x0a010003 @  7 / 0x09010003 @255         false
+  CPU 3: 0x0a010004 @  8 / 0x0a010004 @  8 / 0x09010004 @255         false
+=== End of Ready Set of Threads
+==> 13: # Tasks are created and distributed across CPUs
+==> 14: task_create smp5 1
+Creating task with:  Preemption: yes Timeslicing: no
+  Thread Heir: 0x0a010001 priority=5
+  Thread Executing: 0x0a010001 priority=5
+Task (smp5) created: id=0x0a010005, priority=1
+Task (smp5) starting: id=0x0a010005, priority=1
+==> 15: # GOAL: want 0x0a010005 to be heir on CPU 4
+==> 16: cpus
+=== CPU Status
+            EXECUTING    /     HEIR         /    IDLE        /  SWITCH NEEDED
+  CPU 0: 0x0a010001 @  5 / 0x0a010001 @  5 / 0x09010001 @255         false
+  CPU 1: 0x0a010002 @  6 / 0x0a010002 @  6 / 0x09010002 @255         false
+  CPU 2: 0x0a010003 @  7 / 0x0a010003 @  7 / 0x09010003 @255         false
+  CPU 3: 0x0a010004 @  8 / 0x0a010005 @  1 / 0x09010004 @255         true
+=== End of Ready Set of Threads
+==> 17: dispatch
+=== Invoke Thread Dispatch on CPU 3
+  Thread Heir: 0x0a010005 priority=1
+  Thread Executing: 0x0a010004 priority=8
+  Thread Executing: 0x0a010005 priority=1
+==> 18: # GOAL: want 0x0a010005 to be heir AND executing on CPU 4
+==> 19: cpus
+=== CPU Status
+            EXECUTING    /     HEIR         /    IDLE        /  SWITCH NEEDED
+  CPU 0: 0x0a010001 @  5 / 0x0a010001 @  5 / 0x09010001 @255         false
+  CPU 1: 0x0a010002 @  6 / 0x0a010002 @  6 / 0x09010002 @255         false
+  CPU 2: 0x0a010003 @  7 / 0x0a010003 @  7 / 0x09010003 @255         false
+  CPU 3: 0x0a010005 @  1 / 0x0a010005 @  1 / 0x09010004 @255         false
+=== End of Ready Set of Threads
Index: schedsim/shell/schedsim_smpsimple/scenarios/cpus4_simple_preemption.scen
===================================================================
--- schedsim/shell/schedsim_smpsimple/scenarios/cpus4_simple_preemption.scen	(revision f40778b48660b589278898593c62cf2250d3fbab)
+++ schedsim/shell/schedsim_smpsimple/scenarios/cpus4_simple_preemption.scen	(revision f40778b48660b589278898593c62cf2250d3fbab)
@@ -0,0 +1,19 @@
+#
+#  Ensure lowest priority is preempted
+#
+rtems_init 4
+task_create smp1 5
+task_create smp2 6
+task_create smp3 7
+task_create smp4 8
+dispatch
+# GOAL: want 0x0a010001 - 0x0a010004 as heir and executings
+# GOAL:   on CPUs 1-4 respectively
+cpus
+# Tasks are created and distributed across CPUs
+task_create smp5 1
+# GOAL: want 0x0a010005 to be heir on CPU 4
+cpus
+dispatch
+# GOAL: want 0x0a010005 to be heir AND executing on CPU 4
+cpus
Index: schedsim/shell/schedsim_smpsimple/scenarios/cpus4_suspend_on_all.expected
===================================================================
--- schedsim/shell/schedsim_smpsimple/scenarios/cpus4_suspend_on_all.expected	(revision f40778b48660b589278898593c62cf2250d3fbab)
+++ schedsim/shell/schedsim_smpsimple/scenarios/cpus4_suspend_on_all.expected	(revision f40778b48660b589278898593c62cf2250d3fbab)
@@ -0,0 +1,83 @@
+Script File               : scenarios/cpus4_suspend_on_all.scen
+verbose                   : 1
+==> 1: #
+==> 2: #  Check blocking self on secondary CPU
+==> 3: #
+==> 4: rtems_init 4
+  Thread Heir: 0x09010001 priority=255
+  Thread Executing: 0x09010001 priority=255
+==> 5: task_create smp1 5
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp1) created: id=0x0a010001, priority=5
+Task (smp1) starting: id=0x0a010001, priority=5
+  Thread Heir: 0x0a010001 priority=5
+  Thread Executing: 0x0a010001 priority=5
+==> 6: task_create smp2 6
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp2) created: id=0x0a010002, priority=6
+Task (smp2) starting: id=0x0a010002, priority=6
+==> 7: task_create smp3 7
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp3) created: id=0x0a010003, priority=7
+Task (smp3) starting: id=0x0a010003, priority=7
+==> 8: task_create smp4 8
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp4) created: id=0x0a010004, priority=8
+Task (smp4) starting: id=0x0a010004, priority=8
+==> 9: dispatch
+=== Invoke Thread Dispatch on CPU 1
+  Thread Heir: 0x0a010002 priority=6
+  Thread Executing: 0x09010002 priority=255
+  Thread Executing: 0x0a010002 priority=6
+=== Invoke Thread Dispatch on CPU 2
+  Thread Heir: 0x0a010003 priority=7
+  Thread Executing: 0x09010003 priority=255
+  Thread Executing: 0x0a010003 priority=7
+=== Invoke Thread Dispatch on CPU 3
+  Thread Heir: 0x0a010004 priority=8
+  Thread Executing: 0x09010004 priority=255
+  Thread Executing: 0x0a010004 priority=8
+==> 10: # GOAL: want 0x0a010001 - 0x0a010004 as heir and executings
+==> 11: # GOAL:   on CPUs 0 - 3 respectively
+==> 12: cpus
+=== CPU Status
+            EXECUTING    /     HEIR         /    IDLE        /  SWITCH NEEDED
+  CPU 0: 0x0a010001 @  5 / 0x0a010001 @  5 / 0x09010001 @255         false
+  CPU 1: 0x0a010002 @  6 / 0x0a010002 @  6 / 0x09010002 @255         false
+  CPU 2: 0x0a010003 @  7 / 0x0a010003 @  7 / 0x09010003 @255         false
+  CPU 3: 0x0a010004 @  8 / 0x0a010004 @  8 / 0x09010004 @255         false
+=== End of Ready Set of Threads
+==> 13: task_suspend smp1
+Suspending task (0x0a010001)
+  Thread Heir: 0x09010001 priority=255
+  Thread Executing: 0x0a010001 priority=5
+  Thread Executing: 0x09010001 priority=255
+==> 14: task_suspend smp2
+Suspending task (0x0a010002)
+==> 15: task_suspend smp3
+Suspending task (0x0a010003)
+==> 16: task_suspend smp4
+Suspending task (0x0a010004)
+==> 17: dispatch
+=== Invoke Thread Dispatch on CPU 1
+  Thread Heir: 0x09010002 priority=255
+  Thread Executing: 0x0a010002 priority=6
+  Thread Executing: 0x09010002 priority=255
+=== Invoke Thread Dispatch on CPU 2
+  Thread Heir: 0x09010003 priority=255
+  Thread Executing: 0x0a010003 priority=7
+  Thread Executing: 0x09010003 priority=255
+=== Invoke Thread Dispatch on CPU 3
+  Thread Heir: 0x09010004 priority=255
+  Thread Executing: 0x0a010004 priority=8
+  Thread Executing: 0x09010004 priority=255
+==> 18: # GOAL: want IDLE 0x09010001 - 0x09010004 as heir and executings
+==> 19: # GOAL:   on CPUs 0 - 3 respectively
+==> 20: cpus
+=== CPU Status
+            EXECUTING    /     HEIR         /    IDLE        /  SWITCH NEEDED
+  CPU 0: 0x09010001 @255 / 0x09010001 @255 / 0x09010001 @255         false
+  CPU 1: 0x09010002 @255 / 0x09010002 @255 / 0x09010002 @255         false
+  CPU 2: 0x09010003 @255 / 0x09010003 @255 / 0x09010003 @255         false
+  CPU 3: 0x09010004 @255 / 0x09010004 @255 / 0x09010004 @255         false
+=== End of Ready Set of Threads
Index: schedsim/shell/schedsim_smpsimple/scenarios/cpus4_suspend_on_all.scen
===================================================================
--- schedsim/shell/schedsim_smpsimple/scenarios/cpus4_suspend_on_all.scen	(revision f40778b48660b589278898593c62cf2250d3fbab)
+++ schedsim/shell/schedsim_smpsimple/scenarios/cpus4_suspend_on_all.scen	(revision f40778b48660b589278898593c62cf2250d3fbab)
@@ -0,0 +1,20 @@
+#
+#  Check blocking self on secondary CPU
+#
+rtems_init 4
+task_create smp1 5
+task_create smp2 6
+task_create smp3 7
+task_create smp4 8
+dispatch
+# GOAL: want 0x0a010001 - 0x0a010004 as heir and executings
+# GOAL:   on CPUs 0 - 3 respectively
+cpus
+task_suspend smp1
+task_suspend smp2
+task_suspend smp3
+task_suspend smp4
+dispatch
+# GOAL: want IDLE 0x09010001 - 0x09010004 as heir and executings
+# GOAL:   on CPUs 0 - 3 respectively
+cpus
Index: schedsim/shell/schedsim_smpsimple/scenarios/cpus4_suspend_on_primary.expected
===================================================================
--- schedsim/shell/schedsim_smpsimple/scenarios/cpus4_suspend_on_primary.expected	(revision f40778b48660b589278898593c62cf2250d3fbab)
+++ schedsim/shell/schedsim_smpsimple/scenarios/cpus4_suspend_on_primary.expected	(revision f40778b48660b589278898593c62cf2250d3fbab)
@@ -0,0 +1,73 @@
+Script File               : scenarios/cpus4_suspend_on_primary.scen
+verbose                   : 1
+==> 1: #
+==> 2: #  Check blocking self on primary CPU
+==> 3: #
+==> 4: rtems_init 4
+  Thread Heir: 0x09010001 priority=255
+  Thread Executing: 0x09010001 priority=255
+==> 5: task_create smp1 5
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp1) created: id=0x0a010001, priority=5
+Task (smp1) starting: id=0x0a010001, priority=5
+  Thread Heir: 0x0a010001 priority=5
+  Thread Executing: 0x0a010001 priority=5
+==> 6: task_create smp2 6
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp2) created: id=0x0a010002, priority=6
+Task (smp2) starting: id=0x0a010002, priority=6
+==> 7: task_create smp3 7
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp3) created: id=0x0a010003, priority=7
+Task (smp3) starting: id=0x0a010003, priority=7
+==> 8: task_create smp4 8
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp4) created: id=0x0a010004, priority=8
+Task (smp4) starting: id=0x0a010004, priority=8
+==> 9: dispatch
+=== Invoke Thread Dispatch on CPU 1
+  Thread Heir: 0x0a010002 priority=6
+  Thread Executing: 0x09010002 priority=255
+  Thread Executing: 0x0a010002 priority=6
+=== Invoke Thread Dispatch on CPU 2
+  Thread Heir: 0x0a010003 priority=7
+  Thread Executing: 0x09010003 priority=255
+  Thread Executing: 0x0a010003 priority=7
+=== Invoke Thread Dispatch on CPU 3
+  Thread Heir: 0x0a010004 priority=8
+  Thread Executing: 0x09010004 priority=255
+  Thread Executing: 0x0a010004 priority=8
+==> 10: # GOAL: want 0x0a010001 - 0x0a010004 as heir and executings
+==> 11: # GOAL:   on CPUs 1-4 respectively
+==> 12: cpus
+=== CPU Status
+            EXECUTING    /     HEIR         /    IDLE        /  SWITCH NEEDED
+  CPU 0: 0x0a010001 @  5 / 0x0a010001 @  5 / 0x09010001 @255         false
+  CPU 1: 0x0a010002 @  6 / 0x0a010002 @  6 / 0x09010002 @255         false
+  CPU 2: 0x0a010003 @  7 / 0x0a010003 @  7 / 0x09010003 @255         false
+  CPU 3: 0x0a010004 @  8 / 0x0a010004 @  8 / 0x09010004 @255         false
+=== End of Ready Set of Threads
+==> 13: task_suspend SELF
+Suspending task (0x0a010001)
+  Thread Heir: 0x09010001 priority=255
+  Thread Executing: 0x0a010001 priority=5
+  Thread Executing: 0x09010001 priority=255
+==> 14: # GOAL: want 0x09010001 as heir and executing on CPU 1
+==> 15: cpus
+=== CPU Status
+            EXECUTING    /     HEIR         /    IDLE        /  SWITCH NEEDED
+  CPU 0: 0x09010001 @255 / 0x09010001 @255 / 0x09010001 @255         false
+  CPU 1: 0x0a010002 @  6 / 0x0a010002 @  6 / 0x09010002 @255         false
+  CPU 2: 0x0a010003 @  7 / 0x0a010003 @  7 / 0x09010003 @255         false
+  CPU 3: 0x0a010004 @  8 / 0x0a010004 @  8 / 0x09010004 @255         false
+=== End of Ready Set of Threads
+==> 16: dispatch
+==> 17: # GOAL: want 0x09010001 as heir and executing on CPU 1
+==> 18: cpus
+=== CPU Status
+            EXECUTING    /     HEIR         /    IDLE        /  SWITCH NEEDED
+  CPU 0: 0x09010001 @255 / 0x09010001 @255 / 0x09010001 @255         false
+  CPU 1: 0x0a010002 @  6 / 0x0a010002 @  6 / 0x09010002 @255         false
+  CPU 2: 0x0a010003 @  7 / 0x0a010003 @  7 / 0x09010003 @255         false
+  CPU 3: 0x0a010004 @  8 / 0x0a010004 @  8 / 0x09010004 @255         false
+=== End of Ready Set of Threads
Index: schedsim/shell/schedsim_smpsimple/scenarios/cpus4_suspend_on_primary.scen
===================================================================
--- schedsim/shell/schedsim_smpsimple/scenarios/cpus4_suspend_on_primary.scen	(revision f40778b48660b589278898593c62cf2250d3fbab)
+++ schedsim/shell/schedsim_smpsimple/scenarios/cpus4_suspend_on_primary.scen	(revision f40778b48660b589278898593c62cf2250d3fbab)
@@ -0,0 +1,18 @@
+#
+#  Check blocking self on primary CPU
+#
+rtems_init 4
+task_create smp1 5
+task_create smp2 6
+task_create smp3 7
+task_create smp4 8
+dispatch
+# GOAL: want 0x0a010001 - 0x0a010004 as heir and executings
+# GOAL:   on CPUs 1-4 respectively
+cpus
+task_suspend SELF
+# GOAL: want 0x09010001 as heir and executing on CPU 1
+cpus
+dispatch
+# GOAL: want 0x09010001 as heir and executing on CPU 1
+cpus
Index: schedsim/shell/schedsim_smpsimple/scenarios/cpus4_suspend_on_secondary.expected
===================================================================
--- schedsim/shell/schedsim_smpsimple/scenarios/cpus4_suspend_on_secondary.expected	(revision f40778b48660b589278898593c62cf2250d3fbab)
+++ schedsim/shell/schedsim_smpsimple/scenarios/cpus4_suspend_on_secondary.expected	(revision f40778b48660b589278898593c62cf2250d3fbab)
@@ -0,0 +1,75 @@
+Script File               : scenarios/cpus4_suspend_on_secondary.scen
+verbose                   : 1
+==> 1: #
+==> 2: #  Check blocking self on secondary CPU
+==> 3: #
+==> 4: rtems_init 4
+  Thread Heir: 0x09010001 priority=255
+  Thread Executing: 0x09010001 priority=255
+==> 5: task_create smp1 5
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp1) created: id=0x0a010001, priority=5
+Task (smp1) starting: id=0x0a010001, priority=5
+  Thread Heir: 0x0a010001 priority=5
+  Thread Executing: 0x0a010001 priority=5
+==> 6: task_create smp2 6
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp2) created: id=0x0a010002, priority=6
+Task (smp2) starting: id=0x0a010002, priority=6
+==> 7: task_create smp3 7
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp3) created: id=0x0a010003, priority=7
+Task (smp3) starting: id=0x0a010003, priority=7
+==> 8: task_create smp4 8
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp4) created: id=0x0a010004, priority=8
+Task (smp4) starting: id=0x0a010004, priority=8
+==> 9: dispatch
+=== Invoke Thread Dispatch on CPU 1
+  Thread Heir: 0x0a010002 priority=6
+  Thread Executing: 0x09010002 priority=255
+  Thread Executing: 0x0a010002 priority=6
+=== Invoke Thread Dispatch on CPU 2
+  Thread Heir: 0x0a010003 priority=7
+  Thread Executing: 0x09010003 priority=255
+  Thread Executing: 0x0a010003 priority=7
+=== Invoke Thread Dispatch on CPU 3
+  Thread Heir: 0x0a010004 priority=8
+  Thread Executing: 0x09010004 priority=255
+  Thread Executing: 0x0a010004 priority=8
+==> 10: # GOAL: want 0x0a010001 - 0x0a010004 as heir and executings
+==> 11: # GOAL:   on CPUs 1-4 respectively
+==> 12: cpus
+=== CPU Status
+            EXECUTING    /     HEIR         /    IDLE        /  SWITCH NEEDED
+  CPU 0: 0x0a010001 @  5 / 0x0a010001 @  5 / 0x09010001 @255         false
+  CPU 1: 0x0a010002 @  6 / 0x0a010002 @  6 / 0x09010002 @255         false
+  CPU 2: 0x0a010003 @  7 / 0x0a010003 @  7 / 0x09010003 @255         false
+  CPU 3: 0x0a010004 @  8 / 0x0a010004 @  8 / 0x09010004 @255         false
+=== End of Ready Set of Threads
+==> 13: current_cpu 2
+Changing current CPU from 0 to 2
+==> 14: task_suspend SELF
+Suspending task (0x0a010003)
+  Thread Heir: 0x09010001 priority=255
+  Thread Executing: 0x0a010003 priority=7
+  Thread Executing: 0x09010001 priority=255
+==> 15: # GOAL: Want IDLE 0x09010001 as heir and executing on CPU 2
+==> 16: cpus
+=== CPU Status
+            EXECUTING    /     HEIR         /    IDLE        /  SWITCH NEEDED
+  CPU 0: 0x0a010001 @  5 / 0x0a010001 @  5 / 0x09010001 @255         false
+  CPU 1: 0x0a010002 @  6 / 0x0a010002 @  6 / 0x09010002 @255         false
+  CPU 2: 0x09010001 @255 / 0x09010001 @255 / 0x09010003 @255         false
+  CPU 3: 0x0a010004 @  8 / 0x0a010004 @  8 / 0x09010004 @255         false
+=== End of Ready Set of Threads
+==> 17: dispatch
+==> 18: # GOAL: Want IDLE 0x09010001 as heir and executing on CPU 2
+==> 19: cpus
+=== CPU Status
+            EXECUTING    /     HEIR         /    IDLE        /  SWITCH NEEDED
+  CPU 0: 0x0a010001 @  5 / 0x0a010001 @  5 / 0x09010001 @255         false
+  CPU 1: 0x0a010002 @  6 / 0x0a010002 @  6 / 0x09010002 @255         false
+  CPU 2: 0x09010001 @255 / 0x09010001 @255 / 0x09010003 @255         false
+  CPU 3: 0x0a010004 @  8 / 0x0a010004 @  8 / 0x09010004 @255         false
+=== End of Ready Set of Threads
Index: schedsim/shell/schedsim_smpsimple/scenarios/cpus4_suspend_on_secondary.scen
===================================================================
--- schedsim/shell/schedsim_smpsimple/scenarios/cpus4_suspend_on_secondary.scen	(revision f40778b48660b589278898593c62cf2250d3fbab)
+++ schedsim/shell/schedsim_smpsimple/scenarios/cpus4_suspend_on_secondary.scen	(revision f40778b48660b589278898593c62cf2250d3fbab)
@@ -0,0 +1,19 @@
+#
+#  Check blocking self on secondary CPU
+#
+rtems_init 4
+task_create smp1 5
+task_create smp2 6
+task_create smp3 7
+task_create smp4 8
+dispatch
+# GOAL: want 0x0a010001 - 0x0a010004 as heir and executings
+# GOAL:   on CPUs 1-4 respectively
+cpus
+current_cpu 2
+task_suspend SELF
+# GOAL: Want IDLE 0x09010001 as heir and executing on CPU 2
+cpus
+dispatch
+# GOAL: Want IDLE 0x09010001 as heir and executing on CPU 2
+cpus
Index: schedsim/shell/schedsim_smpsimple/schedsim.cc
===================================================================
--- schedsim/shell/schedsim_smpsimple/schedsim.cc	(revision f40778b48660b589278898593c62cf2250d3fbab)
+++ schedsim/shell/schedsim_smpsimple/schedsim.cc	(revision f40778b48660b589278898593c62cf2250d3fbab)
@@ -0,0 +1,178 @@
+/*
+ *  COPYRIGHT (c) 1989-2010.
+ *  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$
+ */
+
+#include <newlib/getopt.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
+#include "shell.h"
+#include "rtems_sched.h"
+
+/*
+ *  Variables to control global behavior
+ */
+int verbose = 1;
+const char *progname;
+const char *scriptname;
+
+FILE *Script;
+int ScriptFileLine = 0;
+
+/*
+ *  Print program usage message
+ */
+void usage()
+{
+  fprintf(
+    stderr,
+    "Usage: %s [-v] script\n"
+    "\n"
+    "  -v           - enable verbose output\n",
+    progname
+  );
+  exit( -1 );
+}
+
+#define RTEMS_SHELL_MAXIMUM_ARGUMENTS (128)
+
+void ProcessScript(
+  FILE *script
+)
+{
+  char               buffer[512];
+  char              *cStatus;
+  char              *c;
+  size_t             length;
+  int                argc;
+  char              *argv[RTEMS_SHELL_MAXIMUM_ARGUMENTS];
+  rtems_shell_cmd_t *shell_cmd;
+  
+ 
+  while ( 1 ) {
+    cStatus = fgets( buffer, sizeof(buffer), script );
+    if ( cStatus == NULL )
+      break;
+    // If the last line does not have a CR, then we don't want to
+    // arbitrarily clobber an = instead of a \n.
+    length = strlen(buffer);
+    if ( buffer[ length - 1] == '\n' )
+      buffer[ length - 1] = '\0';
+
+    if ( verbose )
+      printf( "==> %d: %s\n", ++ScriptFileLine, buffer );
+
+    if ( buffer[0] == '#' )
+      continue;
+
+    for ( c = buffer ; *c ; c++ ) {
+      if (!isblank((int)*c))
+        break;
+    }
+
+
+    if (!strcmp(c,"bye") || !strcmp(c,"exit")) {
+      return;
+    } 
+
+    if (rtems_shell_make_args(c, &argc, argv, RTEMS_SHELL_MAXIMUM_ARGUMENTS)) {
+      fprintf(stderr, "Error parsing arguments\n" );
+      continue;
+    }
+
+    if ( argc == 0 )
+      continue;
+
+    shell_cmd = rtems_shell_lookup_cmd(argv[0]);
+    if ( !shell_cmd ) {
+      fprintf(stderr, "%s is unknown command\n", c );
+      continue;
+    }
+
+    shell_cmd->command(argc, argv);
+  }
+}
+
+extern "C" {
+ void add_commands(void);
+};
+
+int main(
+  int argc,
+  char **argv
+)
+{
+  int opt;
+  progname = argv[0];
+  
+  while ((opt = getopt(argc, argv, "v")) != -1) {
+    switch (opt) {
+      case 'v': verbose = 0;                break;
+      default: /* '?' */
+        usage();
+    }
+  }
+
+  if ( optind >= argc ) {
+    scriptname = "-"; 
+  } else {
+    scriptname = argv[ optind ];
+  }
+
+  if ( !strcmp( scriptname, "-" ) ) {
+    scriptname = "/dev/stdin";
+  }
+
+  if ( verbose ) {
+    printf(
+      "Script File               : %s\n"
+      "verbose                   : %d\n",
+      scriptname,
+      verbose
+    );
+  }
+
+  //
+  //  Initialize the command interpreter
+  //
+  rtems_shell_initialize_command_set();
+  add_commands();
+
+  //
+  //  Open the script file
+  // 
+  Script = fopen( scriptname, "r" );
+  if ( !Script ) {
+    fprintf( stderr, "Unable to open script file (%s)\n", scriptname );
+    exit( -1 );
+  }
+
+  //
+  //  Process the Script
+  //
+  ProcessScript( Script );
+
+  //
+  //  Open the script file
+  // 
+  (void) fclose( Script );
+
+  //
+  //  Just in case something throws
+  //
+  try {
+  } catch (...) {
+    exit(-1);
+  }
+
+  return 0;
+}
Index: schedsim/shell/schedsim_smpsimple/smp_stub.c
===================================================================
--- schedsim/shell/schedsim_smpsimple/smp_stub.c	(revision f40778b48660b589278898593c62cf2250d3fbab)
+++ schedsim/shell/schedsim_smpsimple/smp_stub.c	(revision f40778b48660b589278898593c62cf2250d3fbab)
@@ -0,0 +1,74 @@
+/*
+ *  RTEMS SMP Support for Single Core
+ *
+ *  COPYRIGHT (c) 1989-2011.
+ *  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$
+ */
+
+#include <rtems.h>
+#include <rtems/bspIo.h>
+#include <rtems/bspsmp.h>
+#include <stdlib.h>
+
+uint32_t Schedsim_Current_cpu;
+
+void bsp_smp_secondary_cpu_initialize(int cpu)
+{
+  Schedsim_Current_cpu = 0;
+}
+
+int bsp_smp_processor_id(void)
+{
+  return Schedsim_Current_cpu;
+}
+
+int bsp_smp_initialize(
+  int maximum
+)
+{
+  /* return the number of CPUs */
+  return maximum;
+}
+
+void bsp_smp_broadcast_interrupt(void)
+{
+}
+
+void bsp_smp_broadcast_message(
+  uint32_t  message
+)
+{
+}
+
+void bsp_smp_interrupt_cpu(
+  int cpu
+)
+{
+}
+
+void bsp_smp_delay( int max )
+{
+}
+
+void bsp_smp_wait_for(
+  volatile unsigned int *address,
+  unsigned int           desired,
+  int                    maximum_usecs
+)
+{
+  int iterations;
+  volatile int i;
+  volatile unsigned int *p = address;
+
+  for (iterations=0 ;  iterations < maximum_usecs ; iterations++ ) {
+    *p = desired;
+    /* XXX hack to make simulator happy */
+  }
+}
+
Index: schedsim/shell/schedsim_smpsimple/wrap_thread_dispatch.c
===================================================================
--- schedsim/shell/schedsim_smpsimple/wrap_thread_dispatch.c	(revision f40778b48660b589278898593c62cf2250d3fbab)
+++ schedsim/shell/schedsim_smpsimple/wrap_thread_dispatch.c	(revision f40778b48660b589278898593c62cf2250d3fbab)
@@ -0,0 +1,42 @@
+/*
+ *  Thread Dispatch Wrapper Implmentation
+ *
+ *  COPYRIGHT (c) 1989-2010.
+ *  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$
+ */
+
+#include "shell.h"
+#include <schedsim_shell.h>
+
+#include <stdio.h>
+#include <rtems.h>
+
+Thread_Control *last_heir = NULL;
+Thread_Control *last_executing = NULL;
+
+extern void __real__Thread_Dispatch(void);
+
+void check_heir_and_executing(void)
+{
+  if ( last_heir != _Thread_Heir ) 
+    PRINT_HEIR();
+
+  if ( last_executing != _Thread_Executing )
+    PRINT_EXECUTING();
+
+  last_heir = _Thread_Heir;
+  last_executing = _Thread_Executing;
+}
+
+void __wrap__Thread_Dispatch(void)
+{
+  check_heir_and_executing();
+    __real__Thread_Dispatch();
+  check_heir_and_executing();
+}
