I need to write a C function that will be invoked from assembly code in linux kernel.
What special issues should be taken into account?
I have some in mind, but can anybody provide more details:
(1) Calling convention
Make sure the caller in assembly and the callee in c shake hands well. But which calling convention should I use? How can I declare the c function and declare it in assembly code?
(2) Protect registers
Some registers should be saved in the assembly before the invoke. I roughly remember they are eax, ecx and edx. But I don't have to save them unless I need to refer to the old value before the invoke to the C function, right?
What are other issues?