A Formal Model of Interrupt-based Checkpointing with Peripherals