Browse Source

Byteswap size is determined by immediate, not by offset

Instruction set according to:
https://github.com/iovisor/bpf-docs/blob/master/eBPF.md
Jan-Erik Rediger 8 years ago
parent
commit
9205b3924f
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/disassembler.rs

+ 2 - 2
src/disassembler.rs

@@ -22,11 +22,11 @@ fn alu_reg_str(name: &str, insn: &ebpf::Insn) -> String {
 
 #[inline]
 fn byteswap_str(name: &str, insn: &ebpf::Insn) -> String {
-    match insn.off {
+    match insn.imm {
         16 | 32 | 64 => {},
         _ => println!("[Disassembler] Warning: Invalid offset value for {} insn", name)
     }
-    format!("{}{} r{}", name, insn.off, insn.dst)
+    format!("{}{} r{}", name, insn.imm, insn.dst)
 }
 
 #[inline]