diff --git a/README b/README index c378542..7f796ec 100644 --- a/README +++ b/README @@ -10,6 +10,7 @@ Dependencies: Basic *nix build instructions: ./autogen.sh # only needed if building from git repo + ./nomacro.pl # only needed if building on Mac OS X ./configure CFLAGS="-O3" make diff --git a/nomacro.pl b/nomacro.pl new file mode 100755 index 0000000..e91cda3 --- /dev/null +++ b/nomacro.pl @@ -0,0 +1,47 @@ +#!/usr/bin/perl +# Copyright 2012 pooler@litecoinpool.org +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 of the License, or (at your option) +# any later version. See COPYING for more details. +# +# nomacro.pl - convert assembler macros to C preprocessor macros. + +use strict; + +foreach my $f (<*.S>) { + rename $f, "$f.orig"; + open FIN, "$f.orig"; + open FOUT, ">$f"; + my $inmacro = 0; + my %macros = (); + while () { + if (m/^\.macro\s+([_0-9A-Z]+)(?:\s*)(.*)$/i) { + print FOUT "#define $1($2) \\\n"; + $macros{$1} = 1; + $inmacro = 1; + next; + } + if (m/^\.endm/) { + print FOUT "\n"; + $inmacro = 0; + next; + } + for my $m (keys %macros) { + s/^([ \t]*)($m)(?:[ \t]+([^#\n]*))?([;\n])/\1\2(\3)\4/; + } + if ($inmacro) { + if (m/^\s*#if/) { + $_ = while (!m/^\s*#endif/); + next; + } + next if (m/^\s*$/); + s/\\//g; + s/$/; \\/; + } + print FOUT; + } + close FOUT; + close FIN; +} diff --git a/scrypt-x86.S b/scrypt-x86.S index 62e77fa..b212746 100644 --- a/scrypt-x86.S +++ b/scrypt-x86.S @@ -384,7 +384,7 @@ .endm .text - .align 32 + .p2align 5 gen_salsa8_core: gen_salsa8_core_quadround gen_salsa8_core_quadround @@ -392,7 +392,7 @@ gen_salsa8_core: .text - .align 32 + .p2align 5 .globl scrypt_core .globl _scrypt_core scrypt_core: @@ -675,7 +675,7 @@ gen_scrypt_core_loop2: xmm_salsa8_core_doubleround .endm - .align 32 + .p2align 5 xmm_scrypt_core: movl 20(%esp), %edi movl 24(%esp), %esi