Guardian Procedure Calls Reference Manual

REFPARAM_BOUNDSCHECK[64]_ Procedures
Summary
Syntax for C Programmers
Syntax for TAL Programmers
Parameters
Returned Value
Considerations
Example
Summary
The REFPARAM_BOUNDSCHECK[64]_ procedures check the validity of parameter addresses
passed to the procedure that calls it. Bounds checking performed by the system is enough for most
applications. This procedure, however, provides additional checks for those few applications that
might need it.
Primarily, REFPARAM_BOUNDSCHECK[64]_ verifies that a specified memory area is valid for a
specified type of access (read only or read/write). Optionally, it also verifies that the specified
memory area does not overlap the part of the process stack occupied by the calling procedure
and any of the procedures it calls.
The REFPARAM_BOUNDSCHECK64_ procedure is a 64-bit version of the
REFPARAM_BOUNDSCHECK _ procedure.
NOTE: The REFPARAM_BOUNDSCHECK64_ procedure is supported on systems running H06.24
and later H-series RVUs and J06.13 and later J-series RVUs. Its use is recommended for new code.
Syntax for C Programmers
#include <cextdecs(REFPARAM_BOUNDSCHECK_)>
short REFPARAM_BOUNDSCHECK_ ( void _far *start-address
,__int32_t area-len
,void _far *framestart
,short flags );
#include <kmem.h>
int16 REFPARAM_BOUNDSCHECK64_ ( void _ptr64 *start-address
,int64 area-len
,void _ptr64 *framestart
,int16 flags );
CEXTDECS (through the included file TNSINTH) defines 32-bit values as the typedef
__int32_t, which for TNS and TNS/R compiles is defined as long and for TNS/E compiles
is defined as int.
To exclude the stack area from the area that REFPARAM_BOUNDSCHECK_ accepts as valid
in a C or C++ program, you pass the _frame_edge(first,last) function as the
frame-start parameter to REFPARAM_BOUNDSCHECK_. The first and last parameters
are the names of the first and last parameters to the calling function. For example:
#include <cextdecs(REFPARAM_BOUNDSCHECK_)>
short tstbnd (short *alpha, long long omega)
{
if ( REFPARAM_BOUNDSCHECK_( alpha,2,
_frame_edge(alpha,omega),0))
1230 Guardian Procedure Calls (R)