rtel wrote on Wednesday, December 22, 2004:
The stack for a task uses the internal RAM when the task is executing. This is dictated by the architecture of the device, but is also good as the internal RAM can be accessed much faster than the external.
However, the internal RAM is much to small to hold the context of all the tasks, so the context of all the tasks that are not currently executing has to be in XRAM. A context switch therefore has to save from internal to XRAM, then copy from XRAM to internal.
As far as finding out which registers are required to be saved and restored - the internal architecture of any device has to be learned from the device datasheets. This will describe all the registers. This together with examining your chosen compilers output will allow you to ascertain which registers are used when, and which form part of the context. Generally all general purpose registers should be saved.