This routine is not provided with a save area. In addition to the linkage registers, this routine may freely alter registers 2 and 4.
If you provide your own EDCXGET routine, it will be used when C library functions explicitly get storage. Whenever the library functions invoke operating system services, there may be implicit requests for storage that cannot be tailored.
* this is an example of a routine to get storage
@@XGET TITLE 'Obtain memory as specified in R0'
EDCXGET CSECT
EDCXGET AMODE ANY
EDCXGET RMODE ANY
@@XGET DS 0H
ENTRY @@XGET
SPACE 1
BALR R2,R0
USING *,R2
LTR R0,R0 Memory above or below?
BNL BELOW
SLL R0,1 Want memory anywhere
SRL R0,1
LTR R2,R2 are we running above the line?
BNL BELOW no, so ignore above request
GETMAIN RC,SP=0,LV=(R0),LOC=ANY
LTR R15,R15 Was it successful?
BZR R14 Yes...
SR R1,R1 No, indicate failure
BR R14
BELOW DS 0H Get memory below the line
GETMAIN RC,SP=0,LV=(R0),LOC=BELOW
LTR R15,R15 Was it successful?
BZR R14 Yes...
SR R1,R1 no, indicate failure in R1
BR R14
*
R0 EQU 0
R1 EQU 1
R2 EQU 2
R4 EQU 4
R13 EQU 13
R14 EQU 14
R15 EQU 15