/DragonOS/kernel/crates/rbpf/src/ |
H A D | verifier.rs | 23 use crate::{ebpf, Error, ErrorKind}; 31 if prog.len() % ebpf::INSN_SIZE != 0 { in check_prog_len() 34 ebpf::INSN_SIZE in check_prog_len() 37 if prog.len() > ebpf::PROG_MAX_SIZE { in check_prog_len() 40 ebpf::PROG_MAX_INSNS, in check_prog_len() 41 prog.len() / ebpf::INSN_SIZE in check_prog_len() 48 let last_opc = ebpf::get_insn(prog, (prog.len() / ebpf::INSN_SIZE) - 1).opc; in check_prog_len() 49 if last_opc & ebpf::BPF_CLS_MASK != ebpf::BPF_JMP { in check_prog_len() 56 fn check_imm_endian(insn: &ebpf::Insn, insn_ptr: usize) -> Result<(), Error> { in check_imm_endian() 68 let next_insn = ebpf::get_insn(prog, insn_ptr + 1); in check_load_dw() [all …]
|
H A D | disassembler.rs | 16 use crate::ebpf; 19 fn alu_imm_str(name: &str, insn: &ebpf::Insn) -> String { in alu_imm_str() 24 fn alu_reg_str(name: &str, insn: &ebpf::Insn) -> String { in alu_reg_str() 29 fn byteswap_str(name: &str, insn: &ebpf::Insn) -> String { in byteswap_str() 38 fn ld_st_imm_str(name: &str, insn: &ebpf::Insn) -> String { in ld_st_imm_str() 52 fn ld_reg_str(name: &str, insn: &ebpf::Insn) -> String { in ld_reg_str() 66 fn st_reg_str(name: &str, insn: &ebpf::Insn) -> String { in st_reg_str() 80 fn ldabs_str(name: &str, insn: &ebpf::Insn) -> String { in ldabs_str() 85 fn ldind_str(name: &str, insn: &ebpf::Insn) -> String { in ldind_str() 90 fn jmp_imm_str(name: &str, insn: &ebpf::Insn) -> String { in jmp_imm_str() [all …]
|
H A D | assembler.rs | 23 ebpf::{self, Insn}, 47 ("add", ebpf::BPF_ADD), in make_instruction_map() 48 ("sub", ebpf::BPF_SUB), in make_instruction_map() 49 ("mul", ebpf::BPF_MUL), in make_instruction_map() 50 ("div", ebpf::BPF_DIV), in make_instruction_map() 51 ("or", ebpf::BPF_OR), in make_instruction_map() 52 ("and", ebpf::BPF_AND), in make_instruction_map() 53 ("lsh", ebpf::BPF_LSH), in make_instruction_map() 54 ("rsh", ebpf::BPF_RSH), in make_instruction_map() 55 ("mod", ebpf::BPF_MOD), in make_instruction_map() [all …]
|
H A D | cranelift.rs | 23 use crate::ebpf::{ 39 helpers: HashMap<u32, ebpf::Helper>, 61 pub(crate) fn new(helpers: HashMap<u32, ebpf::Helper>) -> Self { in new() 252 while insn_ptr * ebpf::INSN_SIZE < prog.len() { in translate_program() 253 let insn = ebpf::get_insn(prog, insn_ptr); in translate_program() 274 ebpf::LD_ABS_B in translate_program() 275 | ebpf::LD_ABS_H in translate_program() 276 | ebpf::LD_ABS_W in translate_program() 277 | ebpf::LD_ABS_DW in translate_program() 278 | ebpf::LD_IND_B in translate_program() [all …]
|
H A D | interpreter.rs | 9 ebpf::{self, Insn}, 87 helpers: &HashMap<u32, ebpf::Helper>, in execute_program() 132 while insn_ptr * ebpf::INSN_SIZE < prog.len() { in execute_program() 133 let insn = ebpf::get_insn(prog, insn_ptr); in execute_program() 143 ebpf::LD_ABS_B => { in execute_program() 150 ebpf::LD_ABS_H => { in execute_program() 157 ebpf::LD_ABS_W => { in execute_program() 164 ebpf::LD_ABS_DW => { in execute_program() 172 ebpf::LD_IND_B => { in execute_program() 180 ebpf::LD_IND_H => { in execute_program() [all …]
|
H A D | jit.rs | 15 use crate::{ebpf, HashMap}; 27 const TARGET_OFFSET: isize = ebpf::PROG_MAX_INSNS as isize; 388 let mul = (opc & ebpf::BPF_ALU_OP_MASK) == (ebpf::MUL32_IMM & ebpf::BPF_ALU_OP_MASK); in emit_muldivmod() 389 let div = (opc & ebpf::BPF_ALU_OP_MASK) == (ebpf::DIV32_IMM & ebpf::BPF_ALU_OP_MASK); in emit_muldivmod() 390 let modrm = (opc & ebpf::BPF_ALU_OP_MASK) == (ebpf::MOD32_IMM & ebpf::BPF_ALU_OP_MASK); in emit_muldivmod() 391 let is64 = (opc & ebpf::BPF_CLS_MASK) == ebpf::BPF_ALU64; in emit_muldivmod() 392 let is_reg = (opc & ebpf::BPF_X) == ebpf::BPF_X; in emit_muldivmod() 479 helpers: &HashMap<u32, ebpf::Helper>, in jit_compile() 532 self.emit_alu64_imm32(mem, 0x81, 5, RSP, ebpf::STACK_SIZE as i32); in jit_compile() 534 self.pc_locs = vec![0; prog.len() / ebpf::INSN_SIZE + 1]; in jit_compile() [all …]
|
H A D | stack.rs | 1 use crate::{ebpf::STACK_SIZE, vec, Vec};
|
H A D | lib.rs | 42 pub mod ebpf; module 123 helpers: HashMap<u32, ebpf::Helper>,
|
H A D | insn_builder.rs | 8 use crate::ebpf::*;
|
/DragonOS/kernel/crates/rbpf/tests/ |
H A D | assembler.rs | 10 use rbpf::{assembler::assemble, ebpf}; 12 fn asm(src: &str) -> Result<Vec<ebpf::Insn>, String> { in asm() 13 Ok(ebpf::to_insn_vec(&(assemble(src))?)) in asm() 16 fn insn(opc: u8, dst: u8, src: u8, off: i16, imm: i32) -> ebpf::Insn { in insn() 17 ebpf::Insn { in insn() 34 assert_eq!(asm("exit"), Ok(vec![insn(ebpf::EXIT, 0, 0, 0, 0)])); in test_exit() 42 Ok(vec![insn(ebpf::ADD64_REG, 1, 3, 0, 0)]) in test_add64() 46 Ok(vec![insn(ebpf::ADD64_IMM, 1, 0, 0, 5)]) in test_add64() 53 assert_eq!(asm("neg64 r1"), Ok(vec![insn(ebpf::NEG64, 1, 0, 0, 0)])); in test_neg64() 61 Ok(vec![insn(ebpf::LD_W_REG, 1, 2, 5, 0)]) in test_ldxw() [all …]
|
H A D | ubpf_verifier.rs | 21 use rbpf::{assembler::assemble, ebpf}; 142 let mut prog = (0..(1_000_000 * ebpf::INSN_SIZE)) in test_verifier_err_too_many_instructions()
|
/DragonOS/user/apps/test_ebpf/ |
H A D | Makefile | 24 build:build-ebpf 27 clean:clean-ebpf 45 build-release:build-ebpf 48 clean-release:clean-ebpf 54 build-ebpf: 56 clean-ebpf: 60 install:build-ebpf
|
/DragonOS/user/apps/test_ebpf/syscall_ebpf/syscall_ebpf-ebpf/ |
H A D | Cargo.toml | 2 name = "syscall_ebpf-ebpf" 7 aya-ebpf = { git = "https://git.mirrors.dragonos.org.cn/DragonOS-Community/aya.git", rev = "3d57d35… 8 aya-log-ebpf = { git = "https://git.mirrors.dragonos.org.cn/DragonOS-Community/aya.git", rev = "3d5…
|
/DragonOS/kernel/src/bpf/prog/ |
H A D | verifier.rs | 11 use rbpf::ebpf; 12 use rbpf::ebpf::to_insn_vec; 46 if insn.opc == ebpf::LD_DW_IMM { in relocation()
|
/DragonOS/user/apps/test_ebpf/syscall_ebpf/ |
H A D | README.md | 10 cargo xtask build-ebpf
|
/DragonOS/docs/kernel/trace/ |
H A D | eBPF.md | 67 ├── syscall_ebpf-ebpf 73 - `syscall_ebpf-ebpf`是 eBPF代码的实现目录,其会被编译到字节码 175 /// See https://ebpf-docs.dylanreimerink.nl/linux/helper-function/bpf_map_lookup_elem/ 181 /// See https://ebpf-docs.dylanreimerink.nl/linux/helper-function/bpf_map_update_elem/ 187 /// See https://ebpf-docs.dylanreimerink.nl/linux/helper-function/bpf_map_delete_elem/ 194 /// See https://ebpf-docs.dylanreimerink.nl/linux/helper-function/bpf_for_each_map_elem/
|
/DragonOS/kernel/crates/rbpf/ |
H A D | README.md | 19 * [Building eBPF programs](#building-ebpf-programs)
|