Guardian Procedure Calls Reference Manual

STACK_ALLOCATE_ Procedure
Summary
Syntax for C Programmers
Syntax for TAL Programmers
Parameters
Returned Value
Examples
Summary
The STACK_ALLOCATE_ procedure allocates a user stack segment for use as a thread or alternate
signal stack.
A user stack consists of three components in the following consecutive areas:
a memory stack, growing downward from the highest-address end
a guard area (one or more unmapped pages) that provides protection against overflow of
the stack pointer
a register stack (supporting the Register Stack Engine (RSE) of the Itanium processor), growing
upward from the base (lowest address) of the segment
The size of each component, and therefore the overall segment, is a multiple of the memory page
size of 16 KB. The caller can specify the minimum overall size of the stack segment, the minimum
size of the guard area, allowance for growth, and the relative size of the RSE and memory areas.
If growth is enabled and the unmapped area exceeds the minimum size of the guard area, both
the memory stack and the register stack areas can grow by mapping additional pages to them.
Upon occurrence of a page fault for attempting to go beyond the currently mapped memory-stack
area, that area is extended downward by consuming an available guard page. Upon occurrence
of a page fault for attempting to go beyond the currently mapped RSE area, that area is extended
upward by consuming an available guard page.
All pages within the stack described by stackaddr and stacksize have read and write
permissions for the user.
The STACK_ALLOCATE_ procedure is a callable routine and is declared in kmem.h and KMEM.
NOTE: The STACK_ALLOCATE_ procedure is supported on systems running H06.21 and later
H-series RVUs and J06.10 and later J-series RVUs. This procedure is not supported on G-series
RVUs.
Syntax for C Programmers
#include <kmem.h>
short STACK_ALLOCATE_ ( unsigned int *stacksize
,unsigned int guardsize
,void **stackaddr
,unsigned int stackoptions );
Syntax for TAL Programmers
?SOURCE KMEM
error := STACK_ALLOCATE_ ( stacksize ! i,o
,guardsize ! i
,stackaddr ! o
,stackoptions ); ! i
1390 Guardian Procedure Calls (S)