Guest User

Unrolled inline functions

a guest
Sep 16th, 2011
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 4.70 KB | None | 0 0
  1. (gdb) list 100
  2. 95
  3. 96        if ( !the_attr->is_initialized )
  4. 97          return EINVAL;
  5. 98
  6. 99        /*
  7. 100        *  We only support process private mutexes.
  8. 101        */
  9. 102       if ( the_attr->process_shared == PTHREAD_PROCESS_SHARED )
  10. 103         return ENOSYS;
  11. 104
  12. (gdb)
  13. 105       if ( the_attr->process_shared != PTHREAD_PROCESS_PRIVATE )
  14. 106         return EINVAL;
  15. 107
  16. 108       /*
  17. 109        *  Determine the discipline of the mutex
  18. 110        */
  19. 111       switch ( the_attr->protocol ) {
  20. 112         case PTHREAD_PRIO_NONE:
  21. 113           the_discipline = CORE_MUTEX_DISCIPLINES_FIFO;
  22. 114           break;
  23. (gdb)
  24. 115         case PTHREAD_PRIO_INHERIT:
  25. 116           the_discipline = CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT;
  26. 117           break;
  27. 118         case PTHREAD_PRIO_PROTECT:
  28. 119           the_discipline = CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING;
  29. 120           break;
  30. 121         default:
  31. 122           return EINVAL;
  32. 123       }
  33. 124
  34. (gdb)
  35. 125       /*
  36. 126        *  Validate the priority ceiling field -- should always be valid.
  37. 127        */
  38. 128       if ( !_POSIX_Priority_Is_valid( the_attr->prio_ceiling ) )
  39. 129         return EINVAL;
  40. 130
  41. 131     #if defined(_UNIX98_THREAD_MUTEX_ATTRIBUTES)
  42. 132       /*
  43. 133        *  Validate the mutex type and set appropriate SuperCore mutex
  44. 134        *  attributes.
  45. (gdb) list 136
  46. 131     }
  47. 132
  48. 133     /**
  49. 134      *  This function returns true if the floating point context of
  50. 135      *  the_thread is currently loaded in the floating point unit, and
  51. 136      *  false otherwise.
  52. 137      */
  53. 138
  54. 139     #if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
  55. 140     RTEMS_INLINE_ROUTINE bool _Thread_Is_allocated_fp (
  56. (gdb)
  57. 141       const Thread_Control *the_thread
  58. 142     )
  59. 143     {
  60. 144       return ( the_thread == _Thread_Allocated_fp );
  61. 145     }
  62. 146     #endif
  63. 147
  64. 148     /**
  65. 149      *  This routine is invoked when the currently loaded floating
  66. 150      *  point context is now longer associated with an active thread.
  67. (gdb)
  68. 151      */
  69. 152
  70. 153     #if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
  71. 154     RTEMS_INLINE_ROUTINE void _Thread_Deallocate_fp( void )
  72. 155     {
  73. 156       _Thread_Allocated_fp = NULL;
  74. 157     }
  75. 158     #endif
  76. 159
  77. 160     /**
  78. (gdb)
  79. 161      *  This routine prevents dispatching.
  80. 162      */
  81. 163
  82. 164     #if defined(RTEMS_HEAVY_STACK_DEBUG) || defined(RTEMS_HEAVY_MALLOC_DEBUG)
  83. 165       #include <rtems/bspIo.h>
  84. 166       #include <rtems/fatal.h>
  85. 167       #include <rtems/stackchk.h>
  86. 168       #include <rtems/score/sysstate.h>
  87. 169       #include <rtems/score/heap.h>
  88. 170
  89. (gdb)
  90. 171       /*
  91. 172        * This is currently not defined in any .h file, so we have to
  92. 173        * extern it here.
  93. 174        */
  94. 175       extern Heap_Control  *RTEMS_Malloc_Heap;
  95. 176     #endif
  96. 177
  97. 178     RTEMS_INLINE_ROUTINE void _Thread_Disable_dispatch( void )
  98. 179     {
  99. 180       /*
  100. (gdb)
  101. 181        *  This check is very brutal to system performance but is very helpful
  102. 182        *  at finding blown stack problems.  If you have a stack problem and
  103. 183        *  need help finding it, then uncomment this code.  Every system
  104. 184        *  call will check the stack and since mutexes are used frequently
  105. 185        *  in most systems, you might get lucky.
  106. 186        */
  107. 187       #if defined(RTEMS_HEAVY_STACK_DEBUG)
  108. 188         if (_System_state_Is_up(_System_state_Get()) && (_ISR_Nest_level == 0)) {
  109. 189           if ( rtems_stack_checker_is_blown() ) {
  110. 190             printk( "Stack blown!!\n" );
  111. (gdb)
  112. 191             rtems_fatal_error_occurred( 99 );
  113. 192           }
  114. 193         }
  115. 194       #endif
  116. 195
  117. 196       _Thread_Dispatch_disable_level += 1;
  118. 197       RTEMS_COMPILER_MEMORY_BARRIER();
  119. 198
  120. 199       /*
  121. 200        * This check is even more brutal than the other one.  This enables
  122. (gdb)
  123. 201        * malloc heap integrity checking upon entry to every system call.
  124. 202        */
  125. 203       #if defined(RTEMS_HEAVY_MALLOC_DEBUG)
  126. 204         if ( _Thread_Dispatch_disable_level == 1 ) {
  127. 205           _Heap_Walk( RTEMS_Malloc_Heap,99, false );
  128. 206         }
  129. 207       #endif
  130. 208     }
  131. 209
  132. 210     /**
  133. (gdb)
  134. 211      *  This routine allows dispatching to occur again.  If this is
  135. 212      *  the outer most dispatching critical section, then a dispatching
  136. 213      *  operation will be performed and, if necessary, control of the
  137. 214      *  processor will be transferred to the heir thread.
  138. 215      */
  139. 216
  140. 217     #if ( (defined(CPU_INLINE_ENABLE_DISPATCH) && \
  141. 218            (CPU_INLINE_ENABLE_DISPATCH == FALSE)) || \
  142. 219           (__RTEMS_DO_NOT_INLINE_THREAD_ENABLE_DISPATCH__ == 1) )
  143. 220     void _Thread_Enable_dispatch( void );
Advertisement
Add Comment
Please, Sign In to add comment