kern/99979: Get Ready for Kernel Module in C++

mag at intron.ac mag at intron.ac
Tue Jul 11 16:45:53 UTC 2006


John Baldwin wrote:

> On Tuesday 11 July 2006 10:57, Dag-Erling Sm  grav wrote:
>> > For example, I think C++ exception handling is really poorly suited for
>> > low-level code.
>> 
>> Exception handling is required by the standard, even for freestanding
>> implementations.
> 
> Standards aside, in Darwin, the C++ Apple uses does not have any exception
> handling or RTTI (and maybe not even templates).  They use their own set of
> meta classes to implement an RTTI-like system that allows for future changes
> in the ABI.  You would also benefit from doing some of your own research.

      Yeah. Besides inspection to OpenDarwin, my motivation comes from my
inspection to assemble code generated by GNU CC. Many object-oriented
directives have been implemented in .o file by compiler.

> 
>> > But the "object model" is still obscure to understand no matter how many
>> > people all over the world master C++.
>> 
>> The fact that you don't understand it doesn't mean it's bad.
> 
> No, but it is obtuse.  And very underused.  How many device drivers do you
> know of that use kobj inheritance?

      Of course many (with bus_if.h and device_if.h generated). But if
I am writing a member function, I am not enough grammartically prompted
that it belongs to a class. What I see is a C function pointer list
(static device_method_t).
      And when I access a context-specific variable in a member function,
I must write variable name "sc->XXX" after obtain the context pointer.


> 
>> > What's more, can the "object model" function really as OpenDarwin's
>> > IOKit class model?
>> 
>> Does it need to?
> 
> He's trying to port IOKit to FreeBSD for his exercise (if you had read his
> first e-mail you'd know that).

You're somewhat right. Now, I would only submit some MINOR patches to
FreeBSD, only to sweep out some conflicts against C++ language. These
patches are also irrelevant to C++ runtime library.

There patches do ABSOLUTELY NO HARM to current FreeBSD kernel.

Before I do enough experiments, naturally I would never talk about
this thing.

I don't know why Dag-Erling C. Smo/rgrav is so unfriendly to me ??? !!!

> 
>> > Well, you can LOOK DOWN UPON me, but I believe you cannot throw doubt on
>> > FreeBSD's actuality: so weak USB support (kernel crash easier than many
>> > other OSs that we laughed at and that we are laughing at), so weak PCI
>> > device support.
>> 
>> Please provide references to the PRs you filed about these issues.
> 
> USB crashes are not that uncommon, and compared to other OS's (such as Windows 
> and OS X both of which I've written a PCI driver for) we require device 
> driver writers to go through a lot more hoops to do certain things like 
> allocate resources.  At the very least there is much that can be improved in 
> our driver model.

      If manufactures would write FreeBSD driver itself, they must do
their best, just as NVIDIA. We should provide a good kernel environment
for them.
      But now some FreeBSD drivers by volunteers, even expert at FreeBSD,
are somewhat rough.

> 
> -- 
> John Baldwin
------------------------------------------------------------------------
                                                From Beijing, China



More information about the freebsd-hackers mailing list