本文整理汇总了C#中DISMODE类的典型用法代码示例。如果您正苦于以下问题:C# DISMODE类的具体用法?C# DISMODE怎么用?C# DISMODE使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DISMODE类属于命名空间,在下文中一共展示了DISMODE类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: tq_I
public static UInt32 tq_I(ulong origin_offset, ulong offset, ref INSTRUCTION instr, int op_index, OPERAND_SIZE opsize, INTERNAL_DATA idata, DISMODE mode)
{
instr.ops[op_index].flags |= (byte)OP_TYPE.OPERAND_TYPE_IMM;
instr.ops[op_index].size = (ushort)opsize.size;
instr.ops[op_index].value.imm.size = (byte)opsize.size_in_stream;
instr.ops[op_index].value.imm .offset = (byte)(offset - origin_offset);
//instr.ops[op_index].value.imm.immab = assembly.Image.ReadBytes(offset, opsize.size_in_stream);
byte[] bt = assembly.ReadBytes(offset, (int)opsize.size_in_stream);
instr.ops[op_index].value.imm.imm64 = 0;
foreach (byte bb in bt.Reverse())
{
instr.ops[op_index].value.imm.imm64 <<= 8;
instr.ops[op_index].value.imm.imm64 += bb;
}
//!!!memcpy(&(instr.ops[op_index].value.imm.imm8), offset, opsize.size_in_stream);
//movsx(ref instr.ops[op_index].value.imm.immab, opsize.size_in_stream, 0x8);
return (byte)opsize.size_in_stream;
}
示例2: post_proc_cmpxchg8b
static UInt32 post_proc_cmpxchg8b(ulong origin_offset, ulong offset, ref INSTRUCTION instr, INTERNAL_DATA idata, DISMODE mode)
{
if ((idata.prefixes[PREF_REX_INDEX] != 0xFF) && ((instr.rex & PREFIX_REX_W)!=0))
{
idata.is_rex_used = 1;
instr.mnemonic = "cmpxchg16b";
instr.ops[0].size = (ushort)OP_SIZE.OPERAND_SIZE_128;
}
return 0;
}
示例3: post_proc_nop_pause
static UInt32 post_proc_nop_pause(ulong origin_offset, ulong offset, ref INSTRUCTION instr, INTERNAL_DATA idata, DISMODE mode)
{
if (idata.prefixes[PREF_REP_INDEX] == PREF_REPNZ_ID)
{
instr.id = ID_PAUSE;
instr.groups = GRP_CACHECT | GRP_SSE2;
idata.prefixes[PREF_REP_INDEX] = 0xFF;
instr.mnemonic ="pause";
}
return 0;
}
示例4: parse_mnemonic
//Parses instruction's mnemonic. If mnemonic is simple, it is just copied to
// struct INSTRUCTION. If mnemonic contains has multi mnemonic indicator (MM_INDICATOR)
// at first character then it depends on implicit operand's size. In this case the function
// calls get_instruction_opsize and builds choses mnemonic basing on result.
static void parse_mnemonic(OPCODE_DESCRIPTOR opcode, INSTRUCTION instr, INTERNAL_DATA idata, DISMODE mode)
{
if ((opcode.mnemonic.value.Length>0) && (opcode.mnemonic.value[0] != MM_INDICATOR))
{
instr.mnemonic = opcode.mnemonic.value;
}
else
{
get_instruction_opsize(opcode.mnemonic, instr, idata, mode);
instr.mnemonic = opcode.mnemonic.values[bsr(instr.opsize) - 1];
}
}
示例5: parse_rm_operand
//Parses operand accordingly to MODRM value.
static UInt32 parse_rm_operand(ulong origin_offset, ulong offset, ref INSTRUCTION instr, int op_index, OPERAND_SIZE opsize, ref INTERNAL_DATA idata, DISMODE mode)
{
UInt32 len = 0;
if ((instr.modrm & 0xC0) == 0xC0)
{
create_genreg_operand(ref instr, op_index, (byte)(instr.modrm & 0x7), opsize.size, PREFIX_REX_B, ref idata, mode);
}
else
{
len = parse_mem_operand(origin_offset, offset, ref instr, op_index, opsize, idata, mode);
}
return len;
}
示例6: get_seg
//Calculates segment for memory addressing operands accordingly to
//mode, segment override prefixes and address base register.
static void get_seg(ref INSTRUCTION instr, int op_index, byte[] prefixes, DISMODE mode)
{
if (prefixes[PREF_SEG_INDEX] == 0xFF)
{
if (mode == DISMODE.DISASSEMBLE_MODE_64)
{
instr.ops[op_index].value.addr.seg = SREG_CODE_CS;
}
else
{
if ( (instr.ops[op_index].value.addr.mod & ADDR_MOD_BASE)==0 )
{
instr.ops[op_index].value.addr.seg = SREG_CODE_DS;
}
else
{
if ((instr.ops[op_index].value.addr.bas != REG_CODE_BP) && (instr.ops[op_index].value.addr.bas != REG_CODE_SP))
{
instr.ops[op_index].value.addr.seg = SREG_CODE_DS;
}
else
{
instr .ops[op_index].value.addr.seg = SREG_CODE_SS;
}
}
}
}
else
{
if (mode != DISMODE.DISASSEMBLE_MODE_64)
{
instr.ops[op_index].value.addr.seg = sregs[prefixes[PREF_SEG_INDEX]];
}
else
{
if (prefixes[PREF_SEG_INDEX] == PREF_FS_ID || prefixes[PREF_SEG_INDEX] == PREF_GS_ID)
{
instr.ops[op_index].value.addr.seg = sregs[prefixes[PREF_SEG_INDEX]];
}
else
{
instr.ops[op_index].value.addr.seg = SREG_CODE_CS;
}
}
}
}
示例7: parse_mem_operand_16
//Parses 16bit memory address operand.
static UInt32 parse_mem_operand_16(ulong origin_offset, ulong offset, ref INSTRUCTION instr, int op_index, DISMODE mode)
{
byte len;
int index;
instr.ops[op_index].value.addr.mod = (byte)(instr.modrm >> 0x6);
len = get_disp(origin_offset, offset, ref instr, op_index, mode);
index = (instr.modrm >> 0x3 & 0x18) | (instr.modrm & 0x7);
instr.ops[op_index].value.addr.seg = addrs_16bit[index].seg;
instr.ops[op_index].value.addr.mod = addrs_16bit[index].mod;
instr.ops[op_index].value.addr.bas = addrs_16bit[index].bas;
instr.ops[op_index].value.addr.index = addrs_16bit[index].index;
instr.ops[op_index].value.addr.scale = addrs_16bit[index].scale;
return len;
}
示例8: tq_T
public static UInt32 tq_T(ulong origin_offset, ulong offset, ref INSTRUCTION instr, int op_index, OPERAND_SIZE opsize, INTERNAL_DATA idata, DISMODE mode)
{
create_reg_operand(ref instr, op_index, REG_TYPE.REG_TYPE_TR, (byte)((instr.modrm >> 0x3) & 0x7), opsize.size);
return 0x0;
}
示例9: tq_V
public static UInt32 tq_V(ulong origin_offset, ulong offset, ref INSTRUCTION instr, int op_index, OPERAND_SIZE opsize, INTERNAL_DATA idata, DISMODE mode)
{
create_xmmreg_operand(ref instr, op_index, (byte)((instr.modrm >> 0x3) & 0x7), opsize.size, PREFIX_REX_R, ref idata, mode);
return 0;
}
示例10: tq_rSP
public static UInt32 tq_rSP(ulong origin_offset, ulong offset, ref INSTRUCTION instr, int op_index, OPERAND_SIZE opsize, INTERNAL_DATA idata, DISMODE mode)
{
create_genreg_operand(ref instr, op_index, REG_CODE_SP, opsize.size, PREFIX_REX_B, ref idata, mode);
return 0x0;
}
示例11: tq_SS
public static UInt32 tq_SS(ulong origin_offset, ulong offset, ref INSTRUCTION instr, int op_index, OPERAND_SIZE opsize, INTERNAL_DATA idata, DISMODE mode)
{
create_reg_operand(ref instr, op_index, REG_TYPE.REG_TYPE_SEG, SREG_CODE_SS, opsize.size);
return 0;
}
示例12: tq_R
public static UInt32 tq_R(ulong origin_offset, ulong offset, ref INSTRUCTION instr, int op_index, OPERAND_SIZE opsize, INTERNAL_DATA idata, DISMODE mode)
{
UInt32 res = parse_rm_operand(origin_offset, offset, ref instr, op_index, opsize, ref idata, mode);
if ((instr.modrm & 0xC0) != 0xC0)
{
idata.err = ERRS.ERR_RM_MEM;//error: rm encodes memory.
}
return res;
}
示例13: tq_O
public static UInt32 tq_O(ulong origin_offset, ulong offset, ref INSTRUCTION instr, int op_index, OPERAND_SIZE opsize, INTERNAL_DATA idata, DISMODE mode)
{
UInt32 res;
res = instr.addrsize;
instr.ops[op_index].flags |= (byte) OP_TYPE.OPERAND_TYPE_MEM;
instr.ops[op_index].size = (ushort)opsize.size;
instr.ops[op_index].value.addr.mod = ADDR_MOD_DISP;
//instr.disp.value.ab = assembly.Image.ReadBytes(offset, instr.addrsize);
byte[] bt = assembly.ReadBytes(offset, instr.addrsize);
instr.disp.value.d64 = 0;
foreach (byte bb in bt.Reverse())
{
instr.disp.value.d64 <<= 8;
instr.disp.value.d64 += bb;
}
get_seg(ref instr, op_index, idata.prefixes, mode);
return res;
}
示例14: tq_J
public static UInt32 tq_J(ulong origin_offset, ulong offset, ref INSTRUCTION instr, int op_index, OPERAND_SIZE opsize, INTERNAL_DATA idata, DISMODE mode)
{
instr.ops[op_index].flags |= OPERAND_FLAG_REL;
return tq_I(origin_offset, offset, ref instr, op_index, opsize, idata, mode);
}
示例15: get_disp
//Calculates displacement's size and copies it to struct DISPLACEMENT.
static byte get_disp(ulong origin_offset, ulong offset, ref INSTRUCTION instr, int op_index, DISMODE mode)
{
byte len = 0;
switch(instr.ops[op_index].value.addr.mod)
{
case 0x0:
if (instr.ops[op_index].value.addr.bas == REG_CODE_BP)
len = instr.addrsize;
else
len = 0x0;
break;
case 0x1:
len = 0x1;
break;
case 0x2:
len = instr.addrsize;
break;
}
if (len == 8)
len = 4;
instr.disp.size = len;
if (len!=0)
{
//instr.disp.value.ab = assembly.Image.ReadBytes(offset, len);
byte[] bt = assembly.ReadBytes(offset, len);
instr.disp.value.d64 = 0;
foreach (byte bb in bt.Reverse())
{
instr.disp.value.d64 <<= 8;
instr.disp.value.d64 += bb;
}
movsx(ref instr.disp.value.d64, len, 0x8);
instr.disp.offset = (byte)(offset - origin_offset);
}
return len;
}