Пример #1
0
        public ArmRegisterCollection CurrentRegisters()
        {
            // Combine all relevant register values into a complete register collection
            ArmRegisterCollection currentBank = CurrentBank;

            // Standard regs
            ArmRegisterCollection ret = CreateCollection(TArmRegisterBank.ETypeUnknown);

            foreach (ArmRegister reg in currentBank)
            {
                ret.Add(reg.OriginalName, reg.Value);
            }

            // Co-processor
            ArmRegisterCollection cop = this[TArmRegisterBank.ETypeCoProcessor];

            foreach (ArmRegister reg in cop)
            {
                ret.Add(reg.OriginalName, reg.Value);
            }

            // Exception
            ArmRegisterCollection exc = this[TArmRegisterBank.ETypeException];

            foreach (ArmRegister reg in exc)
            {
                ret.Add(reg.OriginalName, reg.Value);
            }

            return(ret);
        }
 public void Copy(ArmRegisterCollection aCollection)
 {
     foreach (ArmRegister reg in aCollection)
     {
         Add(reg.OriginalName, reg.Value);
     }
 }
Пример #3
0
 public ArmRegister this[TArmRegisterBank aBank, TArmRegisterType aType]
 {
     get
     {
         ArmRegisterCollection bank = this[aBank];
         return(bank[aType]);
     }
 }
Пример #4
0
 public ArmRegister this[TArmRegisterBank aBank, string aName]
 {
     get
     {
         ArmRegisterCollection bank = this[aBank];
         return(bank[aName]);
     }
 }
Пример #5
0
 public ArmRegisterCollection this[TArmRegisterBank aBank]
 {
     get
     {
         ArmRegisterCollection ret = iBanks[aBank];
         return(ret);
     }
 }
 public ArmRegisterCollection(ArmRegisterCollection aCopy)
     : this(aCopy.Bank, aCopy.iLinkedWith)
 {
     foreach (ArmRegister reg in aCopy)
     {
         ArmRegister copy = new ArmRegister(reg);
         DoAdd(copy);
     }
 }
Пример #7
0
        private ArmRegisterCollection CreateCollection(TArmRegisterBank aBank, ArmRegisterCollection aLinkedWith)
        {
            ArmRegisterCollection ret = null;

            //
            if (iBackingStore != null)
            {
                ret = iBackingStore.ARMBSCreate(aBank, aLinkedWith);
            }
            else
            {
                ret = new ArmRegisterCollection(aBank, aLinkedWith);
            }
            //
            return(ret);
        }
Пример #8
0
        private ArmRegisterCollection AddBank(TArmRegisterBank aBank, ArmRegisterCollection aLinkedWith, params TArmRegisterType[] aExtraRegs)
        {
            ArmRegisterCollection regSet = CreateCollection(aBank, aLinkedWith);

            iBanks.Add(aBank, regSet);

            // Create bank specific registers
            string bankName = ArmRegisterBankUtils.BankAsString(aBank);

            regSet.Add("R13_" + bankName, 0);
            regSet.Add("R14_" + bankName, 0);
            regSet.Add("SPSR_" + bankName, 0);

            // Create custom registers
            foreach (TArmRegisterType custom in aExtraRegs)
            {
                string name = ArmRegister.GetTypeName(custom) + "_" + bankName;
                regSet.Add(name, 0);
            }

            return(regSet);
        }
Пример #9
0
        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
        {
            SortedList <string, ArmRegister> entries = new SortedList <string, ArmRegister>();

            // Get specific entries - we always take all of these
            foreach (KeyValuePair <TArmRegisterBank, ArmRegisterCollection> kvp in iBanks)
            {
                ArmRegisterCollection regs = kvp.Value;
                foreach (ArmRegister reg in regs)
                {
                    string key = reg.Value.ToString("x8") + "_" + reg.OriginalName;
                    if (!entries.ContainsKey(key))
                    {
                        entries.Add(key, reg);
                    }
                }
            }

            // Now we can iterate...
            foreach (ArmRegister entry in entries.Values)
            {
                yield return(entry);
            }
        }
 public ArmRegisterCollection(TArmRegisterBank aBank, ArmRegisterCollection aLinkedWith)
 {
     iBank       = aBank;
     iLinkedWith = aLinkedWith;
 }
Пример #11
0
        public void Clear()
        {
            iBanks.Clear();

            // Common registers
            ArmRegisterCollection common = CreateCollection(TArmRegisterBank.ETypeCommon);

            common.AddMany(TArmRegisterType.EArmReg_CPSR,
                           TArmRegisterType.EArmReg_00,
                           TArmRegisterType.EArmReg_01,
                           TArmRegisterType.EArmReg_02,
                           TArmRegisterType.EArmReg_03,
                           TArmRegisterType.EArmReg_04,
                           TArmRegisterType.EArmReg_05,
                           TArmRegisterType.EArmReg_06,
                           TArmRegisterType.EArmReg_07,
                           TArmRegisterType.EArmReg_PC
                           );
            AddBank(common);

            // User regs
            ArmRegisterCollection user = CreateCollection(TArmRegisterBank.ETypeUser, common);

            user.AddMany(TArmRegisterType.EArmReg_08,
                         TArmRegisterType.EArmReg_09,
                         TArmRegisterType.EArmReg_10,
                         TArmRegisterType.EArmReg_11,
                         TArmRegisterType.EArmReg_12,
                         TArmRegisterType.EArmReg_SP,
                         TArmRegisterType.EArmReg_LR
                         );
            AddBank(user);

            // These are all fairly normal. They have their own SP, LR and SPSR
            // The others are common.
            AddBank(TArmRegisterBank.ETypeAbort, user);
            AddBank(TArmRegisterBank.ETypeInterrupt, user);
            AddBank(TArmRegisterBank.ETypeSupervisor, user);
            AddBank(TArmRegisterBank.ETypeSystem, user);
            AddBank(TArmRegisterBank.ETypeUndefined, user);

            // FIQ is special - it has shadows of R8->12
            AddBank(TArmRegisterBank.ETypeFastInterrupt, common,
                    TArmRegisterType.EArmReg_08,
                    TArmRegisterType.EArmReg_09,
                    TArmRegisterType.EArmReg_10,
                    TArmRegisterType.EArmReg_11,
                    TArmRegisterType.EArmReg_12
                    );

            // Don't forget co-processor or exception regs
            ArmRegisterCollection exception = CreateCollection(TArmRegisterBank.ETypeException);

            exception.AddMany(TArmRegisterType.EArmReg_EXCCODE
                              );
            AddBank(exception);
            ArmRegisterCollection coprocessor = CreateCollection(TArmRegisterBank.ETypeCoProcessor);

            coprocessor.AddMany(TArmRegisterType.EArmReg_FAR,
                                TArmRegisterType.EArmReg_FSR
                                );
            AddBank(coprocessor);
        }
Пример #12
0
 private ArmRegisterCollection AddBank(ArmRegisterCollection aRegSet)
 {
     iBanks.Add(aRegSet.Bank, aRegSet);
     return(aRegSet);
 }
Пример #13
0
 private ArmRegisterCollection AddBank(TArmRegisterBank aBank, ArmRegisterCollection aLinkedWith)
 {
     TArmRegisterType[] empty = new TArmRegisterType[] { };
     return(AddBank(aBank, aLinkedWith, empty));
 }