I am porting a multi-tasking kernel (in C++, WinAVR compiler) to the ATmega2560, and I need to save and then later restore the interrupt status in SREG.
I'm new to both GCC and the AVR instruction set, and I don't see any equivalent instructions to push/pop the SREG to the stack. So it looks like I need to do this manually in this architecture. Or perhaps there is a better way to do this than to use the stack, maybe a shadow register or something?
Would a GCC-guru be so kind as to share their C-macros or assembly sequences to save and restore interrupts please?