Boot driver calling idea
Posted: Sun Oct 11, 2009 10:20 pm
Hello everyone,
After thinking a bit about how the boot drivers can be called by the kernel only when needed, I came up with a solution that I wanted to share for suggestions, comments, and maybe help give some insight on other microkernel developers here. A boot driver, in my case, is a driver loaded along with the kernel by the OS loading program into kernel space.
The basic idea I have is to provide a system call that can be called by drivers (using an INT instruction, like Linux's int 0x80). The system call can be used to install a system interrupt call thus allowing the driver to install its own system interrupt call.
For an example, lets say this system interrupt service is KeSysRead, for reading data from a disk into a buffer. The driver calls the kernel's system interrupt service to install this interrupt to a function of the system interrupt (like, int 0x80 function 2). This will overwrite any existing interrupt in the kernels system call table of course. So, now, whenever INT 0x80 function 2 is called to read data from disk, it will automatically call the drivers interrupt handler.
If the kernel provides a system call that returns the current system interrupt routine, this allows the driver to obtain a pointer to the previous interrupt handler for that function. ie, the driver can obtain the last interrupt handler for int 0x80 function 2, store it somewhere, and install its own.
From here, whenever the drivers interrupt handler is called, using interrupt chaining it can call the last installed handler. Thus allowing the kernels default routines to be called, and any other driver of the same type to have a chance at the request before returning.
This design only applies to drivers needing to be called on system call events. Other drivers do not need to do this. This method also makes it so most system calls will be handled in external libraries or drivers.
---
What do you think? Are there any problems with this method that I may have overlooked? I am looking for comments, suggestions, basically anything for this idea. And who knows - if it is a good one it might help other microkernel system designers here as well.
If you are a microkernel developer, feel free to add your own set up if you like Im basically looking for different designs
After thinking a bit about how the boot drivers can be called by the kernel only when needed, I came up with a solution that I wanted to share for suggestions, comments, and maybe help give some insight on other microkernel developers here. A boot driver, in my case, is a driver loaded along with the kernel by the OS loading program into kernel space.
The basic idea I have is to provide a system call that can be called by drivers (using an INT instruction, like Linux's int 0x80). The system call can be used to install a system interrupt call thus allowing the driver to install its own system interrupt call.
For an example, lets say this system interrupt service is KeSysRead, for reading data from a disk into a buffer. The driver calls the kernel's system interrupt service to install this interrupt to a function of the system interrupt (like, int 0x80 function 2). This will overwrite any existing interrupt in the kernels system call table of course. So, now, whenever INT 0x80 function 2 is called to read data from disk, it will automatically call the drivers interrupt handler.
If the kernel provides a system call that returns the current system interrupt routine, this allows the driver to obtain a pointer to the previous interrupt handler for that function. ie, the driver can obtain the last interrupt handler for int 0x80 function 2, store it somewhere, and install its own.
From here, whenever the drivers interrupt handler is called, using interrupt chaining it can call the last installed handler. Thus allowing the kernels default routines to be called, and any other driver of the same type to have a chance at the request before returning.
This design only applies to drivers needing to be called on system call events. Other drivers do not need to do this. This method also makes it so most system calls will be handled in external libraries or drivers.
---
What do you think? Are there any problems with this method that I may have overlooked? I am looking for comments, suggestions, basically anything for this idea. And who knows - if it is a good one it might help other microkernel system designers here as well.
If you are a microkernel developer, feel free to add your own set up if you like Im basically looking for different designs