示例#1
0
        public x86GRegLocation GetGRegister(int Size)
        {
            var Ret = (x86GRegLocation)null;

            if (NextMaybeHighByte)
            {
                if (Size == 1)
                {
                    var Reg = Options.GRegisters[GRegisterIndex];
                    Ret = new x86GRegLocation(Arch, Reg, 1, 1);
                }

                NextMaybeHighByte = false;
                GRegisterIndex++;
            }

            if (Ret == null)
            {
                if (GRegisterIndex >= Options.GRegisters.Length)
                {
                    return(null);
                }

                var Reg = Options.GRegisters[GRegisterIndex];
                if (Options.AllowPartRegisters && Size == 1 && Arch.IsGRegisterExists(GRegisterIndex, 1, 1))
                {
                    Ret = new x86GRegLocation(Arch, Reg, Size);
                    NextMaybeHighByte = true;
                }
                else
                {
                    Ret = new x86GRegLocation(Arch, Reg, Size);
                    GRegisterIndex++;
                }
            }

            if (StoredDataList != null)
            {
                StoredDataList.GRegisters.SetUsed(Ret);
            }

            return(Ret);
        }
示例#2
0
        private static x86MemoryLocation GetIndexerPosition(x86Architecture Arch, x86DataLocation Address,
                                                            x86GRegLocation AddressTempGReg, x86DataLocation Offset, x86GRegLocation OffsetTempGReg,
                                                            int Size, int Displacement = 0, byte Scale = 1)
        {
            if (Offset != null && Address.Size != Offset.Size)
            {
                throw new ApplicationException();
            }

            var Ret = new x86IndexLocation(Arch, 0, Size, null);

            if (!Ret.Add(Address, AddressTempGReg))
            {
                return(null);
            }

            if (Offset != null && !Ret.Add(Offset, OffsetTempGReg, Scale))
            {
                return(null);
            }

            Ret.Offset += Displacement;
            return(Ret);
        }
示例#3
0
 public void SetUsed(x86GRegLocation Pos)
 {
     SetUsed(Pos.Index, Pos.Mask);
 }
示例#4
0
 public bool IsFree(x86GRegLocation Pos)
 {
     return(UsedRegs[Pos.Index].IsFree(Pos.Mask));
 }
示例#5
0
 public void SetUsed(x86GRegLocation Pos)
 {
     GRegisters.SetUsed(Pos);
 }