From: Segher Boessenkool <segher@kernel.crashing.org>
To: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Cc: Florian Weimer <fweimer@redhat.com>,
libc-alpha@sourceware.org,
Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>,
linuxppc-dev@lists.ozlabs.org,
Nicholas Piggin <npiggin@gmail.com>
Subject: Re: powerpc Linux scv support and scv system call ABI proposal
Date: Fri, 31 Jan 2020 05:55:14 -0600 [thread overview]
Message-ID: <20200131115514.GZ22482@gate.crashing.org> (raw)
In-Reply-To: <7568c170-55ef-d3b0-fe85-e5bec68c1fe1@linaro.org>
Hi!
On Fri, Jan 31, 2020 at 08:30:45AM -0300, Adhemerval Zanella wrote:
> On 30/01/2020 18:41, Segher Boessenkool wrote:
> > On Thu, Jan 30, 2020 at 02:04:51PM -0300, Adhemerval Zanella wrote:
> >> be value propagated over
> >> functions calls and over different scopes, which I take from your
> >> explanation is not supported and fragile.
> >
> > You probably misundertand that, but let me ask: where is err assigned to
> > at all in the code you quoted? I don't see it. Maybe it's hidden in some
> > macro?
>
> Indeed it was not explicit in the example code, it is burried in the
> INTERNAL_SYSCALL_CALL macro which calls sparc-defined macros. For instance,
> with 6 argument kernel syscall, it issues:
>
> #define inline_syscall6(string,err,name,arg1,arg2,arg3,arg4,arg5,arg6) \
> ({ \
> register long __o0 __asm__ ("o0") = (long)(arg1); \
> register long __o1 __asm__ ("o1") = (long)(arg2); \
> register long __o2 __asm__ ("o2") = (long)(arg3); \
> register long __o3 __asm__ ("o3") = (long)(arg4); \
> register long __o4 __asm__ ("o4") = (long)(arg5); \
> register long __o5 __asm__ ("o5") = (long)(arg6); \
> err = name; \
> __asm __volatile (string : "=r" (err), "=r" (__o0) : \
> "0" (err), "1" (__o0), "r" (__o1), \
> "r" (__o2), "r" (__o3), "r" (__o4), \
> "r" (__o5) : \
> __SYSCALL_CLOBBERS); \
> __o0; \
> })
>
> Where 'err' defined by 'INTERNAL_SYSCALL_DECL' should be the 'err' macro
> argument.
GCC makes sure that what is in register g1 at the end of this asm does
end up in the C variable "err" (at least conceptually, the actual code
can be optimised further).
> I meant a register variable where its use 'after' the extended asm
> is expected to use the define register.
Yes, that is not supported like this. You'll have to use some more
inline asm at that use (with "err" as input there). Or, if you actually
care about this being in a specific register, maybe you shouldn't write
this in C at all? Writing assembler code in assembler language (in a
single inline asm block, or even in an assembler source file) tends to
give much better results (and is a lot easier) than trying to second-
guess the compiler. You can write pretty much anything as inline
assembler code, but that doesn't mean you have to, or that that would
be a good idea.
Things on the border like system calls are hard to handle. I like the
idea of doing those in compiler builtins ("compiler intrinsics"), but
that has its own problems as well: mostly, need to {write down / lock
down / determine in advance} more of the calling convention than the
other approaches. And of course it will take years before most projects
can use it :-/
Segher
next prev parent reply other threads:[~2020-01-31 11:58 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-28 10:50 powerpc Linux scv support and scv system call ABI proposal Nicholas Piggin
2020-01-28 13:09 ` Florian Weimer
2020-01-28 14:05 ` Nicholas Piggin
2020-01-28 15:40 ` Segher Boessenkool
2020-01-28 16:04 ` Florian Weimer
2020-01-28 20:01 ` Segher Boessenkool
2020-01-29 16:19 ` Florian Weimer
2020-01-29 16:29 ` Segher Boessenkool
2020-01-29 17:02 ` Florian Weimer
2020-01-29 17:51 ` Segher Boessenkool
2020-01-30 10:42 ` Florian Weimer
2020-01-30 11:25 ` Segher Boessenkool
2020-01-30 12:03 ` Florian Weimer
2020-01-30 13:50 ` Segher Boessenkool
2020-01-30 17:04 ` Adhemerval Zanella
2020-01-30 21:41 ` Segher Boessenkool
2020-01-31 11:30 ` Adhemerval Zanella
2020-01-31 11:55 ` Segher Boessenkool [this message]
2020-01-28 15:58 ` Florian Weimer
2020-01-29 4:41 ` Nicholas Piggin
2020-01-28 17:26 ` Adhemerval Zanella
2020-01-29 4:58 ` Nicholas Piggin
2020-01-29 13:20 ` Segher Boessenkool
2020-01-29 15:51 ` Tulio Magno Quites Machado Filho
2020-02-19 11:03 ` Nicholas Piggin
2020-01-28 22:14 ` Joseph Myers
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=20200131115514.GZ22482@gate.crashing.org \
--to=segher@kernel.crashing.org \
--cc=adhemerval.zanella@linaro.org \
--cc=fweimer@redhat.com \
--cc=libc-alpha@sourceware.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=npiggin@gmail.com \
--cc=tuliom@linux.ibm.com \
/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.