diff --git a/crypto/test/abi_test.h b/crypto/test/abi_test.h index 0d685ed9..44547f81 100644 --- a/crypto/test/abi_test.h +++ b/crypto/test/abi_test.h @@ -109,14 +109,12 @@ struct alignas(16) Reg128 { // References: // AAPCS: http://infocenter.arm.com/help/topic/com.arm.doc.ihi0042f/IHI0042F_aapcs.pdf // iOS32: https://developer.apple.com/library/archive/documentation/Xcode/Conceptual/iPhoneOSABIReference/Articles/ARMv6FunctionCallingConventions.html +// Linux: http://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach142/arm_gnu_linux_%20abi.pdf // -// ARM specifies a common calling convention, except r9 is left to the -// platform. Linux and iOS differ in handling of r9. iOS's behavior is defined -// below. We found no clear reference for Linux but observed behavior from -// LLVM. iOS 3+ treats r9 as caller-saved, while Linux treats it as -// callee-saved. Most of our assembly treats it as callee-saved to be uniform, -// but we match the platform to avoid false positives when testing -// compiler-generated output. +// ARM specifies a common calling convention, except r9 is left to the platform. +// Linux treats r9 as callee-saved, while iOS 3+ treats it as caller-saved. Most +// of our assembly treats it as callee-saved to be uniform, but we match the +// platform to avoid false positives when testing compiler-generated output. #define LOOP_CALLER_STATE_REGISTERS_PRE_R9() \ CALLER_STATE_REGISTER(uint64_t, d8) \ CALLER_STATE_REGISTER(uint64_t, d9) \ diff --git a/crypto/test/asm/trampoline-armv4.pl b/crypto/test/asm/trampoline-armv4.pl index bfa67e42..30f510e7 100755 --- a/crypto/test/asm/trampoline-armv4.pl +++ b/crypto/test/asm/trampoline-armv4.pl @@ -27,6 +27,7 @@ # AAPCS: http://infocenter.arm.com/help/topic/com.arm.doc.ihi0042f/IHI0042F_aapcs.pdf # iOS ARMv6: https://developer.apple.com/library/archive/documentation/Xcode/Conceptual/iPhoneOSABIReference/Articles/ARMv6FunctionCallingConventions.html # iOS ARMv7: https://developer.apple.com/library/archive/documentation/Xcode/Conceptual/iPhoneOSABIReference/Articles/ARMv7FunctionCallingConventions.html +# Linux: http://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach142/arm_gnu_linux_%20abi.pdf use strict; @@ -70,10 +71,10 @@ abi_test_trampoline: stmdb sp!, {r0-r11,lr} @ Reserve stack space for six (10-4) stack parameters, plus an extra 4 - @ bytes to keep it 8-byte-aligned (see APCS, section 5.3). + @ bytes to keep it 8-byte-aligned (see AAPCS, section 5.3). sub sp, sp, #28 - @ Every register in APCS is either non-volatile or a parameter (except + @ Every register in AAPCS is either non-volatile or a parameter (except @ r9 on iOS), so this code, by the actual call, loses all its scratch @ registers. First fill in stack parameters while there are registers @ to spare.