Questions: JIT ARM32

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux