Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (gdb) list 100
- 95
- 96 if ( !the_attr->is_initialized )
- 97 return EINVAL;
- 98
- 99 /*
- 100 * We only support process private mutexes.
- 101 */
- 102 if ( the_attr->process_shared == PTHREAD_PROCESS_SHARED )
- 103 return ENOSYS;
- 104
- (gdb)
- 105 if ( the_attr->process_shared != PTHREAD_PROCESS_PRIVATE )
- 106 return EINVAL;
- 107
- 108 /*
- 109 * Determine the discipline of the mutex
- 110 */
- 111 switch ( the_attr->protocol ) {
- 112 case PTHREAD_PRIO_NONE:
- 113 the_discipline = CORE_MUTEX_DISCIPLINES_FIFO;
- 114 break;
- (gdb)
- 115 case PTHREAD_PRIO_INHERIT:
- 116 the_discipline = CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT;
- 117 break;
- 118 case PTHREAD_PRIO_PROTECT:
- 119 the_discipline = CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING;
- 120 break;
- 121 default:
- 122 return EINVAL;
- 123 }
- 124
- (gdb)
- 125 /*
- 126 * Validate the priority ceiling field -- should always be valid.
- 127 */
- 128 if ( !_POSIX_Priority_Is_valid( the_attr->prio_ceiling ) )
- 129 return EINVAL;
- 130
- 131 #if defined(_UNIX98_THREAD_MUTEX_ATTRIBUTES)
- 132 /*
- 133 * Validate the mutex type and set appropriate SuperCore mutex
- 134 * attributes.
- (gdb) list 136
- 131 }
- 132
- 133 /**
- 134 * This function returns true if the floating point context of
- 135 * the_thread is currently loaded in the floating point unit, and
- 136 * false otherwise.
- 137 */
- 138
- 139 #if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
- 140 RTEMS_INLINE_ROUTINE bool _Thread_Is_allocated_fp (
- (gdb)
- 141 const Thread_Control *the_thread
- 142 )
- 143 {
- 144 return ( the_thread == _Thread_Allocated_fp );
- 145 }
- 146 #endif
- 147
- 148 /**
- 149 * This routine is invoked when the currently loaded floating
- 150 * point context is now longer associated with an active thread.
- (gdb)
- 151 */
- 152
- 153 #if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
- 154 RTEMS_INLINE_ROUTINE void _Thread_Deallocate_fp( void )
- 155 {
- 156 _Thread_Allocated_fp = NULL;
- 157 }
- 158 #endif
- 159
- 160 /**
- (gdb)
- 161 * This routine prevents dispatching.
- 162 */
- 163
- 164 #if defined(RTEMS_HEAVY_STACK_DEBUG) || defined(RTEMS_HEAVY_MALLOC_DEBUG)
- 165 #include <rtems/bspIo.h>
- 166 #include <rtems/fatal.h>
- 167 #include <rtems/stackchk.h>
- 168 #include <rtems/score/sysstate.h>
- 169 #include <rtems/score/heap.h>
- 170
- (gdb)
- 171 /*
- 172 * This is currently not defined in any .h file, so we have to
- 173 * extern it here.
- 174 */
- 175 extern Heap_Control *RTEMS_Malloc_Heap;
- 176 #endif
- 177
- 178 RTEMS_INLINE_ROUTINE void _Thread_Disable_dispatch( void )
- 179 {
- 180 /*
- (gdb)
- 181 * This check is very brutal to system performance but is very helpful
- 182 * at finding blown stack problems. If you have a stack problem and
- 183 * need help finding it, then uncomment this code. Every system
- 184 * call will check the stack and since mutexes are used frequently
- 185 * in most systems, you might get lucky.
- 186 */
- 187 #if defined(RTEMS_HEAVY_STACK_DEBUG)
- 188 if (_System_state_Is_up(_System_state_Get()) && (_ISR_Nest_level == 0)) {
- 189 if ( rtems_stack_checker_is_blown() ) {
- 190 printk( "Stack blown!!\n" );
- (gdb)
- 191 rtems_fatal_error_occurred( 99 );
- 192 }
- 193 }
- 194 #endif
- 195
- 196 _Thread_Dispatch_disable_level += 1;
- 197 RTEMS_COMPILER_MEMORY_BARRIER();
- 198
- 199 /*
- 200 * This check is even more brutal than the other one. This enables
- (gdb)
- 201 * malloc heap integrity checking upon entry to every system call.
- 202 */
- 203 #if defined(RTEMS_HEAVY_MALLOC_DEBUG)
- 204 if ( _Thread_Dispatch_disable_level == 1 ) {
- 205 _Heap_Walk( RTEMS_Malloc_Heap,99, false );
- 206 }
- 207 #endif
- 208 }
- 209
- 210 /**
- (gdb)
- 211 * This routine allows dispatching to occur again. If this is
- 212 * the outer most dispatching critical section, then a dispatching
- 213 * operation will be performed and, if necessary, control of the
- 214 * processor will be transferred to the heir thread.
- 215 */
- 216
- 217 #if ( (defined(CPU_INLINE_ENABLE_DISPATCH) && \
- 218 (CPU_INLINE_ENABLE_DISPATCH == FALSE)) || \
- 219 (__RTEMS_DO_NOT_INLINE_THREAD_ENABLE_DISPATCH__ == 1) )
- 220 void _Thread_Enable_dispatch( void );
Advertisement
Add Comment
Please, Sign In to add comment