lightning
[Top][All Lists]
Advanced

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

Re: [Lightning] Implementing win32 call convention


From: Paulo César Pereira de Andrade
Subject: Re: [Lightning] Implementing win32 call convention
Date: Mon, 23 Sep 2019 11:37:07 -0300

Em dom, 22 de set de 2019 às 20:21, Paul Cercueil
<address@hidden> escreveu:
>
> 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.

  I would expect __CYGWIN__ and __WIN32__ to use the same abi.
  I am not used to windows programming, but I suppose there is also
a __WIN64__ or similiar identifier. Since it works in __CYGWIN__
64 bit, it should be very simple to make it work.
  Currently lightning expects sizeof(void*) == sizeof(long). If it
is not the case, might need to typedef jit_word_t to something else,
like ssize_t or long long, or use some compiler switch.

> 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

Thanks!
Paulo



reply via email to

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