Index: c/src/exec/rtems/headers/message.h
===================================================================
--- c/src/exec/rtems/headers/message.h	(revision b3ac6a8dfe10aeaf3a9c59fd145bddfff119480e)
+++ c/src/exec/rtems/headers/message.h	(revision 3652ad356bf13abe0963c992cbbda96476d31609)
@@ -40,58 +40,5 @@
 #include <rtems/rtems/attr.h>
 #include <rtems/core/threadq.h>
-
-/*
- *  The following defines the data types needed to manipulate
- *  the contents of message buffers.
- *  Since msgs are variable length we just make a ptr to 1.
- */
-
-typedef struct {
-    unsigned32  size;
-
-#ifndef __cplusplus
-                               /* NOTE:   [0] is gcc specific,
-                                *   but specifically disallowed by ANSI STD C++
-                                * g++ warns about it, so we #ifdef it out to
-                                * get rid of warnings when compiled by g++.
-                                */
-    unsigned32  buffer[0];
-#endif
-
-} Message_queue_Buffer;
-
-/*
- *  The following records define the organization of a message
- *  buffer.
- */
-
-typedef struct {
-  Chain_Node           Node;
-  Message_queue_Buffer Contents;
-}   Message_queue_Buffer_control;
-
-/*
- *  The following records define the control block used to manage
- *  each message queue.
- */
-
-typedef struct {
-  Objects_Control      Object;
-  Thread_queue_Control Wait_queue;
-  rtems_attribute      attribute_set;
-  unsigned32           maximum_pending_messages;
-  unsigned32           number_of_pending_messages;
-  unsigned32           maximum_message_size;
-  Chain_Control        Pending_messages;
-  Message_queue_Buffer *message_buffers;
-  Chain_Control        Inactive_messages;
-}   Message_queue_Control;
-
-/*
- *  The following defines the information control block used to
- *  manage this class of objects.
- */
-
-EXTERN Objects_Information  _Message_queue_Information;
+#include <rtems/core/coremsg.h>
 
 /*
@@ -100,9 +47,27 @@
  *  in a send or urgent fashion.
  */
-
+ 
 typedef enum {
   MESSAGE_QUEUE_SEND_REQUEST   = 0,
   MESSAGE_QUEUE_URGENT_REQUEST = 1
 }  Message_queue_Submit_types;
+
+/*
+ *  The following records define the control block used to manage
+ *  each message queue.
+ */
+
+typedef struct {
+  Objects_Control             Object;
+  rtems_attribute             attribute_set;
+  CORE_message_queue_Control  message_queue;
+}   Message_queue_Control;
+
+/*
+ *  The following defines the information control block used to
+ *  manage this class of objects.
+ */
+
+EXTERN Objects_Information  _Message_queue_Information;
 
 /*
@@ -256,5 +221,5 @@
   Objects_Id            id,
   void                 *buffer,
-  unsigned32           *size_p,
+  unsigned32           *size,
   unsigned32            option_set,
   rtems_interval        timeout
@@ -278,59 +243,16 @@
 
 /*
- *  _Message_queue_Copy_buffer
- *
- *  DESCRIPTION:
- *
- *  This routine copies the contents of the source message buffer
- *  to the destination message buffer.
- */
-
-STATIC INLINE void _Message_queue_Copy_buffer (
-  void      *source,
-  void      *destination,
-  unsigned32 size
-);
-
-/*
- *  _Message_queue_Seize
- *
- *  DESCRIPTION:
- *
- *  This routine attempts to receive a message from the_message_queue.
- *  If a message is available or if the RTEMS_NO_WAIT option is enabled in
- *  option_set, then the routine returns.  Otherwise, the calling task
- *  is blocked until a message is available.  If a message is returned
- *  to the task, then buffer will contain its contents.
- */
-
-boolean _Message_queue_Seize(
-  Message_queue_Control *the_message_queue,
-  unsigned32             option_set,
-  void                  *buffer,
-  unsigned32            *size_p
-);
-
-/*
- *  _Message_queue_Flush_support
- *
- *  DESCRIPTION:
- *
- *  This routine flushes all outstanding messages and returns
- *  them to the inactive message chain.
- */
-
-unsigned32 _Message_queue_Flush_support(
-  Message_queue_Control *the_message_queue
-);
-
-/*
  *  _Message_queue_Submit
  *
  *  DESCRIPTION:
  *
- *  This routine provides the common foundation for the
- *  rtems_message_queue_send and rtems_message_queue_urgent directives.
- */
-
+ *  This routine implements the directives rtems_message_queue_send
+ *  and rtems_message_queue_urgent.  It processes a message that is
+ *  to be submitted to the designated message queue.  The message will
+ *  either be processed as a send send message which it will be inserted
+ *  at the rear of the queue or it will be processed as an urgent message
+ *  which will be inserted at the front of the queue.
+ */
+ 
 rtems_status_code _Message_queue_Submit(
   Objects_Id                  id,
@@ -338,74 +260,4 @@
   unsigned32                  size,
   Message_queue_Submit_types  submit_type
-);
-
-/*
- *  _Message_queue_Allocate_message_buffer
- *
- *  DESCRIPTION:
- *
- *  This function allocates a message buffer from the inactive
- *  message buffer chain.
- */
-
-STATIC INLINE Message_queue_Buffer_control *
-  _Message_queue_Allocate_message_buffer (
-   Message_queue_Control *the_message_queue
-);
-
-/*
- *  _Message_queue_Free_message_buffer
- *
- *  DESCRIPTION:
- *
- *  This routine frees a message buffer to the inactive
- *  message buffer chain.
- */
-
-STATIC INLINE void _Message_queue_Free_message_buffer (
-  Message_queue_Control        *the_message_queue,
-  Message_queue_Buffer_control *the_message
-);
-
-/*
- *  _Message_queue_Get_pending_message
- *
- *  DESCRIPTION:
- *
- *  This function removes the first message from the_message_queue
- *  and returns a pointer to it.
- */
-
-STATIC INLINE
-  Message_queue_Buffer_control *_Message_queue_Get_pending_message (
-  Message_queue_Control *the_message_queue
-);
-
-/*
- *  _Message_queue_Append
- *
- *  DESCRIPTION:
- *
- *  This routine places the_message at the rear of the outstanding
- *  messages on the_message_queue.
- */
-
-STATIC INLINE void _Message_queue_Append (
-  Message_queue_Control        *the_message_queue,
-  Message_queue_Buffer_control *the_message
-);
-
-/*
- *  _Message_queue_Prepend
- *
- *  DESCRIPTION:
- *
- *  This routine places the_message at the rear of the outstanding
- *  messages on the_message_queue.
- */
-
-STATIC INLINE void _Message_queue_Prepend (
-  Message_queue_Control        *the_message_queue,
-  Message_queue_Buffer_control *the_message
 );
 
@@ -470,4 +322,33 @@
 );
 
+/*
+ *  _Message_queue_Translate_core_message_queue_return_code
+ *
+ *  DESCRIPTION:
+ *
+ *  This function returns a RTEMS status code based on the core message queue
+ *  status code specified.
+ */
+ 
+rtems_status_code _Message_queue_Translate_core_message_queue_return_code (
+  unsigned32 the_message_queue_status
+);
+
+/*
+ *
+ *  _Message_queue_Core_message_queue_mp_support
+ *
+ *  Input parameters:
+ *    the_thread - the remote thread the message was submitted to
+ *    id         - id of the message queue
+ *
+ *  Output parameters: NONE
+ */
+ 
+void  _Message_queue_Core_message_queue_mp_support (
+  Thread_Control *the_thread,
+  Objects_Id      id
+);
+
 #include <rtems/rtems/message.inl>
 #include <rtems/rtems/msgmp.h>
Index: c/src/exec/rtems/headers/msgmp.h
===================================================================
--- c/src/exec/rtems/headers/msgmp.h	(revision b3ac6a8dfe10aeaf3a9c59fd145bddfff119480e)
+++ c/src/exec/rtems/headers/msgmp.h	(revision 3652ad356bf13abe0963c992cbbda96476d31609)
@@ -64,5 +64,5 @@
   unsigned32                         size;
   unsigned32                         pad0;
-  Message_queue_Buffer               Buffer;
+  CORE_message_queue_Buffer          Buffer;
 }   Message_queue_MP_Packet;
 
Index: c/src/exec/rtems/include/rtems/rtems/message.h
===================================================================
--- c/src/exec/rtems/include/rtems/rtems/message.h	(revision b3ac6a8dfe10aeaf3a9c59fd145bddfff119480e)
+++ c/src/exec/rtems/include/rtems/rtems/message.h	(revision 3652ad356bf13abe0963c992cbbda96476d31609)
@@ -40,58 +40,5 @@
 #include <rtems/rtems/attr.h>
 #include <rtems/core/threadq.h>
-
-/*
- *  The following defines the data types needed to manipulate
- *  the contents of message buffers.
- *  Since msgs are variable length we just make a ptr to 1.
- */
-
-typedef struct {
-    unsigned32  size;
-
-#ifndef __cplusplus
-                               /* NOTE:   [0] is gcc specific,
-                                *   but specifically disallowed by ANSI STD C++
-                                * g++ warns about it, so we #ifdef it out to
-                                * get rid of warnings when compiled by g++.
-                                */
-    unsigned32  buffer[0];
-#endif
-
-} Message_queue_Buffer;
-
-/*
- *  The following records define the organization of a message
- *  buffer.
- */
-
-typedef struct {
-  Chain_Node           Node;
-  Message_queue_Buffer Contents;
-}   Message_queue_Buffer_control;
-
-/*
- *  The following records define the control block used to manage
- *  each message queue.
- */
-
-typedef struct {
-  Objects_Control      Object;
-  Thread_queue_Control Wait_queue;
-  rtems_attribute      attribute_set;
-  unsigned32           maximum_pending_messages;
-  unsigned32           number_of_pending_messages;
-  unsigned32           maximum_message_size;
-  Chain_Control        Pending_messages;
-  Message_queue_Buffer *message_buffers;
-  Chain_Control        Inactive_messages;
-}   Message_queue_Control;
-
-/*
- *  The following defines the information control block used to
- *  manage this class of objects.
- */
-
-EXTERN Objects_Information  _Message_queue_Information;
+#include <rtems/core/coremsg.h>
 
 /*
@@ -100,9 +47,27 @@
  *  in a send or urgent fashion.
  */
-
+ 
 typedef enum {
   MESSAGE_QUEUE_SEND_REQUEST   = 0,
   MESSAGE_QUEUE_URGENT_REQUEST = 1
 }  Message_queue_Submit_types;
+
+/*
+ *  The following records define the control block used to manage
+ *  each message queue.
+ */
+
+typedef struct {
+  Objects_Control             Object;
+  rtems_attribute             attribute_set;
+  CORE_message_queue_Control  message_queue;
+}   Message_queue_Control;
+
+/*
+ *  The following defines the information control block used to
+ *  manage this class of objects.
+ */
+
+EXTERN Objects_Information  _Message_queue_Information;
 
 /*
@@ -256,5 +221,5 @@
   Objects_Id            id,
   void                 *buffer,
-  unsigned32           *size_p,
+  unsigned32           *size,
   unsigned32            option_set,
   rtems_interval        timeout
@@ -278,59 +243,16 @@
 
 /*
- *  _Message_queue_Copy_buffer
- *
- *  DESCRIPTION:
- *
- *  This routine copies the contents of the source message buffer
- *  to the destination message buffer.
- */
-
-STATIC INLINE void _Message_queue_Copy_buffer (
-  void      *source,
-  void      *destination,
-  unsigned32 size
-);
-
-/*
- *  _Message_queue_Seize
- *
- *  DESCRIPTION:
- *
- *  This routine attempts to receive a message from the_message_queue.
- *  If a message is available or if the RTEMS_NO_WAIT option is enabled in
- *  option_set, then the routine returns.  Otherwise, the calling task
- *  is blocked until a message is available.  If a message is returned
- *  to the task, then buffer will contain its contents.
- */
-
-boolean _Message_queue_Seize(
-  Message_queue_Control *the_message_queue,
-  unsigned32             option_set,
-  void                  *buffer,
-  unsigned32            *size_p
-);
-
-/*
- *  _Message_queue_Flush_support
- *
- *  DESCRIPTION:
- *
- *  This routine flushes all outstanding messages and returns
- *  them to the inactive message chain.
- */
-
-unsigned32 _Message_queue_Flush_support(
-  Message_queue_Control *the_message_queue
-);
-
-/*
  *  _Message_queue_Submit
  *
  *  DESCRIPTION:
  *
- *  This routine provides the common foundation for the
- *  rtems_message_queue_send and rtems_message_queue_urgent directives.
- */
-
+ *  This routine implements the directives rtems_message_queue_send
+ *  and rtems_message_queue_urgent.  It processes a message that is
+ *  to be submitted to the designated message queue.  The message will
+ *  either be processed as a send send message which it will be inserted
+ *  at the rear of the queue or it will be processed as an urgent message
+ *  which will be inserted at the front of the queue.
+ */
+ 
 rtems_status_code _Message_queue_Submit(
   Objects_Id                  id,
@@ -338,74 +260,4 @@
   unsigned32                  size,
   Message_queue_Submit_types  submit_type
-);
-
-/*
- *  _Message_queue_Allocate_message_buffer
- *
- *  DESCRIPTION:
- *
- *  This function allocates a message buffer from the inactive
- *  message buffer chain.
- */
-
-STATIC INLINE Message_queue_Buffer_control *
-  _Message_queue_Allocate_message_buffer (
-   Message_queue_Control *the_message_queue
-);
-
-/*
- *  _Message_queue_Free_message_buffer
- *
- *  DESCRIPTION:
- *
- *  This routine frees a message buffer to the inactive
- *  message buffer chain.
- */
-
-STATIC INLINE void _Message_queue_Free_message_buffer (
-  Message_queue_Control        *the_message_queue,
-  Message_queue_Buffer_control *the_message
-);
-
-/*
- *  _Message_queue_Get_pending_message
- *
- *  DESCRIPTION:
- *
- *  This function removes the first message from the_message_queue
- *  and returns a pointer to it.
- */
-
-STATIC INLINE
-  Message_queue_Buffer_control *_Message_queue_Get_pending_message (
-  Message_queue_Control *the_message_queue
-);
-
-/*
- *  _Message_queue_Append
- *
- *  DESCRIPTION:
- *
- *  This routine places the_message at the rear of the outstanding
- *  messages on the_message_queue.
- */
-
-STATIC INLINE void _Message_queue_Append (
-  Message_queue_Control        *the_message_queue,
-  Message_queue_Buffer_control *the_message
-);
-
-/*
- *  _Message_queue_Prepend
- *
- *  DESCRIPTION:
- *
- *  This routine places the_message at the rear of the outstanding
- *  messages on the_message_queue.
- */
-
-STATIC INLINE void _Message_queue_Prepend (
-  Message_queue_Control        *the_message_queue,
-  Message_queue_Buffer_control *the_message
 );
 
@@ -470,4 +322,33 @@
 );
 
+/*
+ *  _Message_queue_Translate_core_message_queue_return_code
+ *
+ *  DESCRIPTION:
+ *
+ *  This function returns a RTEMS status code based on the core message queue
+ *  status code specified.
+ */
+ 
+rtems_status_code _Message_queue_Translate_core_message_queue_return_code (
+  unsigned32 the_message_queue_status
+);
+
+/*
+ *
+ *  _Message_queue_Core_message_queue_mp_support
+ *
+ *  Input parameters:
+ *    the_thread - the remote thread the message was submitted to
+ *    id         - id of the message queue
+ *
+ *  Output parameters: NONE
+ */
+ 
+void  _Message_queue_Core_message_queue_mp_support (
+  Thread_Control *the_thread,
+  Objects_Id      id
+);
+
 #include <rtems/rtems/message.inl>
 #include <rtems/rtems/msgmp.h>
Index: c/src/exec/rtems/include/rtems/rtems/msgmp.h
===================================================================
--- c/src/exec/rtems/include/rtems/rtems/msgmp.h	(revision b3ac6a8dfe10aeaf3a9c59fd145bddfff119480e)
+++ c/src/exec/rtems/include/rtems/rtems/msgmp.h	(revision 3652ad356bf13abe0963c992cbbda96476d31609)
@@ -64,5 +64,5 @@
   unsigned32                         size;
   unsigned32                         pad0;
-  Message_queue_Buffer               Buffer;
+  CORE_message_queue_Buffer          Buffer;
 }   Message_queue_MP_Packet;
 
Index: c/src/exec/rtems/inline/message.inl
===================================================================
--- c/src/exec/rtems/inline/message.inl	(revision b3ac6a8dfe10aeaf3a9c59fd145bddfff119480e)
+++ c/src/exec/rtems/inline/message.inl	(revision 3652ad356bf13abe0963c992cbbda96476d31609)
@@ -19,94 +19,4 @@
 
 #include <rtems/core/wkspace.h>
-
-/*PAGE
- *
- *  _Message_queue_Copy_buffer
- *
- */
-
-STATIC INLINE void _Message_queue_Copy_buffer (
-  void      *source,
-  void      *destination,
-  unsigned32 size
-)
-{
-  memcpy(destination, source, size);
-}
-
-/*PAGE
- *
- *  _Message_queue_Allocate_message_buffer
- *
- */
-
-STATIC INLINE Message_queue_Buffer_control *
-_Message_queue_Allocate_message_buffer (
-    Message_queue_Control *the_message_queue
-)
-{
-   return (Message_queue_Buffer_control *)
-     _Chain_Get( &the_message_queue->Inactive_messages );
-}
-
-/*PAGE
- *
- *  _Message_queue_Free_message_buffer
- *
- */
-
-STATIC INLINE void _Message_queue_Free_message_buffer (
-    Message_queue_Control        *the_message_queue,
-    Message_queue_Buffer_control *the_message
-)
-{
-  _Chain_Append( &the_message_queue->Inactive_messages, &the_message->Node );
-}
-
-/*PAGE
- *
- *  _Message_queue_Get_pending_message
- *
- */
-
-STATIC INLINE
-  Message_queue_Buffer_control *_Message_queue_Get_pending_message (
-  Message_queue_Control *the_message_queue
-)
-{
-  return (Message_queue_Buffer_control *)
-    _Chain_Get_unprotected( &the_message_queue->Pending_messages );
-}
-
-/*PAGE
- *
- *  _Message_queue_Append
- *
- */
-
-STATIC INLINE void _Message_queue_Append (
-  Message_queue_Control        *the_message_queue,
-  Message_queue_Buffer_control *the_message
-)
-{
-  _Chain_Append( &the_message_queue->Pending_messages, &the_message->Node );
-}
-
-/*PAGE
- *
- *  _Message_queue_Prepend
- *
- */
-
-STATIC INLINE void _Message_queue_Prepend (
-  Message_queue_Control        *the_message_queue,
-  Message_queue_Buffer_control *the_message
-)
-{
-  _Chain_Prepend(
-    &the_message_queue->Pending_messages,
-    &the_message->Node
-  );
-}
 
 /*PAGE
@@ -134,9 +44,4 @@
 )
 {
-  if (the_message_queue->message_buffers) {
-    _Workspace_Free((void *) the_message_queue->message_buffers);
-    the_message_queue->message_buffers = 0;
-  }
-  
   _Objects_Free( &_Message_queue_Information, &the_message_queue->Object );
 }
Index: c/src/exec/rtems/inline/rtems/rtems/message.inl
===================================================================
--- c/src/exec/rtems/inline/rtems/rtems/message.inl	(revision b3ac6a8dfe10aeaf3a9c59fd145bddfff119480e)
+++ c/src/exec/rtems/inline/rtems/rtems/message.inl	(revision 3652ad356bf13abe0963c992cbbda96476d31609)
@@ -19,94 +19,4 @@
 
 #include <rtems/core/wkspace.h>
-
-/*PAGE
- *
- *  _Message_queue_Copy_buffer
- *
- */
-
-STATIC INLINE void _Message_queue_Copy_buffer (
-  void      *source,
-  void      *destination,
-  unsigned32 size
-)
-{
-  memcpy(destination, source, size);
-}
-
-/*PAGE
- *
- *  _Message_queue_Allocate_message_buffer
- *
- */
-
-STATIC INLINE Message_queue_Buffer_control *
-_Message_queue_Allocate_message_buffer (
-    Message_queue_Control *the_message_queue
-)
-{
-   return (Message_queue_Buffer_control *)
-     _Chain_Get( &the_message_queue->Inactive_messages );
-}
-
-/*PAGE
- *
- *  _Message_queue_Free_message_buffer
- *
- */
-
-STATIC INLINE void _Message_queue_Free_message_buffer (
-    Message_queue_Control        *the_message_queue,
-    Message_queue_Buffer_control *the_message
-)
-{
-  _Chain_Append( &the_message_queue->Inactive_messages, &the_message->Node );
-}
-
-/*PAGE
- *
- *  _Message_queue_Get_pending_message
- *
- */
-
-STATIC INLINE
-  Message_queue_Buffer_control *_Message_queue_Get_pending_message (
-  Message_queue_Control *the_message_queue
-)
-{
-  return (Message_queue_Buffer_control *)
-    _Chain_Get_unprotected( &the_message_queue->Pending_messages );
-}
-
-/*PAGE
- *
- *  _Message_queue_Append
- *
- */
-
-STATIC INLINE void _Message_queue_Append (
-  Message_queue_Control        *the_message_queue,
-  Message_queue_Buffer_control *the_message
-)
-{
-  _Chain_Append( &the_message_queue->Pending_messages, &the_message->Node );
-}
-
-/*PAGE
- *
- *  _Message_queue_Prepend
- *
- */
-
-STATIC INLINE void _Message_queue_Prepend (
-  Message_queue_Control        *the_message_queue,
-  Message_queue_Buffer_control *the_message
-)
-{
-  _Chain_Prepend(
-    &the_message_queue->Pending_messages,
-    &the_message->Node
-  );
-}
 
 /*PAGE
@@ -134,9 +44,4 @@
 )
 {
-  if (the_message_queue->message_buffers) {
-    _Workspace_Free((void *) the_message_queue->message_buffers);
-    the_message_queue->message_buffers = 0;
-  }
-  
   _Objects_Free( &_Message_queue_Information, &the_message_queue->Object );
 }
Index: c/src/exec/rtems/macros/message.inl
===================================================================
--- c/src/exec/rtems/macros/message.inl	(revision b3ac6a8dfe10aeaf3a9c59fd145bddfff119480e)
+++ c/src/exec/rtems/macros/message.inl	(revision 3652ad356bf13abe0963c992cbbda96476d31609)
@@ -20,64 +20,4 @@
 /*PAGE
  *
- *  _Message_queue_Copy_buffer
- */
-
-#define _Message_queue_Copy_buffer( _source, _destination, _size ) \
-  memcpy( _destination, _source, _size)
-
-/*PAGE
- *
- *  _Message_queue_Allocate_message_buffer
- *
- */
-
-#define _Message_queue_Allocate_message_buffer( _the_message_queue ) \
-  (Message_queue_Buffer_control *) \
-    _Chain_Get( &(_the_message_queue)->Inactive_messages )
-
-/*PAGE
- *
- *  _Message_queue_Free_message_buffer
- *
- */
-
-#define _Message_queue_Free_message_buffer( _the_message_queue, _the_message ) \
-  _Chain_Append( \
-    &(_the_message_queue)->Inactive_messages, \
-    &(_the_message)->Node \
-  )
-
-/*PAGE
- *
- *  _Message_queue_Get_pending_message
- *
- */
-
-#define _Message_queue_Get_pending_message( _the_message_queue ) \
-   (Message_queue_Buffer_control *) \
-     _Chain_Get_unprotected( &(_the_message_queue)->Pending_messages )
-
-/*PAGE
- *
- *  _Message_queue_Append
- *
- */
-
-#define _Message_queue_Append( _the_message_queue, _the_message ) \
-   _Chain_Append( &(_the_message_queue)->Pending_messages, \
-                  &(_the_message)->Node )
-
-/*PAGE
- *
- *  _Message_queue_Prepend
- *
- */
-
-#define _Message_queue_Prepend( _the_message_queue, _the_message ) \
-   _Chain_Prepend( &(_the_message_queue)->Pending_messages, \
-                   &(_the_message)->Node )
-
-/*PAGE
- *
  *  _Message_queue_Is_null
  *
@@ -94,17 +34,5 @@
 
 #define _Message_queue_Free( _the_message_queue ) \
-  do { \
-    \
-    if ( (_the_message_queue)->message_buffers ) { \
-      _Workspace_Free((void *) (_the_message_queue)->message_buffers); \
-      (_the_message_queue)->message_buffers = 0; \
-    } \
-    \
-    _Objects_Free( \
-      &_Message_queue_Information, \
-      &(_the_message_queue)->Object \
-    ); \
-  } while ( 0 )
-
+  _Objects_Free( &_Message_queue_Information, &(_the_message_queue)->Object )
 
 /*PAGE
Index: c/src/exec/rtems/macros/rtems/rtems/message.inl
===================================================================
--- c/src/exec/rtems/macros/rtems/rtems/message.inl	(revision b3ac6a8dfe10aeaf3a9c59fd145bddfff119480e)
+++ c/src/exec/rtems/macros/rtems/rtems/message.inl	(revision 3652ad356bf13abe0963c992cbbda96476d31609)
@@ -20,64 +20,4 @@
 /*PAGE
  *
- *  _Message_queue_Copy_buffer
- */
-
-#define _Message_queue_Copy_buffer( _source, _destination, _size ) \
-  memcpy( _destination, _source, _size)
-
-/*PAGE
- *
- *  _Message_queue_Allocate_message_buffer
- *
- */
-
-#define _Message_queue_Allocate_message_buffer( _the_message_queue ) \
-  (Message_queue_Buffer_control *) \
-    _Chain_Get( &(_the_message_queue)->Inactive_messages )
-
-/*PAGE
- *
- *  _Message_queue_Free_message_buffer
- *
- */
-
-#define _Message_queue_Free_message_buffer( _the_message_queue, _the_message ) \
-  _Chain_Append( \
-    &(_the_message_queue)->Inactive_messages, \
-    &(_the_message)->Node \
-  )
-
-/*PAGE
- *
- *  _Message_queue_Get_pending_message
- *
- */
-
-#define _Message_queue_Get_pending_message( _the_message_queue ) \
-   (Message_queue_Buffer_control *) \
-     _Chain_Get_unprotected( &(_the_message_queue)->Pending_messages )
-
-/*PAGE
- *
- *  _Message_queue_Append
- *
- */
-
-#define _Message_queue_Append( _the_message_queue, _the_message ) \
-   _Chain_Append( &(_the_message_queue)->Pending_messages, \
-                  &(_the_message)->Node )
-
-/*PAGE
- *
- *  _Message_queue_Prepend
- *
- */
-
-#define _Message_queue_Prepend( _the_message_queue, _the_message ) \
-   _Chain_Prepend( &(_the_message_queue)->Pending_messages, \
-                   &(_the_message)->Node )
-
-/*PAGE
- *
  *  _Message_queue_Is_null
  *
@@ -94,17 +34,5 @@
 
 #define _Message_queue_Free( _the_message_queue ) \
-  do { \
-    \
-    if ( (_the_message_queue)->message_buffers ) { \
-      _Workspace_Free((void *) (_the_message_queue)->message_buffers); \
-      (_the_message_queue)->message_buffers = 0; \
-    } \
-    \
-    _Objects_Free( \
-      &_Message_queue_Information, \
-      &(_the_message_queue)->Object \
-    ); \
-  } while ( 0 )
-
+  _Objects_Free( &_Message_queue_Information, &(_the_message_queue)->Object )
 
 /*PAGE
Index: c/src/exec/rtems/src/msg.c
===================================================================
--- c/src/exec/rtems/src/msg.c	(revision b3ac6a8dfe10aeaf3a9c59fd145bddfff119480e)
+++ c/src/exec/rtems/src/msg.c	(revision 3652ad356bf13abe0963c992cbbda96476d31609)
@@ -15,17 +15,18 @@
 
 #include <rtems/system.h>
-#include <rtems/rtems/status.h>
-#include <rtems/rtems/attr.h>
+#include <rtems/sysstate.h>
 #include <rtems/core/chain.h>
 #include <rtems/core/isr.h>
-#include <rtems/rtems/message.h>
+#include <rtems/core/coremsg.h>
 #include <rtems/core/object.h>
-#include <rtems/rtems/options.h>
 #include <rtems/core/states.h>
-#include <rtems/rtems/support.h>
 #include <rtems/core/thread.h>
 #include <rtems/core/wkspace.h>
 #include <rtems/core/mpci.h>
-#include <rtems/sysstate.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/attr.h>
+#include <rtems/rtems/message.h>
+#include <rtems/rtems/options.h>
+#include <rtems/rtems/support.h>
 
 /*PAGE
@@ -73,54 +74,22 @@
  *
  *  Allocate a message queue and the space for its messages
+ * 
+ *  Input parameters:
+ *    the_message_queue - the message queue to allocate message buffers
+ *    count             - maximum message and reserved buffer count
+ *    max_message_size  - maximum size of each message
+ *
+ *  Output parameters:
+ *    the_message_queue - set if successful, NULL otherwise
  */
 
 Message_queue_Control *_Message_queue_Allocate (
-  unsigned32          count,
-  unsigned32          max_message_size
-)
-{
-    Message_queue_Control *mq = 0;
-    unsigned32 message_buffering_required;
-    unsigned32 allocated_message_size;
-
-    mq =
-      (Message_queue_Control *)_Objects_Allocate(&_Message_queue_Information);
-
-    if (mq == 0)
-        goto failed;
-
-    mq->maximum_message_size = max_message_size;
-
-    /*
-     * round size up to multiple of a ptr for chain init
-     */
-    
-    allocated_message_size = max_message_size;
-    if (allocated_message_size & (sizeof(unsigned32) - 1)) {
-        allocated_message_size += sizeof(unsigned32);
-        allocated_message_size &= ~(sizeof(unsigned32) - 1);
-    }
-    
-    message_buffering_required = 
-      count * (allocated_message_size + sizeof(Message_queue_Buffer_control));
-  
-    mq->message_buffers = 
-      (Message_queue_Buffer *) _Workspace_Allocate(message_buffering_required);
-
-    if (mq->message_buffers == 0)
-        goto failed;
-  
-    _Chain_Initialize
-      (&mq->Inactive_messages,
-      mq->message_buffers,
-      count,
-      allocated_message_size + sizeof(Message_queue_Buffer_control)
-    );
-    return mq;
-
-failed:
-    if (mq)
-        _Message_queue_Free(mq);
-    return (Message_queue_Control *) 0;
+  unsigned32           count,
+  unsigned32           max_message_size
+)
+{
+  return 
+    (Message_queue_Control *)_Objects_Allocate(&_Message_queue_Information);
+
 }
 
@@ -133,9 +102,9 @@
  *
  *  Input parameters:
- *    name          - user defined queue name
- *    count         - maximum message and reserved buffer count
+ *    name             - user defined queue name
+ *    count            - maximum message and reserved buffer count
  *    max_message_size - maximum size of each message
- *    attribute_set - process method
- *    id            - pointer to queue
+ *    attribute_set    - process method
+ *    id               - pointer to queue
  *
  *  Output parameters:
@@ -154,9 +123,11 @@
 {
   register Message_queue_Control *the_message_queue;
+  CORE_message_queue_Attributes   the_message_queue_attributes;
+  boolean                         is_global;
 
   if ( !rtems_is_name_valid( name ) )
     return RTEMS_INVALID_NAME;
 
-  if ( _Attributes_Is_global( attribute_set ) && 
+  if ( (is_global = _Attributes_Is_global( attribute_set ) ) && 
        !_System_state_Is_multiprocessing )
     return RTEMS_MP_NOT_CONFIGURED;
@@ -175,14 +146,12 @@
    */
   
-  if ( _Attributes_Is_global( attribute_set ) &&
-       (_MPCI_table->maximum_packet_size < max_message_size))
-  {
-      return RTEMS_INVALID_SIZE;
-  }
+  if ( is_global && (_MPCI_table->maximum_packet_size < max_message_size) )
+    return RTEMS_INVALID_SIZE;
+
 #endif
        
   _Thread_Disable_dispatch();              /* protects object pointer */
 
-  the_message_queue = _Message_queue_Allocate(count, max_message_size);
+  the_message_queue = _Message_queue_Allocate( count, max_message_size );
 
   if ( !the_message_queue ) {
@@ -191,7 +160,7 @@
   }
 
-  if ( _Attributes_Is_global( attribute_set ) &&
-       !( _Objects_MP_Allocate_and_open( &_Message_queue_Information, name,
-                            the_message_queue->Object.id, FALSE ) ) ) {
+  if ( is_global &&
+    !( _Objects_MP_Allocate_and_open( &_Message_queue_Information,
+                              name, the_message_queue->Object.id, FALSE ) ) ) {
     _Message_queue_Free( the_message_queue );
     _Thread_Enable_dispatch();
@@ -199,20 +168,28 @@
   }
 
-  the_message_queue->maximum_pending_messages = count;
-
   the_message_queue->attribute_set = attribute_set;
-  the_message_queue->number_of_pending_messages = 0;
-
-  _Chain_Initialize_empty( &the_message_queue->Pending_messages );
-
-  _Thread_queue_Initialize(
-    &the_message_queue->Wait_queue,
-    OBJECTS_RTEMS_MESSAGE_QUEUES,
-    _Attributes_Is_priority( attribute_set ) ? 
-       THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO,
-    STATES_WAITING_FOR_MESSAGE,
-    _Message_queue_MP_Send_extract_proxy,
-    RTEMS_TIMEOUT
-  );
+
+  if (_Attributes_Is_priority( attribute_set ) )
+    the_message_queue_attributes.discipline = 
+                                      CORE_MESSAGE_QUEUE_DISCIPLINES_PRIORITY;
+  else
+    the_message_queue_attributes.discipline =
+                                      CORE_MESSAGE_QUEUE_DISCIPLINES_FIFO;
+
+  if ( ! _CORE_message_queue_Initialize(
+           &the_message_queue->message_queue,
+           OBJECTS_RTEMS_MESSAGE_QUEUES,
+           &the_message_queue_attributes,
+           count,
+           max_message_size,
+           _Message_queue_MP_Send_extract_proxy ) ) {
+    if ( is_global )
+        _Objects_MP_Close(
+          &_Message_queue_Information, the_message_queue->Object.id);
+
+    _Message_queue_Free( the_message_queue );
+    _Thread_Enable_dispatch();
+    return RTEMS_TOO_MANY;
+  }
 
   _Objects_Open(
@@ -224,5 +201,5 @@
   *id = the_message_queue->Object.id;
 
-  if ( _Attributes_Is_global( attribute_set ) )
+  if ( is_global )
     _Message_queue_MP_Send_process_packet(
       MESSAGE_QUEUE_MP_ANNOUNCE_CREATE,
@@ -305,12 +282,9 @@
                       &the_message_queue->Object );
 
-      if ( the_message_queue->number_of_pending_messages != 0 )
-        (void) _Message_queue_Flush_support( the_message_queue );
-      else
-        _Thread_queue_Flush(
-          &the_message_queue->Wait_queue,
-          _Message_queue_MP_Send_object_was_deleted,
-          RTEMS_OBJECT_WAS_DELETED
-        );
+      _CORE_message_queue_Close(
+        &the_message_queue->message_queue,
+        _Message_queue_MP_Send_object_was_deleted,
+        CORE_MESSAGE_QUEUE_STATUS_WAS_DELETED
+      );
 
       _Message_queue_Free( the_message_queue );
@@ -347,4 +321,5 @@
  *    id     - pointer to message queue
  *    buffer - pointer to message buffer
+ *    size   - size of message to sent urgently
  *
  *  Output parameters:
@@ -359,5 +334,5 @@
 )
 {
-  return _Message_queue_Submit(id, buffer, size, MESSAGE_QUEUE_SEND_REQUEST);
+  return( _Message_queue_Submit(id, buffer, size, MESSAGE_QUEUE_SEND_REQUEST) );
 }
 
@@ -372,8 +347,9 @@
  *    id     - pointer to message queue
  *    buffer - pointer to message buffer
+ *    size   - size of message to sent urgently
  *
  *  Output parameters:
  *    RTEMS_SUCCESSFUL - if successful
- *    error code - if unsuccessful
+ *    error code       - if unsuccessful
  */
 
@@ -384,5 +360,5 @@
 )
 {
-  return _Message_queue_Submit(id, buffer, size, MESSAGE_QUEUE_URGENT_REQUEST);
+  return(_Message_queue_Submit(id, buffer, size, MESSAGE_QUEUE_URGENT_REQUEST));
 }
 
@@ -397,9 +373,10 @@
  *    id     - pointer to message queue
  *    buffer - pointer to message buffer
+ *    size   - size of message to broadcast
  *    count  - pointer to area to store number of threads made ready
  *
  *  Output parameters:
  *    count             - number of threads made ready
- *    RTEMS_SUCCESSFUL - if successful
+ *    RTEMS_SUCCESSFUL  - if successful
  *    error code        - if unsuccessful
  */
@@ -414,6 +391,5 @@
   register Message_queue_Control *the_message_queue;
   Objects_Locations               location;
-  Thread_Control                 *the_thread;
-  unsigned32                      number_broadcasted;
+  CORE_message_queue_Status       core_status;
 
   the_message_queue = _Message_queue_Get( id, &location );
@@ -435,42 +411,19 @@
 
     case OBJECTS_LOCAL:
-    {
-      Thread_Wait_information *waitp;
-      unsigned32 constrained_size;
-
-      number_broadcasted = 0;
-      while ( (the_thread =
-                 _Thread_queue_Dequeue(&the_message_queue->Wait_queue)) ) {
-        waitp = &the_thread->Wait;
-        number_broadcasted += 1;
-
-        constrained_size = size;
-        if (size > the_message_queue->maximum_message_size)
-            constrained_size = the_message_queue->maximum_message_size;
-
-        _Message_queue_Copy_buffer(buffer,
-                                   waitp->return_argument,
-                                   constrained_size);
-
-        *(rtems_unsigned32 *)the_thread->Wait.return_argument_1 = size;
-        
-        if ( !_Objects_Is_local_id( the_thread->Object.id ) ) {
-          the_thread->receive_packet->return_code = RTEMS_SUCCESSFUL;
-
-          _Message_queue_MP_Send_response_packet(
-            MESSAGE_QUEUE_MP_RECEIVE_RESPONSE,
-            id,
-            the_thread
-          );
-        }
-      }
+      core_status = _CORE_message_queue_Broadcast(
+                      &the_message_queue->message_queue,
+                      buffer,
+                      size,
+                      id,
+                      _Message_queue_Core_message_queue_mp_support,
+                      count
+                    );
+                      
       _Thread_Enable_dispatch();
-      *count = number_broadcasted;
-      return RTEMS_SUCCESSFUL;
-    }
-
-    default:
-      return RTEMS_INTERNAL_ERROR;
-  }
+      return 
+        _Message_queue_Translate_core_message_queue_return_code( core_status );
+
+  }
+  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
 }
 
@@ -485,4 +438,5 @@
  *    id         - queue id
  *    buffer     - pointer to message buffer
+ *    size       - size of message receive
  *    option_set - options on receive
  *    timeout    - number of ticks to wait
@@ -490,5 +444,5 @@
  *  Output parameters:
  *    RTEMS_SUCCESSFUL - if successful
- *    error code        - if unsuccessful
+ *    error code       - if unsuccessful
  */
 
@@ -496,5 +450,5 @@
   Objects_Id            id,
   void                 *buffer,
-  unsigned32           *size_p,
+  unsigned32           *size,
   unsigned32            option_set,
   rtems_interval        timeout
@@ -503,4 +457,5 @@
   register Message_queue_Control *the_message_queue;
   Objects_Locations               location;
+  boolean                         wait;
 
   the_message_queue = _Message_queue_Get( id, &location );
@@ -515,5 +470,5 @@
           id,
           buffer,
-          size_p,
+          size,
           option_set,
           timeout
@@ -521,13 +476,21 @@
 
     case OBJECTS_LOCAL:
-      if ( ! _Message_queue_Seize(the_message_queue,
-                                  option_set,
-                                  buffer,
-                                  size_p))
-      {
-        _Thread_queue_Enqueue( &the_message_queue->Wait_queue, timeout );
-      }
+      if ( _Options_Is_no_wait( option_set ) )
+        wait = FALSE;
+      else
+        wait = TRUE;
+ 
+      _CORE_message_queue_Seize(
+        &the_message_queue->message_queue,
+        the_message_queue->Object.id,
+        buffer,
+        size,
+        wait,
+        timeout
+      );
       _Thread_Enable_dispatch();
-      return _Thread_Executing->Wait.return_code;
+      return( _Message_queue_Translate_core_message_queue_return_code(
+                  _Thread_Executing->Wait.return_code ) );
+
   }
 
@@ -573,5 +536,5 @@
           id,
           0,                               /* buffer not used */
-          0,                               /* size_p */
+          0,                               /* size */
           0,                               /* option_set not used */
           MPCI_DEFAULT_TIMEOUT
@@ -579,8 +542,5 @@
 
     case OBJECTS_LOCAL:
-      if ( the_message_queue->number_of_pending_messages != 0 )
-        *count = _Message_queue_Flush_support( the_message_queue );
-      else
-        *count = 0;
+      *count = _CORE_message_queue_Flush( &the_message_queue->message_queue );
       _Thread_Enable_dispatch();
       return RTEMS_SUCCESSFUL;
@@ -592,123 +552,12 @@
 /*PAGE
  *
- *  _Message_queue_Seize
- *
- *  This kernel routine dequeues a message, copies the message buffer to
- *  a given destination buffer, and frees the message buffer to the
- *  inactive message pool.
- *
- *  Input parameters:
- *    the_message_queue - pointer to message queue
- *    option_set        - options on receive
- *    the_buffer        - pointer to message buffer to be filled
- *
- *  Output parameters:
- *    TRUE  - if message received or RTEMS_NO_WAIT and no message
- *    FALSE - if thread is to block
- *
- *  NOTE: Dependent on BUFFER_LENGTH
- *
- *  INTERRUPT LATENCY:
- *    available
- *    wait
- */
-
-boolean _Message_queue_Seize(
-  Message_queue_Control  *the_message_queue,
-  rtems_option            option_set,
-  void                   *buffer,
-  unsigned32             *size_p
-)
-{
-  ISR_Level                     level;
-  Message_queue_Buffer_control *the_message;
-  Thread_Control               *executing;
-
-  executing = _Thread_Executing;
-  executing->Wait.return_code = RTEMS_SUCCESSFUL;
-  _ISR_Disable( level );
-  if ( the_message_queue->number_of_pending_messages != 0 ) {
-    the_message_queue->number_of_pending_messages -= 1;
-
-    the_message = _Message_queue_Get_pending_message( the_message_queue );
-    _ISR_Enable( level );
-    *size_p = the_message->Contents.size;
-    _Message_queue_Copy_buffer( the_message->Contents.buffer, buffer, *size_p );
-    _Message_queue_Free_message_buffer(the_message_queue, the_message );
-    return( TRUE );
-  }
-
-  if ( _Options_Is_no_wait( option_set ) ) {
-    _ISR_Enable( level );
-    executing->Wait.return_code = RTEMS_UNSATISFIED;
-    return( TRUE );
-  }
-
-  the_message_queue->Wait_queue.sync = TRUE;
-  executing->Wait.queue              = &the_message_queue->Wait_queue;
-  executing->Wait.id                 = the_message_queue->Object.id;
-  executing->Wait.option             = option_set;
-  executing->Wait.return_argument    = (void *)buffer;
-  executing->Wait.return_argument_1  = (void *)size_p;
-  _ISR_Enable( level );
-  return FALSE;
-}
-
-/*PAGE
- *
- *  _Message_queue_Flush_support
- *
- *  This message manager routine removes all messages from a message queue
- *  and returns them to the inactive message pool.
- *
- *  Input parameters:
- *    the_message_queue - pointer to message queue
- *
- *  Output parameters:
- *    returns - number of messages placed on inactive chain
- *
- *  INTERRUPT LATENCY:
- *    only case
- */
-
-unsigned32 _Message_queue_Flush_support(
-  Message_queue_Control *the_message_queue
-)
-{
-  ISR_Level   level;
-  Chain_Node *inactive_first;
-  Chain_Node *message_queue_first;
-  Chain_Node *message_queue_last;
-  unsigned32  count;
-
-  _ISR_Disable( level );
-    inactive_first      = the_message_queue->Inactive_messages.first;
-    message_queue_first = the_message_queue->Pending_messages.first;
-    message_queue_last  = the_message_queue->Pending_messages.last;
-
-    the_message_queue->Inactive_messages.first = message_queue_first;
-    message_queue_last->next = inactive_first;
-    inactive_first->previous = message_queue_last;
-    message_queue_first->previous          =
-               _Chain_Head( &the_message_queue->Inactive_messages );
-
-    _Chain_Initialize_empty( &the_message_queue->Pending_messages );
-
-    count = the_message_queue->number_of_pending_messages;
-    the_message_queue->number_of_pending_messages = 0;
-  _ISR_Enable( level );
-  return count;
-}
-
-/*PAGE
- *
  *  _Message_queue_Submit
  *
- *  This routine implements the directives q_send and q_urgent.  It
- *  processes a message that is to be submitted to the designated
- *  message queue.  The message will either be processed as a send
- *  send message which it will be inserted at the rear of the queue
- *  or it will be processed as an urgent message which will be inserted
- *  at the front of the queue.
+ *  This routine implements the directives rtems_message_queue_send
+ *  and rtems_message_queue_urgent.  It processes a message that is
+ *  to be submitted to the designated message queue.  The message will
+ *  either be processed as a send send message which it will be inserted
+ *  at the rear of the queue or it will be processed as an urgent message
+ *  which will be inserted at the front of the queue.
  *
  *  Input parameters:
@@ -730,8 +579,7 @@
 )
 {
-  register Message_queue_Control *the_message_queue;
-  Objects_Locations               location;
-  Thread_Control                 *the_thread;
-  Message_queue_Buffer_control   *the_message;
+  register Message_queue_Control  *the_message_queue;
+  Objects_Locations                location;
+  CORE_message_queue_Status        core_status;
 
   the_message_queue = _Message_queue_Get( id, &location );
@@ -767,74 +615,100 @@
 
     case OBJECTS_LOCAL:
-      if (size > the_message_queue->maximum_message_size)
-      {
-          _Thread_Enable_dispatch();
-          return RTEMS_INVALID_SIZE;
-      }
-
-      /*
-       * Is there a thread currently waiting on this message queue?
-       */
-      
-      the_thread = _Thread_queue_Dequeue( &the_message_queue->Wait_queue );
-      if ( the_thread )
-      {
-        _Message_queue_Copy_buffer(
-          buffer,
-          the_thread->Wait.return_argument,
-          size
-        );
-        *(rtems_unsigned32 *)the_thread->Wait.return_argument_1 = size;
-        
-        if ( !_Objects_Is_local_id( the_thread->Object.id ) ) {
-          the_thread->receive_packet->return_code = RTEMS_SUCCESSFUL;
-
-          _Message_queue_MP_Send_response_packet(
-            MESSAGE_QUEUE_MP_RECEIVE_RESPONSE,
-            id,
-            the_thread
-          );
-
-        }
-        _Thread_Enable_dispatch();
-        return RTEMS_SUCCESSFUL;
-      }
-
-      /*
-       * No one waiting on this one currently.
-       * Allocate a message buffer and store it away
-       */
-
-      if ( the_message_queue->number_of_pending_messages ==
-           the_message_queue->maximum_pending_messages ) {
-        _Thread_Enable_dispatch();
-        return RTEMS_TOO_MANY;
-      }
-
-      the_message = _Message_queue_Allocate_message_buffer(the_message_queue);
-      if ( the_message == 0) {
-        _Thread_Enable_dispatch();
-        return RTEMS_UNSATISFIED;
-      }
-
-      _Message_queue_Copy_buffer( buffer, the_message->Contents.buffer, size );
-      the_message->Contents.size = size;
-      
-      the_message_queue->number_of_pending_messages += 1;
-
       switch ( submit_type ) {
         case MESSAGE_QUEUE_SEND_REQUEST:
-          _Message_queue_Append( the_message_queue, the_message );
+          core_status = _CORE_message_queue_Send(
+                          &the_message_queue->message_queue,
+                          buffer,
+                          size,
+                          id,
+                          _Message_queue_Core_message_queue_mp_support
+                        );
           break;
         case MESSAGE_QUEUE_URGENT_REQUEST:
-          _Message_queue_Prepend( the_message_queue, the_message );
+          core_status = _CORE_message_queue_Urgent(
+                          &the_message_queue->message_queue,
+                          buffer,
+                          size,
+                          id,
+                          _Message_queue_Core_message_queue_mp_support
+                        );
           break;
+        default:
+          core_status = CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL;
+          return RTEMS_INTERNAL_ERROR;   /* should never get here */
       }
 
       _Thread_Enable_dispatch();
+      return _Message_queue_Translate_core_message_queue_return_code(
+                core_status );
+          
+  }
+  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ *  _Message_queue_Translate_core_message_queue_return_code
+ *
+ *  Input parameters:
+ *    the_message_queue_status - message_queue status code to translate
+ *
+ *  Output parameters:
+ *    rtems status code - translated RTEMS status code
+ *
+ */
+ 
+rtems_status_code _Message_queue_Translate_core_message_queue_return_code (
+  unsigned32 the_message_queue_status
+)
+{
+  switch ( the_message_queue_status ) {
+    case  CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL:
       return RTEMS_SUCCESSFUL;
-          
-    default:
-      return RTEMS_INTERNAL_ERROR;       /* And they were such nice boys, too! */
-  }
-}
+    case  CORE_MESSAGE_QUEUE_STATUS_INVALID_SIZE:
+      return RTEMS_INVALID_SIZE;
+    case  CORE_MESSAGE_QUEUE_STATUS_TOO_MANY:
+      return RTEMS_TOO_MANY;
+    case CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED:
+      return RTEMS_UNSATISFIED;
+    case CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_NOWAIT:
+      return RTEMS_UNSATISFIED;
+    case CORE_MESSAGE_QUEUE_STATUS_WAS_DELETED:
+      return RTEMS_OBJECT_WAS_DELETED;
+    case CORE_MESSAGE_QUEUE_STATUS_TIMEOUT:
+      return RTEMS_TIMEOUT;
+    case THREAD_STATUS_PROXY_BLOCKING:
+      return THREAD_STATUS_PROXY_BLOCKING;
+  }
+  _Internal_error_Occurred(         /* XXX */
+    INTERNAL_ERROR_RTEMS_API,
+    TRUE,
+    the_message_queue_status
+  );
+  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
+}
+
+/*PAGE
+ *
+ *  _Message_queue_Core_message_queue_mp_support
+ *
+ *  Input parameters:
+ *    the_thread - the remote thread the message was submitted to
+ *    id         - id of the message queue
+ *
+ *  Output parameters: NONE
+ */
+ 
+void  _Message_queue_Core_message_queue_mp_support (
+  Thread_Control *the_thread,
+  Objects_Id      id
+)
+{
+  the_thread->receive_packet->return_code = RTEMS_SUCCESSFUL;
+ 
+  _Message_queue_MP_Send_response_packet(
+    MESSAGE_QUEUE_MP_RECEIVE_RESPONSE,
+    id,
+    the_thread
+  );
+}
Index: c/src/exec/rtems/src/msgmp.c
===================================================================
--- c/src/exec/rtems/src/msgmp.c	(revision b3ac6a8dfe10aeaf3a9c59fd145bddfff119480e)
+++ c/src/exec/rtems/src/msgmp.c	(revision 3652ad356bf13abe0963c992cbbda96476d31609)
@@ -134,7 +134,9 @@
       if (buffer) {
           the_packet->Buffer.size = *size_p;
-          _Message_queue_Copy_buffer(buffer,
-                                     the_packet->Buffer.buffer,
-                                     *size_p);
+          _CORE_message_queue_Copy_buffer(
+            buffer,
+            the_packet->Buffer.buffer,
+            *size_p
+          );
       }
 
@@ -311,5 +313,5 @@
            the_packet->size;
 
-        _Message_queue_Copy_buffer(
+        _CORE_message_queue_Copy_buffer(
           the_packet->Buffer.buffer,
           the_thread->Wait.return_argument,
Index: c/src/exec/rtems/src/sem.c
===================================================================
--- c/src/exec/rtems/src/sem.c	(revision b3ac6a8dfe10aeaf3a9c59fd145bddfff119480e)
+++ c/src/exec/rtems/src/sem.c	(revision 3652ad356bf13abe0963c992cbbda96476d31609)
@@ -117,13 +117,13 @@
 
   if ( !rtems_is_name_valid( name ) )
-    return ( RTEMS_INVALID_NAME );
+    return RTEMS_INVALID_NAME;
 
   if ( _Attributes_Is_global( attribute_set ) ) {
 
     if ( !_System_state_Is_multiprocessing )
-      return( RTEMS_MP_NOT_CONFIGURED );
+      return RTEMS_MP_NOT_CONFIGURED;
 
     if ( _Attributes_Is_inherit_priority( attribute_set ) )
-      return( RTEMS_NOT_DEFINED );
+      return RTEMS_NOT_DEFINED;
 
   } else if ( _Attributes_Is_inherit_priority( attribute_set ) ) {
@@ -131,10 +131,10 @@
     if ( ! ( _Attributes_Is_binary_semaphore( attribute_set ) &&
              _Attributes_Is_priority( attribute_set ) ) )
-      return( RTEMS_NOT_DEFINED );
+      return RTEMS_NOT_DEFINED;
 
   }
 
   if ( _Attributes_Is_binary_semaphore( attribute_set ) && ( count > 1 ) )
-    return( RTEMS_INVALID_NUMBER );
+    return RTEMS_INVALID_NUMBER;
 
   _Thread_Disable_dispatch();             /* prevents deletion */
@@ -144,5 +144,5 @@
   if ( !the_semaphore ) {
     _Thread_Enable_dispatch();
-    return( RTEMS_TOO_MANY );
+    return RTEMS_TOO_MANY;
   }
 
@@ -152,5 +152,5 @@
     _Semaphore_Free( the_semaphore );
     _Thread_Enable_dispatch();
-    return( RTEMS_TOO_MANY );
+    return RTEMS_TOO_MANY;
   }
 
@@ -211,5 +211,5 @@
     );
   _Thread_Enable_dispatch();
-  return( RTEMS_SUCCESSFUL );
+  return RTEMS_SUCCESSFUL;
 }
 
@@ -271,13 +271,13 @@
   switch ( location ) {
     case OBJECTS_ERROR:
-      return( RTEMS_INVALID_ID );
+      return RTEMS_INVALID_ID;
     case OBJECTS_REMOTE:
       _Thread_Dispatch();
-      return( RTEMS_ILLEGAL_ON_REMOTE_OBJECT );
+      return RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
     case OBJECTS_LOCAL:
       if ( _Attributes_Is_binary_semaphore( the_semaphore->attribute_set) ) { 
         if ( _CORE_mutex_Is_locked( &the_semaphore->Core_control.mutex ) ) {
           _Thread_Enable_dispatch();
-          return( RTEMS_RESOURCE_IN_USE );
+          return RTEMS_RESOURCE_IN_USE;
         }
         else
@@ -311,8 +311,8 @@
       }
       _Thread_Enable_dispatch();
-      return( RTEMS_SUCCESSFUL );
-  }
-
-  return( RTEMS_INTERNAL_ERROR );   /* unreached - only to remove warnings */
+      return RTEMS_SUCCESSFUL;
+  }
+
+  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
 }
 
@@ -346,5 +346,5 @@
   switch ( location ) {
     case OBJECTS_ERROR:
-      return( RTEMS_INVALID_ID );
+      return RTEMS_INVALID_ID;
     case OBJECTS_REMOTE:
       return _Semaphore_MP_Send_request_packet(
@@ -368,6 +368,6 @@
         );
         _Thread_Enable_dispatch();
-        return( _Semaphore_Translate_core_mutex_return_code( 
-                  _Thread_Executing->Wait.return_code ) );
+        return _Semaphore_Translate_core_mutex_return_code( 
+                  _Thread_Executing->Wait.return_code );
       } else {
         _CORE_semaphore_Seize(
@@ -378,10 +378,10 @@
         );
         _Thread_Enable_dispatch();
-        return( _Semaphore_Translate_core_semaphore_return_code( 
-                  _Thread_Executing->Wait.return_code ) );
+        return _Semaphore_Translate_core_semaphore_return_code( 
+                  _Thread_Executing->Wait.return_code );
       }
   }
 
-  return( RTEMS_INTERNAL_ERROR );   /* unreached - only to remove warnings */
+  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
 }
 
@@ -412,13 +412,11 @@
   switch ( location ) {
     case OBJECTS_ERROR:
-      return( RTEMS_INVALID_ID );
+      return RTEMS_INVALID_ID;
     case OBJECTS_REMOTE:
-      return(
-        _Semaphore_MP_Send_request_packet(
-          SEMAPHORE_MP_RELEASE_REQUEST,
-          id,
-          0,                               /* Not used */
-          MPCI_DEFAULT_TIMEOUT
-        )
+      return _Semaphore_MP_Send_request_packet(
+        SEMAPHORE_MP_RELEASE_REQUEST,
+        id,
+        0,                               /* Not used */
+        MPCI_DEFAULT_TIMEOUT
       );
     case OBJECTS_LOCAL:
@@ -430,5 +428,5 @@
                        );
         _Thread_Enable_dispatch();
-        return( _Semaphore_Translate_core_mutex_return_code( mutex_status ) );
+        return _Semaphore_Translate_core_mutex_return_code( mutex_status );
       }
       else
@@ -439,9 +437,9 @@
                            );
         _Thread_Enable_dispatch();
-        return(
-          _Semaphore_Translate_core_semaphore_return_code( semaphore_status ) );
-  }
-
-  return( RTEMS_INTERNAL_ERROR );   /* unreached - only to remove warnings */
+        return
+          _Semaphore_Translate_core_semaphore_return_code( semaphore_status );
+  }
+
+  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
 }
 
@@ -464,24 +462,19 @@
   switch ( the_mutex_status ) {
     case  CORE_MUTEX_STATUS_SUCCESSFUL:
-      return( RTEMS_SUCCESSFUL );
+      return RTEMS_SUCCESSFUL;
     case CORE_MUTEX_STATUS_UNSATISFIED_NOWAIT:
-      return( RTEMS_UNSATISFIED );
+      return RTEMS_UNSATISFIED;
     case CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED:
-      return( RTEMS_INTERNAL_ERROR );
+      return RTEMS_INTERNAL_ERROR;
     case CORE_MUTEX_STATUS_NOT_OWNER_OF_RESOURCE:
-      return( RTEMS_NOT_OWNER_OF_RESOURCE );
+      return RTEMS_NOT_OWNER_OF_RESOURCE;
     case CORE_MUTEX_WAS_DELETED:
-      return( RTEMS_OBJECT_WAS_DELETED );
+      return RTEMS_OBJECT_WAS_DELETED;
     case CORE_MUTEX_TIMEOUT:
-      return( RTEMS_TIMEOUT );
+      return RTEMS_TIMEOUT;
     case THREAD_STATUS_PROXY_BLOCKING:
-      return( THREAD_STATUS_PROXY_BLOCKING );
-  }
-  _Internal_error_Occurred(
-    INTERNAL_ERROR_RTEMS_API,
-    TRUE,
-    the_mutex_status
-  );
-  return( RTEMS_INTERNAL_ERROR );   /* unreached - only to remove warnings */
+      return THREAD_STATUS_PROXY_BLOCKING;
+  }
+  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
 }
 
@@ -504,21 +497,15 @@
   switch ( the_semaphore_status ) {
     case  CORE_SEMAPHORE_STATUS_SUCCESSFUL:
-      return( RTEMS_SUCCESSFUL );
+      return RTEMS_SUCCESSFUL;
     case CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT:
-      return( RTEMS_UNSATISFIED );
+      return RTEMS_UNSATISFIED;
     case CORE_SEMAPHORE_WAS_DELETED:
-      return( RTEMS_OBJECT_WAS_DELETED );
+      return RTEMS_OBJECT_WAS_DELETED;
     case CORE_SEMAPHORE_TIMEOUT:
-      return( RTEMS_TIMEOUT );
+      return RTEMS_TIMEOUT;
     case THREAD_STATUS_PROXY_BLOCKING:
-      return( THREAD_STATUS_PROXY_BLOCKING );
-  }
-  _Internal_error_Occurred(
-    INTERNAL_ERROR_RTEMS_API,
-    TRUE,
-    the_semaphore_status
-  );
-  return( RTEMS_INTERNAL_ERROR );   /* unreached - only to remove warnings */
-  return( RTEMS_INTERNAL_ERROR );   /* unreached - only to remove warnings */
+      return THREAD_STATUS_PROXY_BLOCKING;
+  }
+  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
 }
 
Index: c/src/exec/rtems/src/tasks.c
===================================================================
--- c/src/exec/rtems/src/tasks.c	(revision b3ac6a8dfe10aeaf3a9c59fd145bddfff119480e)
+++ c/src/exec/rtems/src/tasks.c	(revision 3652ad356bf13abe0963c992cbbda96476d31609)
@@ -115,24 +115,19 @@
  
   _ISR_Disable( level );
-
-  signal_set = asr->signals_posted;
- 
-  if ( signal_set ) {
-  /* if ( _ASR_Are_signals_pending( asr ) ) {
- 
-    signal_set          = asr->signals_posted; */
+    signal_set = asr->signals_posted;
     asr->signals_posted = 0;
-    _ISR_Enable( level );
- 
-    asr->nest_level += 1;
-    rtems_task_mode( asr->mode_set, RTEMS_ALL_MODE_MASKS, &prev_mode );
- 
-    (*asr->handler)( signal_set );
- 
-    asr->nest_level -= 1;
-    rtems_task_mode( prev_mode, RTEMS_ALL_MODE_MASKS, &prev_mode );
-  }
-  else
-    _ISR_Enable( level );
+  _ISR_Enable( level );
+ 
+ 
+  if ( !signal_set ) /* similar to _ASR_Are_signals_pending( asr ) */
+    return;
+ 
+  asr->nest_level += 1;
+  rtems_task_mode( asr->mode_set, RTEMS_ALL_MODE_MASKS, &prev_mode );
+ 
+  (*asr->handler)( signal_set );
+
+  asr->nest_level -= 1;
+  rtems_task_mode( prev_mode, RTEMS_ALL_MODE_MASKS, &prev_mode );
 
 }
Index: c/src/exec/sapi/headers/confdefs.h
===================================================================
--- c/src/exec/sapi/headers/confdefs.h	(revision b3ac6a8dfe10aeaf3a9c59fd145bddfff119480e)
+++ c/src/exec/sapi/headers/confdefs.h	(revision 3652ad356bf13abe0963c992cbbda96476d31609)
@@ -237,11 +237,106 @@
 #endif
 
-/* Calculate the RAM size based on the maximum number of tasks configured */
+/* 
+ *  Calculate the RAM size based on the maximum number of objects configured.
+ *  The model is to estimate the memory required for each configured item,
+ *  sum the memory requirements and insure that there is at least 32K greater 
+ *  than that for things not directly addressed such as:
+ *
+ *    + stacks greater than minimum size
+ *    + FP contexts
+ *    + API areas (should be optional)
+ *    + messages
+ *    + object name and local pointer table overhead
+ *    + per node memory requirements
+ *    + executive fixed requirements (including at least internal threads
+ *       and the Ready chains)
+ *
+ *  NOTE:  Eventually this should take into account some of the above.
+ *         Basically, this is a "back of the envelope" estimate for
+ *         memory requirements.  It could be more accurate.
+ */
 
 #ifndef CONFIGURE_EXECUTIVE_RAM_SIZE
-#define CONFIGURE_MEMORY_REQUIRED(_tasks) \
-  (_tasks) * ( (sizeof(Thread_Control) + CONTEXT_FP_SIZE + STACK_MINIMUM_SIZE)) 
+
+#define CONFIGURE_OBJECT_TABLE_STUFF \
+  ( sizeof(Objects_Control *) + sizeof(rtems_name *) + sizeof(rtems_name) )
+
+#define CONFIGURE_MEMORY_FOR_TASKS(_tasks) \
+  ((_tasks) * \
+   ((sizeof(Thread_Control) + CONTEXT_FP_SIZE + \
+      STACK_MINIMUM_SIZE + sizeof( RTEMS_API_Control ) + \
+      CONFIGURE_OBJECT_TABLE_STUFF)) \
+  )
+
+#define CONFIGURE_MEMORY_FOR_TIMERS(_timers) \
+  ((_timers) * ( sizeof(Timer_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) )
+
+#define CONFIGURE_MEMORY_FOR_SEMAPHORES(_semaphores) \
+  ((_semaphores) * \
+   ( sizeof(Semaphore_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) )
+
+#define CONFIGURE_MEMORY_FOR_MESSAGE_QUEUES(_queues) \
+  ( (_queues) * \
+    ( sizeof(Message_queue_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) )
+
+#define CONFIGURE_MEMORY_FOR_PARTITIONS(_partitions) \
+  ( (_partitions) * \
+    ( sizeof(Partition_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) )
+
+#define CONFIGURE_MEMORY_FOR_REGIONS(_regions) \
+  ( (_regions) * \
+    ( sizeof(Region_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) )
+
+#define CONFIGURE_MEMORY_FOR_PORTS(_ports) \
+  ( (_ports) * \
+    ( sizeof(Dual_ported_memory_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) )
+
+#define CONFIGURE_MEMORY_FOR_PERIODS(_periods) \
+  ( (_periods) * \
+    ( sizeof(Rate_monotonic_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) )
+
+#define CONFIGURE_MEMORY_FOR_USER_EXTENSIONS(_extensions) \
+  ( (_extensions) * \
+    ( sizeof(Extension_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) )
+
+#define CONFIGURE_MEMORY_FOR_DEVICES(_devices) \
+  (((_devices) + 1) * ( sizeof(rtems_driver_name_t) ) )
+
+#ifdef CONFIGURE_MPTEST
+
+#ifndef CONFIGURE_HAS_OWN_MULTIPROCESING_TABLE
+
+#define CONFIGURE_MEMORY_FOR_PROXIES(_proxies) \
+  ( ((_proxies) + 1) * ( sizeof(Thread_Proxy_control) )  )
+
+#define CONFIGURE_MEMORY_FOR_GLOBAL_OBJECTS(_global_objects) \
+  ((_global_objects)  * ( sizeof(Objects_MP_Control) )  )
+
+#define CONFIGURE_MEMORY_FOR_MP \
+  ( CONFIGURE_MEMORY_FOR_PROXIES(CONFIGURE_MP_MAXIMUM_PROXIES) + \
+    CONFIGURE_MEMORY_FOR_GLOBAL_OBJECTS(CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS) \
+  )
+
+#endif  /* CONFIGURE_HAS_OWN_MULTIPROCESING_TABLE */
+
+#else
+
+#define CONFIGURE_MEMORY_FOR_MP  0
+
+#endif
 #define CONFIGURE_EXECUTIVE_RAM_SIZE \
-( (CONFIGURE_MEMORY_REQUIRED(CONFIGURE_MAXIMUM_TASKS) + (128*1024)) &0xffff0000)
+(( CONFIGURE_MEMORY_FOR_TASKS(CONFIGURE_MAXIMUM_TASKS) + \
+   CONFIGURE_MEMORY_FOR_TIMERS(CONFIGURE_MAXIMUM_TIMERS) + \
+   CONFIGURE_MEMORY_FOR_SEMAPHORES(CONFIGURE_MAXIMUM_SEMAPHORES) + \
+   CONFIGURE_MEMORY_FOR_MESSAGE_QUEUES(CONFIGURE_MAXIMUM_MESSAGE_QUEUES) + \
+   CONFIGURE_MEMORY_FOR_PARTITIONS(CONFIGURE_MAXIMUM_PARTITIONS) + \
+   CONFIGURE_MEMORY_FOR_REGIONS(CONFIGURE_MAXIMUM_REGIONS) + \
+   CONFIGURE_MEMORY_FOR_PORTS(CONFIGURE_MAXIMUM_PORTS) + \
+   CONFIGURE_MEMORY_FOR_PERIODS(CONFIGURE_MAXIMUM_PERIODS) + \
+   CONFIGURE_MEMORY_FOR_USER_EXTENSIONS(CONFIGURE_MAXIMUM_USER_EXTENSIONS) + \
+   CONFIGURE_MEMORY_FOR_DEVICES(CONFIGURE_MAXIMUM_DEVICES) + \
+   CONFIGURE_MEMORY_FOR_MP + \
+   (96*1024) \
+) & 0xffff8000)
 #endif
 
Index: c/src/exec/sapi/include/confdefs.h
===================================================================
--- c/src/exec/sapi/include/confdefs.h	(revision b3ac6a8dfe10aeaf3a9c59fd145bddfff119480e)
+++ c/src/exec/sapi/include/confdefs.h	(revision 3652ad356bf13abe0963c992cbbda96476d31609)
@@ -237,11 +237,106 @@
 #endif
 
-/* Calculate the RAM size based on the maximum number of tasks configured */
+/* 
+ *  Calculate the RAM size based on the maximum number of objects configured.
+ *  The model is to estimate the memory required for each configured item,
+ *  sum the memory requirements and insure that there is at least 32K greater 
+ *  than that for things not directly addressed such as:
+ *
+ *    + stacks greater than minimum size
+ *    + FP contexts
+ *    + API areas (should be optional)
+ *    + messages
+ *    + object name and local pointer table overhead
+ *    + per node memory requirements
+ *    + executive fixed requirements (including at least internal threads
+ *       and the Ready chains)
+ *
+ *  NOTE:  Eventually this should take into account some of the above.
+ *         Basically, this is a "back of the envelope" estimate for
+ *         memory requirements.  It could be more accurate.
+ */
 
 #ifndef CONFIGURE_EXECUTIVE_RAM_SIZE
-#define CONFIGURE_MEMORY_REQUIRED(_tasks) \
-  (_tasks) * ( (sizeof(Thread_Control) + CONTEXT_FP_SIZE + STACK_MINIMUM_SIZE)) 
+
+#define CONFIGURE_OBJECT_TABLE_STUFF \
+  ( sizeof(Objects_Control *) + sizeof(rtems_name *) + sizeof(rtems_name) )
+
+#define CONFIGURE_MEMORY_FOR_TASKS(_tasks) \
+  ((_tasks) * \
+   ((sizeof(Thread_Control) + CONTEXT_FP_SIZE + \
+      STACK_MINIMUM_SIZE + sizeof( RTEMS_API_Control ) + \
+      CONFIGURE_OBJECT_TABLE_STUFF)) \
+  )
+
+#define CONFIGURE_MEMORY_FOR_TIMERS(_timers) \
+  ((_timers) * ( sizeof(Timer_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) )
+
+#define CONFIGURE_MEMORY_FOR_SEMAPHORES(_semaphores) \
+  ((_semaphores) * \
+   ( sizeof(Semaphore_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) )
+
+#define CONFIGURE_MEMORY_FOR_MESSAGE_QUEUES(_queues) \
+  ( (_queues) * \
+    ( sizeof(Message_queue_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) )
+
+#define CONFIGURE_MEMORY_FOR_PARTITIONS(_partitions) \
+  ( (_partitions) * \
+    ( sizeof(Partition_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) )
+
+#define CONFIGURE_MEMORY_FOR_REGIONS(_regions) \
+  ( (_regions) * \
+    ( sizeof(Region_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) )
+
+#define CONFIGURE_MEMORY_FOR_PORTS(_ports) \
+  ( (_ports) * \
+    ( sizeof(Dual_ported_memory_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) )
+
+#define CONFIGURE_MEMORY_FOR_PERIODS(_periods) \
+  ( (_periods) * \
+    ( sizeof(Rate_monotonic_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) )
+
+#define CONFIGURE_MEMORY_FOR_USER_EXTENSIONS(_extensions) \
+  ( (_extensions) * \
+    ( sizeof(Extension_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) )
+
+#define CONFIGURE_MEMORY_FOR_DEVICES(_devices) \
+  (((_devices) + 1) * ( sizeof(rtems_driver_name_t) ) )
+
+#ifdef CONFIGURE_MPTEST
+
+#ifndef CONFIGURE_HAS_OWN_MULTIPROCESING_TABLE
+
+#define CONFIGURE_MEMORY_FOR_PROXIES(_proxies) \
+  ( ((_proxies) + 1) * ( sizeof(Thread_Proxy_control) )  )
+
+#define CONFIGURE_MEMORY_FOR_GLOBAL_OBJECTS(_global_objects) \
+  ((_global_objects)  * ( sizeof(Objects_MP_Control) )  )
+
+#define CONFIGURE_MEMORY_FOR_MP \
+  ( CONFIGURE_MEMORY_FOR_PROXIES(CONFIGURE_MP_MAXIMUM_PROXIES) + \
+    CONFIGURE_MEMORY_FOR_GLOBAL_OBJECTS(CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS) \
+  )
+
+#endif  /* CONFIGURE_HAS_OWN_MULTIPROCESING_TABLE */
+
+#else
+
+#define CONFIGURE_MEMORY_FOR_MP  0
+
+#endif
 #define CONFIGURE_EXECUTIVE_RAM_SIZE \
-( (CONFIGURE_MEMORY_REQUIRED(CONFIGURE_MAXIMUM_TASKS) + (128*1024)) &0xffff0000)
+(( CONFIGURE_MEMORY_FOR_TASKS(CONFIGURE_MAXIMUM_TASKS) + \
+   CONFIGURE_MEMORY_FOR_TIMERS(CONFIGURE_MAXIMUM_TIMERS) + \
+   CONFIGURE_MEMORY_FOR_SEMAPHORES(CONFIGURE_MAXIMUM_SEMAPHORES) + \
+   CONFIGURE_MEMORY_FOR_MESSAGE_QUEUES(CONFIGURE_MAXIMUM_MESSAGE_QUEUES) + \
+   CONFIGURE_MEMORY_FOR_PARTITIONS(CONFIGURE_MAXIMUM_PARTITIONS) + \
+   CONFIGURE_MEMORY_FOR_REGIONS(CONFIGURE_MAXIMUM_REGIONS) + \
+   CONFIGURE_MEMORY_FOR_PORTS(CONFIGURE_MAXIMUM_PORTS) + \
+   CONFIGURE_MEMORY_FOR_PERIODS(CONFIGURE_MAXIMUM_PERIODS) + \
+   CONFIGURE_MEMORY_FOR_USER_EXTENSIONS(CONFIGURE_MAXIMUM_USER_EXTENSIONS) + \
+   CONFIGURE_MEMORY_FOR_DEVICES(CONFIGURE_MAXIMUM_DEVICES) + \
+   CONFIGURE_MEMORY_FOR_MP + \
+   (96*1024) \
+) & 0xffff8000)
 #endif
 
Index: c/src/exec/score/cpu/hppa1.1/cpu.c
===================================================================
--- c/src/exec/score/cpu/hppa1.1/cpu.c	(revision b3ac6a8dfe10aeaf3a9c59fd145bddfff119480e)
+++ c/src/exec/score/cpu/hppa1.1/cpu.c	(revision 3652ad356bf13abe0963c992cbbda96476d31609)
@@ -194,5 +194,5 @@
 hppa_external_interrupt_initialize(void)
 {
-    hppa_rtems_isr_entry ignore;
+    hppa_rtems_isr_entry ignore = 0;
 
     /* mark them all unused */
@@ -202,6 +202,9 @@
 
     /* install the external interrupt handler */
-    rtems_interrupt_catch((rtems_isr_entry) hppa_external_interrupt,
-                          HPPA_INTERRUPT_EXTERNAL_INTERRUPT, &ignore) ;
+  _CPU_ISR_install_vector(
+    HPPA_INTERRUPT_EXTERNAL_INTERRUPT,
+    (proc_ptr)hppa_external_interrupt,
+    (proc_ptr *)ignore
+  );
 }
 
Index: c/src/exec/score/cpu/hppa1.1/cpu_asm.s
===================================================================
--- c/src/exec/score/cpu/hppa1.1/cpu_asm.s	(revision b3ac6a8dfe10aeaf3a9c59fd145bddfff119480e)
+++ c/src/exec/score/cpu/hppa1.1/cpu_asm.s	(revision 3652ad356bf13abe0963c992cbbda96476d31609)
@@ -25,5 +25,5 @@
 #      suitability of this software for any purpose.
 #
- *  $Id$
+#  $Id$
 #
 
Index: c/src/exec/score/cpu/hppa1.1/hppa.h
===================================================================
--- c/src/exec/score/cpu/hppa1.1/hppa.h	(revision b3ac6a8dfe10aeaf3a9c59fd145bddfff119480e)
+++ c/src/exec/score/cpu/hppa1.1/hppa.h	(revision 3652ad356bf13abe0963c992cbbda96476d31609)
@@ -637,5 +637,5 @@
 
 #define EMIT_SET_CONTROL(name, reg)            \
-static __inline__ unsigned int                 \
+static __inline__ void                         \
 set_ ## name (unsigned int new_value)          \
 {                                              \
Index: c/src/exec/score/cpu/hppa1.1/rtems.s
===================================================================
--- c/src/exec/score/cpu/hppa1.1/rtems.s	(revision b3ac6a8dfe10aeaf3a9c59fd145bddfff119480e)
+++ c/src/exec/score/cpu/hppa1.1/rtems.s	(revision 3652ad356bf13abe0963c992cbbda96476d31609)
@@ -15,5 +15,5 @@
  */
 
-#include <rtems/hppa.h>
+#include <rtems/core/hppa.h>
 #include <rtems/core/cpu_asm.h>
 
Index: c/src/exec/score/cpu/i386/cpu.c
===================================================================
--- c/src/exec/score/cpu/i386/cpu.c	(revision b3ac6a8dfe10aeaf3a9c59fd145bddfff119480e)
+++ c/src/exec/score/cpu/i386/cpu.c	(revision 3652ad356bf13abe0963c992cbbda96476d31609)
@@ -35,5 +35,5 @@
 {
   register unsigned16  fp_status asm ("ax");
-  register unsigned8  *fp_context;
+  register void       *fp_context;
 
   _CPU_Table = *cpu_table;
@@ -57,5 +57,5 @@
   if ( fp_status ==  0 ) {
 
-    fp_context = _CPU_Null_fp_context;
+    fp_context = &_CPU_Null_fp_context;
 
     asm volatile( "fsave (%0)" : "=r" (fp_context)
Index: c/src/exec/score/cpu/i386/cpu.h
===================================================================
--- c/src/exec/score/cpu/i386/cpu.h	(revision b3ac6a8dfe10aeaf3a9c59fd145bddfff119480e)
+++ c/src/exec/score/cpu/i386/cpu.h	(revision 3652ad356bf13abe0963c992cbbda96476d31609)
@@ -148,9 +148,7 @@
 /*
  *  Minimum size of a thread's stack.
- *
- *  NOTE:  256 bytes is probably too low in most cases.
- */
-
-#define CPU_STACK_MINIMUM_SIZE          256
+ */
+
+#define CPU_STACK_MINIMUM_SIZE          1024
 
 /*
@@ -233,6 +231,6 @@
 #define _CPU_Context_Initialize_fp( _fp_area ) \
   { \
-    unsigned32 *_source      = (unsigned32 *) _CPU_Null_fp_context; \
-    unsigned32 *_destination = (unsigned32 *) *(_fp_area); \
+    unsigned32 *_source      = (unsigned32 *) &_CPU_Null_fp_context; \
+    unsigned32 *_destination = *(_fp_area); \
     unsigned32  _index; \
     \
Index: c/src/exec/score/cpu/i386/i386.h
===================================================================
--- c/src/exec/score/cpu/i386/i386.h	(revision b3ac6a8dfe10aeaf3a9c59fd145bddfff119480e)
+++ c/src/exec/score/cpu/i386/i386.h	(revision 3652ad356bf13abe0963c992cbbda96476d31609)
@@ -171,6 +171,6 @@
     register unsigned32 _eflags = 0; \
     \
-    asm volatile ( "push %0 ; \
-                    popf " \
+    asm volatile ( "pushf ; \
+                    pop %0" \
                     : "=r" ((_eflags)) : "0" ((_eflags)) \
     ); \
Index: c/src/exec/score/cpu/i960/cpu.h
===================================================================
--- c/src/exec/score/cpu/i960/cpu.h	(revision b3ac6a8dfe10aeaf3a9c59fd145bddfff119480e)
+++ c/src/exec/score/cpu/i960/cpu.h	(revision 3652ad356bf13abe0963c992cbbda96476d31609)
@@ -180,5 +180,5 @@
 
 #define CPU_SYSTEM_INITIALIZATION_THREAD_EXTRA_STACK \
-   (4096 - CPU_STACK_MINIMUM_SIZE)
+   (CPU_STACK_MINIMUM_SIZE)
 
 /*
@@ -194,5 +194,5 @@
  */
 
-#define CPU_STACK_MINIMUM_SIZE          1024
+#define CPU_STACK_MINIMUM_SIZE          2048
 
 /*
Index: c/src/exec/score/cpu/m68k/cpu.h
===================================================================
--- c/src/exec/score/cpu/m68k/cpu.h	(revision b3ac6a8dfe10aeaf3a9c59fd145bddfff119480e)
+++ c/src/exec/score/cpu/m68k/cpu.h	(revision 3652ad356bf13abe0963c992cbbda96476d31609)
@@ -178,9 +178,7 @@
 /*
  *  Minimum size of a thread's stack.
- *
- *  NOTE:  256 bytes is probably too low in most cases.
- */
-
-#define CPU_STACK_MINIMUM_SIZE           256
+ */
+
+#define CPU_STACK_MINIMUM_SIZE           1024
 
 /*
Index: c/src/exec/score/cpu/unix/cpu.c
===================================================================
--- c/src/exec/score/cpu/unix/cpu.c	(revision b3ac6a8dfe10aeaf3a9c59fd145bddfff119480e)
+++ c/src/exec/score/cpu/unix/cpu.c	(revision 3652ad356bf13abe0963c992cbbda96476d31609)
@@ -1,4 +1,4 @@
 /*
- *  HP PA-RISC CPU Dependent Source
+ *  UNIX Simulator Dependent Source
  *
  *
@@ -19,4 +19,5 @@
 #include <rtems/system.h>
 #include <rtems/core/isr.h>
+#include <rtems/core/interr.h>
 
 #include <stdio.h>
@@ -170,19 +171,14 @@
 
   _CPU_ISR_Set_level( 0 );
-  setjmp( _CPU_Context_Default_with_ISRs_enabled.regs );
-  sigprocmask(
-    SIG_SETMASK,    /* ignored when second arg is NULL */
-    0,
-    &_CPU_Context_Default_with_ISRs_enabled.isr_level
+  _CPU_Context_switch(
+    &_CPU_Context_Default_with_ISRs_enabled,
+    &_CPU_Context_Default_with_ISRs_enabled
   );
 
   _CPU_ISR_Set_level( 1 );
-  setjmp( _CPU_Context_Default_with_ISRs_disabled.regs );
-  sigprocmask(
-    SIG_SETMASK,    /* ignored when second arg is NULL */
-    0,
-    &_CPU_Context_Default_with_ISRs_disabled.isr_level
+  _CPU_Context_switch(
+    &_CPU_Context_Default_with_ISRs_disabled,
+    &_CPU_Context_Default_with_ISRs_disabled
   );
-
 }
 
@@ -192,19 +188,19 @@
  */
 
+sigset_t GET_old_mask;
+
 unsigned32 _CPU_ISR_Get_level( void )
 {
-  sigset_t sigset;
- 
-  sigprocmask( 0, 0, &sigset ); 
-
-  /*
-   *  This is an educated guess based on ONLY ONE of the signals we
-   *  disable/enable to mask ISRs.
-   */
-
-  if ( sigismember( &sigset, SIGUSR1 ) )
-    return 1;
-  else
-    return 0;
+/*  sigset_t  old_mask; */
+   unsigned32 old_level;
+ 
+  sigprocmask(0, 0, &GET_old_mask);
+ 
+  if (memcmp((void *)&posix_empty_mask, (void *)&GET_old_mask, sizeof(sigset_t)))
+    old_level = 1;
+  else 
+    old_level = 0;
+
+  return old_level;
 }
 
@@ -384,5 +380,5 @@
     source = _CPU_Context_Default_with_ISRs_disabled.regs;
       
-  memcpy(_the_context, source, sizeof(jmp_buf));
+  memcpy(_the_context, source, sizeof(Context_Control) ); /* sizeof(jmp_buf)); */
 
   addr = (unsigned32 *)_the_context;
@@ -471,13 +467,28 @@
 )
 {
+  int status;
+
   /*
    *  Switch levels in one operation
    */
 
-  sigprocmask( SIG_SETMASK, &next->isr_level, &current->isr_level );
+  status = sigprocmask( SIG_SETMASK, &next->isr_level, &current->isr_level );
+  if ( status )
+    _Internal_error_Occurred(
+      INTERNAL_ERROR_CORE,
+      TRUE,
+      status
+    );
 
   if (setjmp(current->regs) == 0) {    /* Save the current context */
      longjmp(next->regs, 0);           /* Switch to the new context */
-  }
+     if ( status )
+       _Internal_error_Occurred(
+         INTERNAL_ERROR_CORE,
+         TRUE,
+         status
+       );
+  }
+
 }
  
@@ -511,9 +522,16 @@
 unsigned32 _CPU_ISR_Disable_support(void)
 {
+  int status;
   sigset_t  old_mask;
 
-  sigprocmask(SIG_BLOCK, &_CPU_Signal_mask, &old_mask);
-
-  if (memcmp((void *)&posix_empty_mask, (void *)&old_mask, sizeof(sigset_t)) != 0)
+  status = sigprocmask(SIG_BLOCK, &_CPU_Signal_mask, &old_mask);
+  if ( status )
+    _Internal_error_Occurred(
+      INTERNAL_ERROR_CORE,
+      TRUE,
+      status
+    );
+
+  if (memcmp((void *)&posix_empty_mask, (void *)&old_mask, sizeof(sigset_t)))
     return 1;
 
@@ -530,8 +548,17 @@
 )
 {
+  int status;
+
   if (level == 0)
-    sigprocmask(SIG_UNBLOCK, &_CPU_Signal_mask, 0);
+    status = sigprocmask(SIG_UNBLOCK, &_CPU_Signal_mask, 0);
   else
-    sigprocmask(SIG_BLOCK, &_CPU_Signal_mask, 0);
+    status = sigprocmask(SIG_BLOCK, &_CPU_Signal_mask, 0);
+
+  if ( status )
+    _Internal_error_Occurred(
+      INTERNAL_ERROR_CORE,
+      TRUE,
+      status
+    );
 }
 
Index: c/src/exec/score/headers/coremsg.h
===================================================================
--- c/src/exec/score/headers/coremsg.h	(revision 3652ad356bf13abe0963c992cbbda96476d31609)
+++ c/src/exec/score/headers/coremsg.h	(revision 3652ad356bf13abe0963c992cbbda96476d31609)
@@ -0,0 +1,408 @@
+/*  coremsg.h
+ *
+ *  This include file contains all the constants and structures associated
+ *  with the Message queue Handler.
+ *
+ *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ *  On-Line Applications Research Corporation (OAR).
+ *  All rights assigned to U.S. Government, 1994.
+ *
+ *  This material may be reproduced by or for the U.S. Government pursuant
+ *  to the copyright license under the clause at DFARS 252.227-7013.  This
+ *  notice must appear in all copies of this file and its derivatives.
+ *
+ *  $Id$
+ */
+ 
+#ifndef __RTEMS_CORE_MESSAGE_QUEUE_h
+#define __RTEMS_CORE_MESSAGE_QUEUE_h
+ 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/core/thread.h>
+#include <rtems/core/threadq.h>
+#include <rtems/core/priority.h>
+#include <rtems/core/watchdog.h>
+ 
+/*
+ *  The following type defines the callout which the API provides
+ *  to support global/multiprocessor operations on message_queues.
+ */
+ 
+typedef void ( *CORE_message_queue_API_mp_support_callout )(
+                 Thread_Control *,
+                 Objects_Id
+             );
+
+/*
+ *  The following defines the data types needed to manipulate
+ *  the contents of message buffers.
+ *  Since msgs are variable length we just make a ptr to 1.
+ */
+ 
+typedef struct {
+    unsigned32  size;
+ 
+#ifndef __cplusplus
+                               /* NOTE:   [0] is gcc specific,
+                                *   but specifically disallowed by ANSI STD C++
+                                * g++ warns about it, so we #ifdef it out to
+                                * get rid of warnings when compiled by g++.
+                                */
+    unsigned32  buffer[0];
+#endif
+ 
+} CORE_message_queue_Buffer;
+ 
+/*
+ *  The following records define the organization of a message
+ *  buffer.
+ */
+ 
+typedef struct {
+  Chain_Node                 Node;
+  CORE_message_queue_Buffer  Contents;
+}   CORE_message_queue_Buffer_control;
+
+/*
+ *  Blocking disciplines for a message_queue.
+ */
+
+typedef enum {
+  CORE_MESSAGE_QUEUE_DISCIPLINES_FIFO,
+  CORE_MESSAGE_QUEUE_DISCIPLINES_PRIORITY
+}   CORE_message_queue_Disciplines;
+
+/*
+ *  The following enumerated type details the modes in which a message
+ *  may be submitted to a message queue.  The message may be posted
+ *  in a send or urgent fashion.
+ */
+ 
+typedef enum {
+  CORE_MESSAGE_QUEUE_SEND_REQUEST   = 0,
+  CORE_MESSAGE_QUEUE_URGENT_REQUEST = 1
+}  CORE_message_queue_Submit_types;
+
+/*
+ *  Core Message queue handler return statuses.
+ */
+ 
+typedef enum {
+  CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL,
+  CORE_MESSAGE_QUEUE_STATUS_INVALID_SIZE,
+  CORE_MESSAGE_QUEUE_STATUS_TOO_MANY,
+  CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED,
+  CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_NOWAIT,
+  CORE_MESSAGE_QUEUE_STATUS_WAS_DELETED,
+  CORE_MESSAGE_QUEUE_STATUS_TIMEOUT
+}   CORE_message_queue_Status;
+
+/*
+ *  The following defines the control block used to manage the 
+ *  attributes of each message queue.
+ */
+
+typedef struct {
+  CORE_message_queue_Disciplines  discipline;
+}   CORE_message_queue_Attributes;
+ 
+/*
+ *  The following defines the control block used to manage each 
+ *  counting message_queue.
+ */
+ 
+typedef struct {
+  Thread_queue_Control           Wait_queue;
+  CORE_message_queue_Attributes  Attributes;
+  unsigned32                     maximum_pending_messages;
+  unsigned32                     number_of_pending_messages;
+  unsigned32                     maximum_message_size;
+  Chain_Control                  Pending_messages;
+  CORE_message_queue_Buffer     *message_buffers;
+  Chain_Control                  Inactive_messages;
+}   CORE_message_queue_Control;
+
+/*
+ *  _CORE_message_queue_Initialize
+ *
+ *  DESCRIPTION:
+ *
+ *  This routine initializes the message_queue based on the parameters passed.
+ */
+
+boolean _CORE_message_queue_Initialize(
+  CORE_message_queue_Control    *the_message_queue,
+  Objects_Classes                the_class,
+  CORE_message_queue_Attributes *the_message_queue_attributes,
+  unsigned32                     maximum_pending_messages,
+  unsigned32                     maximum_message_size,
+  Thread_queue_Extract_callout   proxy_extract_callout
+);
+ 
+/*
+ *  _CORE_message_queue_Close
+ *
+ *  DESCRIPTION:
+ *
+ *  This function closes a message by returning all allocated space and
+ *  flushing the message_queue's task wait queue.
+ */
+ 
+void _CORE_message_queue_Close(
+  CORE_message_queue_Control *the_message_queue,
+  Thread_queue_Flush_callout  remote_extract_callout,
+  unsigned32                  status
+);
+
+/*
+ *
+ *  _CORE_message_queue_Flush
+ *
+ *  DESCRIPTION:
+ *
+ *  This function flushes the message_queue's task wait queue.  The number
+ *  messages flushed from the queue is returned.
+ *
+ */
+
+unsigned32 _CORE_message_queue_Flush(
+  CORE_message_queue_Control *the_message_queue
+);
+
+/*
+ *  _CORE_message_queue_Flush_support
+ *
+ *  DESCRIPTION:
+ *
+ *  This routine flushes all outstanding messages and returns
+ *  them to the inactive message chain.
+ */
+ 
+unsigned32 _CORE_message_queue_Flush_support(
+  CORE_message_queue_Control *the_message_queue
+);
+ 
+/*
+ *  _CORE_message_queue_send
+ *
+ *  DESCRIPTION:
+ *
+ *  This routine sends a message to the end of the specified message queue.
+ *
+ */
+ 
+STATIC INLINE CORE_message_queue_Status _CORE_message_queue_Send(
+  CORE_message_queue_Control                *the_message_queue,
+  void                                      *buffer,
+  unsigned32                                 size,
+  Objects_Id                                 id,
+  CORE_message_queue_API_mp_support_callout  api_message_queue_mp_support
+);
+ 
+/*
+ *
+ *  _CORE_message_queue_Urgent
+ *
+ *  DESCRIPTION:
+ *
+ *  This routine sends a message to the front of the specified message queue.
+ *
+ */
+ 
+STATIC INLINE CORE_message_queue_Status _CORE_message_queue_Urgent(
+  CORE_message_queue_Control                *the_message_queue,
+  void                                      *buffer,
+  unsigned32                                 size,
+  Objects_Id                                 id,
+  CORE_message_queue_API_mp_support_callout  api_message_queue_mp_support
+);
+
+/*
+ *
+ *  _CORE_message_queue_Broadcast
+ *
+ *  DESCRIPTION:
+ *
+ *  This function sends a message for every thread waiting on the queue and
+ *  returns the number of threads made ready by the message.
+ *
+ */
+ 
+CORE_message_queue_Status _CORE_message_queue_Broadcast(
+  CORE_message_queue_Control                *the_message_queue,
+  void                                      *buffer,
+  unsigned32                                 size,
+  Objects_Id                                 id,
+  CORE_message_queue_API_mp_support_callout  api_message_queue_mp_support,
+  unsigned32                                *count
+);
+
+/*
+ *
+ *  _CORE_message_queue_Submit
+ *
+ *  DESCRIPTION:
+ *
+ *  This routine implements the send and urgent message functions. It
+ *  processes a message that is to be submitted to the designated
+ *  message queue.  The message will either be processed as a
+ *  send message which it will be inserted at the rear of the queue
+ *  or it will be processed as an urgent message which will be inserted
+ *  at the front of the queue.
+ *
+ */
+ 
+CORE_message_queue_Status _CORE_message_queue_Submit(
+  CORE_message_queue_Control                *the_message_queue,
+  void                                      *buffer,
+  unsigned32                                 size,
+  Objects_Id                                 id,
+  CORE_message_queue_API_mp_support_callout  api_message_queue_mp_support,
+  CORE_message_queue_Submit_types            submit_type
+);
+
+/*
+ *
+ *  _CORE_message_queue_Seize
+ *
+ *  DESCRIPTION:
+ *
+ *  This kernel routine dequeues a message, copies the message buffer to
+ *  a given destination buffer, and frees the message buffer to the
+ *  inactive message pool.  The thread will be blocked if wait is TRUE,
+ *  otherwise an error will be given to the thread if no messages are available.
+ *
+ */
+ 
+void _CORE_message_queue_Seize(
+  CORE_message_queue_Control *the_message_queue,
+  Objects_Id                  id,
+  void                       *buffer,
+  unsigned32                 *size,
+  boolean                     wait,
+  Watchdog_Interval           timeout
+);
+
+/*
+ *  _CORE_message_queue_Allocate_message_buffer
+ *
+ *  DESCRIPTION:
+ *
+ *  This function allocates a message buffer from the inactive
+ *  message buffer chain.
+ */
+ 
+STATIC INLINE CORE_message_queue_Buffer_control *
+  _CORE_message_queue_Allocate_message_buffer (
+   CORE_message_queue_Control *the_message_queue
+);
+
+/*
+ *  _CORE_message_queue_Free_message_buffer
+ *
+ *  DESCRIPTION:
+ *
+ *  This routine frees a message buffer to the inactive
+ *  message buffer chain.
+ */
+ 
+STATIC INLINE void _CORE_message_queue_Free_message_buffer (
+  CORE_message_queue_Control        *the_message_queue,
+  CORE_message_queue_Buffer_control *the_message
+);
+
+/*
+ *  _CORE_message_queue_Copy_buffer
+ *
+ *  DESCRIPTION:
+ *
+ *  This routine copies the contents of the source message buffer
+ *  to the destination message buffer.
+ */
+ 
+STATIC INLINE void _CORE_message_queue_Copy_buffer (
+  void      *source,
+  void      *destination,
+  unsigned32 size
+);
+
+/*
+ *  _CORE_message_queue_Get_pending_message
+ *
+ *  DESCRIPTION:
+ *
+ *  This function removes the first message from the_message_queue
+ *  and returns a pointer to it.
+ */
+ 
+STATIC INLINE
+  CORE_message_queue_Buffer_control *_CORE_message_queue_Get_pending_message (
+       CORE_message_queue_Control *the_message_queue
+);
+ 
+/*
+ *  _CORE_message_queue_Is_priority
+ *
+ *  DESCRIPTION:
+ *
+ *  This function returns TRUE if the priority attribute is
+ *  enabled in the attribute_set and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _CORE_message_queue_Is_priority(
+  CORE_message_queue_Attributes *the_attribute
+);
+
+/*
+ *  _CORE_message_queue_Append
+ *
+ *  DESCRIPTION:
+ *
+ *  This routine places the_message at the rear of the outstanding
+ *  messages on the_message_queue.
+ */
+ 
+STATIC INLINE void _CORE_message_queue_Append (
+  CORE_message_queue_Control        *the_message_queue,
+  CORE_message_queue_Buffer_control *the_message
+);
+ 
+/*
+ *  _CORE_message_queue_Prepend
+ *
+ *  DESCRIPTION:
+ *
+ *  This routine places the_message at the rear of the outstanding
+ *  messages on the_message_queue.
+ */
+ 
+STATIC INLINE void _CORE_message_queue_Prepend (
+  CORE_message_queue_Control        *the_message_queue,
+  CORE_message_queue_Buffer_control *the_message
+);
+
+/*
+ *  _CORE_message_queue_Is_null
+ *
+ *  DESCRIPTION:
+ *
+ *  This function places the_message at the rear of the outstanding
+ *  messages on the_message_queue.
+ */
+ 
+STATIC INLINE boolean _CORE_message_queue_Is_null (
+  CORE_message_queue_Control *the_message_queue
+);
+
+#include <rtems/core/coremsg.inl>
+
+#ifdef __cplusplus
+}
+#endif
+ 
+#endif
+/*  end of include file */
+
Index: c/src/exec/score/include/rtems/score/coremsg.h
===================================================================
--- c/src/exec/score/include/rtems/score/coremsg.h	(revision 3652ad356bf13abe0963c992cbbda96476d31609)
+++ c/src/exec/score/include/rtems/score/coremsg.h	(revision 3652ad356bf13abe0963c992cbbda96476d31609)
@@ -0,0 +1,408 @@
+/*  coremsg.h
+ *
+ *  This include file contains all the constants and structures associated
+ *  with the Message queue Handler.
+ *
+ *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ *  On-Line Applications Research Corporation (OAR).
+ *  All rights assigned to U.S. Government, 1994.
+ *
+ *  This material may be reproduced by or for the U.S. Government pursuant
+ *  to the copyright license under the clause at DFARS 252.227-7013.  This
+ *  notice must appear in all copies of this file and its derivatives.
+ *
+ *  $Id$
+ */
+ 
+#ifndef __RTEMS_CORE_MESSAGE_QUEUE_h
+#define __RTEMS_CORE_MESSAGE_QUEUE_h
+ 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/core/thread.h>
+#include <rtems/core/threadq.h>
+#include <rtems/core/priority.h>
+#include <rtems/core/watchdog.h>
+ 
+/*
+ *  The following type defines the callout which the API provides
+ *  to support global/multiprocessor operations on message_queues.
+ */
+ 
+typedef void ( *CORE_message_queue_API_mp_support_callout )(
+                 Thread_Control *,
+                 Objects_Id
+             );
+
+/*
+ *  The following defines the data types needed to manipulate
+ *  the contents of message buffers.
+ *  Since msgs are variable length we just make a ptr to 1.
+ */
+ 
+typedef struct {
+    unsigned32  size;
+ 
+#ifndef __cplusplus
+                               /* NOTE:   [0] is gcc specific,
+                                *   but specifically disallowed by ANSI STD C++
+                                * g++ warns about it, so we #ifdef it out to
+                                * get rid of warnings when compiled by g++.
+                                */
+    unsigned32  buffer[0];
+#endif
+ 
+} CORE_message_queue_Buffer;
+ 
+/*
+ *  The following records define the organization of a message
+ *  buffer.
+ */
+ 
+typedef struct {
+  Chain_Node                 Node;
+  CORE_message_queue_Buffer  Contents;
+}   CORE_message_queue_Buffer_control;
+
+/*
+ *  Blocking disciplines for a message_queue.
+ */
+
+typedef enum {
+  CORE_MESSAGE_QUEUE_DISCIPLINES_FIFO,
+  CORE_MESSAGE_QUEUE_DISCIPLINES_PRIORITY
+}   CORE_message_queue_Disciplines;
+
+/*
+ *  The following enumerated type details the modes in which a message
+ *  may be submitted to a message queue.  The message may be posted
+ *  in a send or urgent fashion.
+ */
+ 
+typedef enum {
+  CORE_MESSAGE_QUEUE_SEND_REQUEST   = 0,
+  CORE_MESSAGE_QUEUE_URGENT_REQUEST = 1
+}  CORE_message_queue_Submit_types;
+
+/*
+ *  Core Message queue handler return statuses.
+ */
+ 
+typedef enum {
+  CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL,
+  CORE_MESSAGE_QUEUE_STATUS_INVALID_SIZE,
+  CORE_MESSAGE_QUEUE_STATUS_TOO_MANY,
+  CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED,
+  CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_NOWAIT,
+  CORE_MESSAGE_QUEUE_STATUS_WAS_DELETED,
+  CORE_MESSAGE_QUEUE_STATUS_TIMEOUT
+}   CORE_message_queue_Status;
+
+/*
+ *  The following defines the control block used to manage the 
+ *  attributes of each message queue.
+ */
+
+typedef struct {
+  CORE_message_queue_Disciplines  discipline;
+}   CORE_message_queue_Attributes;
+ 
+/*
+ *  The following defines the control block used to manage each 
+ *  counting message_queue.
+ */
+ 
+typedef struct {
+  Thread_queue_Control           Wait_queue;
+  CORE_message_queue_Attributes  Attributes;
+  unsigned32                     maximum_pending_messages;
+  unsigned32                     number_of_pending_messages;
+  unsigned32                     maximum_message_size;
+  Chain_Control                  Pending_messages;
+  CORE_message_queue_Buffer     *message_buffers;
+  Chain_Control                  Inactive_messages;
+}   CORE_message_queue_Control;
+
+/*
+ *  _CORE_message_queue_Initialize
+ *
+ *  DESCRIPTION:
+ *
+ *  This routine initializes the message_queue based on the parameters passed.
+ */
+
+boolean _CORE_message_queue_Initialize(
+  CORE_message_queue_Control    *the_message_queue,
+  Objects_Classes                the_class,
+  CORE_message_queue_Attributes *the_message_queue_attributes,
+  unsigned32                     maximum_pending_messages,
+  unsigned32                     maximum_message_size,
+  Thread_queue_Extract_callout   proxy_extract_callout
+);
+ 
+/*
+ *  _CORE_message_queue_Close
+ *
+ *  DESCRIPTION:
+ *
+ *  This function closes a message by returning all allocated space and
+ *  flushing the message_queue's task wait queue.
+ */
+ 
+void _CORE_message_queue_Close(
+  CORE_message_queue_Control *the_message_queue,
+  Thread_queue_Flush_callout  remote_extract_callout,
+  unsigned32                  status
+);
+
+/*
+ *
+ *  _CORE_message_queue_Flush
+ *
+ *  DESCRIPTION:
+ *
+ *  This function flushes the message_queue's task wait queue.  The number
+ *  messages flushed from the queue is returned.
+ *
+ */
+
+unsigned32 _CORE_message_queue_Flush(
+  CORE_message_queue_Control *the_message_queue
+);
+
+/*
+ *  _CORE_message_queue_Flush_support
+ *
+ *  DESCRIPTION:
+ *
+ *  This routine flushes all outstanding messages and returns
+ *  them to the inactive message chain.
+ */
+ 
+unsigned32 _CORE_message_queue_Flush_support(
+  CORE_message_queue_Control *the_message_queue
+);
+ 
+/*
+ *  _CORE_message_queue_send
+ *
+ *  DESCRIPTION:
+ *
+ *  This routine sends a message to the end of the specified message queue.
+ *
+ */
+ 
+STATIC INLINE CORE_message_queue_Status _CORE_message_queue_Send(
+  CORE_message_queue_Control                *the_message_queue,
+  void                                      *buffer,
+  unsigned32                                 size,
+  Objects_Id                                 id,
+  CORE_message_queue_API_mp_support_callout  api_message_queue_mp_support
+);
+ 
+/*
+ *
+ *  _CORE_message_queue_Urgent
+ *
+ *  DESCRIPTION:
+ *
+ *  This routine sends a message to the front of the specified message queue.
+ *
+ */
+ 
+STATIC INLINE CORE_message_queue_Status _CORE_message_queue_Urgent(
+  CORE_message_queue_Control                *the_message_queue,
+  void                                      *buffer,
+  unsigned32                                 size,
+  Objects_Id                                 id,
+  CORE_message_queue_API_mp_support_callout  api_message_queue_mp_support
+);
+
+/*
+ *
+ *  _CORE_message_queue_Broadcast
+ *
+ *  DESCRIPTION:
+ *
+ *  This function sends a message for every thread waiting on the queue and
+ *  returns the number of threads made ready by the message.
+ *
+ */
+ 
+CORE_message_queue_Status _CORE_message_queue_Broadcast(
+  CORE_message_queue_Control                *the_message_queue,
+  void                                      *buffer,
+  unsigned32                                 size,
+  Objects_Id                                 id,
+  CORE_message_queue_API_mp_support_callout  api_message_queue_mp_support,
+  unsigned32                                *count
+);
+
+/*
+ *
+ *  _CORE_message_queue_Submit
+ *
+ *  DESCRIPTION:
+ *
+ *  This routine implements the send and urgent message functions. It
+ *  processes a message that is to be submitted to the designated
+ *  message queue.  The message will either be processed as a
+ *  send message which it will be inserted at the rear of the queue
+ *  or it will be processed as an urgent message which will be inserted
+ *  at the front of the queue.
+ *
+ */
+ 
+CORE_message_queue_Status _CORE_message_queue_Submit(
+  CORE_message_queue_Control                *the_message_queue,
+  void                                      *buffer,
+  unsigned32                                 size,
+  Objects_Id                                 id,
+  CORE_message_queue_API_mp_support_callout  api_message_queue_mp_support,
+  CORE_message_queue_Submit_types            submit_type
+);
+
+/*
+ *
+ *  _CORE_message_queue_Seize
+ *
+ *  DESCRIPTION:
+ *
+ *  This kernel routine dequeues a message, copies the message buffer to
+ *  a given destination buffer, and frees the message buffer to the
+ *  inactive message pool.  The thread will be blocked if wait is TRUE,
+ *  otherwise an error will be given to the thread if no messages are available.
+ *
+ */
+ 
+void _CORE_message_queue_Seize(
+  CORE_message_queue_Control *the_message_queue,
+  Objects_Id                  id,
+  void                       *buffer,
+  unsigned32                 *size,
+  boolean                     wait,
+  Watchdog_Interval           timeout
+);
+
+/*
+ *  _CORE_message_queue_Allocate_message_buffer
+ *
+ *  DESCRIPTION:
+ *
+ *  This function allocates a message buffer from the inactive
+ *  message buffer chain.
+ */
+ 
+STATIC INLINE CORE_message_queue_Buffer_control *
+  _CORE_message_queue_Allocate_message_buffer (
+   CORE_message_queue_Control *the_message_queue
+);
+
+/*
+ *  _CORE_message_queue_Free_message_buffer
+ *
+ *  DESCRIPTION:
+ *
+ *  This routine frees a message buffer to the inactive
+ *  message buffer chain.
+ */
+ 
+STATIC INLINE void _CORE_message_queue_Free_message_buffer (
+  CORE_message_queue_Control        *the_message_queue,
+  CORE_message_queue_Buffer_control *the_message
+);
+
+/*
+ *  _CORE_message_queue_Copy_buffer
+ *
+ *  DESCRIPTION:
+ *
+ *  This routine copies the contents of the source message buffer
+ *  to the destination message buffer.
+ */
+ 
+STATIC INLINE void _CORE_message_queue_Copy_buffer (
+  void      *source,
+  void      *destination,
+  unsigned32 size
+);
+
+/*
+ *  _CORE_message_queue_Get_pending_message
+ *
+ *  DESCRIPTION:
+ *
+ *  This function removes the first message from the_message_queue
+ *  and returns a pointer to it.
+ */
+ 
+STATIC INLINE
+  CORE_message_queue_Buffer_control *_CORE_message_queue_Get_pending_message (
+       CORE_message_queue_Control *the_message_queue
+);
+ 
+/*
+ *  _CORE_message_queue_Is_priority
+ *
+ *  DESCRIPTION:
+ *
+ *  This function returns TRUE if the priority attribute is
+ *  enabled in the attribute_set and FALSE otherwise.
+ */
+
+STATIC INLINE boolean _CORE_message_queue_Is_priority(
+  CORE_message_queue_Attributes *the_attribute
+);
+
+/*
+ *  _CORE_message_queue_Append
+ *
+ *  DESCRIPTION:
+ *
+ *  This routine places the_message at the rear of the outstanding
+ *  messages on the_message_queue.
+ */
+ 
+STATIC INLINE void _CORE_message_queue_Append (
+  CORE_message_queue_Control        *the_message_queue,
+  CORE_message_queue_Buffer_control *the_message
+);
+ 
+/*
+ *  _CORE_message_queue_Prepend
+ *
+ *  DESCRIPTION:
+ *
+ *  This routine places the_message at the rear of the outstanding
+ *  messages on the_message_queue.
+ */
+ 
+STATIC INLINE void _CORE_message_queue_Prepend (
+  CORE_message_queue_Control        *the_message_queue,
+  CORE_message_queue_Buffer_control *the_message
+);
+
+/*
+ *  _CORE_message_queue_Is_null
+ *
+ *  DESCRIPTION:
+ *
+ *  This function places the_message at the rear of the outstanding
+ *  messages on the_message_queue.
+ */
+ 
+STATIC INLINE boolean _CORE_message_queue_Is_null (
+  CORE_message_queue_Control *the_message_queue
+);
+
+#include <rtems/core/coremsg.inl>
+
+#ifdef __cplusplus
+}
+#endif
+ 
+#endif
+/*  end of include file */
+
Index: c/src/exec/score/inline/coremsg.inl
===================================================================
--- c/src/exec/score/inline/coremsg.inl	(revision 3652ad356bf13abe0963c992cbbda96476d31609)
+++ c/src/exec/score/inline/coremsg.inl	(revision 3652ad356bf13abe0963c992cbbda96476d31609)
@@ -0,0 +1,186 @@
+/*  coremsg.inl
+ *
+ *  This include file contains the static inline implementation of all
+ *  inlined routines in the Core Message Handler.
+ *
+ *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ *  On-Line Applications Research Corporation (OAR).
+ *  All rights assigned to U.S. Government, 1994.
+ *
+ *  This material may be reproduced by or for the U.S. Government pursuant
+ *  to the copyright license under the clause at DFARS 252.227-7013.  This
+ *  notice must appear in all copies of this file and its derivatives.
+ *
+ *  $Id$
+ */
+
+#ifndef __CORE_MESSAGE_QUEUE_inl
+#define __CORE_MESSAGE_QUEUE_inl
+
+/*PAGE
+ *
+ *  _CORE_message_queue_Send
+ *
+ */
+ 
+STATIC INLINE CORE_message_queue_Status _CORE_message_queue_Send(
+  CORE_message_queue_Control                *the_message_queue,
+  void                                      *buffer,
+  unsigned32                                 size,
+  Objects_Id                                 id,
+  CORE_message_queue_API_mp_support_callout  api_message_queue_mp_support
+)
+{
+  return _CORE_message_queue_Submit(
+    the_message_queue,
+    buffer,
+    size,
+    id,
+    api_message_queue_mp_support,
+    CORE_MESSAGE_QUEUE_SEND_REQUEST
+  );
+}
+ 
+/*PAGE
+ *
+ *  _CORE_message_queue_Urgent
+ *
+ */
+ 
+STATIC INLINE CORE_message_queue_Status _CORE_message_queue_Urgent(
+  CORE_message_queue_Control                *the_message_queue,
+  void                                      *buffer,
+  unsigned32                                 size,
+  Objects_Id                                 id,
+  CORE_message_queue_API_mp_support_callout  api_message_queue_mp_support
+)
+{
+  return _CORE_message_queue_Submit(
+    the_message_queue,
+    buffer,
+    size,
+    id,
+    api_message_queue_mp_support,
+    CORE_MESSAGE_QUEUE_URGENT_REQUEST
+ );
+}
+
+/*PAGE
+ *
+ *  _CORE_message_queue_Copy_buffer
+ *
+ */
+
+STATIC INLINE void _CORE_message_queue_Copy_buffer (
+  void      *source,
+  void      *destination,
+  unsigned32 size
+)
+{
+  memcpy(destination, source, size);
+}
+
+/*PAGE
+ *
+ *  _CORE_message_queue_Allocate_message_buffer
+ *
+ */
+
+STATIC INLINE CORE_message_queue_Buffer_control *
+_CORE_message_queue_Allocate_message_buffer (
+    CORE_message_queue_Control *the_message_queue
+)
+{
+   return (CORE_message_queue_Buffer_control *)
+     _Chain_Get( &the_message_queue->Inactive_messages );
+}
+
+/*PAGE
+ *
+ *  _CORE_message_queue_Free_message_buffer
+ *
+ */
+
+STATIC INLINE void _CORE_message_queue_Free_message_buffer (
+    CORE_message_queue_Control        *the_message_queue,
+    CORE_message_queue_Buffer_control *the_message
+)
+{
+  _Chain_Append( &the_message_queue->Inactive_messages, &the_message->Node );
+}
+
+/*PAGE
+ *
+ *  _CORE_message_queue_Get_pending_message
+ *
+ */
+
+STATIC INLINE
+  CORE_message_queue_Buffer_control *_CORE_message_queue_Get_pending_message (
+  CORE_message_queue_Control *the_message_queue
+)
+{
+  return (CORE_message_queue_Buffer_control *)
+    _Chain_Get_unprotected( &the_message_queue->Pending_messages );
+}
+
+/*PAGE
+ *
+ *  _CORE_message_queue_Is_priority
+ *
+ */
+ 
+STATIC INLINE boolean _CORE_message_queue_Is_priority(
+  CORE_message_queue_Attributes *the_attribute
+)
+{
+  return (the_attribute->discipline == CORE_MESSAGE_QUEUE_DISCIPLINES_PRIORITY);
+}
+
+/*PAGE
+ *
+ *  _CORE_message_queue_Append
+ *
+ */
+
+STATIC INLINE void _CORE_message_queue_Append (
+  CORE_message_queue_Control        *the_message_queue,
+  CORE_message_queue_Buffer_control *the_message
+)
+{
+  _Chain_Append( &the_message_queue->Pending_messages, &the_message->Node );
+}
+
+/*PAGE
+ *
+ *  _CORE_message_queue_Prepend
+ *
+ */
+
+STATIC INLINE void _CORE_message_queue_Prepend (
+  CORE_message_queue_Control        *the_message_queue,
+  CORE_message_queue_Buffer_control *the_message
+)
+{
+  _Chain_Prepend(
+    &the_message_queue->Pending_messages,
+    &the_message->Node
+  );
+}
+
+/*PAGE
+ *
+ *  _CORE_message_queue_Is_null
+ *
+ */
+
+STATIC INLINE boolean _CORE_message_queue_Is_null (
+  CORE_message_queue_Control *the_message_queue
+)
+{
+  return ( the_message_queue == NULL  );
+}
+
+
+#endif
+/* end of include file */
Index: c/src/exec/score/inline/rtems/score/coremsg.inl
===================================================================
--- c/src/exec/score/inline/rtems/score/coremsg.inl	(revision 3652ad356bf13abe0963c992cbbda96476d31609)
+++ c/src/exec/score/inline/rtems/score/coremsg.inl	(revision 3652ad356bf13abe0963c992cbbda96476d31609)
@@ -0,0 +1,186 @@
+/*  coremsg.inl
+ *
+ *  This include file contains the static inline implementation of all
+ *  inlined routines in the Core Message Handler.
+ *
+ *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ *  On-Line Applications Research Corporation (OAR).
+ *  All rights assigned to U.S. Government, 1994.
+ *
+ *  This material may be reproduced by or for the U.S. Government pursuant
+ *  to the copyright license under the clause at DFARS 252.227-7013.  This
+ *  notice must appear in all copies of this file and its derivatives.
+ *
+ *  $Id$
+ */
+
+#ifndef __CORE_MESSAGE_QUEUE_inl
+#define __CORE_MESSAGE_QUEUE_inl
+
+/*PAGE
+ *
+ *  _CORE_message_queue_Send
+ *
+ */
+ 
+STATIC INLINE CORE_message_queue_Status _CORE_message_queue_Send(
+  CORE_message_queue_Control                *the_message_queue,
+  void                                      *buffer,
+  unsigned32                                 size,
+  Objects_Id                                 id,
+  CORE_message_queue_API_mp_support_callout  api_message_queue_mp_support
+)
+{
+  return _CORE_message_queue_Submit(
+    the_message_queue,
+    buffer,
+    size,
+    id,
+    api_message_queue_mp_support,
+    CORE_MESSAGE_QUEUE_SEND_REQUEST
+  );
+}
+ 
+/*PAGE
+ *
+ *  _CORE_message_queue_Urgent
+ *
+ */
+ 
+STATIC INLINE CORE_message_queue_Status _CORE_message_queue_Urgent(
+  CORE_message_queue_Control                *the_message_queue,
+  void                                      *buffer,
+  unsigned32                                 size,
+  Objects_Id                                 id,
+  CORE_message_queue_API_mp_support_callout  api_message_queue_mp_support
+)
+{
+  return _CORE_message_queue_Submit(
+    the_message_queue,
+    buffer,
+    size,
+    id,
+    api_message_queue_mp_support,
+    CORE_MESSAGE_QUEUE_URGENT_REQUEST
+ );
+}
+
+/*PAGE
+ *
+ *  _CORE_message_queue_Copy_buffer
+ *
+ */
+
+STATIC INLINE void _CORE_message_queue_Copy_buffer (
+  void      *source,
+  void      *destination,
+  unsigned32 size
+)
+{
+  memcpy(destination, source, size);
+}
+
+/*PAGE
+ *
+ *  _CORE_message_queue_Allocate_message_buffer
+ *
+ */
+
+STATIC INLINE CORE_message_queue_Buffer_control *
+_CORE_message_queue_Allocate_message_buffer (
+    CORE_message_queue_Control *the_message_queue
+)
+{
+   return (CORE_message_queue_Buffer_control *)
+     _Chain_Get( &the_message_queue->Inactive_messages );
+}
+
+/*PAGE
+ *
+ *  _CORE_message_queue_Free_message_buffer
+ *
+ */
+
+STATIC INLINE void _CORE_message_queue_Free_message_buffer (
+    CORE_message_queue_Control        *the_message_queue,
+    CORE_message_queue_Buffer_control *the_message
+)
+{
+  _Chain_Append( &the_message_queue->Inactive_messages, &the_message->Node );
+}
+
+/*PAGE
+ *
+ *  _CORE_message_queue_Get_pending_message
+ *
+ */
+
+STATIC INLINE
+  CORE_message_queue_Buffer_control *_CORE_message_queue_Get_pending_message (
+  CORE_message_queue_Control *the_message_queue
+)
+{
+  return (CORE_message_queue_Buffer_control *)
+    _Chain_Get_unprotected( &the_message_queue->Pending_messages );
+}
+
+/*PAGE
+ *
+ *  _CORE_message_queue_Is_priority
+ *
+ */
+ 
+STATIC INLINE boolean _CORE_message_queue_Is_priority(
+  CORE_message_queue_Attributes *the_attribute
+)
+{
+  return (the_attribute->discipline == CORE_MESSAGE_QUEUE_DISCIPLINES_PRIORITY);
+}
+
+/*PAGE
+ *
+ *  _CORE_message_queue_Append
+ *
+ */
+
+STATIC INLINE void _CORE_message_queue_Append (
+  CORE_message_queue_Control        *the_message_queue,
+  CORE_message_queue_Buffer_control *the_message
+)
+{
+  _Chain_Append( &the_message_queue->Pending_messages, &the_message->Node );
+}
+
+/*PAGE
+ *
+ *  _CORE_message_queue_Prepend
+ *
+ */
+
+STATIC INLINE void _CORE_message_queue_Prepend (
+  CORE_message_queue_Control        *the_message_queue,
+  CORE_message_queue_Buffer_control *the_message
+)
+{
+  _Chain_Prepend(
+    &the_message_queue->Pending_messages,
+    &the_message->Node
+  );
+}
+
+/*PAGE
+ *
+ *  _CORE_message_queue_Is_null
+ *
+ */
+
+STATIC INLINE boolean _CORE_message_queue_Is_null (
+  CORE_message_queue_Control *the_message_queue
+)
+{
+  return ( the_message_queue == NULL  );
+}
+
+
+#endif
+/* end of include file */
Index: c/src/exec/score/macros/coremsg.inl
===================================================================
--- c/src/exec/score/macros/coremsg.inl	(revision 3652ad356bf13abe0963c992cbbda96476d31609)
+++ c/src/exec/score/macros/coremsg.inl	(revision 3652ad356bf13abe0963c992cbbda96476d31609)
@@ -0,0 +1,121 @@
+/*  coremsg.inl
+ *
+ *  This include file contains the macro implementation of all
+ *  inlined routines in the Core Message Handler.
+ *
+ *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ *  On-Line Applications Research Corporation (OAR).
+ *  All rights assigned to U.S. Government, 1994.
+ *
+ *  This material may be reproduced by or for the U.S. Government pursuant
+ *  to the copyright license under the clause at DFARS 252.227-7013.  This
+ *  notice must appear in all copies of this file and its derivatives.
+ *
+ *  $Id$
+ */
+
+#ifndef __CORE_MESSAGE_QUEUE_inl
+#define __CORE_MESSAGE_QUEUE_inl
+
+/*PAGE
+ *
+ *  _CORE_message_queue_Send
+ *
+ */
+ 
+#define _CORE_message_queue_Send( _the_message_queue, _buffer, _size, \
+_id, _api_message_queue_mp_support ) \
+  _CORE_message_queue_Submit( (_the_message_queue), (_buffer), (_size), \
+     (_id), (_api_message_queue_mp_support), CORE_MESSAGE_QUEUE_SEND_REQUEST )
+ 
+/*PAGE
+ *
+ *  _CORE_message_queue_Urgent
+ *
+ */
+ 
+#define _CORE_message_queue_Urgent( _the_message_queue, _buffer, _size, \
+_id, _api_message_queue_mp_support ) \
+  _CORE_message_queue_Submit( (_the_message_queue), (_buffer), (_size), \
+     (_id), (_api_message_queue_mp_support), CORE_MESSAGE_QUEUE_URGENT_REQUEST )
+
+/*PAGE
+ *
+ *  _CORE_message_queue_Copy_buffer
+ */
+
+#define _CORE_message_queue_Copy_buffer( _source, _destination, _size ) \
+  memcpy( _destination, _source, _size)
+
+/*PAGE
+ *
+ *  _CORE_message_queue_Allocate_message_buffer
+ *
+ */
+
+#define _CORE_message_queue_Allocate_message_buffer( _the_message_queue ) \
+  (CORE_message_queue_Buffer_control *) \
+    _Chain_Get( &(_the_message_queue)->Inactive_messages )
+
+/*PAGE
+ *
+ *  _CORE_message_queue_Free_message_buffer
+ *
+ */
+
+#define _CORE_message_queue_Free_message_buffer( _the_message_queue, _the_message ) \
+  _Chain_Append( \
+    &(_the_message_queue)->Inactive_messages, \
+    &(_the_message)->Node \
+  )
+
+/*PAGE
+ *
+ *  _CORE_message_queue_Is_priority
+ *
+ */
+ 
+#define _CORE_message_queue_Is_priority( _the_attribute ) \
+  ((_the_attribute)->discipline == CORE_MESSAGE_QUEUE_DISCIPLINES_PRIORITY)
+
+/*PAGE
+ *
+ *  _CORE_message_queue_Get_pending_message
+ *
+ */
+
+#define _CORE_message_queue_Get_pending_message( _the_message_queue ) \
+   (CORE_message_queue_Buffer_control *) \
+     _Chain_Get_unprotected( &(_the_message_queue)->Pending_messages )
+
+/*PAGE
+ *
+ *  _CORE_message_queue_Append
+ *
+ */
+
+#define _CORE_message_queue_Append( _the_message_queue, _the_message ) \
+   _Chain_Append( &(_the_message_queue)->Pending_messages, \
+                  &(_the_message)->Node )
+
+/*PAGE
+ *
+ *  _CORE_message_queue_Prepend
+ *
+ */
+
+#define _CORE_message_queue_Prepend( _the_message_queue, _the_message ) \
+   _Chain_Prepend( &(_the_message_queue)->Pending_messages, \
+                   &(_the_message)->Node )
+
+/*PAGE
+ *
+ *  _CORE_message_queue_Is_null
+ *
+ */
+
+#define _CORE_message_queue_Is_null( _the_message_queue ) \
+   ( (_the_message_queue) == NULL  )
+
+#endif
+/* end of include file */
Index: c/src/exec/score/macros/rtems/score/coremsg.inl
===================================================================
--- c/src/exec/score/macros/rtems/score/coremsg.inl	(revision 3652ad356bf13abe0963c992cbbda96476d31609)
+++ c/src/exec/score/macros/rtems/score/coremsg.inl	(revision 3652ad356bf13abe0963c992cbbda96476d31609)
@@ -0,0 +1,121 @@
+/*  coremsg.inl
+ *
+ *  This include file contains the macro implementation of all
+ *  inlined routines in the Core Message Handler.
+ *
+ *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ *  On-Line Applications Research Corporation (OAR).
+ *  All rights assigned to U.S. Government, 1994.
+ *
+ *  This material may be reproduced by or for the U.S. Government pursuant
+ *  to the copyright license under the clause at DFARS 252.227-7013.  This
+ *  notice must appear in all copies of this file and its derivatives.
+ *
+ *  $Id$
+ */
+
+#ifndef __CORE_MESSAGE_QUEUE_inl
+#define __CORE_MESSAGE_QUEUE_inl
+
+/*PAGE
+ *
+ *  _CORE_message_queue_Send
+ *
+ */
+ 
+#define _CORE_message_queue_Send( _the_message_queue, _buffer, _size, \
+_id, _api_message_queue_mp_support ) \
+  _CORE_message_queue_Submit( (_the_message_queue), (_buffer), (_size), \
+     (_id), (_api_message_queue_mp_support), CORE_MESSAGE_QUEUE_SEND_REQUEST )
+ 
+/*PAGE
+ *
+ *  _CORE_message_queue_Urgent
+ *
+ */
+ 
+#define _CORE_message_queue_Urgent( _the_message_queue, _buffer, _size, \
+_id, _api_message_queue_mp_support ) \
+  _CORE_message_queue_Submit( (_the_message_queue), (_buffer), (_size), \
+     (_id), (_api_message_queue_mp_support), CORE_MESSAGE_QUEUE_URGENT_REQUEST )
+
+/*PAGE
+ *
+ *  _CORE_message_queue_Copy_buffer
+ */
+
+#define _CORE_message_queue_Copy_buffer( _source, _destination, _size ) \
+  memcpy( _destination, _source, _size)
+
+/*PAGE
+ *
+ *  _CORE_message_queue_Allocate_message_buffer
+ *
+ */
+
+#define _CORE_message_queue_Allocate_message_buffer( _the_message_queue ) \
+  (CORE_message_queue_Buffer_control *) \
+    _Chain_Get( &(_the_message_queue)->Inactive_messages )
+
+/*PAGE
+ *
+ *  _CORE_message_queue_Free_message_buffer
+ *
+ */
+
+#define _CORE_message_queue_Free_message_buffer( _the_message_queue, _the_message ) \
+  _Chain_Append( \
+    &(_the_message_queue)->Inactive_messages, \
+    &(_the_message)->Node \
+  )
+
+/*PAGE
+ *
+ *  _CORE_message_queue_Is_priority
+ *
+ */
+ 
+#define _CORE_message_queue_Is_priority( _the_attribute ) \
+  ((_the_attribute)->discipline == CORE_MESSAGE_QUEUE_DISCIPLINES_PRIORITY)
+
+/*PAGE
+ *
+ *  _CORE_message_queue_Get_pending_message
+ *
+ */
+
+#define _CORE_message_queue_Get_pending_message( _the_message_queue ) \
+   (CORE_message_queue_Buffer_control *) \
+     _Chain_Get_unprotected( &(_the_message_queue)->Pending_messages )
+
+/*PAGE
+ *
+ *  _CORE_message_queue_Append
+ *
+ */
+
+#define _CORE_message_queue_Append( _the_message_queue, _the_message ) \
+   _Chain_Append( &(_the_message_queue)->Pending_messages, \
+                  &(_the_message)->Node )
+
+/*PAGE
+ *
+ *  _CORE_message_queue_Prepend
+ *
+ */
+
+#define _CORE_message_queue_Prepend( _the_message_queue, _the_message ) \
+   _Chain_Prepend( &(_the_message_queue)->Pending_messages, \
+                   &(_the_message)->Node )
+
+/*PAGE
+ *
+ *  _CORE_message_queue_Is_null
+ *
+ */
+
+#define _CORE_message_queue_Is_null( _the_message_queue ) \
+   ( (_the_message_queue) == NULL  )
+
+#endif
+/* end of include file */
Index: c/src/exec/score/src/coremsg.c
===================================================================
--- c/src/exec/score/src/coremsg.c	(revision 3652ad356bf13abe0963c992cbbda96476d31609)
+++ c/src/exec/score/src/coremsg.c	(revision 3652ad356bf13abe0963c992cbbda96476d31609)
@@ -0,0 +1,436 @@
+/*
+ *  CORE Message Queue Handler
+ *
+ *  DESCRIPTION:
+ *
+ *  This package is the implementation of the CORE Message Queue Handler.
+ *  This core object provides task synchronization and communication functions
+ *  via messages passed to queue objects.
+ *
+ *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ *  On-Line Applications Research Corporation (OAR).
+ *  All rights assigned to U.S. Government, 1994.
+ *
+ *  This material may be reproduced by or for the U.S. Government pursuant
+ *  to the copyright license under the clause at DFARS 252.227-7013.  This
+ *  notice must appear in all copies of this file and its derivatives.
+ *
+ *  $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/attr.h>
+#include <rtems/core/chain.h>
+#include <rtems/core/isr.h>
+#include <rtems/rtems/message.h>
+#include <rtems/core/object.h>
+#include <rtems/rtems/options.h>
+#include <rtems/core/states.h>
+#include <rtems/rtems/support.h>
+#include <rtems/core/thread.h>
+#include <rtems/core/wkspace.h>
+#include <rtems/core/mpci.h>
+#include <rtems/sysstate.h>
+
+/*PAGE
+ *
+ *  _CORE_message_queue_Initialize
+ *
+ *  This routine initializes a newly created message queue based on the
+ *  specified data.
+ *
+ *  Input parameters:
+ *    the_message_queue            - the message queue to initialize
+ *    the_class                    - the API specific object class
+ *    the_message_queue_attributes - the message queue's attributes
+ *    maximum_pending_messages     - maximum message and reserved buffer count
+ *    maximum_message_size         - maximum size of each message
+ *    proxy_extract_callout        - remote extract support
+ *
+ *  Output parameters:
+ *    TRUE   - if the message queue is initialized
+ *    FALSE  - if the message queue is NOT initialized
+ */
+
+boolean _CORE_message_queue_Initialize(
+  CORE_message_queue_Control    *the_message_queue,
+  Objects_Classes                the_class,
+  CORE_message_queue_Attributes *the_message_queue_attributes,
+  unsigned32                     maximum_pending_messages,
+  unsigned32                     maximum_message_size,
+  Thread_queue_Extract_callout   proxy_extract_callout
+)
+{
+  unsigned32 message_buffering_required;
+  unsigned32 allocated_message_size;
+
+  the_message_queue->maximum_pending_messages   = maximum_pending_messages;
+  the_message_queue->number_of_pending_messages = 0;
+  the_message_queue->maximum_message_size       = maximum_message_size;
+ 
+  /*
+   * round size up to multiple of a ptr for chain init
+   */
+ 
+  allocated_message_size = maximum_message_size;
+  if (allocated_message_size & (sizeof(unsigned32) - 1)) {
+      allocated_message_size += sizeof(unsigned32);
+      allocated_message_size &= ~(sizeof(unsigned32) - 1);
+  }
+   
+  message_buffering_required = maximum_pending_messages *
+       (allocated_message_size + sizeof(CORE_message_queue_Buffer_control));
+ 
+  the_message_queue->message_buffers = (CORE_message_queue_Buffer *) 
+     _Workspace_Allocate( message_buffering_required );
+ 
+  if (the_message_queue->message_buffers == 0)
+    return FALSE;
+ 
+  _Chain_Initialize (
+    &the_message_queue->Inactive_messages,
+    the_message_queue->message_buffers,
+    maximum_pending_messages,
+    allocated_message_size + sizeof( CORE_message_queue_Buffer_control )
+  );
+ 
+  _Chain_Initialize_empty( &the_message_queue->Pending_messages );
+ 
+  _Thread_queue_Initialize(
+    &the_message_queue->Wait_queue,
+    the_class,
+    _CORE_message_queue_Is_priority( the_message_queue_attributes ) ?
+       THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO,
+    STATES_WAITING_FOR_MESSAGE,
+    proxy_extract_callout,
+    CORE_MESSAGE_QUEUE_STATUS_TIMEOUT
+  );
+
+  return TRUE;
+}
+
+/*PAGE
+ *
+ *  _CORE_message_queue_Close
+ *
+ *  This function closes a message by returning all allocated space and
+ *  flushing the message_queue's task wait queue.
+ *
+ *  Input parameters:
+ *    the_message_queue      - the message_queue to be flushed
+ *    remote_extract_callout - function to invoke remotely
+ *    status                 - status to pass to thread
+ *
+ *  Output parameters:  NONE
+ */
+ 
+void _CORE_message_queue_Close(
+  CORE_message_queue_Control *the_message_queue,
+  Thread_queue_Flush_callout  remote_extract_callout,
+  unsigned32                  status
+)
+{
+ 
+  if ( the_message_queue->number_of_pending_messages != 0 )
+        (void) _CORE_message_queue_Flush_support( the_message_queue );
+  else
+    _Thread_queue_Flush(
+      &the_message_queue->Wait_queue,
+      remote_extract_callout,
+      status
+    );
+
+  (void) _Workspace_Free( the_message_queue->message_buffers );
+
+}
+
+/*PAGE
+ *
+ *  _CORE_message_queue_Flush
+ *
+ *  This function flushes the message_queue's task wait queue.  The number
+ *  of messages flushed from the queue is returned.
+ *
+ *  Input parameters:
+ *    the_message_queue - the message_queue to be flushed
+ *
+ *  Output parameters:
+ *    returns - the number of messages flushed from the queue
+ */
+ 
+unsigned32 _CORE_message_queue_Flush(
+  CORE_message_queue_Control *the_message_queue
+)
+{
+  if ( the_message_queue->number_of_pending_messages != 0 )
+    return _CORE_message_queue_Flush_support( the_message_queue );
+  else
+    return 0;
+}
+
+/*PAGE
+ *
+ *  _CORE_message_queue_Broadcast
+ *
+ *  This function sends a message for every thread waiting on the queue and
+ *  returns the number of threads made ready by the message.
+ *
+ *  Input parameters:
+ *    the_message_queue            - message is submitted to this message queue
+ *    buffer                       - pointer to message buffer
+ *    size                         - size in bytes of message to send
+ *    id                           - id of message queue
+ *    api_message_queue_mp_support - api specific mp support callout
+ *    count                        - area to store number of threads made ready
+ *
+ *  Output parameters:
+ *    count                         - number of threads made ready
+ *    CORE_MESSAGE_QUEUE_SUCCESSFUL - if successful
+ *    error code                    - if unsuccessful
+ */
+
+CORE_message_queue_Status _CORE_message_queue_Broadcast(
+  CORE_message_queue_Control                *the_message_queue,
+  void                                      *buffer,
+  unsigned32                                 size,
+  Objects_Id                                 id,
+  CORE_message_queue_API_mp_support_callout  api_message_queue_mp_support,
+  unsigned32                                *count
+)
+{
+  Thread_Control          *the_thread;
+  unsigned32               number_broadcasted;
+  Thread_Wait_information *waitp;
+  unsigned32               constrained_size;
+
+  number_broadcasted = 0;
+  while ((the_thread = _Thread_queue_Dequeue(&the_message_queue->Wait_queue))) {
+    waitp = &the_thread->Wait;
+    number_broadcasted += 1;
+
+    constrained_size = size;
+    if ( size > the_message_queue->maximum_message_size )
+        constrained_size = the_message_queue->maximum_message_size;
+
+    _CORE_message_queue_Copy_buffer(
+      buffer,
+      waitp->return_argument,
+      constrained_size
+    );
+
+    *(rtems_unsigned32 *)the_thread->Wait.return_argument_1 = size;
+
+    if ( !_Objects_Is_local_id( the_thread->Object.id ) )
+      (*api_message_queue_mp_support) ( the_thread, id );
+
+  }
+  *count = number_broadcasted;
+  return CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL;
+}
+
+/*PAGE
+ *
+ *  _CORE_message_queue_Seize
+ *
+ *  This kernel routine dequeues a message, copies the message buffer to
+ *  a given destination buffer, and frees the message buffer to the
+ *  inactive message pool.  The thread will be blocked if wait is TRUE,
+ *  otherwise an error will be given to the thread if no messages are available.
+ *
+ *  Input parameters:
+ *    the_message_queue - pointer to message queue
+ *    id                - id of object we are waitig on
+ *    buffer            - pointer to message buffer to be filled
+ *    size              - pointer to the size of buffer to be filled
+ *    wait              - TRUE if wait is allowed, FALSE otherwise
+ *    timeout           - time to wait for a message
+ *
+ *  Output parameters:  NONE
+ *
+ *  NOTE: Dependent on BUFFER_LENGTH
+ *
+ *  INTERRUPT LATENCY:
+ *    available
+ *    wait
+ */
+
+void _CORE_message_queue_Seize(
+  CORE_message_queue_Control *the_message_queue,
+  Objects_Id                  id,
+  void                       *buffer,
+  unsigned32                 *size,
+  boolean                     wait,
+  Watchdog_Interval           timeout
+)
+{
+  ISR_Level                          level;
+  CORE_message_queue_Buffer_control *the_message;
+  Thread_Control                    *executing;
+
+  executing = _Thread_Executing;
+  executing->Wait.return_code = CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL;
+  _ISR_Disable( level );
+  if ( the_message_queue->number_of_pending_messages != 0 ) {
+    the_message_queue->number_of_pending_messages -= 1;
+
+    the_message = _CORE_message_queue_Get_pending_message( the_message_queue );
+    _ISR_Enable( level );
+    *size = the_message->Contents.size;
+    _CORE_message_queue_Copy_buffer(the_message->Contents.buffer,buffer,*size );
+    _CORE_message_queue_Free_message_buffer(the_message_queue, the_message );
+    return;
+  }
+
+  if ( !wait ) {
+    _ISR_Enable( level );
+    executing->Wait.return_code = CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_NOWAIT;
+    return;
+  }
+
+  the_message_queue->Wait_queue.sync = TRUE;
+  executing->Wait.queue              = &the_message_queue->Wait_queue;
+  executing->Wait.id                 = id;
+  executing->Wait.return_argument    = (void *)buffer;
+  executing->Wait.return_argument_1  = (void *)size;
+  _ISR_Enable( level );
+
+  _Thread_queue_Enqueue( &the_message_queue->Wait_queue, timeout );
+}
+
+/*PAGE
+ *
+ *  _CORE_message_queue_Flush_support
+ *
+ *  This message handler routine removes all messages from a message queue
+ *  and returns them to the inactive message pool.  The number of messages
+ *  flushed from the queue is returned
+ *
+ *  Input parameters:
+ *    the_message_queue - pointer to message queue
+ *
+ *  Output parameters:
+ *    returns - number of messages placed on inactive chain
+ *
+ *  INTERRUPT LATENCY:
+ *    only case
+ */
+
+unsigned32 _CORE_message_queue_Flush_support(
+  CORE_message_queue_Control *the_message_queue
+)
+{
+  ISR_Level   level;
+  Chain_Node *inactive_first;
+  Chain_Node *message_queue_first;
+  Chain_Node *message_queue_last;
+  unsigned32  count;
+
+  _ISR_Disable( level );
+    inactive_first      = the_message_queue->Inactive_messages.first;
+    message_queue_first = the_message_queue->Pending_messages.first;
+    message_queue_last  = the_message_queue->Pending_messages.last;
+
+    the_message_queue->Inactive_messages.first = message_queue_first;
+    message_queue_last->next = inactive_first;
+    inactive_first->previous = message_queue_last;
+    message_queue_first->previous          =
+               _Chain_Head( &the_message_queue->Inactive_messages );
+
+    _Chain_Initialize_empty( &the_message_queue->Pending_messages );
+
+    count = the_message_queue->number_of_pending_messages;
+    the_message_queue->number_of_pending_messages = 0;
+  _ISR_Enable( level );
+  return count;
+}
+
+/*PAGE
+ *
+ *  _CORE_message_queue_Submit
+ *
+ *  This routine implements the send and urgent message functions. It
+ *  processes a message that is to be submitted to the designated
+ *  message queue.  The message will either be processed as a
+ *  send message which it will be inserted at the rear of the queue
+ *  or it will be processed as an urgent message which will be inserted
+ *  at the front of the queue.
+ *
+ *  Input parameters:
+ *    the_message_queue            - message is submitted to this message queue
+ *    buffer                       - pointer to message buffer
+ *    size                         - size in bytes of message to send
+ *    id                           - id of message queue
+ *    api_message_queue_mp_support - api specific mp support callout
+ *    submit_type                  - send or urgent message
+ *
+ *  Output parameters:
+ *    CORE_MESSAGE_QUEUE_SUCCESSFUL - if successful
+ *    error code                    - if unsuccessful
+ */
+
+CORE_message_queue_Status _CORE_message_queue_Submit(
+  CORE_message_queue_Control                *the_message_queue,
+  void                                      *buffer,
+  unsigned32                                 size,
+  Objects_Id                                 id,
+  CORE_message_queue_API_mp_support_callout  api_message_queue_mp_support,
+  CORE_message_queue_Submit_types            submit_type
+)
+{
+  CORE_message_queue_Buffer_control   *the_message;
+  Thread_Control                      *the_thread;
+
+  if ( size > the_message_queue->maximum_message_size )
+    return CORE_MESSAGE_QUEUE_STATUS_INVALID_SIZE;
+
+  /*
+   * Is there a thread currently waiting on this message queue?
+   */
+      
+  the_thread = _Thread_queue_Dequeue( &the_message_queue->Wait_queue );
+  if ( the_thread )
+  {
+    _CORE_message_queue_Copy_buffer(
+      buffer,
+      the_thread->Wait.return_argument,
+      size
+    );
+    *(rtems_unsigned32 *)the_thread->Wait.return_argument_1 = size;
+    
+    if ( !_Objects_Is_local_id( the_thread->Object.id ) )
+      (*api_message_queue_mp_support) ( the_thread, id );
+
+    return CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL;
+  }
+
+  /*
+   * No one waiting on this one currently.
+   * Allocate a message buffer and store it away
+   */
+
+  if ( the_message_queue->number_of_pending_messages ==
+       the_message_queue->maximum_pending_messages ) {
+    return CORE_MESSAGE_QUEUE_STATUS_TOO_MANY;
+  }
+
+  the_message = _CORE_message_queue_Allocate_message_buffer(the_message_queue);
+  if ( the_message == 0)
+    return CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED;
+
+  _CORE_message_queue_Copy_buffer( buffer, the_message->Contents.buffer, size );
+  the_message->Contents.size = size;
+  
+  the_message_queue->number_of_pending_messages += 1;
+
+  switch ( submit_type ) {
+    case CORE_MESSAGE_QUEUE_SEND_REQUEST:
+      _CORE_message_queue_Append( the_message_queue, the_message );
+      break;
+    case CORE_MESSAGE_QUEUE_URGENT_REQUEST:
+      _CORE_message_queue_Prepend( the_message_queue, the_message );
+      break;
+  }
+
+  return CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL;
+}
