From: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
To: "Maciej W. Rozycki" <macro@orcam.me.uk>
Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] MIPS: Fix big-endian stack argument fetching in o32 wrapper
Date: Tue, 26 May 2026 16:44:14 +0200 [thread overview]
Message-ID: <ahWxvsiqlhwYFrkw@alpha.franken.de> (raw)
In-Reply-To: <alpine.DEB.2.21.2604302350440.38805@angie.orcam.me.uk>
On Sat, May 02, 2026 at 12:14:20AM +0100, Maciej W. Rozycki wrote:
> Fix an issue in call_o32() where the upper 32-bit half of incoming n64
> stack arguments is fetched and used for outgoing o32 stack arguments on
> big-endian platforms.
>
> This code was adapted from arch/mips/dec/prom/call_o32.S which was meant
> for a little-endian platform only and therefore using 32-bit loads from
> 64-bit stack slot locations holding incoming stack arguments resulted in
> correct values being retrieved for data that is expected to be 32-bit.
>
> This works on little-endian platforms where the lower 32-bit half of the
> 64-bit value is located at every 64-bit stack slot location. However on
> big-endian platforms the lower 32-bit half is instead located at offset
> 4 from every 64-bit stack slot location.
>
> So to fix the issue the offset of 4 would have to be used on big-endian
> platforms only, or alternatively a 64-bit load from the 64-bit stack
> slot location can be used across the board, as the subsequent 32-bit
> store to the corresponding outgoing stack argument slot will correctly
> truncate the value and cause no unpredictable result. We already take
> advantage of this architectural feature for the incoming arguments held
> in $a6 and $a7 registers, since the o32 wrapper does not know how many
> incoming arguments there are and consequently propagates incoming data
> which may not be 32-bit.
>
> Since this code is generally supposed to be used with the stack located
> in cached memory there is no extra overhead expected for 64-bit loads as
> opposed to 32-bit ones, so pick this variant for code simplicity.
>
> Fixes: 231a35d37293 ("[MIPS] RM: Collected changes")
> Signed-off-by: Maciej W. Rozycki <macro@orcam.me.uk>
> ---
> arch/mips/fw/lib/call_o32.S | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
applied to mips-next
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]
prev parent reply other threads:[~2026-05-26 14:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-01 23:14 [PATCH] MIPS: Fix big-endian stack argument fetching in o32 wrapper Maciej W. Rozycki
2026-05-26 14:44 ` Thomas Bogendoerfer [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=ahWxvsiqlhwYFrkw@alpha.franken.de \
--to=tsbogend@alpha.franken.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=macro@orcam.me.uk \
/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