The _CPU_Context_Initialize routine initializes the context to a state suitable for starting a task after a context restore operation. Generally, this involves:
This routine generally does not set any unnecessary register in the context. The state of the "general data" registers is undefined at task start time. The _CPU_Context_initialize routine is prototyped as follows:
void _CPU_Context_Initialize( Context_Control *_the_context, void *_stack_base, unsigned32 _size, unsigned32 _isr, void *_entry_point, unsigned32 _is_fp );
The is_fp
parameter is TRUE if the thread is to be a floating point
thread. This is typically only used on CPUs where the FPU may be easily
disabled by software such as on the SPARC where the PSR contains an enable
FPU bit. The use of an FPU enable bit allows RTEMS to ensure that a
non-floating point task is unable to access the FPU. This guarantees that
a deferred floating point context switch is safe.
The _stack_base
parameter is the base address of the memory area
allocated for use as the task stack. It is critical to understand that
_stack_base
may not be the starting stack pointer for this task.
On CPU families where the stack grows from high addresses to lower ones,
(i.e. CPU_STACK_GROWS_UP
is FALSE) the starting stack point
will be near the end of the stack memory area or close to
_stack_base
+ _size
. Even on CPU families where the stack
grows from low to higher addresses, there may be some required
outermost stack frame that must be put at the address _stack_base
.
The _size
parameter is the requested size in bytes of the stack for
this task. It is assumed that the memory area _stack_base
is of this size.
XXX explain other parameters and check prototype
Copyright © 1988-2007OAR Corporation