NeoScrypt icon indicating copy to clipboard operation
NeoScrypt copied to clipboard

faults when compiled with cygwin(64bit)

Open dnprod opened this issue 8 years ago • 4 comments

hi there! i compiled this (with -DWIN64) under windows7 cygwin-64bit it runs okay up to NeoScrypt SSE2 4-way part D integrity test passing. but when it moves on to Scrypt SSE2 4-way part A the program faults.

i'm by no means an assember guy :) but do the Scrypt assembler routines still need their entry sequences WIN64-izing ? --ken

dnprod avatar Mar 19 '17 19:03 dnprod

The WIN64 part is due to different register preservation and argument passing on Windows and UNIX. I'm not familiar how Cygwin manages this part, but it's possible that it needs not -DWIN64 at all.

ghostlander avatar Mar 20 '17 19:03 ghostlander

without -DWIN64 the program faults immediately, using -DWIN64 allowed it to get as far as it did.

i believe cygwin64 uses microsoft conventions for register/function usage, only thing to watch out for is that microsoft thinks longs are 4bytes while cygwin64 thinks longs are 8bytes. ah, here's the reference: https://cygwin.com/cygwin-ug-net/programming.html

below is ugly, because i had to use 'code' indicators to get the double underscores to show up, otherwise this forum just boldfaces the enclosed word when it sees underscores.

for CPP usage with cygwin, both cygwin32 and cygwin64 define __CYGWIN__ however cygwin32 defines __CYGWIN32__ but interestingly enough, cygwin64 does NOT define __CYGWIN64__ (and not __CYGWIN32__ of course :) ) cygwin64 does define __x86_64__ and __LP64__

dnprod avatar Mar 21 '17 00:03 dnprod

Does it work if compiled in the 32-bit mode?

ghostlander avatar Mar 23 '17 15:03 ghostlander

yes, i just got that yesterday. (i had to install cygwin32 to coexist on my system and figure out the magic incantation.) but yes, cygwin32 builds and runs the program fine with -WIN32 defined.

here is my modified build.sh scrypt if you want to see if i've done anything completely bone headed. (and of course this forum totally mangles things regardless of using quote or code indicators. some back-quotes are visually missing because of that.)

#!/bin/sh

grepout=mount | grep -i -e "c:/cygwin32/bin" grstat=$? # 0=match 1=fail 2=cmderr if [ $grstat -eq 0 ]; then echo "Building for WIN32" ARCHFLAGS="-m32 -DWIN32" PROGNAME="neoscrypt32" else echo "Building for WIN64" ARCHFLAGS="-DWIN64" PROGNAME="neoscrypt64" fi DEFINES="-DASM -DOPT -DMINER_4WAY -DSHA256 ${ARCHFLAGS}" CC=gcc CFLAGS="-Wall -O2 -fomit-frame-pointer -fno-stack-protector" LD="gcc" LDFLAGS="-Wl,-s"

echo "$CC $CFLAGS $DEFINES -c neoscrypt.c" $CC $CFLAGS $DEFINES -c neoscrypt.c

echo "$CC $CFLAGS $DEFINES -c neoscrypt_test.c" $CC $CFLAGS $DEFINES -c neoscrypt_test.c

echo "$CC $DEFINES -c neoscrypt_asm.S" $CC $DEFINES -c neoscrypt_asm.S

echo "$LD $LDFLAGS -o ${PROGNAME} neoscrypt.o neoscrypt_test.o neoscrypt_asm.o" $LD $LDFLAGS -o ${PROGNAME} neoscrypt.o neoscrypt_test.o neoscrypt_asm.o

dnprod avatar Mar 23 '17 17:03 dnprod