Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/contrib/arm-optimized-routines/string/aarch64/asmdefs.h
39491 views
1
/*
2
* Macros for asm code. AArch64 version.
3
*
4
* Copyright (c) 2019-2023, Arm Limited.
5
* SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception
6
*/
7
8
#ifndef _ASMDEFS_H
9
#define _ASMDEFS_H
10
11
/* Branch Target Identitication support. */
12
#define BTI_C hint 34
13
#define BTI_J hint 36
14
/* Return address signing support (pac-ret). */
15
#define PACIASP hint 25; .cfi_window_save
16
#define AUTIASP hint 29; .cfi_window_save
17
18
/* GNU_PROPERTY_AARCH64_* macros from elf.h. */
19
#define FEATURE_1_AND 0xc0000000
20
#define FEATURE_1_BTI 1
21
#define FEATURE_1_PAC 2
22
23
/* Add a NT_GNU_PROPERTY_TYPE_0 note. */
24
#define GNU_PROPERTY(type, value) \
25
.section .note.gnu.property, "a"; \
26
.p2align 3; \
27
.word 4; \
28
.word 16; \
29
.word 5; \
30
.asciz "GNU"; \
31
.word type; \
32
.word 4; \
33
.word value; \
34
.word 0; \
35
.text
36
37
/* If set then the GNU Property Note section will be added to
38
mark objects to support BTI and PAC-RET. */
39
#ifndef WANT_GNU_PROPERTY
40
#define WANT_GNU_PROPERTY 1
41
#endif
42
43
#if WANT_GNU_PROPERTY
44
/* Add property note with supported features to all asm files. */
45
GNU_PROPERTY (FEATURE_1_AND, FEATURE_1_BTI|FEATURE_1_PAC)
46
#endif
47
48
#define ENTRY_ALIGN(name, alignment) \
49
.global name; \
50
.type name,%function; \
51
.align alignment; \
52
name: \
53
.cfi_startproc; \
54
BTI_C;
55
56
#define ENTRY(name) ENTRY_ALIGN(name, 6)
57
58
#define ENTRY_ALIAS(name) \
59
.global name; \
60
.type name,%function; \
61
name:
62
63
#define END(name) \
64
.cfi_endproc; \
65
.size name, .-name;
66
67
#define L(l) .L ## l
68
69
#endif
70
71