Win64 status
Kuba Ober
kuba at mareimbrium.org
Mon Jun 19 14:42:21 CDT 2006
On Monday 19 June 2006 14:17, Ge van Geldorp wrote:
> With the Win64 patches I just submitted to wine-patches, I'm able to
> successfully build Win64-enabled Wine and execute the following 64-bit
> winelib (winelib64? wine64lib?) application:
>
> #include "windows.h"
>
> int WINAPI WinMain(HINSTANCE hinst, HINSTANCE hprev, LPSTR cmdline, int
> cmdshow)
> {
> DWORD Written;
>
> WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), "Hello, world\r\n", 14,
> &Written, NULL);
>
> return 0;
> }
>
> Unfortunately, compiling the above app as a true 64-bit HELLO64.EXE using
> Microsoft Visual Studio and then executing it using Wine doesn't work. The
> problem is that the calling convention for functions is different between
> MSVC and GCC generated apps. Basically, MSVC puts the function arguments in
> registers RCX, RDX, R8, R9 while GCC puts function arguments in registers
> RDI, RSI, RDX, RCX, R8, R9. I guess we'll have to wait for true .EXE
> support until someone teaches GCC the MSVC calling convention.
I'm currently hacking on gcc for an embedded target (Z8 Encore), but I
wouldn't mind giving it a try while I'm digging in the gcc tree.
I'd like to hear any suggestions as to how to tell the compiler to use that
calling convention (I'm not talking about implementation, just how the
compiler used would tell it).
I presume it'd need to be something that can be set globally per each compiler
invocation, as well as a per declaration override.
I'm thinking of "-msvc" (like -liberty ;) compiler option to force a
MSVC-compatible ABI, and for now that'd only apply to 64 bit code (i.e. with
-m64). Maybe in the future it could enable something special for 32 bit code
as well.
I'm all ears about the per-declaration override (a pragma? an __attribute__?),
and about alternatives to -msvc.
I'd be submitting a patch to mingw32 people as soon as it's done, in addition
to posting it here. Note that the only way for me to test it would be to
inspect the assembly output, as I'm not running 64 bit environment here (even
though I'm on a 64 bit AMD processor). So it'd need testing from 64 bit
people here at least.
Cheers, Kuba
More information about the wine-devel
mailing list