question about thread on rtems for pc386's context

Yu Chen chyyuu at
Mon Oct 8 15:35:11 UTC 2007

  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

why in irq process, rtems didn't save &restore  the other i386 registers ?


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  chyyuu at

More information about the users mailing list