Register calling convention for asm functions...
Daniel Keep
daniel.keep.lists+dm at gmail.com
Sun Mar 11 21:28:21 PDT 2007
Chris Warwick Wrote:
> What do i need to do to get register calling convention for asm? I've found
> extern(C) for cdecl calling convention, and i have seen mention of the
> 'naked' keyword but cant work out where it goes... im not even sure if it
> does cause register calling convention or just causes the compiler to omit
> entry and exit code.
>
> I assume it must be possible to write asm functions that take arguments in
> the eax,ecx,edx registers?
>
> thanks,
>
> cw
You put 'naked' at the top of a function body, and it causes the compiler to omit the function prelude and prologue. So, for example:
void breakpoint()
{
naked;
asm { int 3; }
}
Compiles literally as
INT 0x3
As for arguments in registers, you can't do that. If you want to have a function that you pass arguments to via registers, then you need to "call" it using asm.
I'd write you an example, but I'm typing this from a Mac at uni and, well, my assembler ain't that crash-hot :3
-- Daniel
More information about the Digitalmars-d-learn
mailing list