27 #define DEBUG_TYPE "bpf-disassembler"
38 ~BPFDisassembler()
override =
default;
51 return new BPFDisassembler(STI, Ctx);
67 BPF::R6, BPF::R7, BPF::R8, BPF::R9, BPF::R10, BPF::R11};
81 uint64_t
Address,
const void *Decoder) {
82 unsigned Register = (Insn >> 16) & 0xf;
84 unsigned Offset = (Insn & 0xffff);
90 #include "BPFGenDisassemblerTables.inc"
93 uint64_t &Size, uint64_t &Insn) {
96 if (Bytes.
size() < 8) {
102 Hi = (Bytes[0] << 24) | (Bytes[1] << 16) | (Bytes[2] << 0) | (Bytes[3] << 8);
103 Lo = (Bytes[4] << 0) | (Bytes[5] << 8) | (Bytes[6] << 16) | (Bytes[7] << 24);
125 case BPF::LD_imm64: {
126 if (Bytes.
size() < 16) {
131 uint64_t
Hi = (Bytes[12] << 0) | (Bytes[13] << 8) | (Bytes[14] << 16) | (Bytes[15] << 24);
141 case BPF::LD_IND_W: {
154 const void *Decoder);
DecodeStatus
Ternary decode status.
Superclass for all disassemblers.
static void RegisterMCDisassembler(Target &T, Target::MCDisassemblerCtorTy Fn)
RegisterMCDisassembler - Register a MCDisassembler implementation for the given target.
static MCOperand createReg(unsigned Reg)
Reg
All possible values of the reg field in the ModR/M byte.
Context object for machine code objects.
static DecodeStatus DecodeGPRRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t, const void *)
int decodeInstruction(InternalInstruction *insn, byteReader_t reader, const void *readerArg, dlog_t logger, void *loggerArg, const void *miiArg, uint64_t startLoc, DisassemblerMode mode)
Decode one instruction and store the decoding results in a buffer provided by the consumer...
static const unsigned GPRDecoderTable[]
DecodeStatus(* DecodeFunc)(MCInst &MI, unsigned insn, uint64_t Address, const void *Decoder)
static DecodeStatus readInstruction64(ArrayRef< uint8_t > Bytes, uint64_t Address, uint64_t &Size, uint64_t &Insn)
size_t size() const
size - Get the array size.
Instances of this class represent a single low-level machine instruction.
static MCDisassembler * createBPFDisassembler(const Target &T, const MCSubtargetInfo &STI, MCContext &Ctx)
Promote Memory to Register
void LLVMInitializeBPFDisassembler()
unsigned getOpcode() const
Target - Wrapper for Target specific information.
static DecodeStatus decodeMemoryOpValue(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
MCSubtargetInfo - Generic base class for all target subtargets.
Target & getTheBPFleTarget()
constexpr uint64_t Make_64(uint32_t High, uint32_t Low)
Make_64 - This functions makes a 64-bit integer from a high / low pair of 32-bit integers.
This class implements an extremely fast bulk output stream that can only output to a stream...
void addOperand(const MCOperand &Op)
Target & getTheBPFbeTarget()
MCDisassembler::DecodeStatus DecodeStatus
static MCOperand createImm(int64_t Val)
const MCOperand & getOperand(unsigned i) const
Target & getTheBPFTarget()