Commit graph

79 commits

Author SHA1 Message Date
Adam Langley
fa3f83552f perlasm/x86_64-xlate.pl: typo fix in comment.
CLA: trivial

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2584)
2017-02-10 20:32:22 +01:00
Andy Polyakov
a3b5684fc1 perlasm/x86_64-xlate.pl: recognize DWARF CFI directives.
CFI directives annotate instructions that are significant for stack
unwinding procedure. In addition to directives recognized by GNU
assembler this module implements three synthetic ones:

- .cfi_push annotates push instructions in prologue and translates to
  .cfi_adjust_cfa_offset (if needed) and .cfi_offset;
- .cfi_pop annotates pop instructions in epilogue and translates to
  .cfi_adjust_cfs_offset (if needed) and .cfi_restore;
- .cfi_cfa_expression encodes DW_CFA_def_cfa_expression and passes it
  to .cfi_escape as byte vector;

CFA expression syntax is made up mix of DWARF operator suffixes [subset
of] and references to registers with optional bias. Following example
describes offloaded original stack pointer at specific offset from
current stack pointer:

	.cfi_cfa_expression	%rsp+40,deref,+8

Final +8 has everything to do with the fact that CFA, Canonical Frame
Address, is reference to top of caller's stack, and on x86_64 call to
subroutine pushes 8-byte return address.

Triggered by request from Adam Langley.

Reviewed-by: Rich Salz <rsalz@openssl.org>
2017-02-09 20:00:33 +01:00
Andy Polyakov
9d301cfea7 perlasm/x86_64-xlate.pl: remove obsolete .picmeup synthetic directive.
Reviewed-by: Rich Salz <rsalz@openssl.org>
2017-02-09 20:00:28 +01:00
Andy Polyakov
e09b6216a5 perlasm/x86_64-xlate.pl: minor readability updates.
Reviewed-by: Rich Salz <rsalz@openssl.org>
2017-02-09 20:00:23 +01:00
Andy Polyakov
e1dbf7f431 perlasm/x86_64-xlate.pl: clarify SEH coding guidelines.
Reviewed-by: Rich Salz <rsalz@openssl.org>
2017-02-06 08:20:46 +01:00
Andy Polyakov
526ab89645 perlasm/x86_64-xlate.pl: add support for AVX512 OPMASK-ing.
Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-12-15 17:57:45 +01:00
Andy Polyakov
82e089308b perlasm/x86_64-xlate.pl: refine sign extension in ea package.
$1<<32>>32 worked fine with either 32- or 64-bit perl for a good while,
relying on quirk that [pure] 32-bit perl performed it as $1<<0>>0. But
this apparently changed in some version past minimally required 5.10,
and operation result became 0. Yet, it went unnoticed for another while,
because most perl package providers configure their packages with
-Duse64bitint option.

Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-12-12 11:00:50 +01:00
David Benjamin
609b0852e4 Remove trailing whitespace from some files.
The prevailing style seems to not have trailing whitespace, but a few
lines do. This is mostly in the perlasm files, but a few C files got
them after the reformat. This is the result of:

  find . -name '*.pl' | xargs sed -E -i '' -e 's/( |'$'\t'')*$//'
  find . -name '*.c' | xargs sed -E -i '' -e 's/( |'$'\t'')*$//'
  find . -name '*.h' | xargs sed -E -i '' -e 's/( |'$'\t'')*$//'

Then bn_prime.h was excluded since this is a generated file.

Note mkerr.pl has some changes in a heredoc for some help output, but
other lines there lack trailing whitespace too.

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
2016-10-10 23:36:21 +01:00
Andy Polyakov
9c940446f6 crypto/x86[_64]cpuid.pl: add OPENSSL_ia32_rd[rand|seed]_bytes.
Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-07-15 13:20:52 +02:00
Andy Polyakov
67b8bf4d84 perlasm/x86_64-xlate.pl: address errors and warnings in elderly perls.
Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-06-24 22:10:19 +02:00
Andy Polyakov
4e3d2866b6 perlasm/x86*.pl: add endbranch instruction.
For further information see "Control-flow Enforcement Technology
Preview" by Intel.

Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-06-14 23:43:52 +02:00
Andy Polyakov
1eb12c437b perlasm/x86_64-xlate.pl: add commentary.
Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-06-14 22:50:47 +02:00
Andy Polyakov
6a4ea0022c perlasm/x86_64-xlate.pl: refactor argument parsing loop.
Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-06-14 22:50:42 +02:00
David Benjamin
c25278db8e Make x86_64-xlate.pl 'use strict' clean.
use strict would have caught a number of historical bugs in the perlasm
code, some in the repository and some found during review. It even found
a fresh masm-only bug (see below).

This required some tweaks. The "single instance is enough" globals got
switched to proper blessed objects rather than relying on symbolic refs.
A few types need $opcode passed in as a result.

The $$line thing is a little bit of a nuisance. There may be a clearer
pattern to use instead.

This even a bug in the masm code.
9b634c9b37 added logic to make labels
global or function-global based on whether something starts with a $,
seemingly intended to capture the $decor setting of '$L$'. However, it
references $ret which is not defined in label::out. label::out is always
called after label::re, so $ret was always the label itself, so the line
always ran.

I've removed the regular expression so as not to change the behavior of
the script. A number of the assembly files now routinely jump across
functions, so this seems to be the desired behavior now.

GH#1165

Signed-off-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-06-14 22:50:04 +02:00
Rich Salz
e0a651945c Copyright consolidation: perl files
Add copyright to most .pl files
This does NOT cover any .pl file that has other copyright in it.
Most of those are Andy's but some are public domain.
Fix typo's in some existing files.

Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-04-20 09:45:40 -04:00
Andy Polyakov
d405aa2ff2 perlasm/x86_64-xlate.pl: make latest ml64 work.
Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-04-20 09:51:33 +02:00
Andy Polyakov
6e42e3ff9c perlasm/x86_64-xlate.pl: handle binary constants early.
Not all assemblers of "gas" flavour handle binary constants, e.g.
seasoned MacOS Xcode doesn't, so give them a hand.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
2016-03-07 14:51:26 +01:00
Viktor Dukhovni
ce3d25d3e5 Fix some issues near recent chomp changes.
Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-02-13 02:54:48 -05:00
Richard Levitte
9ba96fbb25 Perl's chop / chomp considered bad, use a regexp instead
Once upon a time, there was chop, which somply chopped off the last
character of $_ or a given variable, and it was used to take off the
EOL character (\n) of strings.

... but then, you had to check for the presence of such character.

So came chomp, the better chop which checks for \n before chopping it
off.  And this worked well, as long as Perl made internally sure that
all EOLs were converted to \n.

These days, though, there seems to be a mixture of perls, so lines
from files in the "wrong" environment might have \r\n as EOL, or just
\r (Mac OS, unless I'm misinformed).

So it's time we went for the more generic variant and use s|\R$||, the
better chomp which recognises all kinds of known EOLs and chops them
off.

A few chops were left alone, as they are use as surgical tools to
remove one last slash or one last comma.

NOTE: \R came with perl 5.10.0.  It means that from now on, our
scripts will fail with any older version.

Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-02-11 22:11:48 +01:00
Andy Polyakov
fd7dc201d3 perlasm/x86_64-xlate.pl: pass pure constants verbatim.
RT#3885

Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-02-11 21:07:44 +01:00
FdaSilvaYY
0d4fb84390 GH601: Various spelling fixes.
Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
2016-02-05 15:25:50 -05:00
Andy Polyakov
902b30df19 perlasm/x86_64-xlate.pl: handle inter-bank movd.
Reviewed-by: Rich Salz <rsalz@openssl.org>
2014-09-12 00:06:00 +02:00
Andy Polyakov
1b0fe79f3e x86_64 assembly pack: improve masm support. 2014-07-09 20:08:01 +02:00
Andy Polyakov
f4d456408d x86[_64]cpuid.pl: add low-level RDSEED. 2014-02-14 17:24:12 +01:00
Andy Polyakov
41965a84c4 x86_64-xlate.pl: minor update. 2013-12-09 21:23:19 +01:00
Andy Polyakov
667053a2f3 x86_64-xlate.pl: fix jrcxz in nasm case. 2013-10-03 00:26:09 +02:00
Veres Lajos
478b50cf67 misspellings fixes by https://github.com/vlajos/misspell_fixer 2013-09-05 21:39:42 +01:00
Andy Polyakov
a9d14832fd x86_64-xlate.pl: Windows fixes. 2013-06-30 23:07:33 +02:00
Andy Polyakov
22de0e6583 x86_64-xlate.pl: minor size/performance improvement. 2013-05-13 16:06:25 +02:00
Andy Polyakov
f6ff1aa8e0 sha512-x86_64.pl: revert previous change and solve the problem through
perlasm/x86_64-xlate.pl instead.
2012-08-13 12:34:36 +00:00
Andy Polyakov
b2ae61ecf2 x86_64-xlate.pl: remove old kludge.
PR: 2435,2440
2012-03-13 19:19:08 +00:00
Andy Polyakov
e6903980af x86_64-xlate.pl: proper solution for RT#2620. 2012-01-21 11:34:53 +00:00
Andy Polyakov
ff6f9f96fd cryptlib.c, etc.: fix linker warnings in 64-bit Darwin build. 2011-11-12 13:10:00 +00:00
Andy Polyakov
4010b341b7 x86_64-xlate.pl: make vpaes-x86_64.pl and rc4-md5-x86_64 work with ml64,
fix bug in .crt section alignment.
PR: 2620, 2624
2011-10-18 09:50:23 +00:00
Andy Polyakov
a87ff751b7 Add so called Vector Permutation AES x86[_64] assembler, see
http://crypto.stanford.edu/vpaes/ for background information.
It's not integrated into build system yet.
2011-09-12 08:25:14 +00:00
Andy Polyakov
272ba87017 x86_64-xlate.pl: fix movzw. 2011-08-12 21:24:19 +00:00
Andy Polyakov
6fa4c7c43b x86_64-xlate.pl: sha1 and md5 warnings made it to nasm 2.09, extend gnu
assembler workaround to all assemblers.
2011-07-04 13:10:50 +00:00
Andy Polyakov
94c64f9a1c x86_64-xlate.pl: masm-specific update. 2011-07-01 21:21:14 +00:00
Andy Polyakov
0a9a692e4e Minor x86_64 perlasm update. 2011-06-27 09:45:10 +00:00
Andy Polyakov
301799b803 x86[_64]cpuid.pl: add function accessing rdrand instruction. 2011-06-04 12:20:45 +00:00
Andy Polyakov
c7b903e01d x86_64-xlate.pl: add inter-register movq and make x86_64-gfm.s compile on
Solaris, MacOS X, elderly gas...
2011-05-18 16:26:03 +00:00
Andy Polyakov
ddc20d4da9 x86_64cpuid.pl: allow shared build to work without -Bsymbolic.
PR: 2466
2011-05-18 16:24:19 +00:00
Andy Polyakov
b5c6aab57e x86_64-xlate.pl: allow "base-less" effective address, add palignr, move
pclmulqdq.
2011-05-16 17:44:38 +00:00
Andy Polyakov
d6522548dd x86_64-xlate.pl: fix LNK4078 and LNK4210 link warnings.
PR 2356
2010-10-10 21:07:55 +00:00
Andy Polyakov
a9e790b95a perlasm/x86_64-xlate.pl: extend SSE>2 to ml64. 2010-07-26 21:45:38 +00:00
Andy Polyakov
f9a152bd90 x86_64-xlate.pl: refine mingw support and regexps, update commentary. 2010-06-01 05:56:24 +00:00
Andy Polyakov
046ea30864 x86_64-xlate.pl: refine some regexp's and add support for OWORD/QWORD PTR. 2010-05-13 15:26:46 +00:00
Andy Polyakov
fead253986 perlasm/x86*: add support to SSE>2 and pclmulqdq. x86_64-xlate.pl provides
correct solution to problem addressed in committ #19244.
2010-04-10 13:55:05 +00:00
Dr. Stephen Henson
c95bf51167 don't assume 0x is at start of string 2010-02-03 18:19:22 +00:00
Andy Polyakov
ee2b8ed2f5 x86_64-xlate.pl: refine sign extension logic when handling lea.
PR: 2094,2095
2010-01-19 16:15:23 +00:00