Do I need to save the FPRs in mpc8306 when saving state for task switching?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Do I need to save the FPRs in mpc8306 when saving state for task switching?

Jump to solution
1,694 Views
maojiu
Contributor I

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.

Labels (1)
Tags (3)
0 Kudos
1 Solution
1,267 Views
LPP
NXP Employee
NXP Employee

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].

View solution in original post

0 Kudos
2 Replies
1,267 Views
scottwood
NXP Employee
NXP Employee

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?

1,268 Views
LPP
NXP Employee
NXP Employee

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].

0 Kudos