SYKLB@NASAGISS.BITNET (Ken Bell) (02/09/90)
Please forgive the cross posting (ASM370 and IBM-MAIN), but there's been only silence so far from ASM370... ----------------------------Original message---------------------------- I'm new to 370, so go easy please :-) I've been selected to carry forward some local mods to VM, since we are trying to "go uplevel" from SL 509 (VM/SP). Now I found the following block of code in a mod that is currently working, and has been for about three years, thus I'm confident (well..) that the code is correct and that it's just my knowledge of 370 that is lacking. So much for disclaimers, eh? The question is this: I thought that once a base register was declared, its contents could not be changed (at least so long as any address references still depended on that base register). Am I wrong? Can the base actually "move" so long as it's contents still lie within 4095 bytes of the addresses it is being used to reference? Here's a fragment of the code I'm asking about (it's part of a "user" diagnose added to correct an accounting problem for an MVS guest running under VM): MVSPROBT EQU * USING MVSTIME,R2 <= Set base reg R2 LA R2,MVSPTT-MVSSIZE*8 <= Change base reg R2 (?) MVSPTL1 LA R2,MVSSIZE*8(R2) <= MVSSIZE needs base reg R2 (?) CLI 0(R2),X'FF' BE MVSPTL3 CLC MVSUSER,VMUSER <= MVSUSER needs base reg R2 (?) ... ... MVSUSER DS 1D MVSVTIME DS 1D MVSACUM DS 1D MVSSIZE EQU (*-MVSTIME+7)/8
SYSBJAV@VM.TCS.TULANE.EDU (John Voigt - Academic Systems Programmer) (02/10/90)
On Fri, 9 Feb 90 10:42:24 EDT Ken Bell said: ...... > > MVSPROBT EQU * > USING MVSTIME,R2 <= Set base reg R2 > LA R2,MVSPTT-MVSSIZE*8 <= Change base reg R2 (?) > MVSPTL1 LA R2,MVSSIZE*8(R2) <= MVSSIZE needs base reg R2 (?) > CLI 0(R2),X'FF' > BE MVSPTL3 > CLC MVSUSER,VMUSER <= MVSUSER needs base reg R2 (?) > ... > ... > MVSUSER DS 1D > MVSVTIME DS 1D > MVSACUM DS 1D > MVSSIZE EQU (*-MVSTIME+7)/8 Note that the USING statement just informs the assembler that you will be using register 2 as a base. It still has to be loaded with correct address of what you are USING it for. In the example, register 2 will be used to address the storage following label MVSTIME. I presume the series of LA instructions gets register 2 pointing at the correct piece of storage. Also note that MVSSIZE does not depend on the base register since it is a constant with a value of X'10'. The only problem you might have would be with addressability for MVSPTT. I would assume that it is addressed of some other register. John/
PEPMNT@CFAAMP.BITNET (John F. Chandler) (02/10/90)
> I thought that once a base register was declared, > its contents could not be changed (at least so long as any address > references still depended on that base register). Am I wrong? Yes, you were wrong. Base registers are often used for pointing at control blocks in order to map standard DSECT labels onto locations not known at assembly time, and these control blocks often turn out to be members of large classes of similar blocks with the same conceptual mapping. It is therefore often convenient to set up a USING once in a program and just load the base register with the proper value each time you want to look at a different block. Your sample of code is clearly an example of that strategy. John
TSSAKS@UWAMVS1.ADP.WASHINGTON.EDU (206 Al Shing 545-3770) (02/10/90)
How is it known that MVSSIZE is x'10'? It is defined via MVSTIME, not MVSVTIME, and we are not given the entire length of the DSECT in order to determine the value of MVSSIZE. > On Fri, 9 Feb 90 10:42:24 EDT Ken Bell said: > ...... > > > > MVSPROBT EQU * > > USING MVSTIME,R2 <= Set base reg R2 > > LA R2,MVSPTT-MVSSIZE*8 <= Change base reg R2 (?) > > MVSPTL1 LA R2,MVSSIZE*8(R2) <= MVSSIZE needs base reg R2 (?) > > CLI 0(R2),X'FF' > > BE MVSPTL3 > > CLC MVSUSER,VMUSER <= MVSUSER needs base reg R2 (?) > > ... > > ... > > MVSUSER DS 1D > > MVSVTIME DS 1D > > MVSACUM DS 1D > > MVSSIZE EQU (*-MVSTIME+7)/8 > > Note that the USING statement just informs the assembler that you will > be using register 2 as a base. It still has to be loaded with correct > address of what you are USING it for. In the example, register 2 will > be used to address the storage following label MVSTIME. I presume the > series of LA instructions gets register 2 pointing at the correct piece > of storage. Also note that MVSSIZE does not depend on the base register > since it is a constant with a value of X'10'. The only problem you might > have would be with addressability for MVSPTT. I would assume that it is > addressed of some other register. > > John/
SYSBILL@UKCC.BITNET (Bill Sallee) (02/10/90)
A perfect before and after example of why code should be commented. Bill Sallee University of Kentucky
SYSBJAV@VM.TCS.TULANE.EDU (John Voigt - Academic Systems Programmer) (02/10/90)
On Fri, 9 Feb 90 09:41:00 PST 206 Al Shing 545-3770 said: >How is it known that MVSSIZE is x'10'? It is defined via MVSTIME, not >MVSVTIME, and we are not given the entire length of the DSECT in order >to determine the value of MVSSIZE. > Whoops - my IEYIBALL processor had a scan check and misread that name. Sorry for the confusion. John/
MAINTCMS@PUCC.BITNET (John Wagner) (02/10/90)
On Fri, 9 Feb 90 10:42:24 EDT Ken Bell said: Ken, I notice a couple of folks have replied to this with words, but sometimes it is easier to understand when you see the code in context so I recommented the code. > MVSPROBT EQU * > USING MVSTIME,R2 Tell assembler about dsect * R2 will point to the entry > LA R2,MVSPTT-MVSSIZE*8 Point to start of table - 1 entry > MVSPTL1 LA R2,MVSSIZE*8(R2) Bump entry pointer to next entry > CLI 0(R2),X'FF' Is this the end of the table? > BE MVSPTL3 ---> Yes, no match found > CLC MVSUSER,VMUSER Is this the userid we want? > ... > ... > MVSUSER DS 1D These fields are used as a DSECT > MVSVTIME DS 1D to describe the contents of the > MVSACUM DS 1D entries beginning at MVSPTT > MVSSIZE EQU (*-MVSTIME+7)/8
SYKLB@NASAGISS.BITNET (Ken Bell) (02/10/90)
I neglected to note that MVSTIME is, indeed, the name of a DSECT that is included (via COPY) in the source. This DSECT contains the (given) declarations of MVSUSER, MVSVTIME, MVSACUM, and the MVSSIZE equate. My sincere thanks to the 370 (language) experts who replied with helpful explanations, comments, and suggestions, as well as to all who took the time to read and consider my question. I now have a better idea of how base regs are used and a bit more insight into the code that I'm supposed to be maintaining.
SEB1525@CCFVX3.DRAPER.COM (Steve Bacher (Batchman)) (02/11/90)
>The following statement > > MVSPTL1 LA R2,MVSSIZE*8(R2) <= MVSSIZE needs base reg R2 (?) > >should be rewritten as follows: > > MVSPTL1 LA R2,MVSSIZE*8(,R2) > >As written, it is using an index register for addressability instead >of a base register. Such inelegance stands out like a sore thumb in >a dump. The code will work perfectly as written, but it is ugly to >use an index register when a base register is called for. (As previous >responders have pointed out, the LA instruction does *not* depend on >the USING because MVSSIZE is an absolute symbol.) Not only is it ugly, but if you're using access registers under MVS/ESA and register 2 is actually referencing areas in another data space with the help of access register 2, the first statement above will be WRONG. ESA with access registers requires use of the base register and not the index register with effective addresses; otherwise the address computation won't work.