ASM call conventions

Viewed 3039

I have been reading about calling conventions in ASM and this is what I got so far:

          x86(userland)    x86(kernel)    x64(userland)    x64(kernel)

1st arg           Stack           EBX               RDI            RDI
2nd arg           Stack           ECX               RSI            RSI
3rd arg           Stack           EDX               RDX            RDX
4th arg           Stack           ESI               RCX            R10
5th arg           Stack           EDI               R8             R8
6th arg           Stack           EBP               R9             R9

result            EAX             EAX               RAX            RAX

My questions are:

  1. Is what I have learned so far correct?

  2. How can I pass more than 6 arguments in x86(kernel) and x64(both)? Using the stack? Mind to show me a small example?

  3. I have a kernel module and I'm willing to call a function in that module from ASM. What convention should I use? kernel or userland?

4 Answers
Related