>Wouldn't it be easier to make a global statement about R14 being altered
>rather than that the top half (alone) is preserved when AMODE=24/31?

It would be easier, but it would be dangerous.

The case that is being protected against is this
- a program is using the high half of reg 14 for "something".
  Let's say the program is AMODE 31.
- Calls an AMODE 31 routine which does not know about high halves
- AMODE 31 routine saves low halves
- AMODE 31 routine calls a routine that clobbers R14 high half
- AMODE 31 routine restores low halves and returns
- Original caller's reg 14 high half is clobbered

You might, rightly ask, "what coder in their right mind would use
the high half of reg 14 in such a way?". I don't have an answer, but
it is theoretically possible.

There are other variants of this, particularly with routines that document
that they preserve reg 14 but are themselves not cognizant of high
halves..
For this case, the caller might even have a 64-bit value in register 14
and be relying on it as a return address.

Peter Relson
z/OS Core Technology Design

Reply via email to