Re: Performance on maths code?
"OS aside, aren't there CPU instructions to store and restore all registers for the purposes of context switching?"
On the Z80, yes. For processors designed in the '90s or later, no so much. Even if such instructions existed, the space required to save the registers would change whenever new registers are added.
This really is something that the OS has to handle.