| ??? 04/21/02 23:21 Read: times |
#22002 - RE: Task switching for Keil C51 |
Bahri,
1. If I use no reentrant functions, should I save the reentrant stack on context switching? No. 2. If several tasks are using reentrant functions (modifying the reentrant stack), I think I need different reentrant stack area (stack ptr) for each task. Otherwise, I cannot be sure that passive tasks' stack are not modified. If you have non-reentrant task functions and only allow context switches from the task function level, you can call reentrant functions without saving the reentrant stack context, since the reentrant stack pointer will have returned to its baseline once you're back at the task level. If this is true, how can I have different reentrant stack pointers ([IXP]_IBP) for each task? Is simply assigning a value on task entrance adequate? If you allow context switches within functions called from the task function level, then you'll need to save the hardware stack pointer and "stack frame" as part of your tasks' context. If those functions called from the task level are also reentrant, they you'll additionally need to save the reentrant stack pointer and reentrant "stack frame" as part of your tasks' context. Obviously the context switcher must save one task's context before restoring another task's context. Regards, --Dan Henry |



