RTEMS Logo

RTEMS 4.7.2 On-Line Library


Task Context Management Basic Context Data Structure

PREV UP NEXT Bookshelf RTEMS Porting Guide

6.3.1: Basic Context Data Structure

The Context_Control data structure contains the basic integer context of a task. In addition, this context area contains stack and frame pointers, processor status register(s), and any other registers that are normally altered by compiler generated code. In addition, this context must contain the processor interrupt level since the processor interrupt level is maintained on a per-task basis. This is necessary to support the interrupt level portion of the task mode as provided by the Classic RTEMS API.

On some processors, it is cost-effective to save only the callee preserved registers during a task context switch. This means that the ISR code needs to save those registers which do not persist across function calls. It is not mandatory to make this distinctions between the caller/callee saves registers for the purpose of minimizing context saved during task switch and on interrupts. If the cost of saving extra registers is minimal, simplicity is the choice. Save the same context on interrupt entry as for tasks in this case.

The Context_Control data structure should be defined such that the order of elements results in the simplest, most efficient implementation of XXX. A typical implementation starts with a definition such as the following:

typedef struct {
    unsigned32 some_integer_register;
    unsigned32 another_integer_register;
    unsigned32 some_system_register;
} Context_Control;


PREV UP NEXT Bookshelf RTEMS Porting Guide

Copyright © 1988-2004 OAR Corporation