* Questions: JIT ARM32
@ 2022-05-12 7:22 Shenghao Yuan
0 siblings, 0 replies; only message in thread
From: Shenghao Yuan @ 2022-05-12 7:22 UTC (permalink / raw)
To: bpf
Hello all,
I am a beginner to learn the eBPF jit compiler (and also a Linux beginner), I have two questions when I read the eBPF-JIT ARM32 source code (I am using bootlin [1] and this eBPF document [2]), could you please give me some suggestions?
1. mov instructions: I don't understand why it has a condition `imm == 1` [2]
```c
case BPF_ALU | BPF_MOV | BPF_K:
case BPF_ALU | BPF_MOV | BPF_X:
case BPF_ALU64 | BPF_MOV | BPF_K:
case BPF_ALU64 | BPF_MOV | BPF_X:
switch (BPF_SRC(code)) {
case BPF_X:
if (imm == 1) { // I don't understand here
/* Special mov32 for zext */
emit_a32_mov_i(dst_hi, 0, ctx);
break;
}
emit_a32_mov_r64(is64, dst, src, ctx);
```
2. alu32 instructions, why jit arm32 doesn't call/trigger alu32 operations [4]
```c
if (is64) {
const s8 *rs;
rs = arm_bpf_get_reg64(src, tmp2, ctx);
/* ALU operation */
emit_alu_r(rd[1], rs[1], true, false, op, ctx);
emit_alu_r(rd[0], rs[0], true, true, op, ctx);
} else {
s8 rs;
rs = arm_bpf_get_reg32(src_lo, tmp2[1], ctx);
/* ALU operation */
emit_alu_r(rd[1], rs, true, false, op, ctx); //here it also set is64 as true?
if (!ctx->prog->aux->verifier_zext)
emit_a32_mov_i(rd[0], 0, ctx);
}
```
[1] https://elixir.bootlin.com/linux/v5.18-rc6/source
[2] https://github.com/iovisor/bpf-docs/blob/master/eBPF.md
[3] https://elixir.bootlin.com/linux/v5.18-rc6/source/arch/arm/net/bpf_jit_32.c#L1399
[4] https://elixir.bootlin.com/linux/v5.18-rc6/source/arch/arm/net/bpf_jit_32.c#L754
Best wishes,
----------------------- ----------------------- ------------
Shenghao YUAN
TEA (Time, Events and Architectures) team
Inria Rennes
Tel: (+33) 0749504117
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-05-12 7:23 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-12 7:22 Questions: JIT ARM32 Shenghao Yuan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox