Discussion:
[john-dev] x86-64.S Win64 support
Solar Designer
2016-08-08 01:24:29 UTC
Permalink
As part of alpha release preparation we've added JtR to midipix_build.sh
for inclusion in the release tarball. After reading this thread I went
on to test the binary, then realized that x86-64.S was still an open
issue due to the different calling conventions. As all global functions
in x86-64.S take two arguments at the most, I went ahead and patched the
relevant spots using #ifdef __PE__ and a push-mov-pop wrapping method
(note that in the WIN64 ABI, both %rdi and %rsi are nonvolatile
registers). After applying the attached patch, all tests passed.
Attached log is from a Dell Latitude E5450, JtR built with -g3 -O2, musl
libc and libpsxscl built with -g3 -O0.
Thanks for the patch.

Looking at x86-64.S in jumbo, I see it also saves/restores %xmm6 through
%xmm15 when building for Win64. Perhaps this is unnecessary in a build
with midipix, since musl does not currently use those registers and JtR
core does not use any other libraries. But this may be something to
include if I apply a patch like this to the core tree. Or at least
there should be a comment added about this piece missing. Otherwise it
could be an unpleasant surprise to someone when things are neither fully
working nor fully broken in a non-midipix Win64 build of the core tree.

Alexander
w***@midipix.org
2016-08-08 08:47:11 UTC
Permalink
Post by Solar Designer
As part of alpha release preparation we've added JtR to midipix_build.sh
for inclusion in the release tarball. After reading this thread I went
on to test the binary, then realized that x86-64.S was still an open
issue due to the different calling conventions. As all global functions
in x86-64.S take two arguments at the most, I went ahead and patched the
relevant spots using #ifdef __PE__ and a push-mov-pop wrapping method
(note that in the WIN64 ABI, both %rdi and %rsi are nonvolatile
registers). After applying the attached patch, all tests passed.
Attached log is from a Dell Latitude E5450, JtR built with -g3 -O2, musl
libc and libpsxscl built with -g3 -O0.
Thanks for the patch.
Looking at x86-64.S in jumbo, I see it also saves/restores %xmm6 through
%xmm15 when building for Win64. Perhaps this is unnecessary in a build
with midipix, since musl does not currently use those registers and JtR
core does not use any other libraries. But this may be something to
include if I apply a patch like this to the core tree. Or at least
there should be a comment added about this piece missing. Otherwise it
could be an unpleasant surprise to someone when things are neither fully
working nor fully broken in a non-midipix Win64 build of the core tree.
Alexander
Good point, and after looking at the jombo patch I thought it might be
best to have the same prologue/epilogue (and less #ifdef's) in both
projects. Attached an updated patch with a reference comment.

Loading...