The concept of interrupts is not included in the C specification (and is also processor specific). Most compilers, including GCC, allow you to write embedded assembly code (or you can, of course, link the file written in the assembly to your program). But the big problem is that ordinary operating systems (especially those that work in 64-bit mode) will not allow you to change the interrupt table. I think your best bet is to look for a simple open source OS and either install an interrupt handler from a regular program (if the OS allows it) or add code to the kernel. The reason you cannot just run a small piece of code in a processor simulator (or virtual machine) is because the processor needs quite a bit of configuration to work in 64-bit mode. And the exact datahow you modify the interrupt table depends on this setting.