[Openmcl-devel] question about "linker tricks" and "VirtualProtect spjump" error under Wine

Gary Byers gb at clozure.com
Mon Jul 22 09:35:43 PDT 2013

The linker tricks in question are:

  - passing the --image-base 0x10000 argument to ld.exe in
  - telling ld.exe to use a linker script ("pei-x86-64.x")
  - in that linker script, reserving another 64K bytes between
    the (page-aligned) end of the executable file's headers and
    the start of its acual code,

The intent is that the memory between #x11000 and #x21000 is mapped
(readonly) and otherwise unused.  We can achieve this effect in other
ways on other platforms.  remap_spjump() tries to write-enable a page
in this memory region (IIRC, at #x14000) so that something else can
be copied to that fixed address, and that fails under WINE.  I'd guess
that the failure is caused by WINE's failure to have mapped the executable
at the specifed image-base address in the first place, but that's just
a guess.

On Mon, 22 Jul 2013, dto at blocky.io wrote:

> Greetings, Clozure CL community.
> I have a question about the "linker tricks" described near remap_spjump() in
> the CCL source:
> ??
> ? ?http://svn.clozure.com/publicsvn/openmcl/trunk/source/lisp-kernel/pmcl-kern
> el.c
> When attempting to run the Windows version of CCL under Wine 1.6, the
> following error message results:
> ?
> ??? VirtualProtect spjump: 0x57 Invalid parameter.
> A Wine developer took a look at the source in question, and said that it
> appeared that a VM feature that CCL is
> using for memory reservation, isn't supported by Wine. He also said that if
> I could get a clarification from CCL developers
> on what the "linker tricks" are, I might be able to modify Wine so that it
> works, without modifying CCL at all.
> Why am I doing this? I used to use SBCL.EXE with Wine in order to build
> Windows EXE's of my games without
> having Windows. But unfortunately, the resulting EXE won't work on some
> 64-bit versions of Windows due to
> an existing incompatibility in SBCL. I use CCL for the Windows versions now,
> but I have to use a separate Windows
> machine that I don't always have access to.
> For the curious, my current GPL game is here: http://blocky.io/2x0ng.html
> And I'd like to thank you for helping me a few times on the IRC channel,
> when I first started building
> the game with CCL.
> So, I hope that with a little information, I could work with Wine developers
> to make things compatible.
> I would greatly appreciate any information you could offer as to what
> remap_spjump() is doing.
> Thank you.
> --David

More information about the Openmcl-devel mailing list