On Mon, 4 Apr 2011 11:09:25 -0400, Tony Harminc wrote: >On 4 April 2011 08:01, Joe Owens <[email protected]> wrote: > >> One question occurs - must I now use extended save areas, as I am doing >> something to the top halves of the GPRs, or will the system take care of >> that for me? (There are no amode 64 progs on the calling chain).
The system will not restore the high halves of registers when you return to your caller. >Perhaps it's obvious, but... You don't need to do anything if you are >merely using the 64-bit GPRs for calculation If you are using the high halves of registers 2-12, you need to save them and restore before returning to your caller. It doesn't matter what you are using the registers for. If you return to your caller with registers 2-12 different from what they were when you were called, you might cause problems for the calling program. >i.e. the system will not >munge the high halves just because there is an interrupt and you lose >control, no matter what addressing mode you are in and what save area >scheme, if any, you use. You need to worry only if you want to call a >routine (your subroutine or a system service) and have a 64-bit value >in a GPR that you want preserved. It is the responsibility of the called routine to save any registers that it uses and restore them before returning to the caller. This includes the high halves of registers 2-12. >It's almost certainly easier just to >make sure such values are safely stored before you make the call than >it is to update the save area scheme. You don't need to save registers 2-12 before calling any routine that adheres to standard linkage conventions. -- Tom Marchant
