mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-12-30 06:53:09 +00:00
dbf6b14e0a
Ported from https://github.com/ARM-software/optimized-routines These files are included from this repository, including the latest git commit ID: string/aarch64/memcpy.S: afd6244a1f8d string/aarch64/memset.S: e823e3abf5f8 string/asmdefs.h: e823e3abf5f8 Note that memmove is also handled by the memcpy function. Please note that when adding these optimized functions as default memset memcpy functions in U-Boot, U-Boot fails to boot on the LX2160ARDB. After the initial ATF output, no U-Boot output is shown on the serial console. Some exception is triggered here in the very early boot process as some of the assembler opcodes need the caches to be enabled. Because of this, a follow-up patch will add a check to use a simple non-optimized memset for the "cache disabled" case. Note: I also integrated and tested with the Linux versions of these optimized functions. They are similar to the ones now integrated but these ARM versions are still a small bit faster. Signed-off-by: Stefan Roese <sr@denx.de>
98 lines
1.9 KiB
C
98 lines
1.9 KiB
C
/* SPDX-License-Identifier: MIT */
|
|
/*
|
|
* Macros for asm code.
|
|
*
|
|
* Copyright (c) 2019, Arm Limited.
|
|
*/
|
|
|
|
#ifndef _ASMDEFS_H
|
|
#define _ASMDEFS_H
|
|
|
|
#if defined(__aarch64__)
|
|
|
|
/* Branch Target Identitication support. */
|
|
#define BTI_C hint 34
|
|
#define BTI_J hint 36
|
|
/* Return address signing support (pac-ret). */
|
|
#define PACIASP hint 25; .cfi_window_save
|
|
#define AUTIASP hint 29; .cfi_window_save
|
|
|
|
/* GNU_PROPERTY_AARCH64_* macros from elf.h. */
|
|
#define FEATURE_1_AND 0xc0000000
|
|
#define FEATURE_1_BTI 1
|
|
#define FEATURE_1_PAC 2
|
|
|
|
/* Add a NT_GNU_PROPERTY_TYPE_0 note. */
|
|
#define GNU_PROPERTY(type, value) \
|
|
.section .note.gnu.property, "a"; \
|
|
.p2align 3; \
|
|
.word 4; \
|
|
.word 16; \
|
|
.word 5; \
|
|
.asciz "GNU"; \
|
|
.word type; \
|
|
.word 4; \
|
|
.word value; \
|
|
.word 0; \
|
|
.text
|
|
|
|
/* If set then the GNU Property Note section will be added to
|
|
mark objects to support BTI and PAC-RET. */
|
|
#ifndef WANT_GNU_PROPERTY
|
|
#define WANT_GNU_PROPERTY 1
|
|
#endif
|
|
|
|
#if WANT_GNU_PROPERTY
|
|
/* Add property note with supported features to all asm files. */
|
|
GNU_PROPERTY (FEATURE_1_AND, FEATURE_1_BTI|FEATURE_1_PAC)
|
|
#endif
|
|
|
|
#define ENTRY_ALIGN(name, alignment) \
|
|
.global name; \
|
|
.type name,%function; \
|
|
.align alignment; \
|
|
name: \
|
|
.cfi_startproc; \
|
|
BTI_C;
|
|
|
|
#else
|
|
|
|
#define END_FILE
|
|
|
|
#define ENTRY_ALIGN(name, alignment) \
|
|
.global name; \
|
|
.type name,%function; \
|
|
.align alignment; \
|
|
name: \
|
|
.cfi_startproc;
|
|
|
|
#endif
|
|
|
|
#define ENTRY(name) ENTRY_ALIGN(name, 6)
|
|
|
|
#define ENTRY_ALIAS(name) \
|
|
.global name; \
|
|
.type name,%function; \
|
|
name:
|
|
|
|
#define END(name) \
|
|
.cfi_endproc; \
|
|
.size name, .-name;
|
|
|
|
#define L(l) .L ## l
|
|
|
|
#ifdef __ILP32__
|
|
/* Sanitize padding bits of pointer arguments as per aapcs64 */
|
|
#define PTR_ARG(n) mov w##n, w##n
|
|
#else
|
|
#define PTR_ARG(n)
|
|
#endif
|
|
|
|
#ifdef __ILP32__
|
|
/* Sanitize padding bits of size arguments as per aapcs64 */
|
|
#define SIZE_ARG(n) mov w##n, w##n
|
|
#else
|
|
#define SIZE_ARG(n)
|
|
#endif
|
|
|
|
#endif
|