Guardian Procedure Calls Reference Manual

Returned Value
INT
Outcome of the operation:
Operation was successful; stackaddr contains base address of the stack, and stacksize contains the
rounded stack size.
0
Cannot allocate Kernel-Managed Swap space.1
An invalid option value was specified2
A bounds violation on parameter.3
Requested stacksize or guardsize is too large to handle; overall stack size limit is USERSTACK_MAX
(16MB, defined in kmem.h).
5
Address space is unavailable.15
If an error other than 0 is returned, the output parameter values are not set.
Examples
1. Allocate one guard page, one memory-stack page, and one register-stack page:
stacksize=0;
error=STACK_ALLOCATE_(&stacksize, 0, &stackaddr, ST_NONE);
Output stacksize is 48 KB (3 pages).
2. Allocate one guard page, four memory-stack pages, and three register stack pages:
stacksize=0x20000; /* 128 KB */;
error=STACK_ALLOCATE_(&stacksize, 0, &stackaddr, ST_NONE);
Output stacksize is 128 K (8 pages).
3. Allocate one guard page (minimum), four pages reserved for growth, three memory-stack
pages, and two register-stack pages initially:
stacksize=160000;
error=STACK_ALLOCATE_(&stacksize, 0, &stackaddr,
ST_GROWTH*50);
Output stacksize is 160 K (10 pages).
4. Allocate two guard pages, two memory-stack pages, and one register-stack page initially:
stacksize=75000;
error=STACK_ALLOCATE_(&stacksize, 20000, &stackaddr,
ST_NONE);
Output stacksize is 80 K (5 pages).
5. Allocate one guard page, five memory-stack pages, and ten register-stack pages:
stacksize=250000;
error=STACK_ALLOCATE_(&stacksize, 16384, &stackaddr,
ST_RSE*70);
Output stacksize is 256 K (16 pages).
6. Allocate two guard pages (minimum), five pages reserved for growth, seven memory-stack
pages, and two register-stack pages initially:
stacksize=250000;
error=STACK_ALLOCATE_(&stacksize, 32000, &stackaddr,
ST_GROWTH*40][ST_RSE*30);
Output stacksize is 256 K (16 pages).
1392 Guardian Procedure Calls (S)