Context Switch Problem

Joel Sherrill joel.sherrill at oarcorp.com
Fri May 12 15:04:07 UTC 2006


Samuel Bitton wrote:

>I don't believe that's the problem though as the software actually breaks during context switch, i.e. I don't come out of the _Context_Switch, and as far as I can tell the enabling of the interrupts is not done by _Context_Switch but by _ISR_Enable which happens just after.
>
>  
>
ISRs are enabled as a side-effect of the popf in the following code 
sequence. :)
restore:
        pushl     REG_EFLAGS(eax)          /* push eflags */
        popf                               /* restore eflags */
        movl      REG_ESP(eax),esp         /* restore stack pointer */
        movl      REG_EBP(eax),ebp         /* restore base pointer */
        movl      REG_EBX(eax),ebx         /* restore ebx */
        movl      REG_ESI(eax),esi         /* restore source register */
        movl      REG_EDI(eax),edi         /* restore destination 
register */
        ret


-joel

>Regards
>Sam
>
> -----Original Message-----
>From: 	Joel Sherrill [mailto:joel.sherrill at oarcorp.com] 
>Sent:	12 May 2006 16:21
>To:	Chris Johns
>Cc:	Samuel Bitton; rtems-users at rtems.com
>Subject:	Re: Context Switch Problem
>
>Chris Johns wrote:
>
>  
>
>>Samuel Bitton wrote:
>>
>>    
>>
>>>Hi
>>>
>>>I'm currently working on a new RTEMS BSP for a custom made board 
>>>based around the i386ex processor.
>>>The software currently breaks towards the end of RTEMS 
>>>initialisation, at the point where it is doing the first context 
>>>switch (_Context_Switch called at the end of 
>>>_Thread_Start_multitasking).
>>>
>>>My application only has one small init task which toggles a line 
>>>indefinitely.
>>>Any idea what could be going wrong.
>>>I'm using RTEMS 4.6.4.
>>>
>>>      
>>>
>>Have you look over this page:
>>
>> http://www.rtems.org/wiki/index.php/DebuggingHints
>>
>>It has some reasons a BSP can fail.
>>
>>    
>>
>And the most likely reason is included there -- an interrupt is pending 
>and you are taking
>an exception.  The first context switch enables CPU interrupts and any 
>device not in a
>quiescent state will slap you here. :)
>
>--joel
>
>  
>
>>Regards
>>Chris
>>    
>>
>
>
>
>
>  
>




More information about the users mailing list