Exemplo n.º 1
0
        internal unsafe static CString8 *GetBrandName()
        {
            UInt32 eax = 0, ebx = 0, ecx = 0, edx = 0;

            // Check is brand name is available
            // (ebx&0xff)==0 means it isn't
            Asm.XOR(R32.EAX, R32.EAX);
            Asm.INC(R32.EAX);
            Asm.CPUID();
            Asm.MOV(&ebx, R32.EBX);

            if ((ebx & 0xff) == 0)
            {
                return(CString8.Copy("Unknown"));
            }
            else
            {
                textBuffer->Clear();
                for (uint i = 0x80000002; i <= 0x80000004; i++)
                {
                    Asm.MOV(R32.EAX, &i);
                    Asm.CPUID();
                    Asm.MOV(&eax, R32.EAX);
                    Asm.MOV(&ebx, R32.EBX);
                    Asm.MOV(&edx, R32.EDX);
                    Asm.MOV(&ecx, R32.ECX);

                    textBuffer->AppendSubstring((byte *)&eax, 0, 4);
                    textBuffer->AppendSubstring((byte *)&ebx, 0, 4);
                    textBuffer->AppendSubstring((byte *)&ecx, 0, 4);
                    textBuffer->AppendSubstring((byte *)&edx, 0, 4);
                }
                return(CString8.Copy(textBuffer->buffer));
            }
        }
Exemplo n.º 2
0
        internal unsafe static void GetProcessorInfo(out UInt32 stepping, out UInt32 family, out UInt32 model, out ProcessorFeatureFlags flags)
        {
            UInt32 eax = 0, ebx = 0, ecx = 0, edx = 0;

            // Processor Info & Feature Bits
            Asm.XOR(R32.EAX, R32.EAX);
            Asm.INC(R32.EAX);
            Asm.CPUID();
            Asm.MOV(&eax, R32.EAX);
            Asm.MOV(&ebx, R32.EBX);
            Asm.MOV(&edx, R32.EDX);
            Asm.MOV(&ecx, R32.ECX);


            // Signature
            // 3:0   - Stepping
            // 7:4   - Base Model
            // 11:8  - Base Family
            // 13:12 - Reserved / Processor Type
            // 19:16 - Extended Model
            // 27:20 - Extended Family
            //
            // Family = Base Family + Extended Family
            // Model  = Base Model + (Extended Model << 4)
            stepping = (eax & 0x0F);
            model    = ((eax >> 4) & 0x0F) | ((eax >> 12) & 0x0F);
            family   = ((eax >> 8) & 0x0F) + ((eax >> 20) & 0x0F);


            // Miscellaneous Information
            // 7:0   - brand ID
            // 15:8  - CLFLUSH size
            // 23:16 - LogicalProcessorCount is the number of threads per
            //			CPU core times the number of CPU cores per processor
            // 31:24 - Initial local APIC physical ID.
            UInt32 miscellaneousInformation = ebx;             // not sure what to do with this...


            // Feature flags
            UInt64  flags64 = 0;
            UInt32 *flags32 = (UInt32 *)&flags64;

            *flags32 = edx;
            flags32 += sizeof(UInt32);
            *flags32 = ecx;
            flags = (ProcessorFeatureFlags)flags64;
        }
Exemplo n.º 3
0
        internal unsafe static CString8 *GetVendorName()
        {
            UInt32 ebx = 0, ecx = 0, edx = 0;

            // Vendor Name
            Asm.XOR(R32.EAX, R32.EAX);
            Asm.CPUID();
            Asm.MOV(&ebx, R32.EBX);
            Asm.MOV(&edx, R32.EDX);
            Asm.MOV(&ecx, R32.ECX);

            textBuffer->Clear();
            textBuffer->AppendSubstring((byte *)&ebx, 0, 4);
            textBuffer->AppendSubstring((byte *)&edx, 0, 4);
            textBuffer->AppendSubstring((byte *)&ecx, 0, 4);
            return(CString8.Copy(textBuffer->buffer));
        }
Exemplo n.º 4
0
        internal unsafe void SetIntel()
        {
            UInt32 eax = 0, ebx = 0, ecx = 0, edx = 0;
            uint   brand, family, model, cpu_signature, cpu_extfamily;

            Asm.XOR(R32.EAX, R32.EAX);
            Asm.INC(R32.EAX);
            Asm.CPUID();
            Asm.MOV(&eax, R32.EAX);
            Asm.MOV(&ebx, R32.EBX);
            Asm.MOV(&edx, R32.EDX);
            Asm.MOV(&ecx, R32.ECX);

            brand = ebx & 0x0F;

            cpu_signature = (eax);

            family = ((eax >> 8) & 0x0F);           // +((eax >> 20) & 0x0F);

            model = ((eax >> 4) & 0x0F);            // | ((eax >> 12) & 0x0F);

            cpu_extfamily = ((eax >> 20) & 0x0F);

            switch (family)
            {
            case 0x4:
                familyName = CString8.Copy("Intel Family 486");
                break;

            case 0x5:
                familyName = CString8.Copy("Intel Family 586");
                break;

            case 0x6:
                familyName = CString8.Copy("Intel Family 686");
                break;

            case 0x7:
                familyName = CString8.Copy("Intel Family Itanium");
                break;

            case 0xF:
                familyName = CString8.Copy("Intel Family Extended");
                break;

            default:
                familyName = CString8.Copy("Unknown Intel Family");
                break;
            }


            switch (brand)
            {
            case 0x00:
                brandName = CString8.Copy("brand ID not supported");
                switch (family)
                {
                case 0x4:
                    modelName = CString8.Copy("Intel 486");
                    break;

                case 0x5:
                    modelName = CString8.Copy("Intel 586");
                    break;

                case 0x6:
                    switch (model)
                    {
                    case 0x1:
                        modelName = CString8.Copy("Intel Pentium Pro");
                        break;

                    case 0x3:
                        modelName = CString8.Copy("Intel Pentium II");
                        break;

                    case 0x5:
                    case 0x6:
                        modelName = CString8.Copy("Intel Celeron");
                        break;

                    case 0x7:
                    case 0x8:
                    case 0xA:
                    case 0xB:
                        modelName = CString8.Copy("Intel Pentium III");
                        break;

                    case 0x9:
                    case 0xD:
                        modelName = CString8.Copy("Intel Pentium M");
                        break;

                    default:
                        modelName = CString8.Copy("Unknown Intel P6 Family");
                        break;
                    }
                    break;

                case 0x7:
                    modelName = CString8.Copy("Intel Itanium");
                    break;

                case 0xF:
                    switch (cpu_extfamily)
                    {
                    case 0x0:
                        modelName = CString8.Copy("Intel Pentium 4");
                        break;

                    case 0x1:
                        modelName = CString8.Copy("Intel Itanium 2");
                        break;
                    }
                    break;

                default:
                    modelName = CString8.Copy("Unknown Intel Model");
                    break;
                }
                break;

            case 0x01:
            case 0x0A:
            case 0x14:
                brandName = CString8.Copy("Intel Celeron");
                modelName = CString8.Copy("Intel Celeron");
                break;

            case 0x02:
            case 0x04:
                brandName = CString8.Copy("Pentium III");
                modelName = CString8.Copy("Pentium III");
                break;

            case 0x03:
                if (cpu_signature == 0x6B1)
                {
                    brandName = CString8.Copy("Intel Celeron");
                    modelName = CString8.Copy("Intel Celeron");
                }
                else
                {
                    brandName = CString8.Copy("Intel Pentium III Xeon");
                    modelName = CString8.Copy("Intel Pentium III Xeon");
                }
                break;

            case 0x05:
                brandName = CString8.Copy("Mobile Intel Pentium III-M");
                modelName = CString8.Copy("Mobile Intel Pentium III-M");
                break;

            case 0x07:
            case 0x0F:
            case 0x13:
            case 0x17:
                brandName = CString8.Copy("Mobile Intel Celeron");
                modelName = CString8.Copy("Mobile Intel Pentium III-M");
                break;

            case 0x08:
            case 0x09:
                brandName = CString8.Copy("Intel Pentium 4");
                modelName = CString8.Copy("Intel Pentium 4");
                break;

            case 0x0B:
                brandName = CString8.Copy("Intel Xeon");
                modelName = CString8.Copy("Intel Xeon");
                break;

            case 0x0C:
                brandName = CString8.Copy("Intel Xeon MP");
                modelName = CString8.Copy("Intel Xeon MP");
                break;

            case 0x0E:
                if (cpu_signature == 0xF13)
                {
                    brandName = CString8.Copy("Intel Xeon");
                    modelName = CString8.Copy("Intel Xeon");
                }
                else
                {
                    brandName = CString8.Copy("Mobile Intel Pentium 4");
                    modelName = CString8.Copy("Mobile Intel Pentium 4");
                }
                break;

            case 0x12:
                brandName = CString8.Copy("Intel Celeron M");
                modelName = CString8.Copy("Intel Celeron M");
                break;

            case 0x16:
                brandName = CString8.Copy("Intel Pentium M");
                modelName = CString8.Copy("Intel Pentium M");
                break;

            case 0x15:
            case 0x11:
                brandName = CString8.Copy("Mobile Intel");
                modelName = CString8.Copy("Mobile Intel");
                break;

            default:
                brandName = CString8.Copy("Unknown Intel");
                modelName = CString8.Copy("Unknown Intel");
                break;
            }
        }