Lines Matching refs:ebpf
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()
537 while insn_ptr * ebpf::INSN_SIZE < prog.len() { in jit_compile()
538 let insn = ebpf::get_insn(prog, insn_ptr); in jit_compile()
549 ebpf::LD_ABS_B => self.emit_load(mem, OperandSize::S8, R10, RAX, insn.imm), in jit_compile()
550 ebpf::LD_ABS_H => self.emit_load(mem, OperandSize::S16, R10, RAX, insn.imm), in jit_compile()
551 ebpf::LD_ABS_W => self.emit_load(mem, OperandSize::S32, R10, RAX, insn.imm), in jit_compile()
552 ebpf::LD_ABS_DW => self.emit_load(mem, OperandSize::S64, R10, RAX, insn.imm), in jit_compile()
553 ebpf::LD_IND_B => { in jit_compile()
558 ebpf::LD_IND_H => { in jit_compile()
563 ebpf::LD_IND_W => { in jit_compile()
568 ebpf::LD_IND_DW => { in jit_compile()
574 ebpf::LD_DW_IMM => { in jit_compile()
576 let second_part = ebpf::get_insn(prog, insn_ptr).imm as u64; in jit_compile()
582 ebpf::LD_B_REG => self.emit_load(mem, OperandSize::S8, src, dst, insn.off as i32), in jit_compile()
583 ebpf::LD_H_REG => self.emit_load(mem, OperandSize::S16, src, dst, insn.off as i32), in jit_compile()
584 ebpf::LD_W_REG => self.emit_load(mem, OperandSize::S32, src, dst, insn.off as i32), in jit_compile()
585 ebpf::LD_DW_REG => self.emit_load(mem, OperandSize::S64, src, dst, insn.off as i32), in jit_compile()
588 ebpf::ST_B_IMM => { in jit_compile()
591 ebpf::ST_H_IMM => { in jit_compile()
594 ebpf::ST_W_IMM => { in jit_compile()
597 ebpf::ST_DW_IMM => { in jit_compile()
602 ebpf::ST_B_REG => self.emit_store(mem, OperandSize::S8, src, dst, insn.off as i32), in jit_compile()
603 ebpf::ST_H_REG => self.emit_store(mem, OperandSize::S16, src, dst, insn.off as i32), in jit_compile()
604 ebpf::ST_W_REG => self.emit_store(mem, OperandSize::S32, src, dst, insn.off as i32), in jit_compile()
605 ebpf::ST_DW_REG => { in jit_compile()
608 ebpf::ST_W_XADD => unimplemented!(), in jit_compile()
609 ebpf::ST_DW_XADD => unimplemented!(), in jit_compile()
612 ebpf::ADD32_IMM => self.emit_alu32_imm32(mem, 0x81, 0, dst, insn.imm), in jit_compile()
613 ebpf::ADD32_REG => self.emit_alu32(mem, 0x01, src, dst), in jit_compile()
614 ebpf::SUB32_IMM => self.emit_alu32_imm32(mem, 0x81, 5, dst, insn.imm), in jit_compile()
615 ebpf::SUB32_REG => self.emit_alu32(mem, 0x29, src, dst), in jit_compile()
616 ebpf::MUL32_IMM in jit_compile()
617 | ebpf::MUL32_REG in jit_compile()
618 | ebpf::DIV32_IMM in jit_compile()
619 | ebpf::DIV32_REG in jit_compile()
620 | ebpf::MOD32_IMM in jit_compile()
621 | ebpf::MOD32_REG => { in jit_compile()
624 ebpf::OR32_IMM => self.emit_alu32_imm32(mem, 0x81, 1, dst, insn.imm), in jit_compile()
625 ebpf::OR32_REG => self.emit_alu32(mem, 0x09, src, dst), in jit_compile()
626 ebpf::AND32_IMM => self.emit_alu32_imm32(mem, 0x81, 4, dst, insn.imm), in jit_compile()
627 ebpf::AND32_REG => self.emit_alu32(mem, 0x21, src, dst), in jit_compile()
628 ebpf::LSH32_IMM => self.emit_alu32_imm8(mem, 0xc1, 4, dst, insn.imm as i8), in jit_compile()
629 ebpf::LSH32_REG => { in jit_compile()
633 ebpf::RSH32_IMM => self.emit_alu32_imm8(mem, 0xc1, 5, dst, insn.imm as i8), in jit_compile()
634 ebpf::RSH32_REG => { in jit_compile()
638 ebpf::NEG32 => self.emit_alu32(mem, 0xf7, 3, dst), in jit_compile()
639 ebpf::XOR32_IMM => self.emit_alu32_imm32(mem, 0x81, 6, dst, insn.imm), in jit_compile()
640 ebpf::XOR32_REG => self.emit_alu32(mem, 0x31, src, dst), in jit_compile()
641 ebpf::MOV32_IMM => self.emit_alu32_imm32(mem, 0xc7, 0, dst, insn.imm), in jit_compile()
642 ebpf::MOV32_REG => self.emit_mov(mem, src, dst), in jit_compile()
643 ebpf::ARSH32_IMM => self.emit_alu32_imm8(mem, 0xc1, 7, dst, insn.imm as i8), in jit_compile()
644 ebpf::ARSH32_REG => { in jit_compile()
648 ebpf::LE => {} // No-op in jit_compile()
649 ebpf::BE => { in jit_compile()
673 ebpf::ADD64_IMM => self.emit_alu64_imm32(mem, 0x81, 0, dst, insn.imm), in jit_compile()
674 ebpf::ADD64_REG => self.emit_alu64(mem, 0x01, src, dst), in jit_compile()
675 ebpf::SUB64_IMM => self.emit_alu64_imm32(mem, 0x81, 5, dst, insn.imm), in jit_compile()
676 ebpf::SUB64_REG => self.emit_alu64(mem, 0x29, src, dst), in jit_compile()
677 ebpf::MUL64_IMM in jit_compile()
678 | ebpf::MUL64_REG in jit_compile()
679 | ebpf::DIV64_IMM in jit_compile()
680 | ebpf::DIV64_REG in jit_compile()
681 | ebpf::MOD64_IMM in jit_compile()
682 | ebpf::MOD64_REG => { in jit_compile()
685 ebpf::OR64_IMM => self.emit_alu64_imm32(mem, 0x81, 1, dst, insn.imm), in jit_compile()
686 ebpf::OR64_REG => self.emit_alu64(mem, 0x09, src, dst), in jit_compile()
687 ebpf::AND64_IMM => self.emit_alu64_imm32(mem, 0x81, 4, dst, insn.imm), in jit_compile()
688 ebpf::AND64_REG => self.emit_alu64(mem, 0x21, src, dst), in jit_compile()
689 ebpf::LSH64_IMM => self.emit_alu64_imm8(mem, 0xc1, 4, dst, insn.imm as i8), in jit_compile()
690 ebpf::LSH64_REG => { in jit_compile()
694 ebpf::RSH64_IMM => self.emit_alu64_imm8(mem, 0xc1, 5, dst, insn.imm as i8), in jit_compile()
695 ebpf::RSH64_REG => { in jit_compile()
699 ebpf::NEG64 => self.emit_alu64(mem, 0xf7, 3, dst), in jit_compile()
700 ebpf::XOR64_IMM => self.emit_alu64_imm32(mem, 0x81, 6, dst, insn.imm), in jit_compile()
701 ebpf::XOR64_REG => self.emit_alu64(mem, 0x31, src, dst), in jit_compile()
702 ebpf::MOV64_IMM => self.emit_load_imm(mem, dst, insn.imm as i64), in jit_compile()
703 ebpf::MOV64_REG => self.emit_mov(mem, src, dst), in jit_compile()
704 ebpf::ARSH64_IMM => self.emit_alu64_imm8(mem, 0xc1, 7, dst, insn.imm as i8), in jit_compile()
705 ebpf::ARSH64_REG => { in jit_compile()
711 ebpf::JA => self.emit_jmp(mem, target_pc), in jit_compile()
712 ebpf::JEQ_IMM => { in jit_compile()
716 ebpf::JEQ_REG => { in jit_compile()
720 ebpf::JGT_IMM => { in jit_compile()
724 ebpf::JGT_REG => { in jit_compile()
728 ebpf::JGE_IMM => { in jit_compile()
732 ebpf::JGE_REG => { in jit_compile()
736 ebpf::JLT_IMM => { in jit_compile()
740 ebpf::JLT_REG => { in jit_compile()
744 ebpf::JLE_IMM => { in jit_compile()
748 ebpf::JLE_REG => { in jit_compile()
752 ebpf::JSET_IMM => { in jit_compile()
756 ebpf::JSET_REG => { in jit_compile()
760 ebpf::JNE_IMM => { in jit_compile()
764 ebpf::JNE_REG => { in jit_compile()
768 ebpf::JSGT_IMM => { in jit_compile()
772 ebpf::JSGT_REG => { in jit_compile()
776 ebpf::JSGE_IMM => { in jit_compile()
780 ebpf::JSGE_REG => { in jit_compile()
784 ebpf::JSLT_IMM => { in jit_compile()
788 ebpf::JSLT_REG => { in jit_compile()
792 ebpf::JSLE_IMM => { in jit_compile()
796 ebpf::JSLE_REG => { in jit_compile()
802 ebpf::JEQ_IMM32 => { in jit_compile()
806 ebpf::JEQ_REG32 => { in jit_compile()
810 ebpf::JGT_IMM32 => { in jit_compile()
814 ebpf::JGT_REG32 => { in jit_compile()
818 ebpf::JGE_IMM32 => { in jit_compile()
822 ebpf::JGE_REG32 => { in jit_compile()
826 ebpf::JLT_IMM32 => { in jit_compile()
830 ebpf::JLT_REG32 => { in jit_compile()
834 ebpf::JLE_IMM32 => { in jit_compile()
838 ebpf::JLE_REG32 => { in jit_compile()
842 ebpf::JSET_IMM32 => { in jit_compile()
846 ebpf::JSET_REG32 => { in jit_compile()
850 ebpf::JNE_IMM32 => { in jit_compile()
854 ebpf::JNE_REG32 => { in jit_compile()
858 ebpf::JSGT_IMM32 => { in jit_compile()
862 ebpf::JSGT_REG32 => { in jit_compile()
866 ebpf::JSGE_IMM32 => { in jit_compile()
870 ebpf::JSGE_REG32 => { in jit_compile()
874 ebpf::JSLT_IMM32 => { in jit_compile()
878 ebpf::JSLT_REG32 => { in jit_compile()
882 ebpf::JSLE_IMM32 => { in jit_compile()
886 ebpf::JSLE_REG32 => { in jit_compile()
891 ebpf::CALL => { in jit_compile()
909 ebpf::TAIL_CALL => { in jit_compile()
912 ebpf::EXIT => { in jit_compile()
913 if insn_ptr != prog.len() / ebpf::INSN_SIZE - 1 { in jit_compile()
941 self.emit_alu64_imm32(mem, 0x81, 0, RSP, ebpf::STACK_SIZE as i32); in jit_compile()
987 helpers: &HashMap<u32, ebpf::Helper>, in new()