Add save/restore_irq

Factored irq functions into a separate file.