Is there an fast way to find if an interrupt has been generated by the program, the cpu or the LOCAL APIC?
I thought to "pop" the first stack value and test if the point that the value points (program EIP) is equal to 0xCD (int instruction in binary).
Do there exist also a way to block code that runs on ring 3 execute the specific interrupt (if do to generate #GP)?
How to find if an interrupt generated by the program or not?
- Coconut9
- Member
- Posts: 51
- Joined: Sat May 20, 2017 1:25 am
- Location: PCI bus: 3, slot: 9, function: 5
How to find if an interrupt generated by the program or not?
How people react when a new update of your OS is coming:
Linux user: Cool, more free stuff!
Mac user: Ooh I have to pay!
Windows user: Ah not again!
Linux user: Cool, more free stuff!
Mac user: Ooh I have to pay!
Windows user: Ah not again!
Re: How to find if an interrupt generated by the program or
If you're using the local APIC, you can check its ISR register to see if the interrupt is hardware generated. You can also do that for the legacy PIC, however it is not advisable to do so, as reads from the PIC need to go through the system bus and chipset and are much slower than reads from the APIC.
Checking the instruction is not sound as an hardware IRQ might trigger at an "int" instruction boundary.
The IDT has bits that determine the privilege level that is require to invoke each vector using the "int" instruction. The CPU itself only generates faults (i.e. vector number < 32).
Checking the instruction is not sound as an hardware IRQ might trigger at an "int" instruction boundary.
The IDT has bits that determine the privilege level that is require to invoke each vector using the "int" instruction. The CPU itself only generates faults (i.e. vector number < 32).
managarm: Microkernel-based OS capable of running a Wayland desktop (Discord: https://discord.gg/7WB6Ur3). My OS-dev projects: [mlibc: Portable C library for managarm, qword, Linux, Sigma, ...] [LAI: AML interpreter] [xbstrap: Build system for OS distributions].