LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Nicholas Piggin" <npiggin@gmail.com>
To: "Christophe Leroy" <christophe.leroy@csgroup.eu>
Cc: "linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>
Subject: Re: [PATCH 1/2] powerpc: merge 32-bit and 64-bit _switch implementation
Date: Tue, 28 Mar 2023 15:51:12 +1000	[thread overview]
Message-ID: <CRHS5LDYSW5X.VQQQ7FLQKMVC@bobo> (raw)
In-Reply-To: <0dd771db-bb07-420e-8372-b021cbfe22fd@csgroup.eu>

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 <npiggin@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	other threads:[~2023-03-28  5:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-25 13:06 [PATCH 1/2] powerpc: merge 32-bit and 64-bit _switch implementation Nicholas Piggin
2023-03-25 13:06 ` [PATCH 2/2] powerpc/64: Rename entry_64.S to prom_entry.S Nicholas Piggin
2023-03-27 17:48   ` Christophe Leroy
2023-03-28  6:51     ` Nicholas Piggin
2023-03-28  7:08       ` Christophe Leroy
2023-03-27 17:46 ` [PATCH 1/2] powerpc: merge 32-bit and 64-bit _switch implementation Christophe Leroy
2023-03-28  5:51   ` Nicholas Piggin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CRHS5LDYSW5X.VQQQ7FLQKMVC@bobo \
    --to=npiggin@gmail.com \
    --cc=christophe.leroy@csgroup.eu \
    --cc=linuxppc-dev@lists.ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox