Merge pull request #7847 from daverodgman/aarch64-asm-docs

Aarch64 asm docs improvement
This commit is contained in:
Dave Rodgman 2023-06-27 17:58:12 +01:00 committed by GitHub
commit c66033f0d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -170,13 +170,20 @@ inline void mbedtls_xor(unsigned char *r, const unsigned char *a, const unsigned
/* *INDENT-ON* */ /* *INDENT-ON* */
/* /*
* Define the constraint used for pointer operands to asm. * Define the constraint used for read-only pointer operands to aarch64 asm.
* *
* This is normally the usual "r", but for aarch64_32 (aka ILP32, * This is normally the usual "r", but for aarch64_32 (aka ILP32,
* as found in watchos), "p" is required to avoid warnings from clang. * as found in watchos), "p" is required to avoid warnings from clang.
* *
* Note that clang does not recognise '+p' or '=p', and armclang * Note that clang does not recognise '+p' or '=p', and armclang
* does not recognise 'p' at all. * does not recognise 'p' at all. Therefore, to update a pointer from
* aarch64 assembly, it is necessary to use something like:
*
* uintptr_t uptr = (uintptr_t) ptr;
* asm( "ldr x4, [%x0], #8" ... : "+r" (uptr) : : )
* ptr = (void*) uptr;
*
* Note that the "x" in "%x0" is neccessary; writing "%0" will cause warnings.
*/ */
#if defined(__aarch64__) && defined(MBEDTLS_HAVE_ASM) #if defined(__aarch64__) && defined(MBEDTLS_HAVE_ASM)
#if UINTPTR_MAX == 0xfffffffful #if UINTPTR_MAX == 0xfffffffful