Closed ghost closed 2 years ago
What makes you believe Hercules is behaving incorrectly?
According to SA22-7832-12 zArchitecture Principles of Operation for LRA:
For LOAD REAL ADDRESS (LRA, LRAY) in the 24-bit or 31-bit addressing mode, if bits 0-32 of the 64-bit real or absolute address corresponding to the second-operand virtual address are all zeros, bits 32-63 of the real or absolute address are placed in bit positions 32-63 of general register R1, and bits 0-31 of the register remain unchanged. If bits 0-32 of the real address or absolute are not all zeros, a special- operation exception is recognized.
and:
Special Conditions
A special-operation exception is recognized when, for LRA or LRAY in the 24-bit or 31-bit addressing mode, bits 0-32 of the resultant 64-bit real address are not all zeros.
Your PSW indicates 31-bit addressing mode, your residency mode (rmode) for all three tests is ANY
, and the instruction is failing due to a Special-operation exception. What leads you to believe that this is incorrect? What leads you to believe Hercules is malfunctioning?
I assume it is down to Hercules as is does not happen in a real machine. I said that the abend did not happen in Herc 4.3. I have since found that it does. Sorry for the confusion. I had a different MAINSIZE
. Once I set them to the same value I could reproduce the error in Herc 4.3 too. But yes, it could be down to storage sizes.
However, I forced an abend in version of the program that worked. I loaded R4 with the address and I see:
lar r2,cmdbuf
la r4,cmdbuf
HHC02269I CP03: R2=000000007D574028
HHC02269I CP03: R4=000000000C900028
In both registers, bits 0-32 are zero, so I would not expect a special operation exception. In any case I would expect the same behavior regardless of the module size.
lar r2,cmdbuf la r4,cmdbuf HHC02269I CP03: R2=000000007D574028 HHC02269I CP03: R4=000000000C900028
(I presume you meant LRA)
The Principles of Operation manual clearly states:
If bits 0-32 of the real address or absolute are not all zeros, a special-operation exception is recognized.
The value of R4 is immaterial. It is only the real address or absolute address that the virtual address translates to that matters.
If the virtual address translates to a real or absolute address that is larger than 2GB, the real address WON'T FIT in your target register. Addresses larger than 2GB cannot be contained in a 32-bit register when running in 31-bit addressing mode.
In your debug example you provided above, you got lucky. The address translated to a value less than 2GB. The virtual address X'0C900028' in this case translated to real address X'7D574028', which is a value less than 2GB. Thus it worked just fine.
In your original problem report, it failed because the virtual address you were trying to translate to a real address, translated to a value that was greater than 2GB, and therefore could not fit within your 32-bit register. Thus a special operation exception occurred. Your test program was physically loaded at a real storage address above the 2GB line because you specified RMODE ANY. When RMODE ANY is specified, the operating system is free to locate your program anywhere in real storage, and it just happened to choose a location above the 2GB line.
In your second test, you got lucky. The operating system chose to locate your test program at a real address that happened to be below the 2GB line. Thus the LRA instruction was able to complete successfully.
There is nothing wrong with Hercules. Your test programs are bad.
Yes, I did mean LRA. It also abends exactly the same way when linking with RMODE 24. I'll do some more testing.
It also abends exactly the same way when linking with RMODE 24.
That's unexpected!
I'll do some more testing.
Please do. I'm sure you're overlooking something. The LRA instruction hasn't been touched in years, and if there was a bug in it, I doubt ANY z/Architecture operating system would work correctly! It has to be a bug in your program IMHO.
My apologies, I have now seen the abend in a real machine too. It seems to be a moving target, but not down to Hercules.
My apologies, I have now seen the abend in a real machine too.
I suspected as much. I knew it wouldn't necessarily always happen (or always not happen) since whether it does or doesn't happen is ultimately unpredictable given the operating system you're using.
It seems to be a moving target...
Correct. As explained, it all depends on where in storage z/OS decides to load your code (since your rmode was set to "any").
but not down to Hercules.
Yep. :)
And even though it's now no longer needed (since you've already proven the point for yourself), for completeness I have attached a simple stand-alone test program below that hopefully illustrates what's going on:
What it basically does is execute the LRA instruction for three different virtual addresses, each of which gets translated (via the defined page table) to a different real address: the first to real address 16MB, the second to real address 1GB, and the third to real address 2GB.
The first two succeed without problem, but the third of course always fails due to the resulting real address being >=2GB (which cannot fit in a 32-bit register when in 31-bit addressing mode).
I am closing this issue as Invalid (User Error).
P.S. please don't feel badly about this @WJensen-ITconsult! If you've been involved in programming for any length of time then you should already know that even very skilled and knowledgeable individuals sometimes make silly/stupid mistakes. (I call them brain farts)
Hell, I do it all the freaking time. ;-)
(Happy holidays everyone!)
In Hercules 4.4 the
LRA
instruction causes abend S0D3 if module size is 4K.In Hercules 4.3 it works.
Works in this version:
Fails in this version:
Failure:
Test Job....
Step G3 fails, this is where the module size is 4K.
All 3 programs are identical, except for the 'org zlra+nnnn' instruction.