Making a reliable driver system
Posted: Sat Dec 02, 2023 5:43 am
I'm relatively new to OS Development. I started working in my kernel a few months ago and i'd say i did a pretty good job until now. (except for the really messy and poorly documented code )
Here is the source code on Github if you would like to take a look at it: https://github.com/Garnek0/GarnOS
Anyways, my current device manager (i'm going to call it the Device Abstraction Layer or DAL from now on as that is what its called in my kernel) is really unreliable and not future-proof at all. Instead of having each driver registered and stored in a list, the drivers need to be "manually" loaded as modules by the kernel inside device identification routines (if you look inside the mess that pcidev.c is, you'll see what i mean). What i want to do is take the linux approach and register drivers, store them in a list and test them for each device that doesnt have a driver using a list of ids pointed to by a metadata struct inside the driver's executable. My problem is that i have absolutely no idea where to even start. I have my DAL closely tied to other components such as the module loader and trying to morph it into what i explained above is going to be extremely hard. Rewriting the DAL is completely out of the question... doing that will create such a mess that i'd probably just end up git checkouting back to where i started. I tried looking at linux to see how it's implemented there but linux is so complicated that i couldn't even find the routines for the drivers. I'm honestly completely at a loss here. Any help is appreciated.
Thanks!
Here is the source code on Github if you would like to take a look at it: https://github.com/Garnek0/GarnOS
Anyways, my current device manager (i'm going to call it the Device Abstraction Layer or DAL from now on as that is what its called in my kernel) is really unreliable and not future-proof at all. Instead of having each driver registered and stored in a list, the drivers need to be "manually" loaded as modules by the kernel inside device identification routines (if you look inside the mess that pcidev.c is, you'll see what i mean). What i want to do is take the linux approach and register drivers, store them in a list and test them for each device that doesnt have a driver using a list of ids pointed to by a metadata struct inside the driver's executable. My problem is that i have absolutely no idea where to even start. I have my DAL closely tied to other components such as the module loader and trying to morph it into what i explained above is going to be extremely hard. Rewriting the DAL is completely out of the question... doing that will create such a mess that i'd probably just end up git checkouting back to where i started. I tried looking at linux to see how it's implemented there but linux is so complicated that i couldn't even find the routines for the drivers. I'm honestly completely at a loss here. Any help is appreciated.
Thanks!