question about thread on rtems for pc386's context

xi yang hiyangxi at gmail.com
Mon Oct 8 23:31:35 CDT 2007


Yu chen:
These Contex_Control registers are callee saved registers.
It's used to avoid unnecessary saving register if there is on
context switch after this ISR. The first job of instructions of ISR
is to save caller saved registers-->These exceptions frame
(CPU_Exception_Frame)+
context_control is the whole registers .
Look at the comments of cpu.h of ARM.

2007/10/8, Yu Chen <chyyuu at gmail.com>:
> hi,
>   From the source code, in Thread_Control_struct, the field
> 'Context_Control                       Registers' means the context of
> this thread. This field is hardware related. in RTEMS for pc 386, I
> found the define of this field is:
> typedef struct {
>   uint32_t    eflags;   /* extended flags register                   */
>   void       *esp;      /* extended stack pointer register           */
>   void       *ebp;      /* extended base pointer register            */
>   uint32_t    ebx;      /* extended bx register                      */
>   uint32_t    esi;      /* extended source index register            */
>   uint32_t    edi;      /* extended destination index flags register */
> }   Context_Control;
>
> My question is: why rtems didn't store the other i386 registers (such
> as eax, ecx...) when switching the thread context? the other registers
> in threads needn't save &restore?
>
> and the similar question is: in irq_asm.S , rtems_irq_prologue_ ## _vector :
>
> SYM (rtems_irq_prologue_ ## _vector ):             \
>         pushl   eax             ; \
>         pushl   ecx             ; \
>         pushl   edx             ; \
>         movl    $ _vector, ecx  ; \
>         jmp   SYM (_ISR_Handler) ;
> ....
>         popl    edx
>         popl    ecx
>         popl    eax
>         iret
>
> why in irq process, rtems didn't save &restore  the other i386 registers ?
>
> Thanks!
>
> --
> Best Regards
> ==============================================
> Chen Yu
> Laboratory of Pervasive Computing,
> Dept. of Computer Science and Technology
> Tsinghua University, Beijing 100084, P.R. China
> E-Mail: mailto:yuchen at tsinghua.edu.cn  chyyuu at gmail.com
> ==============================================
> _______________________________________________
> rtems-users mailing list
> rtems-users at rtems.com
> http://rtems.rtems.org/mailman/listinfo/rtems-users
>



More information about the rtems-users mailing list