示例#1
0
 public T32(T32_Info_type info, Dictionary <string, RelocableType> reloc)
 {
     t32          = new T32API();
     T32_type     = info;
     T32_reloc    = reloc;
     this.cpuType = getCPUType(info.subSystem);
 }
示例#2
0
        /// <summary>
        /// Controller definition
        /// </summary>
        /// <param name="ipAddress">IP address of the gateway for this protocol.
        /// Could be the IP address of the PLC you want to access.</param>
        /// <param name="path">Required for LGX, Optional for PLC/SLC/MLGX IOI path to access the PLC from the gateway.
        /// <para></para>Communication Port Type: 1- Backplane, 2- Control Net/Ethernet, DH+ Channel A, DH+ Channel B, 3- Serial
        /// <para></para>Slot number where cpu is installed: 0,1.. </param>
        /// <param name="cpuType">AB CPU models</param>
        public Controller(string ipAddress, string path, CPUType cpuType)
        {
            if (cpuType == CPUType.LGX && string.IsNullOrEmpty(path))
            {
                throw new ArgumentException("PortType and Slot must be specified for ControlLogix / CompactLogix processors");
            }

            IPAddress = ipAddress;
            Path      = path;
            CPUType   = cpuType;
        }
示例#3
0
        /// <summary>
        /// Controller definition
        /// </summary>
        /// <param name="ipAddress">IP address of the gateway for this protocol.
        /// Could be the IP address of the PLC you want to access.</param>
        /// <param name="path">Required for LGX, Optional for PLC/SLC/MLGX IOI path to access the PLC from the gateway.
        /// <para></para>Communication Port Type: 1- Backplane, 2- Control Net/Ethernet, DH+ Channel A, DH+ Channel B, 3- Serial
        /// <para></para>Slot number where cpu is installed: 0,1.. </param>
        /// <param name="cpuType">AB CPU models</param>
        public PlcController(string ipAddress, string path, CPUType cpuType)
        {
            if (cpuType == CPUType.LGX && string.IsNullOrEmpty(path))
            {
                throw new ArgumentException("PortType and Slot must be specified for ControlLogix / CompactLogix processors");
            }

            IPAddress = ipAddress;
            Path      = path;
            CPUType   = cpuType;

            _tagGroups.Add(_defaultGroupName, new TagGroup(this, _defaultGroupName));
        }
        public JsonResult SearchAdvanced(SearchAdvancedRequest search_request)
        {
            var result = context.Products.Join(context.ProductDetails, product => product.ProductId, product_detail => product_detail.ProductId, (product, product_detail) => new { product = product, product_detail = product_detail }).ToList();

            if (result != null)
            {
                foreach (var condition in search_request.Company)
                {
                    result = result.Where(x => x.product.Company.Equals(condition)).ToList();
                }

                CPUType cpu_type = new CPUType();
                foreach (var condition in search_request.CPU)
                {
                    result = result.Where(x => x.product_detail.Speed <= cpu_type.filterByCPU(condition).Max&& x.product_detail.Speed >= cpu_type.filterByCPU(condition).Min).ToList();
                }

                foreach (var condition in search_request.Memory)
                {
                    result = result.Where(x => x.product_detail.RAM.Equals(condition)).ToList();
                }

                foreach (var condition in search_request.Disc)
                {
                    result = result.Where(x => x.product_detail.Disc.Equals(condition)).ToList();
                }

                Capacity capacity = new Capacity();
                foreach (var condition in search_request.Capacity)
                {
                    result = result.Where(x => x.product_detail.Capacity <= capacity.filterByCapacity(condition).Max&& x.product_detail.Capacity >= capacity.filterByCapacity(condition).Min).ToList();
                }

                Monitorsize monitorsize = new Monitorsize();
                foreach (var condition in search_request.Monitorsize)
                {
                    result = result.Where(x => x.product_detail.Monitorsize <= monitorsize.filterByMonitorsize(condition).Max&& x.product_detail.Monitorsize >= monitorsize.filterByMonitorsize(condition).Min).ToList();
                }

                foreach (var condition in search_request.Core)
                {
                    result = result.Where(x => x.product_detail.Core.Equals(condition)).ToList();
                }
            }


            return(Json(result, JsonRequestBehavior.AllowGet));
        }
示例#5
0
        public CPU CreateCPU(CPUType type)
        {
            switch (type)
            {
            case CPUType.Core_i5:
                return(new Core_i5());

            case CPUType.Core_i7:
                return(new Core_i7());

            case CPUType.Ryzen3:
                return(new Ryzen3());

            case CPUType.Ryzen7:
                return(new Ryzen7());

            default:
                return(null);
            }
        }
示例#6
0
        public void EnableCPU(CPUType Type, bool Enabled)
        {
            if (Enabled != true)
            {
                throw new Exception("Disabling CPUs are not allowed.");
            }

            switch (Type)
            {
            // ARM9
            case CPUType.ARM9:
                Logger.WriteInfo("Enabling ARM9 CPU.");
                ARM9_Enabled = Enabled;
                break;

            // ARM11
            case CPUType.ARM11:
                Logger.WriteInfo("Enabling ARM11 CPU.");
                ARM11_Enabled = Enabled;
                break;
            }
        }
示例#7
0
 public T32(T32_Info_type info)
 {
     t32          = new T32API();
     T32_type     = info;
     this.cpuType = getCPUType(info.subSystem);
 }
示例#8
0
 public DefaultMachine(IReadable memory, CPUType type)
 {
     _ram = memory;
     _cpu = new CPU(this, type);
 }
示例#9
0
 public DefaultMachine(CPUType type) : this(new Memory(65536), type)
 {
 }
示例#10
0
        public static int CollectSystemInfo()
        {
            if (IsRunningOnMono() == true)
            {
                FoxEventLog.WriteEventLog("Running on Mono is not supported!", EventLogEntryType.Error);
                Console.WriteLine("Running on Mono is not supported!");
                return(1);
            }

            if (GetWineVersion() != "")
            {
                FoxEventLog.WriteEventLog("Running on Wine/CrossOver is not supported!", EventLogEntryType.Error);
                Console.WriteLine("Running on Wine/CrossOver is not supported!");
                return(1);
            }

            SysInfo = new BaseSystemInfo();
            SysInfo.RunningInWindowsPE = WindowsPE.IsRunningInWindowsPE;
            SysInfo.ComputerModel      = GetComputerModel();
            SysInfo.ComputerName       = SystemInformation.ComputerName;
            SysInfo.CPU                 = GetCPU().ToString();
            SysInfo.MachineID           = RegistryData.MachineID;
            SysInfo.IsTSE               = IsSystemTSE();
            SysInfo.OSName              = SysInfo.RunningInWindowsPE == true ? "Windows PE / MiniNT" : GetWindowsProduct();
            SysInfo.OSSuite             = GetOSSuite().ToString();
            SysInfo.OSVerBuild          = Environment.OSVersion.Version.Build;
            SysInfo.OSVerMaj            = Environment.OSVersion.Version.Major;
            SysInfo.OSVerMin            = Environment.OSVersion.Version.Minor;
            SysInfo.Language            = CultureInfo.InstalledUICulture.Name;
            SysInfo.DisplayLanguage     = CultureInfo.InstalledUICulture.EnglishName;
            SysInfo.RunningInHypervisor = ProgramAgent.CPP.IsInHypervisor();
            SysInfo.BIOS                = GetBIOSData();
            SysInfo.BIOSType            = ProgramAgent.CPP.FoxGetFirmwareType();
            GetProcessorInfos(out SysInfo.NumberOfProcessors, out SysInfo.NumberOfLogicalProcessors, out SysInfo.TotalPhysicalMemory);
            SysInfo.CPUName         = GetProcessorName();
            SysInfo.SecureBootState = GetSecureBootState();
            SysInfo.SystemRoot      = Environment.GetFolderPath(Environment.SpecialFolder.Windows);
            SysInfo.SUSID           = GetSUSID();

            try
            {
                SysInfo.IsMeteredConnection = MeteredConnection.IsMeteredConnection();
            }
            catch (Exception ee)
            {
                Debug.WriteLine(ee.ToString());
                SysInfo.IsMeteredConnection = null;
            }

            OSVERSIONINFOEX os = new OSVERSIONINFOEX();

            os.dwOSVersionInfoSize = Marshal.SizeOf(os);
            GetVersionEx(ref os);
            SysInfo.OSVerType = os.wSuiteMask;

#if DEBUG
            SysInfo.AgentVersion = VulpesBranding.AgentIdentifier + " [DEBUG] " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
#else
            SysInfo.AgentVersion = VulpesBranding.AgentIdentifier + " " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
#endif
            SysInfo.AgentVersionID = FoxVersion.Version;

            CPUType CPU = GetCPU();

            if (CPU != CPUType.Intel32 && CPU != CPUType.EM64T && CPU != CPUType.ARM64)
            {
                FoxEventLog.WriteEventLog("Only i386, AMD64 (EM64T) or ARM64 CPU are supported!", EventLogEntryType.Error);
                return(1);
            }

            if (CPU == CPUType.EM64T)
            {
                if (Is64Bit() == null)
                {
                    FoxEventLog.WriteEventLog("Cannot determine WOW state.", EventLogEntryType.Error);
                    return(1);
                }

                if (Is64Bit() == false && CPU == CPUType.EM64T)
                {
                    FoxEventLog.WriteEventLog("If you've a 64 bit CPU, then run this process as 64 bit!!!!", EventLogEntryType.Error);
                    return(1);
                }

                SysInfo.Is64Bit = Is64Bit().Value;
            }
            else
            {
                SysInfo.Is64Bit = false;
            }

            if (SysInfo.MachineID == "")
            {
                FoxEventLog.WriteEventLog("Cannot get machine ID.", EventLogEntryType.Error);
                return(1);
            }

            if (SysInfo.ComputerModel == null)
            {
                FoxEventLog.WriteEventLog("Cannot get Computer Model.", EventLogEntryType.Error);
                return(1);
            }

            PasswordID = RegistryData.MachinePassword;
            if (PasswordID == "")
            {
                FoxEventLog.WriteEventLog("Cannot get PassID.", EventLogEntryType.Error);
                return(1);
            }

            if (SysInfo.OSSuite == "Unknown")
            {
                FoxEventLog.WriteEventLog("Unknown OS Suite.", EventLogEntryType.Error);
                return(1);
            }

            if (RegistryData.UseOnPrem == true)
            {
                ServerURL = RegistryData.ServerURL;
            }
            else
            {
                ServerURL = ProgramAgent.VulpesURL;
            }

            if (ServerURL == "")
            {
                FoxEventLog.WriteEventLog("Cannot get Server URL.", EventLogEntryType.Error);
                return(1);
            }

            ProgramData = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
            if (ProgramData.EndsWith("\\") == false)
            {
                ProgramData += "\\";
            }
            ProgramData += "Fox\\SDC Agent\\";

            try
            {
                if (Directory.Exists(ProgramData) == false)
                {
                    Directory.CreateDirectory(ProgramData);
                }
            }
            catch
            {
                FoxEventLog.WriteEventLog("Error accessing " + ProgramData, EventLogEntryType.Error);
                return(1);
            }

            SysInfo.UCID       = UCID.GetUCID();
            SysInfo.LegacyUCID = UCID.GetUCIDLegacy();

            if (RegistryData.UCIDOverride != "")
            {
                string UUU = RegistryData.UCIDOverride.Trim().ToUpper();
                if (UUU.Length == 32)
                {
                    FoxEventLog.WriteEventLog("UCID Overriden from " + SysInfo.UCID + " to " + UUU, EventLogEntryType.Warning);
                    SysInfo.UCID = UUU;
                }
            }

            string SysInfoResumee = "";

            ContractID       = RegistryData.ContractID.Trim();
            ContractPassword = RegistryData.ContractPassword;

            SysInfoResumee += "System Info:\r\n";
            SysInfoResumee += "Agent:                 " + SysInfo.AgentVersion + "\r\n";
            SysInfoResumee += SysInfo.OSName + "\r\n";
            SysInfoResumee += "aka Windows NT         " + SysInfo.OSVerMaj.ToString() + "." + SysInfo.OSVerMin.ToString() + "." + SysInfo.OSVerBuild.ToString() + "\r\n";
            SysInfoResumee += "Suite:                 " + SysInfo.OSSuite + "\r\n";
            SysInfoResumee += "Language:              " + SysInfo.Language + " (" + SysInfo.DisplayLanguage + ")\r\n";
            SysInfoResumee += "Bits:                  " + (SysInfo.Is64Bit == true ? "64 bit" : "32 bit") + "\r\n";
            SysInfoResumee += "TSE:                   " + (SysInfo.IsTSE == false ? "no" : "yes") + "\r\n";
            SysInfoResumee += "OS Suite:              " + SysInfo.OSVerType + "\r\n";
            SysInfoResumee += "CPU:                   " + CPU.ToString() + "\r\n";
            SysInfoResumee += "Model:                 " + SysInfo.ComputerModel + "\r\n";
            SysInfoResumee += "BIOS:                  " + SysInfo.BIOS + "\r\n";
            SysInfoResumee += "Computername:          " + SysInfo.ComputerName + "\r\n";
            SysInfoResumee += "Machine ID:            " + SysInfo.MachineID + "\r\n";
            SysInfoResumee += "Server URL:            " + ServerURL + "\r\n";
            SysInfoResumee += "UCID:                  " + SysInfo.UCID + "\r\n";
            SysInfoResumee += "Program Data:          " + ProgramData + "\r\n";
            SysInfoResumee += "Running in Hypervisor: " + (SysInfo.RunningInHypervisor == false ? "no" : "yes") + "\r\n";

            FoxEventLog.WriteEventLog("Fox SDC Agent starting: " + SysInfoResumee, EventLogEntryType.Information);

            return(0);
        }
示例#11
0
 public void SetType(CPUType Type)
 {
     this.Type = Type;
 }
示例#12
0
 public CPUInstructionAttribute(byte opcode, int cycles)
 {
     OpCode  = opcode;
     Cycles  = cycles;
     CPUType = CPUType.NMOS | CPUType.CMOS;
 }
示例#13
0
 public CPU(CPUType cores)
 {
     _cores = cores;
 }
示例#14
0
 public LimitCPUTypeAttribute(CPUType type)
 {
     Type = type;
 }
示例#15
0
 public CPUInstructionAttribute(byte opcode, int cycles, CPUType type) : this(opcode, cycles)
 {
     CPUType = type;
 }
示例#16
0
        public CPUHandler()
        {
            ols = new Ols();

            // Check support library sutatus
            switch (ols.GetStatus())
            {
            case (uint)Ols.Status.NO_ERROR:
                break;

            case (uint)Ols.Status.DLL_NOT_FOUND:
                throw new System.ApplicationException("WinRing DLL_NOT_FOUND");

            case (uint)Ols.Status.DLL_INCORRECT_VERSION:
                throw new System.ApplicationException("WinRing DLL_INCORRECT_VERSION");

            case (uint)Ols.Status.DLL_INITIALIZE_ERROR:
                throw new System.ApplicationException("WinRing DLL_INITIALIZE_ERROR");
            }

            // Check WinRing0 status
            switch (ols.GetDllStatus())
            {
            case (uint)Ols.OlsDllStatus.OLS_DLL_NO_ERROR:
                break;

            case (uint)Ols.OlsDllStatus.OLS_DLL_DRIVER_NOT_LOADED:
                throw new System.ApplicationException("WinRing OLS_DRIVER_NOT_LOADED");

            case (uint)Ols.OlsDllStatus.OLS_DLL_UNSUPPORTED_PLATFORM:
                throw new System.ApplicationException("WinRing OLS_UNSUPPORTED_PLATFORM");

            case (uint)Ols.OlsDllStatus.OLS_DLL_DRIVER_NOT_FOUND:
                throw new System.ApplicationException("WinRing OLS_DLL_DRIVER_NOT_FOUND");

            case (uint)Ols.OlsDllStatus.OLS_DLL_DRIVER_UNLOADED:
                throw new System.ApplicationException("WinRing OLS_DLL_DRIVER_UNLOADED");

            case (uint)Ols.OlsDllStatus.OLS_DLL_DRIVER_NOT_LOADED_ON_NETWORK:
                throw new System.ApplicationException("WinRing DRIVER_NOT_LOADED_ON_NETWORK");

            case (uint)Ols.OlsDllStatus.OLS_DLL_UNKNOWN_ERROR:
                throw new System.ApplicationException("WinRing OLS_DLL_UNKNOWN_ERROR");
            }

            // CPU Check. Compare family, model, ext family, ext model. Ignore stepping/revision
            switch (GetCpuInfo() & 0xFFFFFFF0)
            {
            case 0x00800F10:     // CPU \ Zen \ Summit Ridge \ ZP - B0 \ 14nm
            case 0x00800F00:     // CPU \ Zen \ Summit Ridge \ ZP - A0 \ 14nm
                this.cpuType = CPUType.Summit_Ridge;
                break;

            case 0x00800F80:     // CPU \ Zen + \ Pinnacle Ridge \ 12nm
                this.cpuType = CPUType.Pinnacle_Ridge;
                break;

            case 0x00810F80:     // APU \ Zen + \ Picasso \ 12nm
                this.cpuType = CPUType.Picasso;
                break;

            case 0x00810F00:     // APU \ Zen \ Raven Ridge \ RV - A0 \ 14nm
            case 0x00810F10:     // APU \ Zen \ Raven Ridge \ 14nm
            case 0x00820F00:     // APU \ Zen \ Raven Ridge 2 \ RV2 - A0 \ 14nm
                this.cpuType = CPUType.Raven_Ridge;
                break;

            case 0x00870F10:     // CPU \ Zen2 \ Matisse \ MTS - B0 \ 7nm + 14nm I/ O Die
            case 0x00870F00:     // CPU \ Zen2 \ Matisse \ MTS - A0 \ 7nm + 14nm I/ O Die
                this.cpuType = CPUType.Matisse;
                break;

            case 0x00830F00:
            case 0x00830F10:     // CPU \ Epyc 2 \ Rome \ 7nm
                this.cpuType = CPUType.Rome;
                break;

            default:
                this.cpuType = CPUType.Unsupported;
#if DEBUG
                this.cpuType = CPUType.DEBUG;
#endif
                break;
            }

            //this.cpuType = CPUType.Matisse;

            // Get number of threads
            this.Threads = Environment.ProcessorCount;

            // Create mutex handles
            hMutexPci     = new Mutex(false, "Global\\Access_PCI");
            SettingsStore = new Settings();

            if (!SettingsStore.SettingsReset)
            {
                SettingsSaved = true;
            }

            if (cpuType != CPUType.Unsupported)
            {
                TrayIconAtStart = SettingsStore.TrayIconAtStart;
                ApplyAtStart    = SettingsStore.ApplyAtStart;
                P80Temp         = SettingsStore.P80Temp;

                for (int i = 0; i < NumPstates; i++)
                {
                    Pstate[i] = SettingsStore.Pstate[i];
                }

                for (int i = 0; i < 3; i++)
                {
                    BoostFreq[i] = SettingsStore.BoostFreq[i];
                }

                PstateOc = SettingsStore.PstateOc;

                ZenC6Core        = SettingsStore.ZenC6Core;
                ZenC6Package     = SettingsStore.ZenC6Package;
                ZenCorePerfBoost = SettingsStore.ZenCorePerfBoost;
                ZenOc            = SettingsStore.ZenOc;
                ZenPPT           = SettingsStore.ZenPPT;
                ZenTDC           = SettingsStore.ZenTDC;
                ZenEDC           = SettingsStore.ZenEDC;
                ZenScalar        = SettingsStore.ZenScalar;

                //PerformanceEnhancer = SettingsStore.PerformanceEnhancer;
                PerformanceBias = SettingsStore.PerformanceBias;

                // Safety check
                if (SettingsStore.LastState != 0)
                {
                    ShutdownUnclean = true;
                }

                SettingsStore.LastState = 0x01;
                SettingsStore.Save();

                // Get current P-states
                PstateAtStart   = new UInt64[NumPstates];
                PstateOcAtStart = 0x0;

                uint edx = 0, eax = 0;

                for (uint i = 0; i < NumPstates; i++)
                {
                    if (ols.RdmsrTx(MSR_PStateDef0 + i, ref eax, ref edx, (UIntPtr)(1)) == 1)
                    {
                        PstateAtStart[i] = ((UInt64)edx << 32) | eax;
                        if (Pstate[i] == 0)
                        {
                            Pstate[i] = PstateAtStart[i];
                        }
                    }
                }

                BoostFreq[0] = Pstate[0];
                BoostFreq[1] = Pstate[0];
                BoostFreq[2] = Pstate[2];

                PstateOcAtStart = PstateAtStart[0];
                if (PstateOc == 0)
                {
                    PstateOc = PstateOcAtStart;
                }

                // Get current C-state settings
                if (ols.RdmsrTx(MSR_PMGT_MISC, ref eax, ref edx, (UIntPtr)(1)) == 1)
                {
                    ZenC6PackageAtStart = Convert.ToBoolean(edx & 1);
                    if (SettingsStore.SettingsReset)
                    {
                        ZenC6Package = ZenC6PackageAtStart;
                    }
                }
                if (ols.RdmsrTx(MSR_CSTATE_CONFIG, ref eax, ref edx, (UIntPtr)(1)) == 1)
                {
                    bool CCR0_CC6EN = Convert.ToBoolean((eax >> 6) & 1);
                    bool CCR1_CC6EN = Convert.ToBoolean((eax >> 14) & 1);
                    bool CCR2_CC6EN = Convert.ToBoolean((eax >> 22) & 1);
                    if (CCR0_CC6EN && CCR1_CC6EN && CCR2_CC6EN)
                    {
                        ZenC6CoreAtStart = true;
                    }
                    else
                    {
                        ZenC6CoreAtStart = false;
                    }
                    if (SettingsStore.SettingsReset)
                    {
                        ZenC6Core = ZenC6CoreAtStart;
                    }
                }

                // Get current CPB
                if (ols.RdmsrTx(MSR_HWCR, ref eax, ref edx, (UIntPtr)(1)) == 1)
                {
                    ZenCorePerfBoostAtStart = !Convert.ToBoolean((eax >> 25) & 1);
                    if (SettingsStore.SettingsReset)
                    {
                        ZenCorePerfBoost = ZenCorePerfBoostAtStart;
                    }
                }

                // Get OC Mode
                if (ols.RdmsrTx(MSR_PStateStat, ref eax, ref edx, (UIntPtr)(1)) == 1)
                {
                    ZenOcAtStart = Convert.ToBoolean((eax >> 1) & 1);
                    if (SettingsStore.SettingsReset)
                    {
                        ZenOc = ZenOcAtStart;
                    }
                }

                // Get Tctl offset
                GetTctlOffset(ref TctlOffset);
            }
            else if (cpuType == CPUType.DEBUG)
            {
                Pstate[0]               = Convert.ToUInt64("80000000000408A0", 16); //unchecked((UInt64)((1 & 1) << 63 | (0x10 & 0xFF) << 14 | (0x08 & 0xFF) << 8 | 0xA0 & 0xFF));
                Pstate[1]               = Convert.ToUInt64("8000000000080A90", 16); //unchecked((UInt64)((1 & 1) << 63 | (0x20 & 0xFF) << 14 | (0x0A & 0xFF) << 8 | 0x90 & 0xFF));
                Pstate[2]               = Convert.ToUInt64("8000000000100C80", 16); //unchecked((UInt64)((1 & 1) << 63 | (0x30 & 0xFF) << 14 | (0x0C & 0xFF) << 8 | 0x80 & 0xFF));
                BoostFreq[0]            = Pstate[0];
                BoostFreq[1]            = Pstate[0];
                BoostFreq[2]            = Pstate[2];
                PstateOc                = Pstate[0];
                ZenC6Core               = false;
                ZenC6CoreAtStart        = false;
                ZenC6Package            = false;
                ZenC6PackageAtStart     = false;
                ZenCorePerfBoost        = true;
                ZenCorePerfBoostAtStart = true;
                ZenOc        = false;
                ZenOcAtStart = false;
                TctlOffset   = 0;
            }
        }
示例#17
0
 public CPU(string modelNumberName, sbyte cores, double gHz, CPUType Type)
     : base(modelNumberName, Type.ToString())
 {
     this.Cores = cores;
     this.GHz   = gHz;
 }