Re: Generic Kernel API
From: Charles Swiger (cswiger_at_mac.com)
Date: Wed, 9 Nov 2005 16:23:28 -0500 To: Julian Elischer <firstname.lastname@example.org>
On Nov 9, 2005, at 1:58 PM, Julian Elischer wrote:
> Marcin Jessa wrote:
[ ... ]
>> My idea is to create an API for binary vendor drivers to make it
>> easier for hardware vendors to create FreeBSD drivers the same way
>> they can do for Windows or Mac OS X.
> well, you could port the Darwin driver interface in the form of a
> shim, or
> extend "project evil" to cover more kinds of drivers..
An interesting thought, although the IOKit uses an embedded C++
subset rather than plain C . For those who aren't familiar with
it, the Darwin kernel API for drivers, variously called the IOKit or
DriverKit, is documented here:
...and the "Fundamentals" document is an interesting read:
"First, neither the Mac OS 9 driver model nor the FreeBSD driver
model offers a set of features rich enough to meet the needs of Mac
OS X. The Mac OS X kernel is significantly more advanced than its Mac
OS precursors; it handles memory protection, preemptive multitasking,
multiprocessing, and other features not present in previous versions
of Mac OS. Although FreeBSD is capable of handling these features,
the BSD model does not offer other features expected in a modern
operating system, including automatic configuration, driver stacking,
power management, and dynamic loading of devices."
In truth, FreeBSD does have reasonable support for PnP autoconfig and
dynamic loading of device drivers, and FreeBSD does have a decent C-
based object system with introspection in <sys/kobj.h>, although that
doesn't seem to be fully taken advantage of in places where it could
be, except perhaps in the sound and UART drivers. Most other FreeBSD
drivers are "flat" and have a fair amount of code duplication, rather
than using OO inheritance so that your fxp or dc driver inherits from
a common NIC abstraction (Apple's IONetworkController ->
IOEthernetController -> _device_).
Apple has found that using inheritance is a big win for them: "In
addition, code reusability decreases the memory footprint of drivers;
drivers ported from Mac OS 9, for example, have been up to 75%
smaller in Mac OS X." Of course, it's easier to say such things then
to write the code, but Apple has achieved pretty good results from
-- -Chuck : http://www.caravan.net/ec2plus/ _______________________________________________ email@example.com mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "firstname.lastname@example.org"