2 Copyright 1988-2022 Free Software Foundation, Inc.
3 This is part of the GCC manual.
4 For copying conditions, see the copyright.rst file.
6 .. _x86-control-flow-protection-intrinsics:
8 x86 Control-Flow Protection Intrinsics
9 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
11 .. function:: ret_type _get_ssp (void)
13 Get the current value of shadow stack pointer if shadow stack support
14 from Intel CET is enabled in the hardware or ``0`` otherwise.
15 The ``ret_type`` is ``unsigned long long`` for 64-bit targets
16 and ``unsigned int`` for 32-bit targets.
18 .. function:: void _inc_ssp (unsigned int)
20 Increment the current shadow stack pointer by the size specified by the
21 function argument. The argument is masked to a byte value for security
22 reasons, so to increment by more than 255 bytes you must call the function
25 The shadow stack unwind code looks like:
29 #include <immintrin.h>
31 /* Unwind the shadow stack for EH. */
32 #define _Unwind_Frames_Extra(x) \
35 _Unwind_Word ssp = _get_ssp (); \
38 _Unwind_Word tmp = (x); \
49 This code runs unconditionally on all 64-bit processors. For 32-bit
50 processors the code runs on those that support multi-byte NOP instructions.