From: Jiong Wang <jiong.wang@netronome.com>
To: "Jose E. Marchesi" <jose.marchesi@oracle.com>
Cc: binutils@sourceware.org,
Alexei Starovoitov <alexei.starovoitov@gmail.com>,
Daniel Borkmann <daniel@iogearbox.net>,
bpf@vger.kernel.org
Subject: Re: [PATCH 0/9] eBPF support for GNU binutils
Date: Tue, 21 May 2019 19:14:47 +0100 [thread overview]
Message-ID: <768B654F-A66B-4CCE-9320-D096538B23F2@netronome.com> (raw)
In-Reply-To: <87d0kbrb3m.fsf@oracle.com>
> On 21 May 2019, at 18:06, Jose E. Marchesi <jose.marchesi@oracle.com> wrote:
>
>
> Hi Jiong.
>
>> Despite using a different syntax for the assembler (the llvm assembler
>> uses a C-ish expression-based syntax while the GNU assembler opts for
>> a more classic assembly-language syntax) this implementation tries to
>> provide inter-operability with clang/llvm generated objects.
>
> I also noticed your implementation doesn’t seem to use the same sub-register
> syntax as what LLVM assembler is doing.
>
> x register for 64-bit, and w register for 32-bit sub-register.
>
> So:
> add r0, r1, r2 means BPF_ALU64 | BPF_ADD | BFF_X
> add w0, w1, w1 means BPF_ALU | BPF_ADD | BPF_X
>
> ASAICT, different register prefix for different register width is also adopted
> by quite a few other GNU assembler targets like AArch64, X86_64.
>
> Right. I opted for using different mnemonics for alu and alu64
> instructions, as it seemed to be simpler.
>
> What was your rationale for using sub-register notation?
It is the same instruction operating on different register classes, sub-register
is a new register class, so define separate notation for them. This also
simplifies compiler back-end when generating sub-register instructions, at
least for LLVM, and is likely for GCC as well.
LLVM eBPF backend has full support for generating sub-register ISA,
> Are you
> planning to support instructions (or pseudo-instructions) mixing w and x
> registers in the future?
>
>> In particular, the numbers of the relocations used for instruction
>> fields are the same. These are R_BPF_INSN_64 and R_BPF_INSN_DISP32.
>> The later is resolved at load-time by bpf_load.c.
>
> I think you missed the latest JMP32 instructions.
>
> https://github.com/torvalds/linux/blob/master/Documentation/networking/filter.txt#L870
>
> Oh thanks for spotting that.
> Adding support for it :)
next prev parent reply other threads:[~2019-05-21 18:14 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20190520164526.13491-1-jose.marchesi () oracle ! com>
2019-05-21 15:41 ` [PATCH 0/9] eBPF support for GNU binutils Jiong Wang
2019-05-21 17:06 ` Jose E. Marchesi
2019-05-21 18:14 ` Jiong Wang [this message]
2019-05-21 19:13 ` Jose E. Marchesi
2019-05-21 17:43 ` David Miller
2019-05-21 18:18 ` Alexei Starovoitov
2019-05-21 18:58 ` Jose E. Marchesi
2019-05-21 19:02 ` Edward Cree
2019-05-21 19:34 ` Jose E. Marchesi
2019-05-21 19:49 ` Edward Cree
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=768B654F-A66B-4CCE-9320-D096538B23F2@netronome.com \
--to=jiong.wang@netronome.com \
--cc=alexei.starovoitov@gmail.com \
--cc=binutils@sourceware.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=jose.marchesi@oracle.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).