assembler.h (1207B)
1/* SPDX-License-Identifier: GPL-2.0 */ 2/* 3 * Copyright (C) 2019 Arm Limited 4 * Original author: Dave Martin <Dave.Martin@arm.com> 5 */ 6 7#ifndef ASSEMBLER_H 8#define ASSEMBLER_H 9 10#define NT_GNU_PROPERTY_TYPE_0 5 11#define GNU_PROPERTY_AARCH64_FEATURE_1_AND 0xc0000000 12 13/* Bits for GNU_PROPERTY_AARCH64_FEATURE_1_BTI */ 14#define GNU_PROPERTY_AARCH64_FEATURE_1_BTI (1U << 0) 15#define GNU_PROPERTY_AARCH64_FEATURE_1_PAC (1U << 1) 16 17 18.macro startfn name:req 19 .globl \name 20\name: 21 .macro endfn 22 .size \name, . - \name 23 .type \name, @function 24 .purgem endfn 25 .endm 26.endm 27 28.macro emit_aarch64_feature_1_and 29 .pushsection .note.gnu.property, "a" 30 .align 3 31 .long 2f - 1f 32 .long 6f - 3f 33 .long NT_GNU_PROPERTY_TYPE_0 341: .string "GNU" 352: 36 .align 3 373: .long GNU_PROPERTY_AARCH64_FEATURE_1_AND 38 .long 5f - 4f 394: 40#if BTI 41 .long GNU_PROPERTY_AARCH64_FEATURE_1_PAC | \ 42 GNU_PROPERTY_AARCH64_FEATURE_1_BTI 43#else 44 .long 0 45#endif 465: 47 .align 3 486: 49 .popsection 50.endm 51 52.macro paciasp 53 hint 0x19 54.endm 55 56.macro autiasp 57 hint 0x1d 58.endm 59 60.macro __bti_ 61 hint 0x20 62.endm 63 64.macro __bti_c 65 hint 0x22 66.endm 67 68.macro __bti_j 69 hint 0x24 70.endm 71 72.macro __bti_jc 73 hint 0x26 74.endm 75 76.macro bti what= 77 __bti_\what 78.endm 79 80#endif /* ! ASSEMBLER_H */