class Casm_tiny { public: enum { E_INS_BL = 0, E_INS_BLX = 1, E_INS_BW = 2, E_INS_MAX, };

public: Casm_tiny(); ~Casm_tiny();

typedef uint32_t (Casm_tiny::*gen_code_cb)(uint32_t, uint32_t);
typedef uint32_t (Casm_tiny::*check_code_cb)(uint32_t);
typedef uint32_t (Casm_tiny::*get_func_cb)(uint32_t, uint32_t);

struct asm_ins_pro_t
{
    int8_t           ins_dsc[10];
    gen_code_cb      gen_code;
    check_code_cb    check_code;
    get_func_cb      get_func;
};

bool asm_tiny_proc(uint32_t old_pos, uint32_t new_pos, uint32_t len);

private: asm_ins_pro_t m_ins_pro[E_INS_MAX] = { {"BL", &Casm_tiny::gen_code_bl, &Casm_tiny::check_code_bl, &Casm_tiny::get_func_bl}, {"BLX", &Casm_tiny::gen_code_blx, &Casm_tiny::check_code_blx, &Casm_tiny::get_func_blx}, {"BW", &Casm_tiny::gen_code_bw, &Casm_tiny::check_code_bw, &Casm_tiny::get_func_bw} };

uint32_t gen_code_bl(uint32_t, uint32_t);
uint32_t check_code_bl(uint32_t);
uint32_t get_func_bl(uint32_t, uint32_t);

uint32_t gen_code_blx(uint32_t, uint32_t);
uint32_t check_code_blx(uint32_t);
uint32_t get_func_blx(uint32_t, uint32_t);

uint32_t gen_code_bw(uint32_t, uint32_t);
uint32_t check_code_bw(uint32_t);
uint32_t get_func_bw(uint32_t, uint32_t);

};

Casm_tiny::Casm_tiny() {

}

bool Casm_tiny::asm_tiny_proc(uint32_t old_pos, uint32_t new_pos, uint32_t len) { // Call m_ins_pro functions using the appropriate enum value uint32_t result = (this->*m_ins_pro[E_INS_BL].gen_code)(old_pos, new_pos); result = (this->*m_ins_pro[E_INS_BLX].check_code)(result); result = (this->*m_ins_pro[E_INS_BW].get_func)(result, len); return true; }

Casm_tiny::~Casm_tiny() { // Destructor implementation }

uint32_t Casm_tiny::gen_code_bl(uint32_t, uint32_t) { // gen_code_bl implementation return 0; }

uint32_t Casm_tiny::check_code_bl(uint32_t) { // check_code_bl implementation return 0; }

uint32_t Casm_tiny::get_func_bl(uint32_t, uint32_t) { // get_func_bl implementation return 0; }

uint32_t Casm_tiny::gen_code_blx(uint32_t, uint32_t) { // gen_code_blx implementation return 0; }

uint32_t Casm_tiny::check_code_blx(uint32_t) { // check_code_blx implementation return 0; }

uint32_t Casm_tiny::get_func_blx(uint32_t, uint32_t) { // get_func_blx implementation return 0; }

uint32_t Casm_tiny::gen_code_bw(uint32_t, uint32_t) { // gen_code_bw implementation return 0; }

uint32_t Casm_tiny::check_code_bw(uint32_t) { // check_code_bw implementation return 0; }

uint32_t Casm_tiny::get_func_bw(uint32_t, uint32_t) { // get_func_bw implementation return 0;

修改下面代码:完成m_ins_pro的初始化并在函数asm_tiny_proc中调用class Casm_tinypublic enum E_INS_BL = 0 E_INS_BLX = 1 E_INS_BW = 2 E_INS_MAX ;public Casm_tiny; ~Casm_tiny; t

原文地址: https://www.cveoy.top/t/topic/iTmp 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录