capstone-engine / capstone

Capstone disassembly/disassembler framework for ARM, ARM64 (ARMv8), Alpha, BPF, Ethereum VM, HPPA, LoongArch, M68K, M680X, Mips, MOS65XX, PPC, RISC-V(rv32G/rv64G), SH, Sparc, SystemZ, TMS320C64X, TriCore, Webassembly, XCore and X86.
http://www.capstone-engine.org
7.51k stars 1.54k forks source link

Add eBPF bswap16/32/64 instruction #2323

Closed chengshuyi closed 5 months ago

chengshuyi commented 5 months ago

Your checklist for this pull request

Detailed description

Supports bswap16/32/64 instructions. Different from the le or be instructions, the opcode of bswap is BPF_ALU64.

// copy from: https://docs.kernel.org/bpf/standardization/instruction-set.html
BPF_ALU64 | BPF_TO_LE | BPF_END with imm = 16/32/64 means:

  dst = bswap16(dst)
  dst = bswap32(dst)
  dst = bswap64(dst)

...

Test plan

test case in suite/cs_test/issues.cs

...

Closing issues

None ...