Go to main content

man pages section 3: Basic Library Functions

Exit Print View

Updated: Wednesday, July 27, 2022



adistack_clear_stack - clear ADI versions from many SPARC stack frames


#include <adi.h>

int adistack_clear_stack(uintptr_t endfp, boolean_t use_endfp_savefp);


The adistack_clear_stack() function walks the stack and clears ADI versions set on the register save area of each stack frame, up to the specified end point, if the ADISTACK security extension is active. It flushes the register windows to the stack prior to walking it; the caller need not do so. If the ADISTACK extension is not active, or the platform does not support the extension (such as an x86 platform), it does nothing very quickly and returns success.

endfp is a SPARC V9 biased stack frame pointer that indicates the stopping point for the walk. If endfp is 0 then the entire stack is walked.

If use_endfp_savefp is set to B_FALSE then the stack walk will clear versions on all frames up to but not including endfp.

If use_endfp_savefp is set to B_TRUE then the stack walk will clear versions on all frames up to but not including the frame pointed to by the saved %fp fetched from the register save area of endfp. This supports the special case where siglongjmp() restores execution in a frame that won't be found by a stack walk because the original call to siglongjmp() was followed by a call to alloca() in the same function. Since alloca() adjusts %sp to make room for the allocated memory, a subsequent stack walk will not see the original %sp.

For more information on ADI and ADISTACK see adi(3C) and sxadm(8).

Return Values

The adistack_clear_stack() function returns 0 on success. On error, it returns -1.


No errors are defined.


See attributes(7) for descriptions of the following attributes:

Interface Stability

See Also

adi(3C), adistack_clear_frame(3C), sparc_stack_read(3C), sxadm(8), attributes(7), standards(7)