From: Sam Ravnborg <sam@ravnborg.org>
To: Koakuma <koachan@protonmail.com>
Cc: "sparclinux@vger.kernel.org" <sparclinux@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"davem@davemloft.net" <davem@davemloft.net>,
"ndesaulniers@google.com" <ndesaulniers@google.com>,
"arnd@arndb.de" <arnd@arndb.de>
Subject: Re: [sparc] Use of -fcall-used-* flags in Makefile?
Date: Tue, 19 Mar 2024 23:16:15 +0100 [thread overview]
Message-ID: <20240319221615.GA379167@ravnborg.org> (raw)
In-Reply-To: <JAYB7uS-EdLABTR4iWZdtFOVa5MvlKosIrD_cKTzgeozCOGRM7lhxeLigFB1g3exX445I_W5VKB-tAzl2_G1zCVJRQjp67ODfsSqiZWOZ9o=@protonmail.com>
Hi Koakuma,
On Sat, Mar 16, 2024 at 02:59:42PM +0000, Koakuma wrote:
> Hello, first time poster so apologies if I posted to the wrong list.
>
> Anyone knows why the SPARC makefiles (arch/sparc/Makefile and
> arch/sparc/vdso/Makefile) set `-fcall-used-g5` and `-fcall-used-g7`
> in their CFLAGS?
sparc32 uses:
-fcall-used-g5 -fcall-used-g7
sparc64 uses:
-ffixed-g4 -ffixed-g5 -fcall-used-g7
For sparc64:
-ffixed-g4 is added because sparc64 uses the g4 register to hold the
pointer to the current task. See:
arch/sparc/include/asm/current.h line 18.
g2, g5, g7 all have their specific use or assumptions.
From arch/sparc/include/asm/ttable.h:
* Further note that we cannot use the g2, g4, g5, and g7 alternate
* globals in the spill routines, check out the save instruction in
* arch/sparc64/kernel/etrap.S to see what I mean about g2, and
* g4/g5 are the globals which are preserved by etrap processing
* for the caller of it. The g7 register is the return pc for
* etrap. Finally, g6 is the current thread register so we cannot
* us it in the spill handlers either. Most of these rules do not
* apply to fill processing, only g6 is not usable.
*/
Looking at https://github.com/gcc-mirror/gcc/blob/master/gcc/config/sparc/sparc.h
I read that:
On v9 systems:
g1,g5 are free to use as temporaries, and are free to use between calls
...
g6-g7 are reserved for the operating system (or application in
embedded case).
Based on the above I would assume gcc do not change behaviour with or
without -fcall-used-g7.
I do not have a sparc64 system at my hands - and for this qemu may not
cut it. But it would be super if someone with a working sparc64 target
could verify if the kernel could be built and works without
-fcall-used-g7.
For sparc32 the above file says:
g5 through g7 are reserved for the operating system.
So again - it looks like -fcall-used-g5 -fcall-used-g7 should have no
effect here and verification on a real target would be nice.
Sam
next prev parent reply other threads:[~2024-03-19 22:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-16 14:59 [sparc] Use of -fcall-used-* flags in Makefile? Koakuma
2024-03-19 22:16 ` Sam Ravnborg [this message]
2024-03-23 16:37 ` Koakuma
2024-03-24 8:53 ` Sam Ravnborg
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=20240319221615.GA379167@ravnborg.org \
--to=sam@ravnborg.org \
--cc=arnd@arndb.de \
--cc=davem@davemloft.net \
--cc=koachan@protonmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ndesaulniers@google.com \
--cc=sparclinux@vger.kernel.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