| 1 |
/* SPDX-License-Identifier: LGPL-2.1 |
| 2 |
* |
| 3 |
* 86_64_defs.h: Support macros for the x86-64 architectural feature |
| 4 |
* |
| 5 |
* include at the top of asm files to define GPU property section |
| 6 |
*/ |
| 7 |
|
| 8 |
#ifndef SRC_LIBMPG123_X86_64_DEFS_H_ |
| 9 |
#define SRC_LIBMPG123_X86_64_DEFS_H_ |
| 10 |
|
| 11 |
/* Could adapt for x86 trivially, but do we bother? */ |
| 12 |
#ifdef __x86_64__ |
| 13 |
|
| 14 |
#if defined(__CET__) && ((__CET__ & 1) != 0) |
| 15 |
#define GNU_PROPERTY_X86_64_IBT 1 /* bit 0 GNU Notes is for IBT support */ |
| 16 |
#else |
| 17 |
#define GNU_PROPERTY_X86_64_IBT 0 |
| 18 |
#endif |
| 19 |
|
| 20 |
#if defined(__CET__) && ((__CET__ & 2) != 0) |
| 21 |
#define GNU_PROPERTY_X86_64_SHSTK 2 /* bit 1 GNU Notes is for PAC support */ |
| 22 |
#else |
| 23 |
#define GNU_PROPERTY_X86_64_SHSTK 0 |
| 24 |
#endif |
| 25 |
|
| 26 |
/* Add the BTI support to GNU Notes section */ |
| 27 |
#if defined(__ASSEMBLER__) && defined(__ELF__) |
| 28 |
#if GNU_PROPERTY_X86_64_IBT != 0 || GNU_PROPERTY_X86_64_SHSTK != 0 |
| 29 |
.pushsection .note.gnu.property, "a"; /* Start a new allocatable section */ |
| 30 |
.balign 8; /* align it on a byte boundry */ |
| 31 |
.long 4; /* size of "GNU\0" */ |
| 32 |
.long 0x10; /* size of descriptor */ |
| 33 |
.long 0x5; /* NT_GNU_PROPERTY_TYPE_0 */ |
| 34 |
.asciz "GNU"; |
| 35 |
.long 0xc0000002; /* GNU_PROPERTY_X86_FEATURE_1_AND */ |
| 36 |
.long 4; /* Four bytes of data */ |
| 37 |
.long (GNU_PROPERTY_X86_64_IBT|GNU_PROPERTY_X86_64_SHSTK); /* IBT or SHSTK is enabled */ |
| 38 |
.long 0; /* padding for 8 byte alignment */ |
| 39 |
.popsection; /* end the section */ |
| 40 |
#endif /* GNU Notes additions */ |
| 41 |
#endif /* if __ASSEMBLER__ and __ELF__ */ |
| 42 |
|
| 43 |
#endif /* __x86_64__ */ |
| 44 |
|
| 45 |
#endif /* SRC_LIBMPG123_X86_64_DEFS_H_ */ |