Lines Matching refs:insn

77 fn do_jump(insn_ptr: &mut usize, insn: &Insn) {  in do_jump()
78 *insn_ptr = (*insn_ptr as i16 + insn.off) as usize; in do_jump()
133 let insn = ebpf::get_insn(prog, insn_ptr); in execute_program() localVariable
135 let _dst = insn.dst as usize; in execute_program()
136 let _src = insn.src as usize; in execute_program()
138 match insn.opc { in execute_program()
145 let x = (mem.as_ptr() as u64 + (insn.imm as u32) as u64) as *const u8; in execute_program()
152 let x = (mem.as_ptr() as u64 + (insn.imm as u32) as u64) as *const u16; in execute_program()
159 let x = (mem.as_ptr() as u64 + (insn.imm as u32) as u64) as *const u32; in execute_program()
165 log::info!("executing LD_ABS_DW, set reg[{}] to {:#x}", _dst, insn.imm); in execute_program()
167 let x = (mem.as_ptr() as u64 + (insn.imm as u32) as u64) as *const u64; in execute_program()
175 (mem.as_ptr() as u64 + reg[_src] + (insn.imm as u32) as u64) as *const u8; in execute_program()
183 (mem.as_ptr() as u64 + reg[_src] + (insn.imm as u32) as u64) as *const u16; in execute_program()
191 (mem.as_ptr() as u64 + reg[_src] + (insn.imm as u32) as u64) as *const u32; in execute_program()
199 (mem.as_ptr() as u64 + reg[_src] + (insn.imm as u32) as u64) as *const u64; in execute_program()
213 reg[_dst] = ((insn.imm as u32) as u64) + ((next_insn.imm as u64) << 32); in execute_program()
220 let x = (reg[_src] as *const u8).offset(insn.off as isize); in execute_program()
228 let x = (reg[_src] as *const u8).offset(insn.off as isize) as *const u16; in execute_program()
236 let x = (reg[_src] as *const u8).offset(insn.off as isize) as *const u32; in execute_program()
250 let x = (reg[_src] as *const u8).offset(insn.off as isize) as *const u64; in execute_program()
258 let x = (reg[_dst] as *const u8).offset(insn.off as isize) as *mut u8; in execute_program()
260 x.write_unaligned(insn.imm as u8); in execute_program()
264 let x = (reg[_dst] as *const u8).offset(insn.off as isize) as *mut u16; in execute_program()
266 x.write_unaligned(insn.imm as u16); in execute_program()
270 let x = (reg[_dst] as *const u8).offset(insn.off as isize) as *mut u32; in execute_program()
272 x.write_unaligned(insn.imm as u32); in execute_program()
276 let x = (reg[_dst] as *const u8).offset(insn.off as isize) as *mut u64; in execute_program()
278 x.write_unaligned(insn.imm as u64); in execute_program()
283 let x = (reg[_dst] as *const u8).offset(insn.off as isize) as *mut u8; in execute_program()
289 let x = (reg[_dst] as *const u8).offset(insn.off as isize) as *mut u16; in execute_program()
295 let x = (reg[_dst] as *const u8).offset(insn.off as isize) as *mut u32; in execute_program()
301 let x = (reg[_dst] as *const u8).offset(insn.off as isize) as *mut u64; in execute_program()
312 …ebpf::ADD32_IMM => reg[_dst] = (reg[_dst] as i32).wrapping_add(insn.imm) as u64, //((reg[_dst] & U… in execute_program()
314 ebpf::SUB32_IMM => reg[_dst] = (reg[_dst] as i32).wrapping_sub(insn.imm) as u64, in execute_program()
316 ebpf::MUL32_IMM => reg[_dst] = (reg[_dst] as i32).wrapping_mul(insn.imm) as u64, in execute_program()
318 ebpf::DIV32_IMM if insn.imm as u32 == 0 => reg[_dst] = 0, in execute_program()
319 ebpf::DIV32_IMM => reg[_dst] = (reg[_dst] as u32 / insn.imm as u32) as u64, in execute_program()
322 ebpf::OR32_IMM => reg[_dst] = (reg[_dst] as u32 | insn.imm as u32) as u64, in execute_program()
324 ebpf::AND32_IMM => reg[_dst] = (reg[_dst] as u32 & insn.imm as u32) as u64, in execute_program()
328 ebpf::LSH32_IMM => reg[_dst] = (reg[_dst] as u32).wrapping_shl(insn.imm as u32) as u64, in execute_program()
330 ebpf::RSH32_IMM => reg[_dst] = (reg[_dst] as u32).wrapping_shr(insn.imm as u32) as u64, in execute_program()
336 ebpf::MOD32_IMM if insn.imm as u32 == 0 => (), in execute_program()
337 ebpf::MOD32_IMM => reg[_dst] = (reg[_dst] as u32 % insn.imm as u32) as u64, in execute_program()
340 ebpf::XOR32_IMM => reg[_dst] = (reg[_dst] as u32 ^ insn.imm as u32) as u64, in execute_program()
342 ebpf::MOV32_IMM => reg[_dst] = insn.imm as u32 as u64, in execute_program()
347 reg[_dst] = (reg[_dst] as i32).wrapping_shr(insn.imm as u32) as u64; in execute_program()
355 reg[_dst] = match insn.imm { in execute_program()
363 reg[_dst] = match insn.imm { in execute_program()
372 ebpf::ADD64_IMM => reg[_dst] = reg[_dst].wrapping_add(insn.imm as u64), in execute_program()
374 ebpf::SUB64_IMM => reg[_dst] = reg[_dst].wrapping_sub(insn.imm as u64), in execute_program()
376 ebpf::MUL64_IMM => reg[_dst] = reg[_dst].wrapping_mul(insn.imm as u64), in execute_program()
378 ebpf::DIV64_IMM if insn.imm == 0 => reg[_dst] = 0, in execute_program()
379 ebpf::DIV64_IMM => reg[_dst] /= insn.imm as u64, in execute_program()
382 ebpf::OR64_IMM => reg[_dst] |= insn.imm as u64, in execute_program()
384 ebpf::AND64_IMM => reg[_dst] &= insn.imm as u64, in execute_program()
386 ebpf::LSH64_IMM => reg[_dst] <<= insn.imm as u64 & SHIFT_MASK_64, in execute_program()
388 ebpf::RSH64_IMM => reg[_dst] >>= insn.imm as u64 & SHIFT_MASK_64, in execute_program()
391 ebpf::MOD64_IMM if insn.imm == 0 => (), in execute_program()
392 ebpf::MOD64_IMM => reg[_dst] %= insn.imm as u64, in execute_program()
395 ebpf::XOR64_IMM => reg[_dst] ^= insn.imm as u64, in execute_program()
397 ebpf::MOV64_IMM => reg[_dst] = insn.imm as u64, in execute_program()
400 reg[_dst] = (reg[_dst] as i64 >> (insn.imm as u64 & SHIFT_MASK_64)) as u64 in execute_program()
408 ebpf::JA => do_jump(&mut insn_ptr, &insn), in execute_program()
410 if reg[_dst] == insn.imm as u64 { in execute_program()
411 do_jump(&mut insn_ptr, &insn); in execute_program()
416 do_jump(&mut insn_ptr, &insn); in execute_program()
420 if reg[_dst] > insn.imm as u64 { in execute_program()
421 do_jump(&mut insn_ptr, &insn); in execute_program()
426 do_jump(&mut insn_ptr, &insn); in execute_program()
430 if reg[_dst] >= insn.imm as u64 { in execute_program()
431 do_jump(&mut insn_ptr, &insn); in execute_program()
436 do_jump(&mut insn_ptr, &insn); in execute_program()
440 if reg[_dst] < insn.imm as u64 { in execute_program()
441 do_jump(&mut insn_ptr, &insn); in execute_program()
446 do_jump(&mut insn_ptr, &insn); in execute_program()
450 if reg[_dst] <= insn.imm as u64 { in execute_program()
451 do_jump(&mut insn_ptr, &insn); in execute_program()
456 do_jump(&mut insn_ptr, &insn); in execute_program()
460 if reg[_dst] & insn.imm as u64 != 0 { in execute_program()
461 do_jump(&mut insn_ptr, &insn); in execute_program()
466 do_jump(&mut insn_ptr, &insn); in execute_program()
470 if reg[_dst] != insn.imm as u64 { in execute_program()
471 do_jump(&mut insn_ptr, &insn); in execute_program()
476 do_jump(&mut insn_ptr, &insn); in execute_program()
480 if reg[_dst] as i64 > insn.imm as i64 { in execute_program()
481 do_jump(&mut insn_ptr, &insn); in execute_program()
486 do_jump(&mut insn_ptr, &insn); in execute_program()
490 if reg[_dst] as i64 >= insn.imm as i64 { in execute_program()
491 do_jump(&mut insn_ptr, &insn); in execute_program()
496 do_jump(&mut insn_ptr, &insn); in execute_program()
500 if (reg[_dst] as i64) < insn.imm as i64 { in execute_program()
501 do_jump(&mut insn_ptr, &insn); in execute_program()
506 do_jump(&mut insn_ptr, &insn); in execute_program()
510 if reg[_dst] as i64 <= insn.imm as i64 { in execute_program()
511 do_jump(&mut insn_ptr, &insn); in execute_program()
516 do_jump(&mut insn_ptr, &insn); in execute_program()
522 if reg[_dst] as u32 == insn.imm as u32 { in execute_program()
523 do_jump(&mut insn_ptr, &insn); in execute_program()
528 do_jump(&mut insn_ptr, &insn); in execute_program()
532 if reg[_dst] as u32 > insn.imm as u32 { in execute_program()
533 do_jump(&mut insn_ptr, &insn); in execute_program()
538 do_jump(&mut insn_ptr, &insn); in execute_program()
542 if reg[_dst] as u32 >= insn.imm as u32 { in execute_program()
543 do_jump(&mut insn_ptr, &insn); in execute_program()
548 do_jump(&mut insn_ptr, &insn); in execute_program()
552 if (reg[_dst] as u32) < insn.imm as u32 { in execute_program()
553 do_jump(&mut insn_ptr, &insn); in execute_program()
558 do_jump(&mut insn_ptr, &insn); in execute_program()
562 if reg[_dst] as u32 <= insn.imm as u32 { in execute_program()
563 do_jump(&mut insn_ptr, &insn); in execute_program()
568 do_jump(&mut insn_ptr, &insn); in execute_program()
572 if reg[_dst] as u32 & insn.imm as u32 != 0 { in execute_program()
573 do_jump(&mut insn_ptr, &insn); in execute_program()
578 do_jump(&mut insn_ptr, &insn); in execute_program()
582 if reg[_dst] as u32 != insn.imm as u32 { in execute_program()
583 do_jump(&mut insn_ptr, &insn); in execute_program()
588 do_jump(&mut insn_ptr, &insn); in execute_program()
592 if reg[_dst] as i32 > insn.imm { in execute_program()
593 do_jump(&mut insn_ptr, &insn); in execute_program()
598 do_jump(&mut insn_ptr, &insn); in execute_program()
602 if reg[_dst] as i32 >= insn.imm { in execute_program()
603 do_jump(&mut insn_ptr, &insn); in execute_program()
608 do_jump(&mut insn_ptr, &insn); in execute_program()
612 if (reg[_dst] as i32) < insn.imm { in execute_program()
613 do_jump(&mut insn_ptr, &insn); in execute_program()
618 do_jump(&mut insn_ptr, &insn); in execute_program()
622 if reg[_dst] as i32 <= insn.imm { in execute_program()
623 do_jump(&mut insn_ptr, &insn); in execute_program()
628 do_jump(&mut insn_ptr, &insn); in execute_program()
640 if let Some(function) = helpers.get(&(insn.imm as u32)) { in execute_program()
646 insn.imm as u32,BPF_FUNC_MAPPER[insn.imm as usize],insn_ptr in execute_program()
667 …log::trace!("BPF TO BPF CALL: new pc: {} + {} = {}",insn_ptr ,insn.imm,insn_ptr + insn.imm as usiz… in execute_program()
670 insn_ptr += insn.imm as usize; in execute_program()
677 insn.imm as u32,BPF_FUNC_MAPPER[insn.imm as usize],insn_ptr in execute_program()