Exemplo n.º 1
0
        protected TranslationCPU(string cpuType, Machine machine, EndiannessEnum endianness)
        {
            if(cpuType == null)
            {
                throw new RecoverableException(new ArgumentNullException("cpuType"));
            }

            Endianness = endianness;
            PerformanceInMips = 100;
            currentCountThreshold = 5000;
            this.cpuType = cpuType;
            ClockSource = new BaseClockSource();
            ClockSource.NumberOfEntriesChanged += (oldValue, newValue) =>
            {
                if(oldValue > newValue)
                {
                    Misc.Swap(ref oldValue, ref newValue);
                }
                if(oldValue == 0 && newValue != 0)
                {
                    ClearTranslationCache();
                }
            };
            this.translationCacheSize = DefaultTranslationCacheSize;
            this.machine = machine;
            started = false;
            isHalted = false;
            translationCacheSync = new object();
            pumpingModeSync = new object();
            InitializeRegisters();
            InitInterruptEvents();
            Init();
            InitDisas();
        }
Exemplo n.º 2
0
 public static void LoadPeripheralsFromJSONFile(this Machine machine, String fileName)
 {
     if (!File.Exists(fileName))
     {
         throw new RecoverableException("Cannot load devices configuration from file {0} as it does not exist.".FormatWith(fileName));
     }
     new DevicesConfig(File.ReadAllText(fileName), machine);
 }
Exemplo n.º 3
0
        public CortexM(string cpuType, Machine machine, NVIC nvic, Endianess endianness = Endianess.LittleEndian) : base(cpuType, machine, endianness)
        {
            if(nvic == null)
            {
                throw new RecoverableException(new ArgumentNullException("nvic"));
            }

            this.nvic = nvic;
            nvic.AttachCPU(this);
            Init();
        }
Exemplo n.º 4
0
        public CortexM(string cpuType, Machine machine, NVIC nvic, Endianess endianness = Endianess.LittleEndian) : base(cpuType, machine, endianness)
        {
            if (nvic == null)
            {
                throw new RecoverableException(new ArgumentNullException("nvic"));
            }

            this.nvic = nvic;
            nvic.AttachCPU(this);
            Init();
        }
Exemplo n.º 5
0
        protected TranslationCPU(string cpuType, Machine machine, Endianess endianness)
        {
            if(cpuType == null)
            {
                throw new RecoverableException(new ArgumentNullException("cpuType"));
            }

            oldMaximumBlockSize = -1;

            Endianness = endianness;
            PerformanceInMips = 100;
            currentCountThreshold = 5000;
            this.cpuType = cpuType;
            DisableInterruptsWhileStepping = true;
            ClockSource = new BaseClockSource();
            ClockSource.NumberOfEntriesChanged += (oldValue, newValue) =>
            {
                if(oldValue > newValue)
                {
                    Misc.Swap(ref oldValue, ref newValue);
                }
                if(oldValue == 0 && newValue != 0)
                {
                    ClearTranslationCache();
                }
            };
            this.translationCacheSize = DefaultTranslationCacheSize;
            this.machine = machine;
            started = false;
            isHalted = false;
            translationCacheSync = new object();
            pagesAccessedByIo = new HashSet<long>();
            pauseGuard = new CpuThreadPauseGuard(this);
            InitializeRegisters();
            InitInterruptEvents();
            Init();
            InitDisas();
        }
Exemplo n.º 6
0
 public PowerPc(string cpuType, Machine machine, Endianess endianness = Endianess.BigEndian) : base(cpuType, machine, endianness)
 {
     irqSync = new object();
     machine.ObtainClockSource().AddClockEntry(
         new ClockEntry(long.MaxValue / 2, ClockEntry.FrequencyToRatio(this, 128000000), DecrementerHandler, false, Direction.Descending));
 }
Exemplo n.º 7
0
 public static void LoadPeripherals(this Machine machine, String fileName)
 {
     new DevicesConfig(fileName, machine);
 }
Exemplo n.º 8
0
        public static Dictionary <PeripheralTreeEntry, IEnumerable <IRegistrationPoint> > GetPeripheralsWithAllRegistrationPoints(this Machine machine)
        {
            var result = new Dictionary <PeripheralTreeEntry, IEnumerable <IRegistrationPoint> >();

            var peripheralEntries = machine.GetRegisteredPeripherals().ToArray();

            foreach (var entryList in peripheralEntries.OrderBy(x => x.Name).GroupBy(x => x.Peripheral))
            {
                var uniqueEntryList = entryList.DistinctBy(x => x.RegistrationPoint).ToArray();
                var entry           = uniqueEntryList.FirstOrDefault();
                if (entry != null)
                {
                    result.Add(entry, uniqueEntryList.Select(x => x.RegistrationPoint).ToList());
                }
            }

            return(result);
        }
Exemplo n.º 9
0
 public PowerPc(string cpuType, Machine machine, Endianess endianness = Endianess.BigEndian) : base(cpuType, machine, endianness)
 {
     irqSync = new object();
     machine.ObtainClockSource().AddClockEntry(
         new ClockEntry(long.MaxValue / 2, ClockEntry.FrequencyToRatio(this, 128000000), DecrementerHandler, false, Direction.Descending));
 }
Exemplo n.º 10
0
 public static void LoadPeripheralsFromJSONString(this Machine machine, String text)
 {
     new DevicesConfig(text, machine);
 }