So how do you define the communication interface between kernel & driver?
This is my current design:
1. kernel call driver directly (ie C call) by calling driver's exported symbols.
Code: Select all
// kernel code
func = (int(*)(void)) ELF32_sym ( &elf, "driver_init" );
rez = func();
Code: Select all
// driver code
void* kmalloc(size_t s); // define prototype only, the body is in the kernel.bin
…
rez = kmalloc(16); // call it directly
I also considered alternatives, like provide another interrupt entry but I can't think of an elegant way to tell if the caller is a driver or an user-apps, checking the return address is ugly.