Passing Parameters in 64 bit Assembly Function from C language. Which Register Receive These Parameter?

StackOverflow https://stackoverflow.com/questions/16457109

Domanda

I want to pass a parameter to an assembly function from C.

On a UNIX-like system, the first six parameters go into rdi, rsi, rdx, rcx, r8, and r9.

On Windows, the first four parameters go into rcx, rdx, r8, and r9.

Now, my question is: On the BIOS- or DOS programming level, which registers receive these parameters? If the number of parameter are more than 6, how do I write the assembly to handle these parameters?

È stato utile?

Soluzione 2

If I understand the first part of your question, using C in 16-bit mode is not really supported (since 16-bit mode uses segmentation to get past 16 bits of addressing).

Referring to the second part, that depends on the compiler, but IIRC both Windows and Unix will pass additional arguments on the stack (see http://en.wikipedia.org/wiki/X86_calling_conventions for more on argument passing).

Altri suggerimenti

64-bit UEFI uses the Windows convention.

The BIOS and DOS APIs are defined in assembly language.

Traditionally in 16-bit and 32-bit x86 all the arguments are stored on the stack.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top