GNIDA.mediana.parse_mem_operand_32_64 C# (CSharp) Method

parse_mem_operand_32_64() static private method

static private parse_mem_operand_32_64 ( long origin_offset, long offset, INSTRUCTION &instr, int op_index, INTERNAL_DATA idata, DISMODE mode ) : UInt32
origin_offset long
offset long
instr INSTRUCTION
op_index int
idata INTERNAL_DATA
mode DISMODE
return UInt32
        static UInt32 parse_mem_operand_32_64(long origin_offset, long offset, ref INSTRUCTION instr, int op_index, INTERNAL_DATA idata, DISMODE mode)
        {
            UInt32 len = 0;

            if ((instr.flags & INSTR_FLAG_SIB)!=0)
            {
            instr.ops[op_index].value.addr.mod = (byte)(instr.modrm >> 0x6);
            instr.ops[op_index].value.addr.bas = (byte)(instr.sib & 0x7);
            instr.ops[op_index].value.addr.index = (byte)((instr.sib >> 3) & 0x7);
            instr.ops[op_index].value.addr.scale = (byte)(1 << (instr.sib >> 0x6));

            if (mode == DISMODE.DISASSEMBLE_MODE_64 && idata.prefixes[PREF_REX_INDEX] != 0xFF)
            {
            if ((instr.rex & PREFIX_REX_B)!=0)
            {
                instr.ops[op_index].value.addr.bas |= REG_CODE_64;
                idata.is_rex_used = 1;
            }
            if ((instr.rex & PREFIX_REX_X)!=0)
            {
                instr.ops[op_index].value.addr.index |= REG_CODE_64;
                idata.is_rex_used = 1;
            }
            }
            len = get_disp(origin_offset, offset, ref instr, op_index, mode);
            get_mod_type_sib(ref instr, op_index);
            }
            else
            {
            instr.ops[op_index].value.addr.mod = (byte)(instr.modrm >> 0x6);
            instr.ops[op_index].value.addr.bas = (byte)(instr.modrm & 0x7);

            if (mode == DISMODE.DISASSEMBLE_MODE_64)
            {
            if ((idata.prefixes[PREF_REX_INDEX] != 0xFF) && ((instr.rex & PREFIX_REX_B)!=0))
            {
                instr.ops[op_index].value.addr.bas |= REG_CODE_64;
                idata.is_rex_used = 1;
            }

            if ( (instr.ops[op_index].value.addr.mod == 0x0) &&
                 ((instr.ops[op_index].value.addr.bas == REG_CODE_BP) ||
                  (instr.ops[op_index].value.addr.bas == REG_CODE_R13)) )
            {
                instr.ops[op_index].value.addr.bas = REG_CODE_IP;
            }
            }
            len = get_disp(origin_offset, offset, ref instr, op_index, mode);
            get_mod_type_modrm(ref instr, op_index);
            }
            get_seg(ref instr, op_index, idata.prefixes, mode);

            return len;
        }