From: Segher Boessenkool <segher@kernel.crashing.org>
To: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Paul Mackerras <paulus@samba.org>,
linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] powerpc/booke: Avoid link stack corruption in several places
Date: Mon, 23 Aug 2021 15:12:19 -0500 [thread overview]
Message-ID: <20210823201219.GZ1583@gate.crashing.org> (raw)
In-Reply-To: <67a5be3f-a443-03eb-aa8e-a1fa6c0b3d3f@csgroup.eu>
On Mon, Aug 23, 2021 at 07:05:38PM +0200, Christophe Leroy wrote:
> Le 23/08/2021 à 17:58, Segher Boessenkool a écrit :
> >On Mon, Aug 23, 2021 at 07:53:01AM +0000, Christophe Leroy wrote:
> >> /* Be careful, this will clobber the lr register. */
> >> #define LOAD_REG_ADDR_PIC(reg, name) \
> >>- bl 0f; \
> >>+ bcl 20,31,0f \
> >> 0: mflr reg; \
> >> addis reg,reg,(name - 0b)@ha; \
> >> addi reg,reg,(name - 0b)@l;
> >
> >The code ended each line with a semicolon before, for absolutely no
> >reason that I can see, but still. Fixing that would be nice, but only
> >doing it on one line isn't good.
>
> Sure, forgetting the semicolon broke the build. That's because the
> backslash removes the newline.
Ah right, one of the surprises you get from using the C preprocessor on
non-C code :-)
> The cleanest way I found to fix that quite of stuff is by using GAS macro,
> as I did for LOAD_REG_IMMEDIATE() some time ago.
Yeah, good plan. You can use loops and saner parameters etc. as well if
you do :-)
> >Btw. Both the 7450 and the modern cores implementing this really need
> >this to be $+4, so it is a lot clearer to write that instead of 1f or
> >a named label.
>
> I like that, removing unneeded labels will make it smoother and clearer.
> I'll do it.
Cool, thanks!
Segher
WARNING: multiple messages have this Message-ID (diff)
From: Segher Boessenkool <segher@kernel.crashing.org>
To: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Paul Mackerras <paulus@samba.org>,
Michael Ellerman <mpe@ellerman.id.au>,
linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] powerpc/booke: Avoid link stack corruption in several places
Date: Mon, 23 Aug 2021 15:12:19 -0500 [thread overview]
Message-ID: <20210823201219.GZ1583@gate.crashing.org> (raw)
In-Reply-To: <67a5be3f-a443-03eb-aa8e-a1fa6c0b3d3f@csgroup.eu>
On Mon, Aug 23, 2021 at 07:05:38PM +0200, Christophe Leroy wrote:
> Le 23/08/2021 à 17:58, Segher Boessenkool a écrit :
> >On Mon, Aug 23, 2021 at 07:53:01AM +0000, Christophe Leroy wrote:
> >> /* Be careful, this will clobber the lr register. */
> >> #define LOAD_REG_ADDR_PIC(reg, name) \
> >>- bl 0f; \
> >>+ bcl 20,31,0f \
> >> 0: mflr reg; \
> >> addis reg,reg,(name - 0b)@ha; \
> >> addi reg,reg,(name - 0b)@l;
> >
> >The code ended each line with a semicolon before, for absolutely no
> >reason that I can see, but still. Fixing that would be nice, but only
> >doing it on one line isn't good.
>
> Sure, forgetting the semicolon broke the build. That's because the
> backslash removes the newline.
Ah right, one of the surprises you get from using the C preprocessor on
non-C code :-)
> The cleanest way I found to fix that quite of stuff is by using GAS macro,
> as I did for LOAD_REG_IMMEDIATE() some time ago.
Yeah, good plan. You can use loops and saner parameters etc. as well if
you do :-)
> >Btw. Both the 7450 and the modern cores implementing this really need
> >this to be $+4, so it is a lot clearer to write that instead of 1f or
> >a named label.
>
> I like that, removing unneeded labels will make it smoother and clearer.
> I'll do it.
Cool, thanks!
Segher
next prev parent reply other threads:[~2021-08-23 20:15 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-23 7:53 [PATCH] powerpc/booke: Avoid link stack corruption in several places Christophe Leroy
2021-08-23 7:53 ` Christophe Leroy
2021-08-23 15:58 ` Segher Boessenkool
2021-08-23 15:58 ` Segher Boessenkool
2021-08-23 17:05 ` Christophe Leroy
2021-08-23 17:05 ` Christophe Leroy
2021-08-23 20:12 ` Segher Boessenkool [this message]
2021-08-23 20:12 ` Segher Boessenkool
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=20210823201219.GZ1583@gate.crashing.org \
--to=segher@kernel.crashing.org \
--cc=christophe.leroy@csgroup.eu \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=paulus@samba.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.