On 03/01/16 04:20, Ian Lance Taylor wrote:
On Sat, Jan 2, 2016 at 11:16 AM, Marcin Kościelnicki <koria...@0x04.net> wrote:
The differences start in the __morestack calling convention. Basically,
since pushing things on stuck is unwieldy and there's only one free
register (%r0 could be used for static chain, %r2-%r6 contain arguments,
%r6-%r15 are callee-saved), I stuff the parameters somewhere in .rodata
or .text section, and pass the address of the parameter block in %r1.
The parameter block also contains a (position-relative) address that
__morestack should jump to (x86 just mangles the return address from
__morestack to compute that). On zSeries CPUs, the parameter block
is stuffed somewhere in .rodata, its address loaded to %r1 by larl
instruction, and __morestack is sibling-called by jg instruction.
Does that work in a multi-threaded program if two different threads
are calling the same function at the same time and both threads need
to split the stack?
Ian
Sure, why not? The parameters are link-time constants after all.
Marcin Kościelnicki