Do I need to save the FPRs in mpc8306 when saving state for task switching? If yes, how to save them? I tried the statement "stfd f1, 80(r1)" and it made an error while the address 80+(r1) was safe to write.
Solved! Go to Solution.
When a task context has to be saved in exception handler, keep in mind that MSR[FP] is cleared automatically when the core enters interrupt handler. Prior using FP load/store instructions, the handler's code should restore MSR[FP].
You need to save anything that is used. This includes floating point registers, unless at least one of the tasks has the floating point unit disabled. Do you really mean switching tasks (e.g. going from one userspace task to another userspace task), or do you mean entering the kernel (as in your previous questions)? If the kernel does not use the floating point unit, then you don't need to save the floating point registers when you enter the kernel (but you will need to save them later if you switch to another userspace task).
What error are you getting? Is MSR[FP] set?
When a task context has to be saved in exception handler, keep in mind that MSR[FP] is cleared automatically when the core enters interrupt handler. Prior using FP load/store instructions, the handler's code should restore MSR[FP].