On Tue Mar 28, 2023 at 3:46 AM AEST, Christophe Leroy wrote:
>
>
> Le 25/03/2023 à 14:06, Nicholas Piggin a écrit :
> > The _switch stack frame setup are substantially the same, so are the
> > comments. The difference in how the stack and current are switched,
> > and other hardware and software housekeeping is done is moved into
> > macros.
> > 
> > Signed-off-by: Nicholas Piggin <npig...@gmail.com>
> > ---
> > These patches are mostly just shuffling code around. Better? Worse?
>
> I find it nice, at least for PPC32 part.
>
> For PPC32 generated code is almost the same, only a few reordering at 
> the start of the function.
>
> Before the change I have:
>
> 00000238 <_switch>:
>   238:        94 21 ff 30     stwu    r1,-208(r1)
>   23c:        7c 08 02 a6     mflr    r0
>   240:        90 01 00 d4     stw     r0,212(r1)
>   244:        91 a1 00 44     stw     r13,68(r1)

Hmm, this is how GCC seems to emits stack prologue code for ppc32.

On ppc64  the mflr r0 comes first, then the non-volatile register
saving, then the LR save, then ther r1 stdu.

Seems a bit pointless to have to different implementations. I
think we'd like to have LR saved before r1 though, otherwise you
get an unreliable backtrace in your last 2 stack frames instead
of just the last one, don't you?

Thanks,
Nick

Reply via email to