gtpg2m4a | General Macros |
This general macro is used with ISO-C support. It is required for writing C library functions in assembler language and must be the first executable code after the BEGIN macro.
The TMSPC macro is the first part of an interface between external assembly language library routines and ISO-C programs. The interface begins with a call (in the external function) to the TMSPC macro (normally at the beginning of the program) preserving the C environment. The TMSEC macro completes the interface. TMSPC generates code that stores all registers in the calling program's ISO-C stack frame. It may allocate a stack frame for the function.
TMSPC can be used to migrate C library functions from TARGET(TPF) to ISO-C.
Format
|
Entry Requirements
Return Conditions
If MIGRATION=YES is coded, R7 also points to the newly created stack frame.
Programming Considerations
See TMSEC-Epilog for ISO-C Functions Calling TPF Macro Services for more information about the TMSEC macro.
Examples
TMSPC FRAMESIZE=66
TMSPC FRAMESIZE=0,MIGRATION=YES
TMSPC FRAMESIZE=NO,LWS=R2
********************************************************* * TARGET(TPF) version of C library function. * ********************************************************* BEGIN NAME=CFUN (point a) ICPLOG HIGHREG=R2,FRAMESIZE=16 (point b) ***** Initial processing ***** ST R8,CSTKLBAS Save my R8 on the stack. * L R8,CE1SVP Load library caller's R8. ***** Call TFP macro ***** L R8,CSTKLBAS Restore my R8. ***** Final processing ***** L R6,returncode ICELOG (point c) FINIS END
********************************************************* * TPF ISO-C version of C library function. * ********************************************************* BEGIN NAME=CFUN,TPFISOC=YES (point a) TMSPC FRAMESIZE=16,MIGRATION=YES (point b) ***** Initial processing ***** ST R8,CSTKLBAS Save my R8 on the stack. * L R8,CE1SVP Load library caller's R8. ***** Call TFP macro ***** L R8,CSTKLBAS Restore my R8. * ***** Final processing ***** L R6,returncode TMSEC RC=R6 (point c) FINIS END
PRINT NOGEN BEGIN NAME=C001,VERSION=41,TPFISOC=YES * TMSPC FRAMESIZE=NO,LWS=R6 Pointer to LWS in R6. No frame. L R5,ILWSUEXP Address of User Expansion Area ST R8,ILWSLBAS Save the library base L R8,CE1SVP Get the Application base TIMEC , Get the timestamp into UEXP L R8,ILWSLBAS Restore library base TMSEC RC=R5 Return to C application * LTORG FINIS END
BEGIN NAME=CKEYRC,IBM=YES,VERSION=40,TPFISOC=YES *---------------------------------------------------------------------* * Entry point for 'keyrc()' function. This is the normal KEYRC and * * sets the protection key to the key of the ECB, which is a key of 1.* *---------------------------------------------------------------------* TMSPC FRAMESIZE=30,PPANAME=keyrc L R8,CE1SVP Get the Application base KEYRC TMSEC RC=NONE LTORG *---------------------------------------------------------------------* * Entry point for 'keyrc_okey()' function. This is the entry point * * for the special KEYRC OKEY=YES and sets the protection key to the * * one saved by the previous CINFC W call. * *---------------------------------------------------------------------* @@OKEYRC TMSPC FRAMESIZE=30,PPANAME=keyrc_okey L R8,CE1SVP Get the Application base KEYRC OKEY=YES TMSEC RC=NONE LTORG FINIS END