lightning
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Lightning] Implementing win32 call convention


From: Paul Cercueil
Subject: Re: [Lightning] Implementing win32 call convention
Date: Mon, 23 Sep 2019 01:21:00 +0200

Hi,

Actually the calling convention is the same between MinGW and Cygwin, but on x86_64 the ABI is still a bit different - Cygwin considers that a "long" type is 64-bit, while MinGW (and Visual Studio) consider that a "long" type is 32 bits.

I have a patch to add support for MinGW ready, I'll send it ASAP.

Cheers
-Paul



Le sam. 21 sept. 2019 à 21:39, address@hidden a écrit :
Hi,

I am collaborating with other people to get a GNU Lightning based
project to run on Windows and x86_64.
Other project details include the restraint of only using 2 Makefiles
to build it all, which meant using autotools
only once to generate configuration files and foregoing that build
system altogether afterwards.

We got it to compile using the MSYS2 toolchain, specifically the
mingw-w64-x86_64 subset.
But when the program crashes shortly after launch.Stepping through the
code with GDB, the crash happens
after jumping into the first recompiled block.

I've been told this might be due to GNU Lightning generating asm that
handles registers according to System V ABI call conventions.
Assuming this the source of the segfault, then the solution would be
to use the Microsoft x86 calling convention instead.

With that said, I would like to know if anyone in the mailing list has
any interest in implementing this.
If there is no one willing and able, then I would request some
guidance on where these changes would occur as I myself am not
familiar
with where GNU Lightning says "if we're on x86 and using SysV ABI,
then these registers are params, these registers are return vals,
etc".

For example, I see that in jit_private.h and jit_x86.h that some
register-related macros take on different values based on __CYGWIN__
being defined.
I suppose the implementation of this feature would look like that but
we'd check for __WIN32__?

For reference, here is our project:
https://github.com/ZachCook/beetle-psx-libretro/tree/lightrec
GNU Lightning is used by LightRec, which is a dynamic recompiler for MIPS.

Regards,
R. Cinco

_______________________________________________
Lightning mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/lightning





reply via email to

[Prev in Thread] Current Thread [Next in Thread]