mirror of
https://github.com/capstone-engine/capstone.git
synced 2024-11-28 07:50:39 +00:00
cac94ccee5
* Basic changes of new arch - BPF * Define some constants * defined some API methods * Able to print MISC instruction * Follow Linux coding style * Ability to show ALU insn names * decode return * Add suite/MC/BPF * decode jump * decode store * decode load * print instruction done * try to implement BPF_reg_access * Implements explicit accessed registers and fix some tiny bugs * Fix unhandled ja case * Added BPF_REG_OFF do fix wrong display in jump class * Great I'm able to decode cBPF with eyes * Fix: misunderstood the 16-byte instruction's imm * Add ldxdw * Add extended-all.cs * Implements cstest/bpf_getdetail.c * Fix memory leak * Add BPF to fuzz * Implemented regs_read and regs_write * Fix missing write-access on ALU's dst * Updated cstool/, test_basic.c, test_detail.c, and test_iter.c * Updated docs * Fix type of cs_bpf#operands * Implements python bindings * Fix some bugs found by self code review * Remove dummy tests * remove typeof * Address comments * Fix MSVC's warnings and add test_bpf.py to bindings/python/Makefile * Fix: call is not offset
35 lines
702 B
C
35 lines
702 B
C
/* Capstone Disassembly Engine */
|
|
/* BPF Backend by david942j <david942j@gmail.com>, 2019 */
|
|
|
|
#ifdef CAPSTONE_HAS_BPF
|
|
|
|
#include "BPFDisassembler.h"
|
|
#include "BPFInstPrinter.h"
|
|
#include "BPFMapping.h"
|
|
#include "BPFModule.h"
|
|
|
|
cs_err BPF_global_init(cs_struct *ud)
|
|
{
|
|
ud->printer = BPF_printInst;
|
|
ud->reg_name = BPF_reg_name;
|
|
ud->insn_id = BPF_get_insn_id;
|
|
ud->insn_name = BPF_insn_name;
|
|
ud->group_name = BPF_group_name;
|
|
#ifndef CAPSTONE_DIET
|
|
ud->reg_access = BPF_reg_access;
|
|
#endif
|
|
ud->disasm = BPF_getInstruction;
|
|
|
|
return CS_ERR_OK;
|
|
}
|
|
|
|
cs_err BPF_option(cs_struct *handle, cs_opt_type type, size_t value)
|
|
{
|
|
if (type == CS_OPT_MODE)
|
|
handle->mode = (cs_mode)value;
|
|
|
|
return CS_ERR_OK;
|
|
}
|
|
|
|
#endif
|