예제 #1
0
        public override TargetAddress GetEffectiveAddress(TargetMemoryAccess memory)
        {
            if (!CallTarget.IsNull)
            {
                return(CallTarget);
            }

            Registers regs = memory.GetRegisters();

            long effective_displacement = Displacement;

            if (IndexRegister >= 0)
            {
                long index = regs [IndexRegister].GetValue();
                index *= 1 << SIB.Scale;
                effective_displacement += index;
            }

            TargetAddress effective_address;

            if (is_ip_relative)
            {
                effective_address = Address + InstructionSize;
            }
            else
            {
                effective_address = new TargetAddress(
                    memory.AddressDomain, regs [Register].GetValue());
            }

            effective_address += effective_displacement;

            if (DereferenceAddress)
            {
                effective_address = memory.ReadAddress(effective_address);
            }

            return(effective_address);
        }
예제 #2
0
        public override TargetAddress GetEffectiveAddress(TargetMemoryAccess memory)
        {
            if (!CallTarget.IsNull)
                return CallTarget;

            Registers regs = memory.GetRegisters ();

            long effective_displacement = Displacement;
            if (IndexRegister >= 0) {
                long index = regs [IndexRegister].GetValue ();
                index *= 1 << SIB.Scale;
                effective_displacement += index;
            }

            TargetAddress effective_address;
            if (is_ip_relative)
                effective_address = Address + InstructionSize;
            else
                effective_address = new TargetAddress (
                    memory.AddressDomain, regs [Register].GetValue ());

            effective_address += effective_displacement;

            if (DereferenceAddress)
                effective_address = memory.ReadAddress (effective_address);

            return effective_address;
        }