microkernel and constant driver interface

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
AndrewAPrice
Member
Member
Posts: 2327
Joined: Mon Jun 05, 2006 11:00 pm
Location: USA (and Australia)

microkernel and constant driver interface

Post by AndrewAPrice »

I have driver interface, which works fine for end devices (e.g. storage devices, input devices, etc), but things like my DMA driver exist within the kernel as a global object my other drivers depend on. It works, but it seems to steer away from my consistent interface.

I'm planning on rewriting my driver interface, and using an event based system. I also wish to move my drivers out of kernel land (including DMA). I'll leave process management (including loading/unloading), memory management, and event management inside of the kernel since these aren't really 'drivers' as such and I don't want to abstract them away.

What I want to know, is how do microkernels handle drivers like DMA? How does a floppy driver find the DMA driver (I don't want to make it a 'special-case' driver, or else I'll be doing that for PCI, USB, etc, and my driver-interface will loose that feeling of consistency) and interact with it? How do drivers in general work in a microkernel environment?
My OS is Perception.
User avatar
AndrewAPrice
Member
Member
Posts: 2327
Joined: Mon Jun 05, 2006 11:00 pm
Location: USA (and Australia)

Post by AndrewAPrice »

I've sort of got an idea of how I'm going to do it.

A driver will be an ordinary program that can be loaded like any other. When the program is loaded, a special system call is made that upgrades the program to driver level (only programs started by the super user can make the system call). This system call will register things like the driver's name ("Generic Floppy", "DMA", etc).

There will be a second system call to register a device ("Generic Floppy" will create "Floppy0" "Floppy1" etc, "DMA" will create "DMA8" and "DMA16").

Drivers will use windows-style events (with events like "DRIVER_SHUTDOWN", and pass a special 'device code' which is most likely a pointer in driver-space), although there will be custom events (i.e. "DMA_DO_TRANSFER").

Having drivers run in their own memory space means a memory leak in a driver won't chew up memory on the whole system, only for the driver's process which can instantly be killed if necessary.

Anyway, I need to work out a system to send structs across with my requests, but they can be of varying size.
My OS is Perception.
User avatar
lukem95
Member
Member
Posts: 536
Joined: Fri Aug 03, 2007 6:03 am
Location: Cambridge, UK

Post by lukem95 »

that sounds like a good plan, have you got inter-process-messages working?
~ Lukem95 [ Cake ]
Release: 0.08b
Image
User avatar
AndrewAPrice
Member
Member
Posts: 2327
Joined: Mon Jun 05, 2006 11:00 pm
Location: USA (and Australia)

Post by AndrewAPrice »

Yes, but right now the most you can send between processes is 20-bytes (an event structure). I have a 'reserved' event which specifies a message is waiting and the size of the message, so I'll get that working first.
My OS is Perception.
Post Reply