I have read the AMD64 Developer manual on interrupt routines. According to the manual,
The interrupt handler must pop the error code off the stack if one was pushed by the interrupt or exception. IRET restores the interrupted program's rIP, CS and rFLAGS by popping their saved values off of the stack and into their respective registers.
Therefore, would an empty ISR handler look something along this ASM code?
add rsp, 4 ;pop err code off stack
iretq
I am assuming the size of the error code is 4 bytes, as other websites have told me. I'm pretty sure this is totally wrong, but some guidance will help.
iretq
and one that does have an error code would beadd rsp, 8
,iretq
? – Arush Agarampuriretq
to return. – Michael Petch