[ prev |
next |
up ]
Register windows on the Sparc
[instructor's question was sent to our local Unix/Sparc guru, who replied:]
> On the Sparc, when a subroutine is called, the stack pointer
> gets adjusted downwards by some amount equal to 104 + (# of bytes
> needed for local variables).
>
> When the register windows are saved to the stack (either
> automatically when calling depth goes beyond the end of the window
> set or via the trap), does each window set get written to the top of
> its corresponding frame, i.e., into that 104+ area of the stack set
> up for each subroutine?
Most of that space is for window spill, yes. 64 bytes of it is
necessary for registers (%l0-%l7, %i0-%i7). 24 bytes of it appears to
be a dumping ground for arguments, presumably so they can be in RAM
adjacent to any arguments that got stacked because there were more args
than fit in registers. This accounts for only 88 bytes; I don't know
what the remaining 16 bytes are. I seem to recall seeing some
indication that there's space in there for a pointer used for return
value areas for struct-valued functions, but that is unclear.