3

I'm trying to get a better understanding of how interrupts work (both hardware and software) and the privileges that go with them.

If we use the NIC as an example. When the OS creates the IDT, does the entry for the NIC descriptor point to the built in driver that handles it. If the user were to then install a 3rd party driver for the NIC, would the IDT be modified to point to the new driver?

Would an interrupt from a USB controller point to a USB driver?

What would be the privilege level of this IDT entry and what purpose would it serve? I have read somewhere that hardware interrupts ignore the privilege level and allowed to run regardless, but I'm not sure if this is true.

With software interrupts, what sort of interrupts would these do. If it is wanting to access functions of the kernel, are all these accessed through the same interrupt that has level 3 privileges?

What sort of software interrupts are there and what do user mode programs do with them, or do user mode programs just use software interrupts to access the kernel.

I have being trying to piece it all together from online sources but I'm just wondering if anyone could make it clear how the whole process works.

Any help would be much appreciated.

Thanks.

1 Answer 1

2

You have not specified the processor architecture you are asking about. I assume that you're talking about x86 processors in PCs. The very basic piece of information to know is that the major current operating systems only use 2 privilege levels (of the 4 provided by the x86 processor architecture): kernel (level 0) and user (level 3). From this, it follows that in every driver every interrupt service routine has to run at kernel privilege (level 0).

Software interrupts are a way to call a function with a higher privilege level from a less privileged code. This happens in current operating systems if and only if the user (level 3) code wants to call a kernel (level 0) function.

If the user were to then install a 3rd party driver for the NIC, would the IDT be modified to point to the new driver?

The IDT usually points to a generic kernel function, which looks up the address of the actual interrupt service routine in some memory structure. Normally, this structure gets set up when the driver is loaded into the kernel. Installation usually involves copying files in the filesystem, whereas these structures exist in memory.

Looking into the sources of Linux can give you a good insight into how these things are implemented nowadays.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .