On Thu, 8 Oct 2015 10:20:41 -0600, Paul Gilmartin wrote:

>On 2015-10-08, at 08:48, Peter Relson wrote:
>> ...
>> Consider 
>> -- Module A is using 64-bit GRs (whether AMODE 64 or not) and expects 
>> anything it calls to comply with the linkage conventions
>> -- Module A calls Module B
>> -- Module B is AMODE 31, knows nothing about 64-bit GRs so saves/restores 
>> low halves only
>> -- Module B uses some macro that clobbers the high half of something other 
>> than reg 0,1,15
>> -- Module B restores low halves, returns to Module A
>> -- Module A is now broken 
>>  
>Isn't module B's offense to modify a high half without restoring it, regardless
>of AMODE?

No. B committed no offense unless the macro that clobbered the high half is 
documented to change that register without saving and restoring it. It is the 
macro that is violating the linkage conventions in this case. If the macro 
documents that it does not follow the linkage conventions, it is up to the 
coders of program B that uses the macro to ensure that it follows the 
conventions.

>Conversely, if B restores 64-bit registers 2-14, is B a good citizen even if
>B modifies high halves.

If B saves and restores all 64 bits of registers 2-14, it is following the 
linkage 
conventions. B can use the 64-bit registers in any way it chooses in this case.

>And B must remember that the operation of LA (others?) depends on AMODE.

Any program needs to be coded with the awareness of hoe the instructions 
work. There is nothing special about this case.

-- 
Tom Marchant

Reply via email to