newlib-cygwin/newlib/libc/machine
Victor L. Do Nascimento 9d6b00511e newlib: libc: define M-profile PACBTI-enablement macros
Augment the arm_asm.h header file to simplify function prologues and
epilogues whilst adding support for PACBTI enablement via macros for
hand-written assembly functions.  For PACBTI, both prologues/epilogues
as well as cfi-related directives are automatically amended
accordingly, depending on the compile-time mbranch-protection argument
values.

It defines the following preprocessor macros:
   * HAVE_PAC_LEAF: Indicates whether pac-signing has been requested for
   leaf functions.
   * PAC_LEAF_PUSH_IP: Whether leaf functions should push the pac code
   to the stack irrespective of whether the ip register is clobbered in
   the function or not.
   * STACK_ALIGN_ENFORCE: Whether a dummy register should be added to
   the push list as necessary in the prologue to ensure stack
   alignment preservation at the start of assembly function.  The
   epilogue behavior is likewise affected by this flag, ensuring any
   pushed dummy registers also get popped on function return.

It also defines the following assembler macros:
   * prologue: In addition to pushing any callee-saved registers onto
   the stack, it generates any requested pacbti instructions.
   Pushed registers are specified via the optional `first', `last',
   `push_ip' and `push_lr' macro argument parameters.
   when a single register number is provided, it pushes that
   register.  When two register numbers are provided, they specify a
   rage to save.  If push_ip and/or push_lr are non-zero, the
   respective registers are also saved.  Stack alignment is requested
   via the `align` argument, which defaults to the value of
   STACK_ALIGN_ENFORCE, unless manually overridden.

   For example:

       prologue push_ip=1 -> push {ip}
       prologue push_ip=1, align8=1 -> push {r2, ip}
       prologue push_ip=1, push_lr=1 -> push {ip, lr}
       prologue 1 -> push {r1}
       prologue 1, align8=1 -> push {r0, r1}
       prologue 1 push_ip=1 -> push {r1, ip}
       prologue 1 4 -> push {r1-r4}
       prologue 1 4 push_ip=1 -> push {r1-r4, ip}

   * epilogue: pops registers off the stack and emits pac key signing
   instruction, if requested. The `first', `last', `push_ip',
   `push_lr' and `align' function as per the prologue macro,
   generating pop instead of push instructions.

   Stack alignment is enforced via the following helper macro
   call-chain:

	{prologue|epilogue} ->_align8 -> _preprocess_reglist ->
	  _preprocess_reglist1 -> {_prologue|_epilogue}

   Finally, the necessary cfi directives for adding debug information
   to prologue and epilogue are generated via the following macros:

   * cfisavelist - prologue macro helper function, generating
   necessary .cfi_offset directives associated with push instruction.
   Therefore, the net effect of calling `prologue 1 2 push_ip=1' is
   to generate the following:

       push {r1-r2, ip}
       .cfi_adjust_cfa_offset 12
       .cfi_offset 143, -4
       .cfi_offset 2, -8
       .cfi_offset 1, -12

   * cfirestorelist - epilogue macro helper function, emitting
   .cfi_restore instructions prior to resetting the cfa offset.  As
   such, calling `epilogue 1 2 push_ip=1' will produce:

        pop {r1-r2, ip}
	.cfi_register 143, 12
	.cfi_restore 2
	.cfi_restore 1
	.cfi_def_cfa_offset 0
2023-01-10 14:16:05 +00:00
..
aarch64 newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
amdgcn amdgcn: Use __builtin_gcn_ in libc/machine/amdgcn/getreent.c 2022-11-22 18:05:34 -05:00
arc newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
arm newlib: libc: define M-profile PACBTI-enablement macros 2023-01-10 14:16:05 +00:00
bfin newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
cr16 newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
cris Add _REENT_ERRNO(ptr) 2022-07-13 06:55:41 +02:00
crx newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
csky newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
d10v newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
d30v newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
epiphany newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
fr30 newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
frv newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
ft32 newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
h8300 newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
h8500 newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
hppa newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
i386 newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
i960 newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
iq2000 newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
lm32 newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
m32c newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
m32r newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
m68hc11 newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
m68k newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
m88k newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
mep newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
microblaze newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
mips Fix a bug in setjmp for MIPS o32/o64 FPXX/FP64 2022-12-19 10:38:05 +01:00
mn10200 newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
mn10300 newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
moxie newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
msp430 newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
mt newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
nds32 newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
necv70 newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
nios2 newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
nvptx nvptx: Implement '_exit' instead of 'exit' 2022-12-22 12:52:15 +01:00
or1k newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
powerpc powerpc/setjmp: Fix 64-bit buffer alignment 2022-11-10 16:05:17 +01:00
pru newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
riscv newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
rl78 newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
rx newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
sh newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
shared_x86/sys Cygwin: don't export _feinitialise from newlib 2021-04-13 12:55:34 +02:00
sparc newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
spu Add _REENT_IS_NULL() 2022-07-13 06:55:46 +02:00
tic4x newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
tic6x newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
tic80 newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
v850 newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
visium newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
w65 remove +x bit on source files 2022-12-21 22:38:57 -05:00
x86_64 newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
xc16x newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
xstormy16 newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
z8k newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
Makefile.inc newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00