Fastcall calling convention

Damjan Jovanovic damjan.jov at gmail.com
Tue Mar 23 05:09:45 CDT 2010


On Tue, Mar 23, 2010 at 11:15 AM, Paul Chitescu <paulc at voip.null.ro> wrote:
> On Tuesday 23 March 2010 10:59:56 am Damjan Jovanovic wrote:
>> Hi
>>
>> Wine doesn't seem to support the fastcall calling convention:
>>
>> include/winternl.h:
>> /* These are implemented as __fastcall, so we can't let Winelib apps
>> link with them */
>>
>> dlls/hal/hal.c:
>> #ifdef __i386__
>> #define DEFINE_FASTCALL1_ENTRYPOINT( name ) \
>>     __ASM_STDCALL_FUNC( name, 4, \
>>                        "popl %eax\n\t" \
>>                        "pushl %ecx\n\t" \
>>                        "pushl %eax\n\t" \
>>                        "jmp " __ASM_NAME("__regs_") #name __ASM_STDCALL(4))
>>
>> GCC seems to support fastcall from version 3.4:
>> http://www.ohse.de/uwe/articles/gcc-attributes.html
>>
>> Should we support it? Its absence makes kernel driver code a lot
>> uglier (eg. irp->Tail.Overlay.s.u2.CurrentStackLocation instead of
>> IoGetCurrentIrpStackLocation()). We also can't declare fastcall
>> functions in header files, so some functions that are actually
>> implemented are missing from header files and thus unusable from
>> inside Wine.
>>
>> Thank you
>> Damjan Jovanovic
>
>
> Unfortunately GCC's fastcall is different from the Microsoft's fastcall so
> it's not usable in exported functions:
>
> http://gcc.gnu.org/ml/gcc-bugs/2009-08/msg00837.html

Those differences seem to only feature when passing/returning
structures/floats by value, something the Windows DDK should never do.

Also can we declare some fastcall functions inline, like winternl.h
has done for RtlUshortByteSwap()?

Thank you
Damjan Jovanovic



More information about the wine-devel mailing list