Open John-Titor opened 1 year ago
It depends how you implement "hardware interrupts". There is a FAQ about it:
https://github.com/unicorn-engine/unicorn/wiki/FAQ#how-to-emulate-interrupts-or-ticks-with-unicorn
This leaves you stuck (re) implementing the processor (family's) interrupt dispatch behaviour, which QEMU already has sorted (for emulation purposes). It'd be nice to have a binding that lets you invoke this from a hook, etc.
But note unicorn is a pure cpu emulator and how interrupts are handled largely depends on periphery devices (say, standalone interrupt controllers). Not every architecture behaves like the monolithic x86. That said, it's hard to maintain a elegant and simple API for such things. The current way is the best we could offer regarding our cross-architecture nature.
If you would like some interrupts handling logic, you may look at qiling
I say "apparent" because Qiling must have a way to do this, but I haven't been able to to work out how. QEMU itself has the machinery, but it doesn't appear to be surfaced in the bindings.