Subject: Re: LKMs independent of DIAGNOSTIC?
To: None <assar@netbsd.org, port-alpha@netbsd.org>
From: None <eeh@netbsd.org>
List: tech-kern
Date: 08/06/2001 15:57:46
| I tried loading an LKM into an alpha kernel build with DIAGNOSTIC.
| This fails some time after loading it in a not-very-pretty way since
| the layout of `struct cpu_info' is different depending on DIAGNOSTIC
| (and MULTIPROCESSOR).  To not have to build LKMs with the exakt same
| set of defines (and no way of finding these) as the kernel, I suggest
| something along the line of this patch.  Any comments?

That's all you had to change?  Lucky you.

Spend a moment to think about the problem.  Any macro or structure
that could vary depending on some other macro is a problem.  This
includes locks, some pmap and bus_space implementations, etc.  

I don't really think fixing this piecemeal will be much help.  If you
want to have some independence between LKMs and the kernels they are
loaded on you really need to define a specific set of APIs that LKMs 
can use, and make sure they remain constant despite any changes to 
flags used to compile the kernel.  Unfortunately, this means that
most macros will simply have to go, being replaced with real function
calls with fixed signatures.

Eduardo