Disclaimer: I am not *quite* sure I got your idea correctly, so I might be off here.
sebihepp wrote:
If I use an abstract Interface class for my kernel...
Yes...
Quote:
...and for every driver I call main with the address of my kernel class...
I guess you mean: during driver initialization, your kernel calls the main() function of the driver, passing the address of the kernel interface class as parameter. (So that the driver could call back the kernel.)
Nice idea.
One note: Don't call it main(), call it driver_init() or init(). The function main() has a defined special meaning, and even if the environment makes it clear that your driver is not a hosted executable, your choice of function naming should also reflect this.
Quote:
...then there should be no relocations, because no data/code from outside is used.
Wrong.
Your driver consists of class X and class Y. It has been compiled for address 0xdeadbeef, so class X sits at 0xdeadbeef and class Y sits at 0xdeadfeed.
Unless you load your kernel binary
exactly to 0xdeadbeef, you have to do relocation, otherwise all references to class X and class Y will be off.
Same goes for any data object inside the driver binary.