Index: cpukit/score/Makefile.am
===================================================================
--- cpukit/score/Makefile.am	(revision 13ab94be6ce3130c55ebb57fa96406d6b6e8c2b8)
+++ cpukit/score/Makefile.am	(revision 9db8705cc8ad2863dc0173b846783487742b313e)
@@ -30,4 +30,6 @@
 include_rtems_score_HEADERS += include/rtems/score/coresem.h
 include_rtems_score_HEADERS += include/rtems/score/coresemimpl.h
+include_rtems_score_HEADERS += include/rtems/score/cpuset.h
+include_rtems_score_HEADERS += include/rtems/score/cpusetimpl.h
 include_rtems_score_HEADERS += include/rtems/score/heap.h
 include_rtems_score_HEADERS += include/rtems/score/heapimpl.h
@@ -125,4 +127,6 @@
 libscore_a_SOURCES += src/schedulersmpstartidle.c
 libscore_a_SOURCES += src/smp.c
+libscore_a_SOURCES += src/cpuset.c
+libscore_a_SOURCES += src/cpusetprintsupport.c
 endif
 
Index: cpukit/score/include/rtems/score/cpuset.h
===================================================================
--- cpukit/score/include/rtems/score/cpuset.h	(revision 9db8705cc8ad2863dc0173b846783487742b313e)
+++ cpukit/score/include/rtems/score/cpuset.h	(revision 9db8705cc8ad2863dc0173b846783487742b313e)
@@ -0,0 +1,64 @@
+/**
+ *  @file  rtems/score/cpuset.h
+ *
+ *  @brief Information About the CPU Set
+ *
+ *  This include file contains all information about the thread
+ *  CPU Set.  
+ */
+
+/*
+ *  COPYRIGHT (c) 2014.
+ *  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.org/license/LICENSE.
+ */
+
+#ifndef _RTEMS_SCORE_CPUSET_H
+#define _RTEMS_SCORE_CPUSET_H
+
+#include <rtems/score/basedefs.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __RTEMS_HAVE_SYS_CPUSET_H__
+ 
+/**
+ *  @defgroup ScoreCpuset
+ *
+ *  @ingroup Score
+ *
+ *  This handler encapsulates functionality which is used in the management
+ *  of thread's CPU set.
+ */
+/**@{*/
+
+/**
+ *  The following defines the control block used to manage the cpuset.
+ *  The names do not include affinity in the front in case the set is
+ *  ever used for something other than affinity.  The usage in thread
+ *  uses the attribute affinity such that accesses will read 
+ *  thread->affinity.set.
+ */
+typedef struct {
+  /** This is the size of the set */
+  size_t                  setsize;
+  /** This is the preallocated space to store the set */
+  cpu_set_t               preallocated;
+  /** This is a pointer to the set in use */
+  cpu_set_t               *set;
+}   CPU_set_Control;
+
+#endif
+
+/**@}*/
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+/* end of include file */
Index: cpukit/score/include/rtems/score/cpusetimpl.h
===================================================================
--- cpukit/score/include/rtems/score/cpusetimpl.h	(revision 9db8705cc8ad2863dc0173b846783487742b313e)
+++ cpukit/score/include/rtems/score/cpusetimpl.h	(revision 9db8705cc8ad2863dc0173b846783487742b313e)
@@ -0,0 +1,83 @@
+/**
+ *  @file  rtems/score/cpusetimpl.h
+ *
+ *  @brief Implementation Prototypes for CPU Set
+ *
+ *  This file contains the implementation prototypes for
+ *  CPU set methods.
+ */
+
+/*
+ *  COPYRIGHT (c) 2014.
+ *  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.org/license/LICENSE.
+ */
+
+#ifndef _RTEMS_SCORE_CPUSETIMPL_H
+#define _RTEMS_SCORE_CPUSETIMPL_H
+
+#include <rtems/score/cpuset.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __RTEMS_HAVE_SYS_CPUSET_H__
+
+/**
+ * _CPU_set_Is_valid
+ *
+ * This routine validates a cpuset size corresponds to
+ * the system correct size, that at least one
+ * valid cpu is set and that no invalid cpus are set.
+ */
+int _CPU_set_Is_valid( const cpu_set_t *cpuset, size_t setsize );
+
+/**
+ * _CPU_set_Show
+ *
+ * This routine will print the value of the given cpuset.
+ */
+void _CPU_set_Show( const char *description, const cpu_set_t   *cpuset);
+
+/**
+ * _CPU_set_Show_default
+ *
+ * This routine will print the value of the default cpuset.
+ */
+void _CPU_set_Show_default( const char *description );
+
+/**
+ * _CPU_set_Default
+ *
+ * This routine returns the default cpuset for
+ * this system.
+ */
+const CPU_set_Control *_CPU_set_Default(void);
+
+#endif
+
+/**
+ * _CPU_set_Handler_initialization
+ *
+ * This routine validates a cpuset sets at least one
+ * valid cpu and that it does not set any invalid
+ * cpus.
+ */
+
+#if __RTEMS_HAVE_SYS_CPUSET_H__ && defined( RTEMS_SMP )
+void _CPU_set_Handler_initialization(void);
+#else
+#define _CPU_set_Handler_initialization()  do { } while ( 0 )
+#endif
+
+/**@}*/
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+/* end of include file */
Index: cpukit/score/include/rtems/score/thread.h
===================================================================
--- cpukit/score/include/rtems/score/thread.h	(revision 13ab94be6ce3130c55ebb57fa96406d6b6e8c2b8)
+++ cpukit/score/include/rtems/score/thread.h	(revision 9db8705cc8ad2863dc0173b846783487742b313e)
@@ -31,4 +31,11 @@
 #include <rtems/score/threadq.h>
 #include <rtems/score/watchdog.h>
+
+#ifdef RTEMS_SMP
+#if __RTEMS_HAVE_SYS_CPUSET_H__
+#include <sys/cpuset.h>
+#include <rtems/score/cpuset.h>
+#endif
+#endif
 
 #ifdef __cplusplus
@@ -407,5 +414,16 @@
    */
   bool                                  is_executing;
-#endif
+
+#if __RTEMS_HAVE_SYS_CPUSET_H__
+  /**
+   *  @brief This field controls affinity attributes for this thread.
+   *
+   *  Affinity attributes indicate which cpus the thread can run on
+   *  in an SMP system.
+   */
+  CPU_set_Control                       affinity;
+#endif 
+#endif
+
 #if __RTEMS_ADA__
   /** This field is the GNAT self context pointer. */
Index: cpukit/score/preinstall.am
===================================================================
--- cpukit/score/preinstall.am	(revision 13ab94be6ce3130c55ebb57fa96406d6b6e8c2b8)
+++ cpukit/score/preinstall.am	(revision 9db8705cc8ad2863dc0173b846783487742b313e)
@@ -99,4 +99,12 @@
 	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/coresemimpl.h
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/coresemimpl.h
+
+$(PROJECT_INCLUDE)/rtems/score/cpuset.h: include/rtems/score/cpuset.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/cpuset.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/cpuset.h
+
+$(PROJECT_INCLUDE)/rtems/score/cpusetimpl.h: include/rtems/score/cpusetimpl.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/cpusetimpl.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/cpusetimpl.h
 
 $(PROJECT_INCLUDE)/rtems/score/heap.h: include/rtems/score/heap.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
Index: cpukit/score/src/cpuset.c
===================================================================
--- cpukit/score/src/cpuset.c	(revision 9db8705cc8ad2863dc0173b846783487742b313e)
+++ cpukit/score/src/cpuset.c	(revision 9db8705cc8ad2863dc0173b846783487742b313e)
@@ -0,0 +1,94 @@
+/**
+ * @file
+ *
+ * @ingroup ScoreCpuset
+ *
+ * @brief Routines to Control a CPU Set.
+ */
+
+/*
+ *  COPYRIGHT (c) 2014.
+ *  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.org/license/LICENSE.
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#ifdef __RTEMS_HAVE_SYS_CPUSET_H__
+#include <sys/cpuset.h>
+#include <rtems/score/cpusetimpl.h>
+#include <rtems/score/assert.h>
+#include <rtems/score/percpu.h>
+
+static CPU_set_Control cpuset_default;
+
+/*
+ * _CPU_set_Handler_initialization
+ */
+void _CPU_set_Handler_initialization()
+{
+  int i;
+  int max_cpus;
+
+  /* We do not support a cpu count over CPU_SETSIZE  */
+  max_cpus = _SMP_Get_processor_count();
+
+  /* This should never happen */
+  _Assert( max_cpus <= CPU_SETSIZE );
+
+  /*  Initialize the affinity to be the set of all available CPU's   */
+  cpuset_default.set     = &cpuset_default.preallocated;
+  cpuset_default.setsize = sizeof( *cpuset_default.set );
+  CPU_ZERO_S( cpuset_default.setsize, &cpuset_default.preallocated );
+
+  for (i=0; i<max_cpus; i++)  
+    CPU_SET_S(i, cpuset_default.setsize, cpuset_default.set );
+}
+
+/**
+ * _CPU_set_Is_valid
+ *
+ * This routine validates a cpuset size corresponds to
+ * the system correct size, that at least one
+ * valid cpu is set and that no invalid cpus are set.
+ */
+int _CPU_set_Is_valid( const cpu_set_t *cpuset, size_t setsize )
+{
+  cpu_set_t             temp;
+
+  if ( !cpuset )
+    return -1;
+
+  if (setsize != cpuset_default.setsize )
+    return -1;
+
+  /* Validate at least 1 valid cpu is set in cpuset */
+  CPU_AND_S( cpuset_default.setsize, &temp, cpuset, cpuset_default.set );
+
+  if ( CPU_COUNT_S( setsize, &temp ) == 0 )
+    return -1;
+
+  /* Validate that no invalid cpu's are set in cpuset */
+  if ( !CPU_EQUAL_S( setsize, &temp, cpuset ) )
+    return -1;
+
+  return 0;
+}
+
+/**
+ * _CPU_set_Default
+ *
+ * This routine returns the default cpuset.
+ */
+const CPU_set_Control *_CPU_set_Default() 
+{
+  return &cpuset_default;
+}
+#endif
+
+
Index: cpukit/score/src/cpusetprintsupport.c
===================================================================
--- cpukit/score/src/cpusetprintsupport.c	(revision 9db8705cc8ad2863dc0173b846783487742b313e)
+++ cpukit/score/src/cpusetprintsupport.c	(revision 9db8705cc8ad2863dc0173b846783487742b313e)
@@ -0,0 +1,84 @@
+/**
+ * @file
+ *
+ * @brief CPU Set Print Support Routines
+ * @ingroup ScoreCpuset
+ */
+
+/*
+ *  COPYRIGHT (c) 2014.
+ *  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.org/license/LICENSE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <inttypes.h>
+#include <rtems/bspIo.h>
+#include <rtems/score/cpusetimpl.h>
+
+#ifdef __RTEMS_HAVE_SYS_CPUSET_H__
+
+  void _CPU_set_Show_with_plugin(
+    void                  *context,
+    rtems_printk_plugin_t  print,
+    const char            *description, 
+    const cpu_set_t       *cpuset
+  );
+
+  /*
+   * _CPU_set_Show_with_plugin
+   *
+   * This routine shows cpuset cpuset using a
+   * print plugin .
+   */
+  void _CPU_set_Show_with_plugin(
+    void                  *context,
+    rtems_printk_plugin_t  print,
+    const char            *description, 
+    const cpu_set_t       *cpuset
+  )
+  {
+    int i;
+
+    if ( !print )
+      return;
+
+    (*print)(context ,"%s: ", description);
+    for(i=0; i<_NCPUWORDS; i++)
+      (*print)(context ,"%x", cpuset->__bits[i]);
+    (*print)(context ,"\n");
+  }
+
+  /*
+   * _CPU_set_Show
+   *
+   * This routine shows a cpuset using the
+   * printk plugin.
+   */
+  void _CPU_set_Show( const char *description, const cpu_set_t   *cpuset)
+  {
+    _CPU_set_Show_with_plugin( NULL, printk_plugin, description, cpuset );
+  }
+
+  /*
+   * _CPU_set_Show_default
+   *
+   * This routine shows the default cpuset.
+   */
+ void _CPU_set_Show_default( const char *description )
+  {
+    const CPU_set_Control *ctl;
+    ctl = _CPU_set_Default();
+    _CPU_set_Show( description, ctl->set );  
+  }
+#endif
Index: cpukit/score/src/threadinitialize.c
===================================================================
--- cpukit/score/src/threadinitialize.c	(revision 13ab94be6ce3130c55ebb57fa96406d6b6e8c2b8)
+++ cpukit/score/src/threadinitialize.c	(revision 9db8705cc8ad2863dc0173b846783487742b313e)
@@ -6,5 +6,5 @@
  */
 /*
- *  COPYRIGHT (c) 1989-2011.
+ *  COPYRIGHT (c) 1989-2014.
  *  On-Line Applications Research Corporation (OAR).
  *
@@ -25,4 +25,5 @@
 #include <rtems/score/watchdogimpl.h>
 #include <rtems/score/wkspace.h>
+#include <rtems/score/cpusetimpl.h>
 #include <rtems/config.h>
 
@@ -207,4 +208,8 @@
   /* Initialize the cpu field for the non-SMP schedulers */
   the_thread->cpu                     = _Per_CPU_Get_by_index( 0 );
+#if __RTEMS_HAVE_SYS_CPUSET_H__
+   the_thread->affinity               = *(_CPU_set_Default());
+   the_thread->affinity.set           = &the_thread->affinity.preallocated;
+#endif
 #endif
 
