Index: cpukit/libcsupport/src/newlibc.c
===================================================================
RCS file: /afs/slac/g/spear/cvsrep/rtems/src-20030128/cpukit/libcsupport/src/newlibc.c,v
retrieving revision 1.5
diff -c -r1.5 newlibc.c
*** cpukit/libcsupport/src/newlibc.c	21 Apr 2003 23:10:13 -0000	1.5
--- cpukit/libcsupport/src/newlibc.c	30 Sep 2003 00:31:52 -0000
***************
*** 121,127 ****
--- 121,136 ----
     *        it is based on the Classic API Region Manager.
     */
  
+ #define REENT_MALLOCED 0
+ #if REENT_MALLOCED
    ptr = (struct _reent *) calloc(1, sizeof(struct _reent));
+ #else
+   /* It is OK to allocate from the workspace because these
+    * hooks run with thread dispatching disabled.
+    */
+   ptr = (struct _reent *) _Workspace_Allocate(sizeof(struct _reent));
+   memset(ptr, 0, sizeof(*ptr));
+ #endif
  
    if (!ptr)
       rtems_fatal_error_occurred(RTEMS_NO_MEMORY);
***************
*** 204,210 ****
--- 213,223 ----
    if (ptr && ptr != &libc_global_reent) {
      _wrapup_reent(ptr);
      _reclaim_reent(ptr);
+ #if REENT_MALLOCED
      free(ptr);
+ #else
+ 	_Workspace_Free(ptr);
+ #endif
    }
  
    deleted_task->libc_reent = NULL;
Index: cpukit/score/include/rtems/score/coremutex.h
===================================================================
RCS file: /afs/slac/g/spear/cvsrep/rtems/src-20030128/cpukit/score/include/rtems/score/coremutex.h,v
retrieving revision 1.1.1.2
diff -c -r1.1.1.2 coremutex.h
*** cpukit/score/include/rtems/score/coremutex.h	29 Jan 2003 22:59:27 -0000	1.1.1.2
--- cpukit/score/include/rtems/score/coremutex.h	29 Sep 2003 23:58:37 -0000
***************
*** 26,31 ****
--- 26,33 ----
  #include <rtems/score/threadq.h>
  #include <rtems/score/priority.h>
  #include <rtems/score/watchdog.h>
+ #include <rtems/score/interr.h>
+ #include <rtems/score/sysstate.h>
   
  /*
   *  The following type defines the callout which the API provides
***************
*** 152,157 ****
--- 154,160 ----
   *         a macro that uses two support routines.
   */
  
+ 
  #ifndef __RTEMS_APPLICATION__
  RTEMS_INLINE_ROUTINE int _CORE_mutex_Seize_interrupt_trylock(
    CORE_mutex_Control  *the_mutex,
***************
*** 166,171 ****
--- 169,183 ----
  #define _CORE_mutex_Seize( \
    _the_mutex, _id, _wait, _timeout, _level ) \
    do { \
+ 	if ( _Thread_Dispatch_disable_level \
+ 		&& (_wait) \
+ 		&& (_System_state_Get() >= SYSTEM_STATE_BEGIN_MULTITASKING ) \
+ 	   ) { \
+ 		_Internal_error_Occurred( \
+   							INTERNAL_ERROR_CORE, \
+ 							FALSE, \
+ 							18 /* called from wrong environment */); \
+ 	} \
      if ( _CORE_mutex_Seize_interrupt_trylock( _the_mutex, &_level ) ) {  \
        if ( !_wait ) { \
          _ISR_Enable( _level ); \
