Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
an interrupt might occur anywhere anytime. As you wish to make it transparent to the interrupted process, you *must* make the registers saved before any interrupt-related process starts and restored after. Otherwise, the interrupted process could see its internal variables changed randomly (not good at all) ...