_Internal_error_Occurred from rtems_semaphore_obtain in rtems_termios_write
Till Straumann
strauman at slac.stanford.edu
Wed Aug 30 20:58:38 UTC 2006
Kenneth J. Peters wrote:
> I'm getting _Internal_error_Occurred called from
> rtems_semaphore_obtain in rtems_termios_write.
>
> Sparc erc32-based BSP on custom hardware.
>
> Two issues:
>
> 1. The _Internal_error_Occurred call is actually in
> cpukit/score/include/rtems/score/coremutex.h
> and is just called with a hardcoded number, not an
> Internal_errors_Core_list enum item from
> cpukit/score/include/rtems/score/interr.h
>
>> #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 */); \
>> } \
>
> Seems like this error code should be in the Internal_errors_Core_list
> enum . I don't know if there are any other hardcoded error values
> elsewhere.
>
> 2. I have not traced all through my code yet, or created a simple
> example. It could be that I am just doing something stupid like
> accidentally trying to print in a trap handler. However, if some
> kernel expert can explain a little about
> _Thread_Dispatch_disable_level, that might help me figure out what's
> going on. I am in multitasking when the error occurs, and the obtain
> call is with RTEMS_WAIT, so those make general sense to me.
You must not call a blocking directive (RTEMS_WAIT) from a section of
code that has thread dispatching disabled (this is a programming error).
If the directive tries to block it would have to dispatch the CPU to another
thread - something you try to prevent from happening during a
dispatch-disabled section.
The problem is that sometimes you are not aware that a certain routine
is called with thread-dispatching disabled...
-- Till
>
> Ken Peters
> Ken.Peters at jpl.nasa.gov
More information about the users
mailing list