Add the BTI C hint to libcontext arm64

This commit is contained in:
Mark Roszko 2023-11-01 15:53:11 +00:00
parent 909619c8cc
commit 2b3ad808ea
1 changed files with 16 additions and 0 deletions

View File

@ -537,6 +537,10 @@ __asm (
".balign 16\n" ".balign 16\n"
".global _jump_fcontext\n" ".global _jump_fcontext\n"
"_jump_fcontext:\n" "_jump_fcontext:\n"
#if defined(__ARM_FEATURE_BTI_DEFAULT) && (__ARM_FEATURE_BTI_DEFAULT == 1)
" # bti c\n"
" hint #34\n"
#endif
" # prepare stack for GP + FPU\n" " # prepare stack for GP + FPU\n"
" sub sp, sp, #0xb0\n" " sub sp, sp, #0xb0\n"
" # test if fpu env should be preserved\n" " # test if fpu env should be preserved\n"
@ -598,6 +602,10 @@ __asm (
".align 2\n" ".align 2\n"
".global _make_fcontext\n" ".global _make_fcontext\n"
"_make_fcontext:\n" "_make_fcontext:\n"
#if defined(__ARM_FEATURE_BTI_DEFAULT) && (__ARM_FEATURE_BTI_DEFAULT == 1)
" # bti c\n"
" hint #34\n"
#endif
" # shift address in x0 (allocated stack) to lower 16 byte boundary\n" " # shift address in x0 (allocated stack) to lower 16 byte boundary\n"
" and x0, x0, ~0xF\n" " and x0, x0, ~0xF\n"
" # reserve space for context-data on context-stack\n" " # reserve space for context-data on context-stack\n"
@ -700,6 +708,10 @@ __asm (
".global jump_fcontext\n" ".global jump_fcontext\n"
".type jump_fcontext, %function\n" ".type jump_fcontext, %function\n"
"jump_fcontext:\n" "jump_fcontext:\n"
#if defined(__ARM_FEATURE_BTI_DEFAULT) && (__ARM_FEATURE_BTI_DEFAULT == 1)
" # bti c\n"
" hint #34\n"
#endif
" # prepare stack for GP + FPU\n" " # prepare stack for GP + FPU\n"
" sub sp, sp, #0xb0\n" " sub sp, sp, #0xb0\n"
"# Because gcc may save integer registers in fp registers across a\n" "# Because gcc may save integer registers in fp registers across a\n"
@ -769,6 +781,10 @@ __asm (
".global make_fcontext\n" ".global make_fcontext\n"
".type make_fcontext, %function\n" ".type make_fcontext, %function\n"
"make_fcontext:\n" "make_fcontext:\n"
#if defined(__ARM_FEATURE_BTI_DEFAULT) && (__ARM_FEATURE_BTI_DEFAULT == 1)
" # bti c\n"
" hint #34\n"
#endif
" # shift address in x0 (allocated stack) to lower 16 byte boundary\n" " # shift address in x0 (allocated stack) to lower 16 byte boundary\n"
" and x0, x0, ~0xF\n" " and x0, x0, ~0xF\n"
" # reserve space for context-data on context-stack\n" " # reserve space for context-data on context-stack\n"