The first thing that needs to be done is to save whatever registers will be used onto the stack so that they can be restored on the way out of the ISR. Then the actual ISR processing is done, followed by the restoration of the registers that were saved on the way in. This completes software interrupt processing and the ISR is exited with the Return from Exception, or RTE instruction.