/DragonOS/kernel/crates/rbpf/tests/ ! |
H A D | ubpf_vm.rs | 29 let prog = assemble( in test_vm_add() localVariable 38 let vm = rbpf::EbpfVmNoData::new(Some(&prog)).unwrap(); in test_vm_add() 44 let prog = assemble( in test_vm_alu64_arith() localVariable 67 let vm = rbpf::EbpfVmNoData::new(Some(&prog)).unwrap(); in test_vm_alu64_arith() 73 let prog = assemble( in test_vm_alu64_bit() localVariable 100 let vm = rbpf::EbpfVmNoData::new(Some(&prog)).unwrap(); in test_vm_alu64_bit() 106 let prog = assemble( in test_vm_alu_arith() localVariable 129 let vm = rbpf::EbpfVmNoData::new(Some(&prog)).unwrap(); in test_vm_alu_arith() 135 let prog = assemble( in test_vm_alu_bit() localVariable 160 let vm = rbpf::EbpfVmNoData::new(Some(&prog)).unwrap(); in test_vm_alu_bit() [all …]
|
H A D | ubpf_jit_x86_64.rs | 30 let prog = assemble( in test_jit_add() localVariable 39 let mut vm = rbpf::EbpfVmNoData::new(Some(&prog)).unwrap(); in test_jit_add() 48 let prog = assemble( in test_jit_alu64_arith() localVariable 71 let mut vm = rbpf::EbpfVmNoData::new(Some(&prog)).unwrap(); in test_jit_alu64_arith() 80 let prog = assemble( in test_jit_alu64_bit() localVariable 107 let mut vm = rbpf::EbpfVmNoData::new(Some(&prog)).unwrap(); in test_jit_alu64_bit() 116 let prog = assemble( in test_jit_alu_arith() localVariable 139 let mut vm = rbpf::EbpfVmNoData::new(Some(&prog)).unwrap(); in test_jit_alu_arith() 148 let prog = assemble( in test_jit_alu_bit() localVariable 173 let mut vm = rbpf::EbpfVmNoData::new(Some(&prog)).unwrap(); in test_jit_alu_bit() [all …]
|
H A D | ubpf_verifier.rs | 26 let prog = &[ in test_verifier_err_endian_size() localVariable 30 let vm = rbpf::EbpfVmNoData::new(Some(prog)).unwrap(); in test_verifier_err_endian_size() 38 let prog = &[ in test_verifier_err_incomplete_lddw() localVariable 42 let vm = rbpf::EbpfVmNoData::new(Some(prog)).unwrap(); in test_verifier_err_incomplete_lddw() 49 let prog = assemble( in test_verifier_err_infinite_loop() localVariable 55 let vm = rbpf::EbpfVmNoData::new(Some(&prog)).unwrap(); in test_verifier_err_infinite_loop() 62 let prog = assemble( in test_verifier_err_invalid_reg_dst() localVariable 68 let vm = rbpf::EbpfVmNoData::new(Some(&prog)).unwrap(); in test_verifier_err_invalid_reg_dst() 75 let prog = assemble( in test_verifier_err_invalid_reg_src() localVariable 81 let vm = rbpf::EbpfVmNoData::new(Some(&prog)).unwrap(); in test_verifier_err_invalid_reg_src() [all …]
|
H A D | cranelift.rs | 14 ($name:ident, $prog:expr, $expected:expr) => { 17 let prog = assemble($prog).unwrap(); localVariable 18 let mut vm = rbpf::EbpfVmNoData::new(Some(&prog)).unwrap(); 23 ($name:ident, $prog:expr, $mem:expr, $expected:expr) => { 26 let prog = assemble($prog).unwrap(); localVariable 28 let mut vm = rbpf::EbpfVmRaw::new(Some(&prog)).unwrap(); 261 let prog = assemble( in test_cranelift_call() localVariable 273 let mut vm = rbpf::EbpfVmNoData::new(Some(&prog)).unwrap(); in test_cranelift_call() 282 let prog = assemble( in test_cranelift_err_call_unreg() localVariable 294 let mut vm = rbpf::EbpfVmNoData::new(Some(&prog)).unwrap(); in test_cranelift_err_call_unreg() [all …]
|
H A D | misc.rs | 116 let prog = &[ in test_vm_block_port() localVariable 149 let mut vm = rbpf::EbpfVmFixedMbuff::new(Some(prog), 0x40, 0x50).unwrap(); in test_vm_block_port() 182 let prog = &[ in test_jit_block_port() localVariable 215 let mut vm = rbpf::EbpfVmFixedMbuff::new(Some(prog), 0x40, 0x50).unwrap(); in test_jit_block_port() 230 let prog = &[ in test_vm_mbuff() localVariable 246 let vm = rbpf::EbpfVmMbuff::new(Some(prog)).unwrap(); in test_vm_mbuff() 288 let prog = &[ in test_jit_mbuff() localVariable 305 let mut vm = rbpf::EbpfVmMbuff::new(Some(prog)).unwrap(); in test_jit_mbuff() 314 let prog = &[ in test_vm_jit_ldabsb() localVariable 322 let mut vm = rbpf::EbpfVmRaw::new(Some(prog)).unwrap(); in test_vm_jit_ldabsb() [all …]
|
H A D | disassembler.rs | 369 let prog = to_insn_vec(&insns); in test_offset_overflow() localVariable 370 let asm = prog in test_offset_overflow()
|
/DragonOS/kernel/crates/rbpf/src/ ! |
H A D | verifier.rs | 30 fn check_prog_len(prog: &[u8]) -> Result<(), Error> { in check_prog_len() 31 if prog.len() % ebpf::INSN_SIZE != 0 { in check_prog_len() 37 if prog.len() > ebpf::PROG_MAX_SIZE { in check_prog_len() 41 prog.len() / ebpf::INSN_SIZE in check_prog_len() 45 if prog.is_empty() { in check_prog_len() 48 let last_opc = ebpf::get_insn(prog, (prog.len() / ebpf::INSN_SIZE) - 1).opc; in check_prog_len() 65 fn check_load_dw(prog: &[u8], insn_ptr: usize) -> Result<(), Error> { in check_load_dw() 68 let next_insn = ebpf::get_insn(prog, insn_ptr + 1); in check_load_dw() 76 fn check_jmp_offset(prog: &[u8], insn_ptr: usize) -> Result<(), Error> { in check_jmp_offset() 77 let insn = ebpf::get_insn(prog, insn_ptr); in check_jmp_offset() [all …]
|
H A D | lib.rs | 69 pub type Verifier = fn(prog: &[u8]) -> Result<(), Error>; 117 prog: Option<&'a [u8]>, field 142 pub fn new(prog: Option<&'a [u8]>) -> Result<EbpfVmMbuff<'a>, Error> { in new() 143 if let Some(prog) = prog { in new() 144 verifier::check(prog)?; in new() 148 prog, in new() 177 pub fn set_program(&mut self, prog: &'a [u8]) -> Result<(), Error> { in set_program() 178 (self.verifier)(prog)?; in set_program() 179 self.prog = Some(prog); in set_program() 214 if let Some(prog) = self.prog { in set_verifier() [all …]
|
H A D | ebpf.rs | 554 pub fn get_insn(prog: &[u8], idx: usize) -> Insn { in get_insn() 558 if (idx + 1) * INSN_SIZE > prog.len() { in get_insn() 562 prog.len() in get_insn() 566 opc: prog[INSN_SIZE * idx], in get_insn() 567 dst: prog[INSN_SIZE * idx + 1] & 0x0f, in get_insn() 568 src: (prog[INSN_SIZE * idx + 1] & 0xf0) >> 4, in get_insn() 569 off: LittleEndian::read_i16(&prog[(INSN_SIZE * idx + 2)..]), in get_insn() 570 imm: LittleEndian::read_i32(&prog[(INSN_SIZE * idx + 4)..]), in get_insn() 618 pub fn to_insn_vec(prog: &[u8]) -> Vec<Insn> { in to_insn_vec() 619 if prog.len() % INSN_SIZE != 0 { in to_insn_vec() [all …]
|
H A D | disassembler.rs | 202 pub fn to_insn_vec(prog: &[u8]) -> Vec<HLInsn> { in to_insn_vec() 203 if prog.len() % ebpf::INSN_SIZE != 0 { in to_insn_vec() 209 if prog.is_empty() { in to_insn_vec() 216 while insn_ptr * ebpf::INSN_SIZE < prog.len() { in to_insn_vec() 217 let insn = ebpf::get_insn(prog, insn_ptr); in to_insn_vec() 259 let next_insn = ebpf::get_insn(prog, insn_ptr); in to_insn_vec() 794 pub fn disassemble(prog: &[u8]) { in disassemble() 797 for insn in to_insn_vec(prog) { in disassemble() 803 for insn in to_insn_vec(prog) { in disassemble()
|
H A D | cranelift.rs | 111 pub(crate) fn compile_function(mut self, prog: &[u8]) -> Result<CraneliftProgram, Error> { in compile_function() 145 self.build_cfg(&mut builder, prog)?; in compile_function() 147 self.translate_program(&mut builder, prog)?; in compile_function() 250 fn translate_program(&mut self, bcx: &mut FunctionBuilder, prog: &[u8]) -> Result<(), Error> { in translate_program() 252 while insn_ptr * ebpf::INSN_SIZE < prog.len() { in translate_program() 253 let insn = ebpf::get_insn(prog, insn_ptr); in translate_program() 319 let next_insn = ebpf::get_insn(prog, insn_ptr); in translate_program() 1083 fn build_cfg(&mut self, bcx: &mut FunctionBuilder, prog: &[u8]) -> Result<(), Error> { in build_cfg() 1085 while insn_ptr * ebpf::INSN_SIZE < prog.len() { in build_cfg() 1086 let insn = ebpf::get_insn(prog, insn_ptr); in build_cfg()
|
H A D | jit.rs | 476 prog: &[u8], in jit_compile() 534 self.pc_locs = vec![0; prog.len() / ebpf::INSN_SIZE + 1]; in jit_compile() 537 while insn_ptr * ebpf::INSN_SIZE < prog.len() { in jit_compile() 538 let insn = ebpf::get_insn(prog, insn_ptr); in jit_compile() 576 let second_part = ebpf::get_insn(prog, insn_ptr).imm as u64; in jit_compile() 913 if insn_ptr != prog.len() / ebpf::INSN_SIZE - 1 { in jit_compile() 986 prog: &[u8], in new() 1013 jit.jit_compile(&mut mem, prog, use_mbuff, update_data_ptr, helpers)?; in new()
|
H A D | interpreter.rs | 92 let prog = match prog_ { in execute_program() localVariable 93 Some(prog) => prog, 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() 206 let next_insn = ebpf::get_insn(prog, insn_ptr); in execute_program()
|
/DragonOS/kernel/src/bpf/prog/ ! |
H A D | verifier.rs | 3 use crate::bpf::prog::util::VerifierLogLevel; 4 use crate::bpf::prog::BpfProg; 20 prog: BpfProg, field 26 pub fn new(prog: BpfProg, log_level: VerifierLogLevel, log_buf: &'a mut [u8]) -> Self { in new() 28 prog, in new() 37 let instructions = self.prog.insns_mut(); in relocation() 122 self.prog.insert_map(ptr); in relocation() 129 Ok(self.prog) in verify()
|
H A D | mod.rs | 6 use crate::bpf::prog::util::{BpfProgMeta, BpfProgVerifierInfo}; 7 use crate::bpf::prog::verifier::BpfProgVerifier; 117 let prog = BpfProg::new(args); in bpf_prog_load() localVariable 119 let prog = BpfProgVerifier::new(prog, log_info.log_level, &mut []).verify(&fd_table)?; in bpf_prog_load() localVariable 120 let file = File::new(Arc::new(prog), FileMode::O_RDWR)?; in bpf_prog_load()
|
/DragonOS/kernel/crates/rbpf/examples/ ! |
H A D | to_json.rs | 22 fn to_json(prog: &[u8]) -> String { in to_json() 27 let insns = disassembler::to_insn_vec(prog); in to_json() 71 let prog = &text_scn.data; in main() localVariable 73 println!("{}", to_json(prog)); in main()
|
H A D | disassemble.rs | 9 let prog = &[ in main() localVariable 25 disassembler::disassemble(prog); in main()
|
H A D | load_elf.rs | 64 let prog = &text_scn.data; in main() localVariable 92 let mut vm = rbpf::EbpfVmFixedMbuff::new(Some(prog), 0x40, 0x50).unwrap(); in main()
|
/DragonOS/kernel/src/bpf/ ! |
H A D | mod.rs | 3 pub mod prog; module 34 bpf_cmd::BPF_PROG_LOAD => prog::bpf_prog_load(attr), in bpf()
|
/DragonOS/kernel/crates/rbpf/ ! |
H A D | README.md | 144 pub fn new(prog: &'a [u8]) -> Result<EbpfVmMbuff<'a>, Error> 147 pub fn new(prog: &'a [u8], 152 pub fn new(prog: &'a [u8]) -> Result<EbpfVmRaw<'a>, Error> 155 pub fn new(prog: &'a [u8]) -> Result<EbpfVmNoData<'a>, Error> 174 pub fn set_program(&mut self, prog: &'a [u8]) -> Result<(), Error> 177 pub fn set_program(&mut self, prog: &'a [u8], 188 pub type Verifier = fn(prog: &[u8]) -> Result<(), Error>; 270 let prog = &[ 281 let vm = rbpf::EbpfVmNoData::new(Some(prog)).unwrap(); 296 let prog = &[ [all …]
|
/DragonOS/kernel/src/perf/ ! |
H A D | kprobe.rs | 5 use crate::bpf::prog::BpfProg;
|
/DragonOS/docs/kernel/trace/ ! |
H A D | eBPF.md | 134 bpf_cmd::BPF_PROG_LOAD => prog::bpf_prog_load(attr), 251 // For bpf prog output
|