5.3.4.3 How Do I Save C Variables When an ISR Is Invoked?

You can use the save parameter of the interrupt attribute to save variables and SFRs so that their values may be restored on a return from interrupt. For more information, see the following section in this user’s guide:

Interrupt Service Routine Context Saving