Index: schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus1_exercise_affinity_api.expected
===================================================================
--- schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus1_exercise_affinity_api.expected	(revision 9f3c8eba59c36e6cfa6d1028c288bb8090a460e2)
+++ schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus1_exercise_affinity_api.expected	(revision 9f3c8eba59c36e6cfa6d1028c288bb8090a460e2)
@@ -0,0 +1,27 @@
+Script File               : scenarios/cpus1_exercise_affinity_api.scen
+verbose                   : 1
+==> 1: #
+==> 2: #  Verify that affinity on 1 core
+==> 3: #
+==> 4: rtems_init 1
+  CPU 0: Thread Heir 0x09010001 priority=255
+  CPU 0: Thread Executing 0x09010001 priority=255
+==> 5: 
+==> 6: # GOAL: 0x0a010001 with affinity
+==> 7: echo "=== Create and start 0x0a010001 ==="
+=== Create and start 0x0a010001 ===
+==> 8: task_create TA1 3 -a 1
+Creating task with:  Preemption: yes Timeslicing: no
+Task (TA1) created: id=0x0a010001, priority=3
+Task (0x0a010001) Set affinity=0x00000001
+Task (TA1) starting: id=0x0a010001, priority=3
+  CPU 0: Thread Heir 0x0a010001 priority=3
+  CPU 0: Thread Executing 0x0a010001 priority=3
+==> 9: 
+==> 10: # GOAL: 0x0a010001 is now heir and executing on CPU 0
+==> 11: cpus
+=== CPU Status
+          EXECUTING      /   HEIR             / SWITCH NEEDED
+  CPU 0: 0x0a010001 @  3 / 0x0a010001 @  3          false
+=== End of Ready Set of Threads
+==> 12: 
Index: schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus1_exercise_affinity_api.scen
===================================================================
--- schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus1_exercise_affinity_api.scen	(revision 9f3c8eba59c36e6cfa6d1028c288bb8090a460e2)
+++ schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus1_exercise_affinity_api.scen	(revision 9f3c8eba59c36e6cfa6d1028c288bb8090a460e2)
@@ -0,0 +1,12 @@
+#
+#  Verify that affinity on 1 core
+#
+rtems_init 1
+
+# GOAL: 0x0a010001 with affinity
+echo "=== Create and start 0x0a010001 ==="
+task_create TA1 3 -a 1
+
+# GOAL: 0x0a010001 is now heir and executing on CPU 0
+cpus
+
Index: schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_case1.expected
===================================================================
--- schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_case1.expected	(revision 9f3c8eba59c36e6cfa6d1028c288bb8090a460e2)
+++ schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_case1.expected	(revision 9f3c8eba59c36e6cfa6d1028c288bb8090a460e2)
@@ -0,0 +1,50 @@
+Script File               : scenarios/cpus2_affinity_case1.scen
+verbose                   : 1
+==> 1: #
+==> 2: #  
+==> 3: #
+==> 4: rtems_init 2
+  CPU 0: Thread Heir 0x09010001 priority=255
+  CPU 0: Thread Executing 0x09010001 priority=255
+  CPU 1: Thread Heir 0x09010002 priority=255
+  CPU 1: Thread Executing 0x09010002 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
+  CPU 1: Thread Heir 0x0a010001 priority=3
+  CPU 1: Thread Executing 0x0a010001 priority=3
+==> 6: # GOAL: 0x09010001, 0x0a010001
+==> 7: # GOAL:   on CPUs 0-1 respectively
+==> 8: cpus
+=== CPU Status
+          EXECUTING      /   HEIR             / SWITCH NEEDED
+  CPU 0: 0x09010001 @255 / 0x09010001 @255          false
+  CPU 1: 0x0a010001 @  3 / 0x0a010001 @  3          false
+=== End of Ready Set of Threads
+==> 9: 
+==> 10: task_create smp2 2 -a 2
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp2) created: id=0x0a010002, priority=2
+Task (0x0a010002) Set affinity=0x00000002
+Task (smp2) starting: id=0x0a010002, priority=2
+  CPU 1: Thread Heir 0x0a010002 priority=2
+  CPU 1: Thread Executing 0x0a010002 priority=2
+==> 11: # GOAL: want 0x09010001, 0x0a010002 as heir and executings
+==> 12: # GOAL:   on CPUs 0 -1 respectively
+==> 13: cpus
+=== CPU Status
+          EXECUTING      /   HEIR             / SWITCH NEEDED
+  CPU 0: 0x09010001 @255 / 0x09010001 @255          false
+  CPU 1: 0x0a010002 @  2 / 0x0a010002 @  2          false
+=== End of Ready Set of Threads
+==> 14: 
+==> 15: dispatch
+==> 16: # GOAL: want 0x0a010001 - 0x0a010002 as heir and executings
+==> 17: # GOAL:   on CPUs 0 -1 respectively
+==> 18: cpus
+=== CPU Status
+          EXECUTING      /   HEIR             / SWITCH NEEDED
+  CPU 0: 0x0a010001 @  3 / 0x0a010001 @  3          false
+  CPU 1: 0x0a010002 @  2 / 0x0a010002 @  2          false
+=== End of Ready Set of Threads
Index: schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_case1.scen
===================================================================
--- schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_case1.scen	(revision 9f3c8eba59c36e6cfa6d1028c288bb8090a460e2)
+++ schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_case1.scen	(revision 9f3c8eba59c36e6cfa6d1028c288bb8090a460e2)
@@ -0,0 +1,18 @@
+#
+#  
+#
+rtems_init 2
+task_create smp1 3 
+# GOAL: 0x09010001, 0x0a010001
+# GOAL:   on CPUs 0-1 respectively
+cpus
+
+task_create smp2 2 -a 2
+# GOAL: want 0x09010001, 0x0a010002 as heir and executings
+# GOAL:   on CPUs 0 -1 respectively
+cpus
+
+dispatch
+# GOAL: want 0x0a010001 - 0x0a010002 as heir and executings
+# GOAL:   on CPUs 0 -1 respectively
+cpus
Index: schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_case2.expected
===================================================================
--- schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_case2.expected	(revision 9f3c8eba59c36e6cfa6d1028c288bb8090a460e2)
+++ schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_case2.expected	(revision 9f3c8eba59c36e6cfa6d1028c288bb8090a460e2)
@@ -0,0 +1,48 @@
+Script File               : scenarios/cpus2_affinity_case2.scen
+verbose                   : 1
+==> 1: #
+==> 2: #  
+==> 3: #
+==> 4: rtems_init 2
+  CPU 0: Thread Heir 0x09010001 priority=255
+  CPU 0: Thread Executing 0x09010001 priority=255
+  CPU 1: Thread Heir 0x09010002 priority=255
+  CPU 1: Thread Executing 0x09010002 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
+  CPU 1: Thread Heir 0x0a010001 priority=3
+  CPU 1: Thread Executing 0x0a010001 priority=3
+==> 6: # GOAL: 0x09010001, 0x0a010001
+==> 7: # GOAL:   on CPUs 0-1 respectively
+==> 8: cpus
+=== CPU Status
+          EXECUTING      /   HEIR             / SWITCH NEEDED
+  CPU 0: 0x09010001 @255 / 0x09010001 @255          false
+  CPU 1: 0x0a010001 @  3 / 0x0a010001 @  3          false
+=== End of Ready Set of Threads
+==> 9: 
+==> 10: task_create smp2 4 -a 2
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp2) created: id=0x0a010002, priority=4
+Task (0x0a010002) Set affinity=0x00000002
+Task (smp2) starting: id=0x0a010002, priority=4
+==> 11: # GOAL: 0x09010001, 0x0a010001
+==> 12: # GOAL:   on CPUs 0 -1 respectively
+==> 13: cpus
+=== CPU Status
+          EXECUTING      /   HEIR             / SWITCH NEEDED
+  CPU 0: 0x09010001 @255 / 0x09010001 @255          false
+  CPU 1: 0x0a010001 @  3 / 0x0a010001 @  3          false
+=== End of Ready Set of Threads
+==> 14: 
+==> 15: dispatch
+==> 16: # GOAL: 0x09010001, 0x0a010001
+==> 17: # GOAL:   on CPUs 0 -1 respectively
+==> 18: cpus
+=== CPU Status
+          EXECUTING      /   HEIR             / SWITCH NEEDED
+  CPU 0: 0x09010001 @255 / 0x09010001 @255          false
+  CPU 1: 0x0a010001 @  3 / 0x0a010001 @  3          false
+=== End of Ready Set of Threads
Index: schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_case2.scen
===================================================================
--- schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_case2.scen	(revision 9f3c8eba59c36e6cfa6d1028c288bb8090a460e2)
+++ schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_case2.scen	(revision 9f3c8eba59c36e6cfa6d1028c288bb8090a460e2)
@@ -0,0 +1,18 @@
+#
+#  
+#
+rtems_init 2
+task_create smp1 3 
+# GOAL: 0x09010001, 0x0a010001
+# GOAL:   on CPUs 0-1 respectively
+cpus
+
+task_create smp2 4 -a 2
+# GOAL: 0x09010001, 0x0a010001
+# GOAL:   on CPUs 0 -1 respectively
+cpus
+
+dispatch
+# GOAL: 0x09010001, 0x0a010001
+# GOAL:   on CPUs 0 -1 respectively
+cpus
Index: schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_case3.expected
===================================================================
--- schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_case3.expected	(revision 9f3c8eba59c36e6cfa6d1028c288bb8090a460e2)
+++ schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_case3.expected	(revision 9f3c8eba59c36e6cfa6d1028c288bb8090a460e2)
@@ -0,0 +1,33 @@
+Script File               : scenarios/cpus2_affinity_case3.scen
+verbose                   : 1
+==> 1: #
+==> 2: #  
+==> 3: #
+==> 4: rtems_init 2
+  CPU 0: Thread Heir 0x09010001 priority=255
+  CPU 0: Thread Executing 0x09010001 priority=255
+  CPU 1: Thread Heir 0x09010002 priority=255
+  CPU 1: Thread Executing 0x09010002 priority=255
+==> 5: task_create smp1 3 -a 1 
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp1) created: id=0x0a010001, priority=3
+Task (0x0a010001) Set affinity=0x00000001
+Task (smp1) starting: id=0x0a010001, priority=3
+  CPU 0: Thread Heir 0x0a010001 priority=3
+  CPU 0: Thread Executing 0x0a010001 priority=3
+==> 6: task_create smp2 2 -a 2
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp2) created: id=0x0a010002, priority=2
+Task (0x0a010002) Set affinity=0x00000002
+Task (smp2) starting: id=0x0a010002, priority=2
+  CPU 1: Thread Heir 0x0a010002 priority=2
+  CPU 1: Thread Executing 0x0a010002 priority=2
+==> 7: 
+==> 8: # GOAL: want 0x0a010001 - 0x0a010002 as heir and executings
+==> 9: # GOAL:   on CPUs 0 -1 respectively
+==> 10: cpus
+=== CPU Status
+          EXECUTING      /   HEIR             / SWITCH NEEDED
+  CPU 0: 0x0a010001 @  3 / 0x0a010001 @  3          false
+  CPU 1: 0x0a010002 @  2 / 0x0a010002 @  2          false
+=== End of Ready Set of Threads
Index: schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_case3.scen
===================================================================
--- schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_case3.scen	(revision 9f3c8eba59c36e6cfa6d1028c288bb8090a460e2)
+++ schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_case3.scen	(revision 9f3c8eba59c36e6cfa6d1028c288bb8090a460e2)
@@ -0,0 +1,10 @@
+#
+#  
+#
+rtems_init 2
+task_create smp1 3 -a 1 
+task_create smp2 2 -a 2
+
+# GOAL: want 0x0a010001 - 0x0a010002 as heir and executings
+# GOAL:   on CPUs 0 -1 respectively
+cpus
Index: schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_case4.expected
===================================================================
--- schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_case4.expected	(revision 9f3c8eba59c36e6cfa6d1028c288bb8090a460e2)
+++ schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_case4.expected	(revision 9f3c8eba59c36e6cfa6d1028c288bb8090a460e2)
@@ -0,0 +1,33 @@
+Script File               : scenarios/cpus2_affinity_case4.scen
+verbose                   : 1
+==> 1: #
+==> 2: #  
+==> 3: #
+==> 4: rtems_init 2
+  CPU 0: Thread Heir 0x09010001 priority=255
+  CPU 0: Thread Executing 0x09010001 priority=255
+  CPU 1: Thread Heir 0x09010002 priority=255
+  CPU 1: Thread Executing 0x09010002 priority=255
+==> 5: task_create smp1 3 -a 2 
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp1) created: id=0x0a010001, priority=3
+Task (0x0a010001) Set affinity=0x00000002
+Task (smp1) starting: id=0x0a010001, priority=3
+  CPU 1: Thread Heir 0x0a010001 priority=3
+  CPU 1: Thread Executing 0x0a010001 priority=3
+==> 6: task_create smp2 2 -a 1
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp2) created: id=0x0a010002, priority=2
+Task (0x0a010002) Set affinity=0x00000001
+Task (smp2) starting: id=0x0a010002, priority=2
+  CPU 0: Thread Heir 0x0a010002 priority=2
+  CPU 0: Thread Executing 0x0a010002 priority=2
+==> 7: 
+==> 8: # GOAL: want 0x0a010002 - 0x0a010001 as heir and executings
+==> 9: # GOAL:   on CPUs 0 -1 respectively
+==> 10: cpus
+=== CPU Status
+          EXECUTING      /   HEIR             / SWITCH NEEDED
+  CPU 0: 0x0a010002 @  2 / 0x0a010002 @  2          false
+  CPU 1: 0x0a010001 @  3 / 0x0a010001 @  3          false
+=== End of Ready Set of Threads
Index: schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_case4.scen
===================================================================
--- schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_case4.scen	(revision 9f3c8eba59c36e6cfa6d1028c288bb8090a460e2)
+++ schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_case4.scen	(revision 9f3c8eba59c36e6cfa6d1028c288bb8090a460e2)
@@ -0,0 +1,10 @@
+#
+#  
+#
+rtems_init 2
+task_create smp1 3 -a 2 
+task_create smp2 2 -a 1
+
+# GOAL: want 0x0a010002 - 0x0a010001 as heir and executings
+# GOAL:   on CPUs 0 -1 respectively
+cpus
Index: schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_exercise_affinity_api.expected
===================================================================
--- schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_exercise_affinity_api.expected	(revision 9f3c8eba59c36e6cfa6d1028c288bb8090a460e2)
+++ schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_exercise_affinity_api.expected	(revision 9f3c8eba59c36e6cfa6d1028c288bb8090a460e2)
@@ -0,0 +1,79 @@
+Script File               : scenarios/cpus4_exercise_affinity_api.scen
+verbose                   : 1
+==> 1: #
+==> 2: #  Verify that affinity APIs work with the right values
+==> 3: #
+==> 4: rtems_init 4
+  CPU 0: Thread Heir 0x09010001 priority=255
+  CPU 0: Thread Executing 0x09010001 priority=255
+  CPU 1: Thread Heir 0x09010002 priority=255
+  CPU 1: Thread Executing 0x09010002 priority=255
+  CPU 2: Thread Heir 0x09010003 priority=255
+  CPU 2: Thread Executing 0x09010003 priority=255
+  CPU 3: Thread Heir 0x09010004 priority=255
+  CPU 3: Thread Executing 0x09010004 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
+  CPU 3: Thread Heir 0x0a010001 priority=3
+  CPU 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
+  CPU 2: Thread Heir 0x0a010002 priority=6
+  CPU 2: Thread Executing 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
+  CPU 1: Thread Heir 0x0a010003 priority=7
+  CPU 1: Thread Executing 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
+  CPU 0: Thread Heir 0x0a010004 priority=8
+  CPU 0: Thread Executing 0x0a010004 priority=8
+==> 9: task_create smp5 10
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp5) created: id=0x0a010005, priority=10
+Task (smp5) starting: id=0x0a010005, priority=10
+==> 10: dispatch
+==> 11: # GOAL: Tasks 0x0a010001 - 0x0a010004 as heir and executing
+==> 12: # GOAL:    on CPUs 1 - 4 respectively
+==> 13: cpus
+=== CPU Status
+          EXECUTING      /   HEIR             / SWITCH NEEDED
+  CPU 0: 0x0a010004 @  8 / 0x0a010004 @  8          false
+  CPU 1: 0x0a010003 @  7 / 0x0a010003 @  7          false
+  CPU 2: 0x0a010002 @  6 / 0x0a010002 @  6          false
+  CPU 3: 0x0a010001 @  3 / 0x0a010001 @  3          false
+=== End of Ready Set of Threads
+==> 14: 
+==> 15: # GOAL: These should work OK and change the affinity
+==> 16: task_get_affinity smp5
+Task (0x0a010005) Get affinity=0x0000000f
+==> 17: task_set_affinity smp5 0x01
+Task (0x0a010005) Set affinity=0x00000001
+==> 18: task_get_affinity smp5
+Task (0x0a010005) Get affinity=0x00000001
+==> 19: task_set_affinity smp5 0x02
+Task (0x0a010005) Set affinity=0x00000002
+==> 20: task_get_affinity smp5
+Task (0x0a010005) Get affinity=0x00000002
+==> 21: task_set_affinity smp5 0x04
+Task (0x0a010005) Set affinity=0x00000004
+==> 22: task_get_affinity smp5
+Task (0x0a010005) Get affinity=0x00000004
+==> 23: task_set_affinity smp5 0x08
+Task (0x0a010005) Set affinity=0x00000008
+==> 24: task_get_affinity smp5
+Task (0x0a010005) Get affinity=0x00000008
+==> 25: 
+==> 26: # GOAL This should fail.
+==> 27: task_set_affinity smp5 0x10
+==> 28: task_get_affinity smp5
+Task (0x0a010005) Get affinity=0x00000008
+==> 29: 
