z/OS UNIX System Services File System Interface Reference
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Assembler replacements for @@XGET and @@XFREE

z/OS UNIX System Services File System Interface Reference
SA23-2285-00

 TITLE 'BPXFASM: File System Assembler Utilities'
*/****START OF SPECIFICATIONS******************************************
*
*    $MOD(BPXFASM) COMP(SCPX1) PROD(BPX):
*
*01* MODULE-NAME: BPXFASM
*
*01* CSECT NAME: @@XGET and @@XFREE
*
*01* DESCRIPTIVE-NAME: HOTC Replaceable Get/Free Storage for C PFSs
*
****END OF SPECIFICATIONS*********************************************/
*
BPXFASM  CSECT
BPXFASM  AMODE ANY
BPXFASM  RMODE ANY
BPXFASM  MODID BR=NO
*
***********************************************************************
*   CSECT-NAME:  @@XGET
*
*   DESCRIPTIVE-NAME:  Allocate storage for C/370
*
*   Input: R0 - length of storage to obtain  (high bit on for storage
*               above the line).
*          R14 - Return address
*
*   Output: R0 - length of storage obtained
*           R1 - address of memory obtained
*
*   No save area is provided.
*   R2 and R4 are used as work regs.
*   Regs and Access Regs 0, 1, 14, 15 may be modified.
*
***********************************************************************
@@XGET   CSECT
@@XGET   AMODE ANY
@@XGET   RMODE ANY
         ENTRY @@XGET
*
         LR    R2,R0             Save Input Length
         LR    R4,R14            Save Return Addr
         EPAR  R15               Extract Primary ASID
         LOCASCB ASID=(R15)      Locate the Primary ASCB, Ret in R1
         USING ASCB,R1
         L     R15,ASCBXTCB      Save Xmem Resource Owning TCB
         DROP  R1
         LR    R0,R2             Restore Input Length to R0
         BALR  R2,R0             Establish Addressability
         USING *,R2
*
         LTR   R0,R0             request for below?
         BNL   BELOW             yes
         SLL   R0,1              allocate anywhere
         SRL   R0,1              clear high bit
         LTR   R2,R2             are we running below the line
         BNL   BELOW             yes, get below instead of anywhere
         STORAGE OBTAIN,LENGTH=(R0),COND=YES,SP=3,TCBADDR=(R15)
         LTR   R15,R15           successful?
         BZR   R4                yes, return
         SR    R1,R1             R1=0, R15<>0 for failure
         BR    R4                Return
BELOW    DS    0H                Get memory below the line
         STORAGE OBTAIN,LENGTH=(R0),COND=YES,LOC=BELOW,                +
               SP=3,TCBADDR=(R15)
         LTR   R15,R15           Was it successful?
         BZR   R4                yes, return
         SR    R1,R1             R1=0, R15<>0 for failure
         BR    R4                Return
*
*
***********************************************************************
*   CSECT-NAME:  @@XFREE
*
*   DESCRIPTIVE-NAME:  Free allocated storage for C/370
*
*   Input: R0 - length of storage to free
*          R1 - address of storage to free
*          R14 - Return address
*
*   No save area is provided.
*   R2 and R4 are used as work regs.
*   Regs and Access Regs 0, 1, 14, 15 may be modified.
*
***********************************************************************
@@XFREE  CSECT
@@XFREE  AMODE ANY
@@XFREE  RMODE ANY
         ENTRY @@XFREE
*
         LR    R2,R1             Save Input Addr
         ST    R0,0(R2)          Save Input Length in the passed area
         LR    R4,R14            Save Return Addr
         EPAR  R15               Extract Primary ASID
         LOCASCB ASID=(R15)      Locate the Primary ASCB, Ret in R1
         USING ASCB,R1
         L     R15,ASCBXTCB      Save Xmem Resource Owning TCB
         DROP  R1
         L     R0,0(R2)          Restore Input Length to R0
         LR    R1,R2             Restore Input Addr   to R1
         BALR  R2,R0             Establish Addressability
         USING *,R2
*
         STORAGE RELEASE,LENGTH=(R0),ADDR=(R1),SP=3,TCBADDR=(R15)
         BR    R4
*
R0       EQU   0
R1       EQU   1
R2       EQU   2
R4       EQU   4
R14      EQU   14
R15      EQU   15
*
         PRINT OFF
         IHAASCB
         PRINT ON
*
         END

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014