I'm wondering the best way to work on my HAL.
But I'm stuck on the following thoughts:
If my drivers are loadable modules I want to dynamically link them with a driver library (which exposes sections of the kernel most useful for driver development). Except to load the dynamic library I need a disk driver and an FS driver, which are dynamically linked to the library. If I don't use a dynamic library, how will drivers know the location of kernel functions and classes? (I want to try to keep away from kernel<->kernel interrupts unless absolutely necessary.)
How do I handle DMA, USB, etc within drivers? My OS has a DMA driver, and I'm trying to think of a way I can neatly handle things like DMA and USB and making them accessible through my disk drivers with a consistant interface.
HAL
- AndrewAPrice
- Member

- Posts: 2327
- Joined: Mon Jun 05, 2006 11:00 pm
- Location: USA (and Australia)
HAL
My OS is Perception.
- Combuster
- Member

- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
I would think of an hierarchical structure. A driver for an USB device would include calls to a USB driver.
Or in monospaced font:
Or in monospaced font:
Code: Select all
USB controller
|
SD card
|
VFS
|
FAT- AndrewAPrice
- Member

- Posts: 2327
- Joined: Mon Jun 05, 2006 11:00 pm
- Location: USA (and Australia)
How would I manage different types of hardware dependencies (how would one driver find my DMA or USB driver?)
You would need some sort of name the other drivers could look up, e.g. "DMA" "USB".
Suddenly the Unix philosophy that everything is a file makes a lot of sense.
Anyway, what is the best way for module code to interact with kernel code?
You would need some sort of name the other drivers could look up, e.g. "DMA" "USB".
Suddenly the Unix philosophy that everything is a file makes a lot of sense.
Anyway, what is the best way for module code to interact with kernel code?
My OS is Perception.
Well the Windows kernel uses a technique of tagging objects/pages with 4 to 5 letter names. Memory reserved for PNP is tagged PNP[0-...], etc. You could define classes of devices and drivers and have the driver identify themselves with what category they belong to. But doing it that way places limitations on your code, as drivers will only look for a device that has codename x, etc. Just a thought.
- AndrewAPrice
- Member

- Posts: 2327
- Joined: Mon Jun 05, 2006 11:00 pm
- Location: USA (and Australia)
That would be the best way to go (FLOPPY0, FLOPPY1, DMA8, DMA16, etc). I'm going with a mixed mono/microkernel-ish route; drivers will run in user-space, while VFS, FS, will be in kernel-space.
Drivers will run like regular programs (except as super user) and the kernel will use IPC to communicate. I still need to work out a standard system of how a driver can access an area of memory in the kernel (DMA, video buffers, etc), unless drivers are allowed to map anywhere in physical memory to their address space.
Hmm... I still need to work out how I can transfer a large block of data from one driver into another.
Drivers will run like regular programs (except as super user) and the kernel will use IPC to communicate. I still need to work out a standard system of how a driver can access an area of memory in the kernel (DMA, video buffers, etc), unless drivers are allowed to map anywhere in physical memory to their address space.
Hmm... I still need to work out how I can transfer a large block of data from one driver into another.
My OS is Perception.