Index: cpukit/posix/include/rtems/posix/semaphoreimpl.h
===================================================================
--- cpukit/posix/include/rtems/posix/semaphoreimpl.h	(revision b5a21bf139168285a009c8da65e63ea99bc064ba)
+++ cpukit/posix/include/rtems/posix/semaphoreimpl.h	(revision 4025a60fcb892169266102a58beef4caad17340c)
@@ -23,6 +23,5 @@
 #include <rtems/posix/posixapi.h>
 #include <rtems/score/coresemimpl.h>
-
-#include <errno.h>
+#include <rtems/seterr.h>
 
 #ifdef __cplusplus
@@ -62,24 +61,4 @@
 }
 
-/**
- *  @brief POSIX Semaphore Get
- *
- *  This function maps semaphore IDs to semaphore control blocks.
- *  If ID corresponds to a local semaphore, then it returns
- *  the_semaphore control pointer which maps to ID and location
- *  is set to OBJECTS_LOCAL.  if the semaphore ID is global and
- *  resides on a remote node, then location is set to OBJECTS_REMOTE,
- *  and the_semaphore is undefined.  Otherwise, location is set
- *  to OBJECTS_ERROR and the_semaphore is undefined.
- */
-RTEMS_INLINE_ROUTINE POSIX_Semaphore_Control *_POSIX_Semaphore_Get (
-  sem_t             *id,
-  Objects_Locations *location
-)
-{
-  return (POSIX_Semaphore_Control *)
-    _Objects_Get( &_POSIX_Semaphore_Information, (Objects_Id)*id, location );
-}
-
 RTEMS_INLINE_ROUTINE POSIX_Semaphore_Control *
 _POSIX_Semaphore_Get_interrupt_disable(
@@ -117,5 +96,6 @@
  */
 void _POSIX_Semaphore_Delete(
-  POSIX_Semaphore_Control *the_semaphore
+  POSIX_Semaphore_Control *the_semaphore,
+  ISR_lock_Context        *lock_context
 );
 
Index: cpukit/posix/src/semaphoredeletesupp.c
===================================================================
--- cpukit/posix/src/semaphoredeletesupp.c	(revision b5a21bf139168285a009c8da65e63ea99bc064ba)
+++ cpukit/posix/src/semaphoredeletesupp.c	(revision 4025a60fcb892169266102a58beef4caad17340c)
@@ -19,24 +19,22 @@
 #endif
 
-#include <stdarg.h>
-
-#include <errno.h>
-#include <fcntl.h>
-#include <pthread.h>
-#include <semaphore.h>
-#include <limits.h>
-
-#include <rtems/system.h>
 #include <rtems/posix/semaphoreimpl.h>
-#include <rtems/seterr.h>
 
 void _POSIX_Semaphore_Delete(
-  POSIX_Semaphore_Control *the_semaphore
+  POSIX_Semaphore_Control *the_semaphore,
+  ISR_lock_Context        *lock_context
 )
 {
   if ( !the_semaphore->linked && !the_semaphore->open_count ) {
     _Objects_Close( &_POSIX_Semaphore_Information, &the_semaphore->Object );
-    _CORE_semaphore_Destroy( &the_semaphore->Semaphore, NULL, 0 );
+    _CORE_semaphore_Destroy(
+      &the_semaphore->Semaphore,
+      NULL,
+      0,
+      lock_context
+    );
     _POSIX_Semaphore_Free( the_semaphore );
+  } else {
+    _CORE_semaphore_Release( &the_semaphore->Semaphore, lock_context );
   }
 }
Index: cpukit/posix/src/semclose.c
===================================================================
--- cpukit/posix/src/semclose.c	(revision b5a21bf139168285a009c8da65e63ea99bc064ba)
+++ cpukit/posix/src/semclose.c	(revision 4025a60fcb892169266102a58beef4caad17340c)
@@ -19,15 +19,7 @@
 #endif
 
-#include <stdarg.h>
+#include <semaphore.h>
 
-#include <errno.h>
-#include <fcntl.h>
-#include <pthread.h>
-#include <semaphore.h>
-#include <limits.h>
-
-#include <rtems/system.h>
 #include <rtems/posix/semaphoreimpl.h>
-#include <rtems/seterr.h>
 
 int sem_close(
@@ -37,13 +29,21 @@
   POSIX_Semaphore_Control          *the_semaphore;
   Objects_Locations                 location;
+  ISR_lock_Context                  lock_context;
 
   _Objects_Allocator_lock();
-  the_semaphore = _POSIX_Semaphore_Get( sem, &location );
+  the_semaphore = _POSIX_Semaphore_Get_interrupt_disable(
+    sem,
+    &location,
+    &lock_context
+  );
   switch ( location ) {
 
     case OBJECTS_LOCAL:
+      _CORE_semaphore_Acquire_critical(
+        &the_semaphore->Semaphore,
+        &lock_context
+      );
       the_semaphore->open_count -= 1;
-      _POSIX_Semaphore_Delete( the_semaphore );
-      _Objects_Put( &the_semaphore->Object );
+      _POSIX_Semaphore_Delete( the_semaphore, &lock_context );
       _Objects_Allocator_unlock();
       return 0;
Index: cpukit/posix/src/semdestroy.c
===================================================================
--- cpukit/posix/src/semdestroy.c	(revision b5a21bf139168285a009c8da65e63ea99bc064ba)
+++ cpukit/posix/src/semdestroy.c	(revision 4025a60fcb892169266102a58beef4caad17340c)
@@ -19,15 +19,7 @@
 #endif
 
-#include <stdarg.h>
+#include <semaphore.h>
 
-#include <errno.h>
-#include <fcntl.h>
-#include <pthread.h>
-#include <semaphore.h>
-#include <limits.h>
-
-#include <rtems/system.h>
 #include <rtems/posix/semaphoreimpl.h>
-#include <rtems/seterr.h>
 
 int sem_destroy(
@@ -37,19 +29,28 @@
   POSIX_Semaphore_Control          *the_semaphore;
   Objects_Locations                 location;
+  ISR_lock_Context                  lock_context;
 
   _Objects_Allocator_lock();
-  the_semaphore = _POSIX_Semaphore_Get( sem, &location );
+  the_semaphore = _POSIX_Semaphore_Get_interrupt_disable(
+    sem,
+    &location,
+    &lock_context
+  );
   switch ( location ) {
 
     case OBJECTS_LOCAL:
+      _CORE_semaphore_Acquire_critical(
+        &the_semaphore->Semaphore,
+        &lock_context
+      );
+
       /*
        *  Undefined operation on a named semaphore. Release the object
        *  and fall to the EINVAL return at the bottom.
        */
-      if ( the_semaphore->named == true ) {
-        _Objects_Put( &the_semaphore->Object );
+      if ( the_semaphore->named ) {
+        _CORE_semaphore_Release( &the_semaphore->Semaphore, &lock_context );
       } else {
-        _POSIX_Semaphore_Delete( the_semaphore );
-        _Objects_Put( &the_semaphore->Object );
+        _POSIX_Semaphore_Delete( the_semaphore, &lock_context );
         _Objects_Allocator_unlock();
         return 0;
Index: cpukit/posix/src/semunlink.c
===================================================================
--- cpukit/posix/src/semunlink.c	(revision b5a21bf139168285a009c8da65e63ea99bc064ba)
+++ cpukit/posix/src/semunlink.c	(revision 4025a60fcb892169266102a58beef4caad17340c)
@@ -22,5 +22,4 @@
 
 #include <rtems/posix/semaphoreimpl.h>
-#include <rtems/seterr.h>
 
 int sem_unlink(
@@ -30,4 +29,5 @@
   POSIX_Semaphore_Control   *the_semaphore;
   Objects_Get_by_name_error  error;
+  ISR_lock_Context           lock_context;
 
   _Objects_Allocator_lock();
@@ -39,7 +39,10 @@
   }
 
+  _POSIX_Semaphore_Namespace_remove( the_semaphore );
+
+  _ISR_lock_ISR_disable( &lock_context );
+  _CORE_semaphore_Acquire_critical( &the_semaphore->Semaphore, &lock_context );
   the_semaphore->linked = false;
-  _POSIX_Semaphore_Namespace_remove( the_semaphore );
-  _POSIX_Semaphore_Delete( the_semaphore );
+  _POSIX_Semaphore_Delete( the_semaphore, &lock_context );
 
   _Objects_Allocator_unlock();
Index: cpukit/rtems/src/semdelete.c
===================================================================
--- cpukit/rtems/src/semdelete.c	(revision b5a21bf139168285a009c8da65e63ea99bc064ba)
+++ cpukit/rtems/src/semdelete.c	(revision 4025a60fcb892169266102a58beef4caad17340c)
@@ -38,9 +38,14 @@
   Semaphore_Control          *the_semaphore;
   Objects_Locations           location;
+  ISR_lock_Context            lock_context;
   rtems_attribute             attribute_set;
 
   _Objects_Allocator_lock();
 
-  the_semaphore = _Semaphore_Get( id, &location );
+  the_semaphore = _Semaphore_Get_interrupt_disable(
+    id,
+    &location,
+    &lock_context
+  );
   switch ( location ) {
 
@@ -51,7 +56,14 @@
         MRSP_Status mrsp_status;
 
+        _MRSP_Acquire_critical(
+          &the_semaphore->Core_control.mrsp,
+          &lock_context
+        );
         mrsp_status = _MRSP_Can_destroy( &the_semaphore->Core_control.mrsp );
         if ( mrsp_status != MRSP_SUCCESSFUL ) {
-          _Objects_Put( &the_semaphore->Object );
+          _MRSP_Release(
+            &the_semaphore->Core_control.mrsp,
+            &lock_context
+          );
           _Objects_Allocator_unlock();
           return _Semaphore_Translate_MRSP_status_code( mrsp_status );
@@ -59,33 +71,33 @@
       } else
 #endif
-      if (
-        !_Attributes_Is_counting_semaphore( attribute_set )
-          && _CORE_mutex_Is_locked( &the_semaphore->Core_control.mutex )
-          && !_Attributes_Is_simple_binary_semaphore( attribute_set )
-      ) {
-        _Objects_Put( &the_semaphore->Object );
-        _Objects_Allocator_unlock();
-        return RTEMS_RESOURCE_IN_USE;
+      if ( !_Attributes_Is_counting_semaphore( attribute_set ) ) {
+        _CORE_mutex_Acquire_critical(
+          &the_semaphore->Core_control.mutex,
+          &lock_context
+        );
+
+        if (
+          _CORE_mutex_Is_locked( &the_semaphore->Core_control.mutex )
+            && !_Attributes_Is_simple_binary_semaphore( attribute_set )
+        ) {
+          _CORE_mutex_Release(
+            &the_semaphore->Core_control.mutex,
+            &lock_context
+          );
+          _Objects_Allocator_unlock();
+          return RTEMS_RESOURCE_IN_USE;
+        }
+      } else {
+        _CORE_semaphore_Acquire_critical(
+          &the_semaphore->Core_control.semaphore,
+          &lock_context
+        );
       }
 
       _Objects_Close( &_Semaphore_Information, &the_semaphore->Object );
 
-#if defined(RTEMS_MULTIPROCESSING)
-      if ( _Attributes_Is_global( attribute_set ) ) {
-
-        _Objects_MP_Close( &_Semaphore_Information, the_semaphore->Object.id );
-
-        _Semaphore_MP_Send_process_packet(
-          SEMAPHORE_MP_ANNOUNCE_DELETE,
-          the_semaphore->Object.id,
-          0,                         /* Not used */
-          0                          /* Not used */
-        );
-      }
-#endif
-
 #if defined(RTEMS_SMP)
       if ( _Attributes_Is_multiprocessor_resource_sharing( attribute_set ) ) {
-        _MRSP_Destroy( &the_semaphore->Core_control.mrsp );
+        _MRSP_Destroy( &the_semaphore->Core_control.mrsp, &lock_context );
       } else
 #endif
@@ -95,5 +107,6 @@
           _CORE_mutex_Was_deleted,
           _Semaphore_MP_Send_object_was_deleted,
-          id
+          id,
+          &lock_context
         );
         _CORE_mutex_Destroy( &the_semaphore->Core_control.mutex );
@@ -102,9 +115,23 @@
           &the_semaphore->Core_control.semaphore,
           _Semaphore_MP_Send_object_was_deleted,
-          id
+          id,
+          &lock_context
         );
       }
 
-      _Objects_Put( &the_semaphore->Object );
+#if defined(RTEMS_MULTIPROCESSING)
+      if ( _Attributes_Is_global( attribute_set ) ) {
+
+        _Objects_MP_Close( &_Semaphore_Information, id );
+
+        _Semaphore_MP_Send_process_packet(
+          SEMAPHORE_MP_ANNOUNCE_DELETE,
+          id,
+          0,                         /* Not used */
+          0                          /* Not used */
+        );
+      }
+#endif
+
       _Semaphore_Free( the_semaphore );
       _Objects_Allocator_unlock();
Index: cpukit/rtems/src/semflush.c
===================================================================
--- cpukit/rtems/src/semflush.c	(revision b5a21bf139168285a009c8da65e63ea99bc064ba)
+++ cpukit/rtems/src/semflush.c	(revision 4025a60fcb892169266102a58beef4caad17340c)
@@ -38,7 +38,12 @@
   Semaphore_Control          *the_semaphore;
   Objects_Locations           location;
+  ISR_lock_Context            lock_context;
   rtems_attribute             attribute_set;
 
-  the_semaphore = _Semaphore_Get( id, &location );
+  the_semaphore = _Semaphore_Get_interrupt_disable(
+    id,
+    &location,
+    &lock_context
+  );
   switch ( location ) {
 
@@ -47,28 +52,36 @@
 #if defined(RTEMS_SMP)
       if ( _Attributes_Is_multiprocessor_resource_sharing( attribute_set ) ) {
-        _Objects_Put( &the_semaphore->Object );
+        _ISR_lock_ISR_enable( &lock_context );
         return RTEMS_NOT_DEFINED;
       } else
 #endif
       if ( !_Attributes_Is_counting_semaphore( attribute_set ) ) {
+        _CORE_mutex_Acquire_critical(
+          &the_semaphore->Core_control.mutex,
+          &lock_context
+        );
         _CORE_mutex_Flush(
           &the_semaphore->Core_control.mutex,
           _CORE_mutex_Unsatisfied_nowait,
           _Semaphore_MP_Send_object_was_deleted,
-          id
+          id,
+          &lock_context
         );
       } else {
+        _CORE_semaphore_Acquire_critical(
+          &the_semaphore->Core_control.semaphore,
+          &lock_context
+        );
         _CORE_semaphore_Flush(
           &the_semaphore->Core_control.semaphore,
           _Semaphore_MP_Send_object_was_deleted,
-          id
+          id,
+          &lock_context
         );
       }
-      _Objects_Put( &the_semaphore->Object );
       return RTEMS_SUCCESSFUL;
 
 #if defined(RTEMS_MULTIPROCESSING)
     case OBJECTS_REMOTE:
-      _Thread_Dispatch();
       return RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
 #endif
Index: cpukit/score/include/rtems/score/coremuteximpl.h
===================================================================
--- cpukit/score/include/rtems/score/coremuteximpl.h	(revision b5a21bf139168285a009c8da65e63ea99bc064ba)
+++ cpukit/score/include/rtems/score/coremuteximpl.h	(revision 4025a60fcb892169266102a58beef4caad17340c)
@@ -356,21 +356,15 @@
   filter, \
   mp_callout, \
-  mp_id \
+  mp_id, \
+  lock_context \
 ) \
-  do { \
-    ISR_lock_Context _core_mutex_flush_lock_context; \
-    _Thread_queue_Acquire( \
-      &( the_mutex )->Wait_queue, \
-      &_core_mutex_flush_lock_context \
-    ); \
-    _Thread_queue_Flush_critical( \
-      &( the_mutex )->Wait_queue.Queue, \
-      ( the_mutex )->operations, \
-      filter, \
-      mp_callout, \
-      mp_id, \
-      &_core_mutex_flush_lock_context \
-    ); \
-  } while ( 0 )
+  _Thread_queue_Flush_critical( \
+    &( the_mutex )->Wait_queue.Queue, \
+    ( the_mutex )->operations, \
+    filter, \
+    mp_callout, \
+    mp_id, \
+    lock_context \
+  )
 
 /**
Index: cpukit/score/include/rtems/score/coresemimpl.h
===================================================================
--- cpukit/score/include/rtems/score/coresemimpl.h	(revision b5a21bf139168285a009c8da65e63ea99bc064ba)
+++ cpukit/score/include/rtems/score/coresemimpl.h	(revision 4025a60fcb892169266102a58beef4caad17340c)
@@ -87,4 +87,20 @@
 );
 
+RTEMS_INLINE_ROUTINE void _CORE_semaphore_Acquire_critical(
+  CORE_semaphore_Control *the_semaphore,
+  ISR_lock_Context       *lock_context
+)
+{
+  _Thread_queue_Acquire_critical( &the_semaphore->Wait_queue, lock_context );
+}
+
+RTEMS_INLINE_ROUTINE void _CORE_semaphore_Release(
+  CORE_semaphore_Control *the_semaphore,
+  ISR_lock_Context       *lock_context
+)
+{
+  _Thread_queue_Release( &the_semaphore->Wait_queue, lock_context );
+}
+
 Thread_Control *_CORE_semaphore_Was_deleted(
   Thread_Control     *the_thread,
@@ -102,12 +118,8 @@
   the_semaphore, \
   mp_callout, \
-  mp_id \
+  mp_id, \
+  lock_context \
 ) \
   do { \
-    ISR_lock_Context _core_semaphore_destroy_lock_context; \
-    _Thread_queue_Acquire( \
-      &( the_semaphore )->Wait_queue, \
-      &_core_semaphore_destroy_lock_context \
-    ); \
     _Thread_queue_Flush_critical( \
       &( the_semaphore )->Wait_queue.Queue, \
@@ -116,5 +128,5 @@
       mp_callout, \
       mp_id, \
-      &_core_semaphore_destroy_lock_context \
+      lock_context \
     ); \
     _Thread_queue_Destroy( &( the_semaphore )->Wait_queue ); \
@@ -135,5 +147,5 @@
   status = CORE_SEMAPHORE_STATUS_SUCCESSFUL;
 
-  _Thread_queue_Acquire_critical( &the_semaphore->Wait_queue, lock_context );
+  _CORE_semaphore_Acquire_critical( the_semaphore, lock_context );
 
   the_thread = _Thread_queue_First_locked(
@@ -156,5 +168,5 @@
       status = CORE_SEMAPHORE_MAXIMUM_COUNT_EXCEEDED;
 
-    _Thread_queue_Release( &the_semaphore->Wait_queue, lock_context );
+    _CORE_semaphore_Release( the_semaphore, lock_context );
   }
 
@@ -209,12 +221,8 @@
   the_semaphore, \
   mp_callout, \
-  mp_id \
+  mp_id, \
+  lock_context \
 ) \
   do { \
-    ISR_lock_Context _core_semaphore_flush_lock_context; \
-    _Thread_queue_Acquire( \
-      &( the_semaphore )->Wait_queue, \
-      &_core_semaphore_flush_lock_context \
-    ); \
     _Thread_queue_Flush_critical( \
       &( the_semaphore )->Wait_queue.Queue, \
@@ -223,5 +231,5 @@
       mp_callout, \
       mp_id, \
-      &_core_semaphore_flush_lock_context \
+      lock_context \
     ); \
   } while ( 0 )
@@ -269,13 +277,13 @@
 
   executing->Wait.return_code = CORE_SEMAPHORE_STATUS_SUCCESSFUL;
-  _Thread_queue_Acquire_critical( &the_semaphore->Wait_queue, lock_context );
+  _CORE_semaphore_Acquire_critical( the_semaphore, lock_context );
   if ( the_semaphore->count != 0 ) {
     the_semaphore->count -= 1;
-    _Thread_queue_Release( &the_semaphore->Wait_queue, lock_context );
+    _CORE_semaphore_Release( the_semaphore, lock_context );
     return;
   }
 
   if ( !wait ) {
-    _Thread_queue_Release( &the_semaphore->Wait_queue, lock_context );
+    _CORE_semaphore_Release( the_semaphore, lock_context );
     executing->Wait.return_code = CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT;
     return;
Index: cpukit/score/include/rtems/score/mrspimpl.h
===================================================================
--- cpukit/score/include/rtems/score/mrspimpl.h	(revision b5a21bf139168285a009c8da65e63ea99bc064ba)
+++ cpukit/score/include/rtems/score/mrspimpl.h	(revision 4025a60fcb892169266102a58beef4caad17340c)
@@ -54,4 +54,20 @@
 }
 
+RTEMS_INLINE_ROUTINE void _MRSP_Acquire_critical(
+  MRSP_Control     *mrsp,
+  ISR_lock_Context *lock_context
+)
+{
+  _ISR_lock_Acquire( &mrsp->Lock, lock_context );
+}
+
+RTEMS_INLINE_ROUTINE void _MRSP_Release(
+  MRSP_Control     *mrsp,
+  ISR_lock_Context *lock_context
+)
+{
+  _ISR_lock_Release_and_ISR_enable( &mrsp->Lock, lock_context );
+}
+
 RTEMS_INLINE_ROUTINE bool _MRSP_Restore_priority_filter(
   Thread_Control   *thread,
@@ -104,5 +120,5 @@
 
   cpu_self = _Thread_Dispatch_disable_critical( lock_context );
-  _ISR_lock_Release_and_ISR_enable( &mrsp->Lock, lock_context );
+  _MRSP_Release( mrsp, lock_context );
 
   _Thread_Raise_priority( new_owner, ceiling_priority );
@@ -167,5 +183,6 @@
   ISR_lock_Context lock_context;
 
-  _ISR_lock_ISR_disable_and_acquire( &mrsp->Lock, &lock_context );
+  _ISR_lock_ISR_disable( &lock_context );
+  _MRSP_Acquire_critical( mrsp, &lock_context );
 
   if ( rival->status == MRSP_WAIT_FOR_OWNERSHIP ) {
@@ -184,7 +201,7 @@
     rival->status = MRSP_TIMEOUT;
 
-    _ISR_lock_Release_and_ISR_enable( &mrsp->Lock, &lock_context );
+    _MRSP_Release( mrsp, &lock_context );
   } else {
-    _ISR_lock_Release_and_ISR_enable( &mrsp->Lock, &lock_context );
+    _MRSP_Release( mrsp, &lock_context );
   }
 }
@@ -228,5 +245,5 @@
 
   cpu_self = _Thread_Dispatch_disable_critical( lock_context );
-  _ISR_lock_Release_and_ISR_enable( &mrsp->Lock, lock_context );
+  _MRSP_Release( mrsp, lock_context );
 
   _Thread_Raise_priority( executing, ceiling_priority );
@@ -294,5 +311,5 @@
   }
 
-  _ISR_lock_Acquire( &mrsp->Lock, lock_context );
+  _MRSP_Acquire_critical( mrsp, lock_context );
   owner = _Resource_Get_owner( &mrsp->Resource );
   if ( owner == NULL ) {
@@ -319,5 +336,5 @@
     );
   } else {
-    _ISR_lock_Release_and_ISR_enable( &mrsp->Lock, lock_context );
+    _MRSP_Release( mrsp, lock_context );
     /* Not available, nested access or deadlock */
     status = MRSP_UNSATISFIED;
@@ -354,5 +371,5 @@
   initial_priority = mrsp->initial_priority_of_owner;
 
-  _ISR_lock_Acquire( &mrsp->Lock, lock_context );
+  _MRSP_Acquire_critical( mrsp, lock_context );
 
   _MRSP_Giant_acquire( &giant_lock_context );
@@ -390,5 +407,5 @@
 
   cpu_self = _Thread_Dispatch_disable_critical( lock_context );
-  _ISR_lock_Release_and_ISR_enable( &mrsp->Lock, lock_context );
+  _MRSP_Release( mrsp, lock_context );
 
   _MRSP_Restore_priority( executing, initial_priority );
@@ -408,6 +425,10 @@
 }
 
-RTEMS_INLINE_ROUTINE void _MRSP_Destroy( MRSP_Control *mrsp )
-{
+RTEMS_INLINE_ROUTINE void _MRSP_Destroy(
+  MRSP_Control     *mrsp,
+  ISR_lock_Context *lock_context
+)
+{
+  _MRSP_Release( mrsp, lock_context );
   _ISR_lock_Destroy( &mrsp->Lock );
   _Workspace_Free( mrsp->ceiling_priorities );
