Hardware Reference
In-Depth Information
10.5.1
LOW-LEVEL PRIMITIVES
Basically, the low-level primitives implement the mechanism for saving and loading
the context of a task; that is, the values of the processor registers.
/*-----------------------------------------------------------*/
/* save context -- of the task in execution */
/*-----------------------------------------------------------*/
void
save context (void)
int
*pc;
/* pointer to context of pexe */
<disable interrupts>
pc = vdes[pexe].context;
pc[0] = <register 0>
/* save register 0 */
pc[1] = <register 1>
/* save register 1 */
pc[2] = <register 2>
/* save register 2 */
...
pc[n] = <register n>
/* save register n */
}
Search WWH ::




Custom Search