mirror of
https://gitlab.com/qemu-project/capstone.git
synced 2025-09-17 02:01:15 +08:00
MCInst_Init() is arch-independent
This commit is contained in:
14
MCInst.c
14
MCInst.c
@ -10,16 +10,12 @@
|
||||
|
||||
#define MCINST_CACHE (ARR_SIZE(mcInst->Operands) - 1)
|
||||
|
||||
void MCInst_Init(cs_struct *handle, MCInst *inst)
|
||||
void MCInst_Init(MCInst *inst)
|
||||
{
|
||||
switch(handle->arch) {
|
||||
default:
|
||||
memset(inst, 0, sizeof(*inst));
|
||||
break;
|
||||
case CS_ARCH_X86:
|
||||
inst->size = 0;
|
||||
break;
|
||||
}
|
||||
inst->OpcodePub = 0;
|
||||
inst->size = 0;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void MCInst_clear(MCInst *inst)
|
||||
|
4
MCInst.h
4
MCInst.h
@ -92,9 +92,9 @@ MCOperand *MCOperand_CreateImm1(MCInst *inst, int64_t Val);
|
||||
struct MCInst {
|
||||
unsigned Opcode;
|
||||
MCOperand Operands[34];
|
||||
unsigned OpcodePub;
|
||||
unsigned size; // number of operands
|
||||
cs_insn *flat_insn; // insn to be exposed to public
|
||||
unsigned OpcodePub;
|
||||
uint64_t address; // address of this insn
|
||||
cs_struct *csh; // save the main csh
|
||||
uint8_t x86_imm_size; // save immediate size to print immediate properly
|
||||
@ -105,7 +105,7 @@ struct MCInst {
|
||||
uint8_t x86_prefix[4];
|
||||
};
|
||||
|
||||
void MCInst_Init(cs_struct *handle, MCInst *inst);
|
||||
void MCInst_Init(MCInst *inst);
|
||||
|
||||
void MCInst_clear(MCInst *inst);
|
||||
|
||||
|
@ -538,7 +538,7 @@ void ARM_printInst(MCInst *MI, SStream *O, void *Info)
|
||||
if (MCRegisterClass_contains(MRC, Reg)) {
|
||||
MCInst NewMI;
|
||||
|
||||
MCInst_Init(MI->csh, &NewMI);
|
||||
MCInst_Init(&NewMI);
|
||||
MCInst_setOpcode(&NewMI, Opcode);
|
||||
|
||||
if (isStore)
|
||||
|
Reference in New Issue
Block a user