On Sun, 31 Jul 2005 20:22:31 -0700, Edward E. Jaffe wrote:
>
>I never suggested it was *impossible* to branch into PSA using a long
>relative branch. Obviously, if one branches into data or constants
>anything is possible. I simply pointed out that it's not possible to
>code such a branch in an assembler program. (Your pathological relative
>branch scenarios involving EXecute and/or self-modifying code help
>illustrate that point quite well.)
>
>In other words, I never meant to imply one couldn't write code to
>*construct* a relative branch that goes to location zero. What I meant
>was that you couldn't assemble one in your program. Specifically, 'J 0'
>is totally invalid (will not assemble) whereas 'B 0' does exactly what
>you think it does -- branches to location zero. More to the point, 'J
>XXX' can *never* be "wild" whereas 'B XXX' can be "wild" any time the
>base register becomes corrupted or the USING is coded improperly.
I agree with your general position but for the "not possible" extreme.
For example, here is some assembler source that WILL branch to (or near,
depending on exactly where it is loaded) location 0:
BRCLTEST START 0
BRCLTEST AMODE 31
BRCLTEST RMODE 24
PRINT NOGEN
YREGS ,
BRCLTEST CSECT ,
BASR R12,0
* SR R1,R1
AHILEN AHI R1,1
JLU -UPEQU No WARNING IF SUP(058) ON EXEC PARM
LO2HERE DSECT
UPLEN DS XL(32730/2)
UPEND DS 0X
UPEQU EQU *-LO2HERE
END ,
Granted, it is (still) a largely pathological case since its branch to
location 0 depends on where the routine is loaded (on one of our LPARs it
hits 0 as-is, on another LPAR I needed to change the 32730 constant to
32756 to hit the target; that's why I BASR R12,0 - to help me hand-compute
the target). The example is interesting in that the target address is not
within the CSECT.
What it demonstrates is that the assembler will let you shoot your toes off
even with a relative branch, by incorrect use of an EQU as a jump target.
In other words, a coding error at o'dark-thirty could still result in funky
behavior in spite of the coder's intentions and the architect's solid
attempt to prevent bad things.
>I have long considered relative branches to be part of the solution ..
>not part of the problem.
Here we agree completely -- they are PART of the solution, but not a
complete solution. They are much, much, much better than what we had.
--
Tom Schmidt
Madison, WI
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html