Register calling convention for asm functions...
Chris Warwick
sp at m.me.not
Mon Mar 12 09:55:19 PDT 2007
"Daniel Keep" <daniel.keep.lists+dm at gmail.com> wrote in message
news:et2kt5$2g7c$1 at digitalmars.com...
> 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.
Eeek! I think i'll just suck up the overhead and use extern(C) then. ;-)
cw
More information about the Digitalmars-d-learn
mailing list