From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
To: Jerry Cruntime <jerry.c.t@web.de>
Cc: bpf <bpf@vger.kernel.org>
Subject: Re: [PATCH bpf] libbpf: Fix register in PT_REGS MIPS macros
Date: Thu, 30 Jul 2020 13:43:17 -0700 [thread overview]
Message-ID: <CAEf4BzZE4a6Zz=zFdSg5j8dvu4PY_B8ZfznDv47R2ivaa-we-g@mail.gmail.com> (raw)
In-Reply-To: <6ac86da0-16f0-eb9e-010e-277cfdd555be@web.de>
On Thu, Jul 30, 2020 at 1:38 PM Jerry Cruntime <jerry.c.t@web.de> wrote:
>
> Hi,
>
> > I've quickly looked up some doc on MIPS calling convention, doesn't
> > seem like regs[8] is actually used for 5th input argument (the doc I
> > found documented only the use of $4 through $7 for first 4 args).
> > Should we drop PT_REGS_PARM5() for MIPS, while at it?
>
> My understanding is that with o32 only 4 arguments can be passed in
> registers ($4-$7). But n32 and n64 extended it to pass 8 arguments in
> registers ($4-$11).
>
> My source is "MIPS Run, Second Edition" from Dominic Sweetman table 11.2
> on page 327. It is also described here:
>
> https://en.wikipedia.org/wiki/Calling_convention#MIPS
>
Oh, right, I should have used Wikipedia instead. :)
Acked-by: Andrii Nakryiko <andriin@fb.com>
>
> On 7/30/20 9:55 PM, Andrii Nakryiko wrote:
> > On Thu, Jul 30, 2020 at 4:45 AM Jerry Cruntime <jerry.c.t@web.de> wrote:
> >>
> >> The o32, n32 and n64 calling conventions require the return
> >> value to be stored in $v0 which maps to $2 register, i.e.,
> >> the second register.
> >>
> >> Fixes: c1932cd ("bpf: Add MIPS support to samples/bpf.")
> >> ---
> >> tools/lib/bpf/bpf_tracing.h | 2 +-
> >> 1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/tools/lib/bpf/bpf_tracing.h b/tools/lib/bpf/bpf_tracing.h
> >> index 58eceb884..ae205dcf8 100644
> >> --- a/tools/lib/bpf/bpf_tracing.h
> >> +++ b/tools/lib/bpf/bpf_tracing.h
> >> @@ -215,7 +215,7 @@ struct pt_regs;
> >> #define PT_REGS_PARM5(x) ((x)->regs[8])
> >
> > I've quickly looked up some doc on MIPS calling convention, doesn't
> > seem like regs[8] is actually used for 5th input argument (the doc I
> > found documented only the use of $4 through $7 for first 4 args).
> > Should we drop PT_REGS_PARM5() for MIPS, while at it?
> >
> >> #define PT_REGS_RET(x) ((x)->regs[31])
> >> #define PT_REGS_FP(x) ((x)->regs[30]) /* Works only with
> >> CONFIG_FRAME_POINTER */
> >> -#define PT_REGS_RC(x) ((x)->regs[1])
> >> +#define PT_REGS_RC(x) ((x)->regs[2])
> >
> > This looks good, though.
> >
> >> #define PT_REGS_SP(x) ((x)->regs[29])
> >> #define PT_REGS_IP(x) ((x)->cp0_epc)
> >>
> >> --
> >> 2.17.1
next prev parent reply other threads:[~2020-07-30 20:43 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-30 11:44 [PATCH bpf] libbpf: Fix register in PT_REGS MIPS macros Jerry Cruntime
2020-07-30 19:55 ` Andrii Nakryiko
2020-07-30 20:38 ` Jerry Cruntime
2020-07-30 20:43 ` Andrii Nakryiko [this message]
2020-07-30 23:00 ` Daniel Borkmann
2020-07-31 9:56 ` Jerry Crunchtime
2020-07-31 10:31 ` Daniel Borkmann
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='CAEf4BzZE4a6Zz=zFdSg5j8dvu4PY_B8ZfznDv47R2ivaa-we-g@mail.gmail.com' \
--to=andrii.nakryiko@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=jerry.c.t@web.de \
/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.