gtps1m34 | System Macros |
Use this system macro with TARGET(TPF) C language support to allocate a TARGET(TPF) stack frame for the function from the current TARGET(TPF) stack block. If there is no current TARGET(TPF) stack block or if the requested stack frame does not fit in the current block, the TARGET(TPF) stack exception routine in the control program (CP) is activated.
This macro is required for writing TARGET(TPF) C library functions in assembler language and for assembler external functions that need to manage TARGET(TPF) stack storage. It must be the first instruction coded after the BEGIN macro. See TPF General Macros for more information about the BEGIN macro.
The ICPLOG macro generates code that stores specified registers in the:
The ICPLOG macro allocates a TARGET(TPF) stack frame for the function from the current TARGET(TPF) stack block. If there is no current TARGET(TPF) stack block or if the requested stack frame does not fit in the current block, the TARGET(TPF) stack exception routine in the control program (CP) is activated.
Format
|
Entry Requirements
R9 must contain the address of the current ECB.
Return Conditions
Programming Considerations
Examples
This example creates a prolog that saves registers R14 through R5 and does not change the size of the function stack frame. R5 is required by the TIMEC macro. The registers are set up with R5 pointing at the stack frame and R8 operating as the application base register. The C library base previously in R8 is saved. After the TPF macro returns, the C library base is restored and the address of the timestamp provided by TIMEC is placed in the return register (R6) for TARGET(TPF) C. The ICELOG macro stores the C environment and returns to the calling C program.
ICPLOG HIGHREG=R5,FRAMESIZE=NO R5 needed for TIMEC interface L R5,CE1TCA points to first stack frame SL R5,=A(CSTKTCA-ICS0TK) compute base of first frame L R5,CSTKUEXP-ICS0TK(,R5) get address of user exp. area ST R8,CSTKLBAS save library base L R8,CE1SVP get application base TIMEC , get the timestamp L R8,CSTKLBAS restore library base LR R6,R5 return the address in R6 ICELOG , return to C application
The following example creates a prolog that saves registers R14 through R3 and reserves 66 bytes of storage in the stack frame for the function:
ICPLOG HIGHREG=R3,FRAMESIZE=66
The following example creates a prolog that saves registers R14 through R2, and allocates a minimal stack frame:
ICPLOG HIGHREG=R2,FRAMESIZE=0
The following example creates a prolog that saves registers R14 through R5 (because R5 is the default), and reserves 212 bytes of storage in the stack frame:
ICPLOG FRAMESIZE=212
The following example creates a prolog that saves registers R14 through R5, and does not allocate a stack frame:
ICPLOG FRAMESIZE=0
The following example has the same effect as the previous one -- it creates a prolog that saves registers R14 through R5, and does not allocate a stack frame (because FRAMESIZE=0 is the default):
ICPLOG
The following example is a TARGET(TPF library function that calls a TPF macro to put a time stamp in the stack frame. The function returns a pointer to the time stamp as its value.
PRINT NOGEN BEGIN NAME=C001,VERSION=31 * ICPLOG HIGHREG=R5,FRAMESIZE=NO R5 needed for TIMEC interface L R5,CE1TCA points to first stack frame SL R5,=A(CSTKTCA-ICS0TK) compute base of first frame L R5,CSTKUEXP-ICS0TK(,R5) get address of user exp. area ST R8,CSTKLBAS save library base L R8,CE1SVP get application base TIMEC , get the timestamp L R8,CSTKLBAS restore library base LR R6,R5 return the address in R6 ICELOG , return to C application * LTORG FINIS END