How exactly are device drivers and interrupt handlers connected?

jj1984

Member
Hi guys,

So, recently, I finished reading Intel's big manual; I learned a ton.

Anyway, I was very disappointed to see that there wasn't any attention paid specifically to two big low level sub-systems for modern computer systems: device drivers and the graphics system.

Despite the fact that the word 'driver' appears 44 times in the PDF (I control-Fed it) there isn't a chapter dedicated to drivers nor any real explanation as to how drivers and interrupt handlers are supposed to interact.

I assume that the interrupt handler at some point calls out to the driver to query the hardware I/O device by reading status registers on that I/O device to ascertain the nature of the interrupt and obtain other status information.

But, where is the device driver stored?

Is it subject to paging, or is it part of the kernel?

I assume that the driver has to occupy the same place in memory every boot, otherwise the interrupt handler wont' be able to find it boot to boot.

What happens if no driver exists for the I/O device?

At initialization, before boot, the UEFI / BIOS should assign the I/O device an interrupt number (by writing to a memory location on the I/O device I think) to call into the IDT.

I don't think that the presence or absence of a driver effects that process; I don't think that the initialization code has any knowledge of drivers at all (wait, what about low level I/O devices like mice that run before the OS is booted? Maybe, I'm not entirely correct here).

If no driver has been loaded for some I/O device and that device fires an interrupt on the line assigned to it by the BIOS, what happens?

Thanks.
 

Cromewell

Administrator
Staff member
Well let's be honest here, this is pretty specialized stuff. The odds that someone here working on these kinds of things is pretty low.
 

jj1984

Member
How do vendors actually deliver drivers to customers?

Are the drivers permanently burned on ROM chips on the peripherals themselves and then pulled into the kernel by the BIOS / UEFI every boot?

Are they delivered on a DVD and manually installed once by the customer and permanently added to the kernel that way?

Are they downloaded from the internet?

Generally speaking, if I buy a PCIe peripheral like a GPU or sound card, how will I obtain the driver software it?
 

johnb35

Administrator
Staff member
How do vendors actually deliver drivers to customers?
Cd's or download on website.
Are the drivers permanently burned on ROM chips on the peripherals themselves and then pulled into the kernel by the BIOS / UEFI every boot?
Drivers are stored in the drivers folder so that windows will load them on bootup.
Are they delivered on a DVD and manually installed once by the customer and permanently added to the kernel that way?
Again, either on cd or download them online.
Are they downloaded from the internet?
Most updated driver is downloaded online yes.
Generally speaking, if I buy a PCIe peripheral like a GPU or sound card, how will I obtain the driver software it?
Included cd or download online.
 

Cromewell

Administrator
Staff member
Are the drivers permanently burned on ROM chips on the peripherals themselves and then pulled into the kernel by the BIOS / UEFI every boot?
Kind of. Most devices have a basic operating mode, like *vga for video adapters, that just work albeit at limited functionality. And all devices have vendor and device ids stored in ROM so that the OS can look up drivers for it. Drivers are architecture dependent so it doesn't make sense to store them on the device. They get loaded by the OS from the hard drive when it tries to start up the device.
Is it possible to disassemble driver code and learn the proprietary interface for yourself?
Yes and no. There's actually a really good article at https://www.linuxvoice.com/drive-it-yourself-usb-car-6/ about doing this with a much simpler device (radio controlled car). Doing this same process for say a video card or a sound card is a lot more difficult. Could it be done? Probably. But the time and effort cost would be huge.
 
Top