Check for x18 usage in aarch64 assembly.
r18 (accessed as x18 and w18) is the platform register. The ABI testing framework cannot touch it, but we can statically check that our assembly leaves it alone. Also fix a comment which cited the wrong register. Change-Id: Iba2714eef5db19e2e93a6838d12a4e7c9011cc67 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/35764 Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
committed by
Adam Langley
parent
c1d8c5b0e0
commit
586235df2e
@@ -168,6 +168,15 @@ while(my $line=<>) {
|
||||
$line =~ s|^\s+||; # ... and skip white spaces in beginning...
|
||||
$line =~ s|\s+$||; # ... and at the end
|
||||
|
||||
if ($flavour =~ /64/) {
|
||||
my $copy = $line;
|
||||
# Also remove line comments.
|
||||
$copy =~ s|//.*||;
|
||||
if ($copy =~ /\b[wx]18\b/) {
|
||||
die "r18 is reserved by the platform and may not be used.";
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
$line =~ s|[\b\.]L(\w{2,})|L$1|g; # common denominator for Locallabel
|
||||
$line =~ s|\bL(\w{2,})|\.L$1|g if ($dotinlocallabels);
|
||||
|
||||
@@ -149,11 +149,11 @@ struct alignas(16) Reg128 {
|
||||
// AAPCS64: http://infocenter.arm.com/help/topic/com.arm.doc.ihi0055b/IHI0055B_aapcs64.pdf
|
||||
// iOS64: https://developer.apple.com/library/archive/documentation/Xcode/Conceptual/iPhoneOSABIReference/Articles/ARM64FunctionCallingConventions.html
|
||||
//
|
||||
// In aarch64, r19 (x19 in a 64-bit context) is the platform register. iOS says
|
||||
// user code may not touch it. We found no clear reference for Linux. The iOS
|
||||
// behavior implies portable assembly cannot use it, and aarch64 has many
|
||||
// registers. Thus this framework ignores register's existence. We can test r19
|
||||
// violations with grep.
|
||||
// In aarch64, r18 (accessed as w18 or x18 in a 64-bit context) is the platform
|
||||
// register. iOS says user code may not touch it. We found no clear reference
|
||||
// for Linux. The iOS behavior implies portable assembly cannot use it, and
|
||||
// aarch64 has many registers. Thus this framework ignores register's existence.
|
||||
// We test r18 violations in arm-xlate.pl.
|
||||
#define LOOP_CALLER_STATE_REGISTERS() \
|
||||
/* Per AAPCS64, section 5.1.2, only the bottom 64 bits of v8-v15 */ \
|
||||
/* are preserved. These are accessed as dN. */ \
|
||||
|
||||
Reference in New Issue
Block a user