As the stack handling of assembly function and C function are different.
The assembly code "callq" can not directly call C routines, need a piece of code to put assembly parameter into C stack before calling.
The macro "asmlinkage", defined in Linux kernel source, is used to tell compiler the function is prepared to called from assembly and the compiler will add some parameter placement code at head of this C function.
So, things you have to do is:
At caller side
movq <arg6>,%r9 /* 6th arg */
movq <arg5>,%r8 /* 5th arg */
movq <arg4>,%rcx /* 4th arg */
movq <arg3>,%rdx /* 3rd arg */
movq <arg2>,%rsi /* 2nd arg */
movq <arg1>,%rdi /* 1st arg*/
callq <your-function-name>
movq %rax, <buf-to-return-result> /* return value */
At callee side:
asmlinkage int my-function(int arg1, int arg2, int arg3, ...) {
<your code>;
return 0;
}