Interrupt environment

When your ISR is running, it runs in the context of the process that attached it, except with a different stack.

Since the kernel uses an internal interrupt-handling stack for hardware interrupts, your ISR is impacted in that the internal stack is small. Generally, you can assume that you have about 200 bytes available.

The PIC doesn't get the EOI command until after all ISRs—whether supplied by your code via InterruptAttach() or by the kernel if you use InterruptAttachEvent()—for that particular interrupt have been run. Then the kernel itself issues the EOI; your code should not issue the EOI command.