Пример #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));
            }
        }
Пример #2
0
        public static void Execute(CommandExecutionContext *context)
        {
            CommandExecutionAttemptResult result = Prompter.CommandTable->HandleLine(context->parameters, false, true);

            if (result == CommandExecutionAttemptResult.NotFound)
            {
                int       indexOfSpace = context->parameters->IndexOf(" ");
                CString8 *tempStr;
                if (indexOfSpace >= 0)
                {
                    tempStr = context->parameters->Substring(0, indexOfSpace);
                }
                else
                {
                    tempStr = CString8.Copy(context->parameters);
                }

                TextMode.Write("No command '");
                TextMode.Write(tempStr);
                TextMode.WriteLine("' is available to retrieve help for.");
                TextMode.WriteLine(CommandTableHeader.inform_USE_HELP_COMMANDS);

                CString8.DISPOSE(tempStr);
                return;
            }
            if (result == CommandExecutionAttemptResult.BlankEntry)
            {
                ADC.MemoryUtil.Call((void *)Stubs.GetFunctionPointer(lblGetHelp), (void *)context);
            }
        }
Пример #3
0
        private static void DispatchBuffer()
        {
            CString8 *bufferCopy = CString8.Copy(textBuffer->buffer);

            Diagnostics.Assert(bufferCopy != null, "Prompter::DispatchBuffer(): INSANITY CHECK: CString8.Copy(byte*) returned NULL");
            Prompter.QueueLine(bufferCopy);
            CString8.DISPOSE(bufferCopy);
            textBuffer->Clear();
        }
Пример #4
0
        public static void Pulse()
        {
            if (running == false)
            {
                return;
            }

            CString8 *line = DequeueLine();

            if (line != null)
            {
                HandleLine(line);
                CString8.DISPOSE(line);
            }
        }
Пример #5
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));
        }
Пример #6
0
        public unsafe static void BootEntry(uint magic, uint pointer, uint kernelStart, uint kernelEnd)
        {
            // Initialize architecture-specific portion of the kernel
            Architecture.Setup();

            // Set up text mode display
            TextMode.Setup();

            TextMode.SetAttributes(TextColor.Yellow, TextColor.Black);
            TextMode.ClearScreen();
            TextMode.SetCursor(0, 0);

            // Write the banner
            DisplayBanner();

            StageMessage("Multiboot setup...");
            if (!Multiboot.Setup(magic, pointer, kernelStart, kernelEnd))
            {
                StageError("Error: multiboot loader required!");
                return;
            }

            kernelStartLoc = (void *)kernelStart;
            kernelEndLoc   = (void *)kernelEnd;

            StageMessage("Commandline setup...");
            CommandLine.Setup();

            StageMessage("PageAllocator setup...");
            PageAllocator.Setup(
                Multiboot.KernelAddress,
                Multiboot.KernelSize,
                Multiboot.UpperMemorySize + 1000);

            StageMessage("MemoryManager setup...");
            ADC.MemoryManager.Setup();

            StageMessage("Debug setup...");
            Debug.Setup();

            // Must be done after MemoryManager setup.
            StageMessage("Runtime setup...");
            ExceptionHandling.Setup();

            StageMessage("Event Dispatch setup...");
            SimpleEventDispatch.Setup();

            StageMessage("Device setup...");
            DeviceSystem.Boot.Start();
            Debug.Setup2();

            StageMessage("Diagnostic Tool setup...");
            DiagnosticTool.Server.Setup();

            StageMessage("Scheduler setup...");
            ThreadManager.Setup();

            StageMessage("File System setup...");
            FileSystem.Boot.Start();

            //StageMessage ("Clock setup...");
            Clock.Setup();

            StageMessage("Keymap setup...");
            KeyMap.Setup();

            StageMessage("Keyboard setup...");
            Keyboard.Setup();

            StageMessage("Console setup...");
            SharpOS.Kernel.Console.Setup();

            TextMode.SaveAttributes();
            TextMode.SetAttributes(TextColor.LightGreen, TextColor.Black);
            TextMode.WriteLine("");
            TextMode.WriteLine("Pinky: What are we gonna do tonight, Brain?");
            TextMode.WriteLine("The Brain: The same thing we do every night, Pinky - Try to take over the world!");
            TextMode.RestoreAttributes();

            //SharpOS.Kernel.Memory.PageAllocator.DumpInfo ();

#if KERNEL_TESTS
            // Testcases
            MemoryManager.__RunTests();
            ByteString.__RunTests();
            StringBuilder.__RunTests();
            CString8.__RunTests();
            PString8.__RunTests();
            InternalSystem.String.__RunTests();
            Runtime.__RunTests();
            Debug.COM1.WriteLine("Failed AOT Tests:");
            //SharpOS.Kernel.Tests.Wrapper.Run ();
            Debug.COM1.WriteLine();
            Debug.COM1.WriteLine("Kernel Tests:");
#endif

            /*
             * void* thread = ThreadManager.CreateThread(Stubs.GetFunctionPointer ("TEST"));
             * void* thread2 = ThreadManager.CreateThread(Stubs.GetFunctionPointer ("TEST2"));
             *
             * ThreadManager.ScheduleThread(thread);
             * ThreadManager.ScheduleThread(thread2);
             * ThreadManager.Enabled = true;
             */

            //Multiboot.WriteMultibootInfo();

            StageMessage("Shell setup...");
            SharpOS.Kernel.Shell.Prompter.Setup();
            SharpOS.Kernel.Shell.Prompter.Start();

            SetKernelStage(KernelStage.Diagnostics);

            // Infinite loop used to halt the processors
            //FIXME We must know on each processor the current thread runs on.
            //      Halt all other procs, then halt the current one.
            IProcessor[] procs     = Architecture.GetProcessors();
            int          procCount = Architecture.GetProcessorCount();
            while (stayInLoop)
            {
                for (int i = 0; i < procCount; i++)
                {
                    procs[i].Halt();
                }
            }
        }
Пример #7
0
        internal Processor(uint _index)
        {
            Asm.CLI();

            index = _index;

            bool haveCPU = HaveCPUID();

            if (!haveCPU)
            {
                archType   = ProcessorType.IA32;
                vendorName = CString8.Copy("Unknown");
                brandName  = CString8.Copy("Unknown");
                familyName = CString8.Copy("Unknown");
                modelName  = CString8.Copy("Unknown");
            }
            if (haveCPU)
            {
                UInt32 stepping;
                UInt32 family;
                UInt32 model;

                textBuffer = StringBuilder.CREATE((uint)(20));
                vendorName = GetVendorName();

                if (vendorName->Compare("GenuineIntel", 12) == 0)
                {
                    SetIntel();
                }
                else
                if (vendorName->Compare("AuthenticAMD", 12) == 0)
                {
                    SetAMD();
                }
                else
                {
                    brandName  = GetBrandName();
                    familyName = CString8.Copy("Not implemented yet");
                    modelName  = CString8.Copy("Not implemented yet");
                }

                GetProcessorInfo(out stepping, out family, out model, out featureFlags);

                if (0 != (featureFlags & ProcessorFeatureFlags.IA64))
                {
                    archType = ProcessorType.IA64;
                }
                else
                {
                    archType = ProcessorType.IA32;
                }

                ulong flags        = ((ulong)featureFlags) & ((ulong)ProcessorFeatureFlags.ReservedFlagsMask);
                uint  featureCount = MemoryUtil.BitCount(flags);

                features     = new ProcessorFeature[featureCount];
                featureCount = 0;

                // TODO: this could be improved upon if we had:
                //	constructor support
                //	enum.ToString support
                // etc.
                if (0 != (flags & (ulong)ProcessorFeatureFlags.FPU))
                {
                    features[featureCount] = new ProcessorFeature(); features[featureCount].FeatureName = ("FPU"); featureCount++;
                }
                if (0 != (flags & (ulong)ProcessorFeatureFlags.VME))
                {
                    features[featureCount] = new ProcessorFeature(); features[featureCount].FeatureName = ("VME"); featureCount++;
                }
                if (0 != (flags & (ulong)ProcessorFeatureFlags.DE))
                {
                    features[featureCount] = new ProcessorFeature(); features[featureCount].FeatureName = ("DE"); featureCount++;
                }
                if (0 != (flags & (ulong)ProcessorFeatureFlags.PSE))
                {
                    features[featureCount] = new ProcessorFeature(); features[featureCount].FeatureName = ("PSE"); featureCount++;
                }
                if (0 != (flags & (ulong)ProcessorFeatureFlags.TSC))
                {
                    features[featureCount] = new ProcessorFeature(); features[featureCount].FeatureName = ("TSC"); featureCount++;
                }
                if (0 != (flags & (ulong)ProcessorFeatureFlags.MSR))
                {
                    features[featureCount] = new ProcessorFeature(); features[featureCount].FeatureName = ("MSR"); featureCount++;
                }
                if (0 != (flags & (ulong)ProcessorFeatureFlags.PAE))
                {
                    features[featureCount] = new ProcessorFeature(); features[featureCount].FeatureName = ("PAE"); featureCount++;
                }
                if (0 != (flags & (ulong)ProcessorFeatureFlags.MCE))
                {
                    features[featureCount] = new ProcessorFeature(); features[featureCount].FeatureName = ("MCE"); featureCount++;
                }
                if (0 != (flags & (ulong)ProcessorFeatureFlags.CX8))
                {
                    features[featureCount] = new ProcessorFeature(); features[featureCount].FeatureName = ("CX8"); featureCount++;
                }
                if (0 != (flags & (ulong)ProcessorFeatureFlags.APIC))
                {
                    features[featureCount] = new ProcessorFeature(); features[featureCount].FeatureName = ("APIC"); featureCount++;
                }
                if (0 != (flags & (ulong)ProcessorFeatureFlags.SEP))
                {
                    features[featureCount] = new ProcessorFeature(); features[featureCount].FeatureName = ("SEP"); featureCount++;
                }
                if (0 != (flags & (ulong)ProcessorFeatureFlags.MTRR))
                {
                    features[featureCount] = new ProcessorFeature(); features[featureCount].FeatureName = ("MTRR"); featureCount++;
                }
                if (0 != (flags & (ulong)ProcessorFeatureFlags.PGE))
                {
                    features[featureCount] = new ProcessorFeature(); features[featureCount].FeatureName = ("PGE"); featureCount++;
                }
                if (0 != (flags & (ulong)ProcessorFeatureFlags.MCA))
                {
                    features[featureCount] = new ProcessorFeature(); features[featureCount].FeatureName = ("MCA"); featureCount++;
                }
                if (0 != (flags & (ulong)ProcessorFeatureFlags.CMOV))
                {
                    features[featureCount] = new ProcessorFeature(); features[featureCount].FeatureName = ("CMOV"); featureCount++;
                }
                if (0 != (flags & (ulong)ProcessorFeatureFlags.PAT))
                {
                    features[featureCount] = new ProcessorFeature(); features[featureCount].FeatureName = ("PAT"); featureCount++;
                }
                if (0 != (flags & (ulong)ProcessorFeatureFlags.PSE36))
                {
                    features[featureCount] = new ProcessorFeature(); features[featureCount].FeatureName = ("PSE36"); featureCount++;
                }
                if (0 != (flags & (ulong)ProcessorFeatureFlags.PSN))
                {
                    features[featureCount] = new ProcessorFeature(); features[featureCount].FeatureName = ("PSN"); featureCount++;
                }
                if (0 != (flags & (ulong)ProcessorFeatureFlags.CLFSH))
                {
                    features[featureCount] = new ProcessorFeature(); features[featureCount].FeatureName = ("CLFSH"); featureCount++;
                }
                if (0 != (flags & (ulong)ProcessorFeatureFlags.DTES))
                {
                    features[featureCount] = new ProcessorFeature(); features[featureCount].FeatureName = ("DTES"); featureCount++;
                }
                if (0 != (flags & (ulong)ProcessorFeatureFlags.ACPI))
                {
                    features[featureCount] = new ProcessorFeature(); features[featureCount].FeatureName = ("ACPI"); featureCount++;
                }
                if (0 != (flags & (ulong)ProcessorFeatureFlags.MMX))
                {
                    features[featureCount] = new ProcessorFeature(); features[featureCount].FeatureName = ("MMX"); featureCount++;
                }
                if (0 != (flags & (ulong)ProcessorFeatureFlags.FXSR))
                {
                    features[featureCount] = new ProcessorFeature(); features[featureCount].FeatureName = ("FXSR"); featureCount++;
                }
                if (0 != (flags & (ulong)ProcessorFeatureFlags.SSE))
                {
                    features[featureCount] = new ProcessorFeature(); features[featureCount].FeatureName = ("SSE"); featureCount++;
                }
                if (0 != (flags & (ulong)ProcessorFeatureFlags.SSE2))
                {
                    features[featureCount] = new ProcessorFeature(); features[featureCount].FeatureName = ("SSE2"); featureCount++;
                }
                if (0 != (flags & (ulong)ProcessorFeatureFlags.SS))
                {
                    features[featureCount] = new ProcessorFeature(); features[featureCount].FeatureName = ("SS"); featureCount++;
                }
                if (0 != (flags & (ulong)ProcessorFeatureFlags.HTT))
                {
                    features[featureCount] = new ProcessorFeature(); features[featureCount].FeatureName = ("HTT"); featureCount++;
                }
                if (0 != (flags & (ulong)ProcessorFeatureFlags.TM1))
                {
                    features[featureCount] = new ProcessorFeature(); features[featureCount].FeatureName = ("TM1"); featureCount++;
                }
                if (0 != (flags & (ulong)ProcessorFeatureFlags.IA64))
                {
                    features[featureCount] = new ProcessorFeature(); features[featureCount].FeatureName = ("IA64"); featureCount++;
                }
                if (0 != (flags & (ulong)ProcessorFeatureFlags.PBE))
                {
                    features[featureCount] = new ProcessorFeature(); features[featureCount].FeatureName = ("PBE"); featureCount++;
                }
                if (0 != (flags & (ulong)ProcessorFeatureFlags.SSE3))
                {
                    features[featureCount] = new ProcessorFeature(); features[featureCount].FeatureName = ("SSE3"); featureCount++;
                }
                if (0 != (flags & (ulong)ProcessorFeatureFlags.DTSE64))
                {
                    features[featureCount] = new ProcessorFeature(); features[featureCount].FeatureName = ("DTSE64"); featureCount++;
                }
                if (0 != (flags & (ulong)ProcessorFeatureFlags.MON))
                {
                    features[featureCount] = new ProcessorFeature(); features[featureCount].FeatureName = ("MON"); featureCount++;
                }
                if (0 != (flags & (ulong)ProcessorFeatureFlags.DSCPL))
                {
                    features[featureCount] = new ProcessorFeature(); features[featureCount].FeatureName = ("DSCPL"); featureCount++;
                }
                if (0 != (flags & (ulong)ProcessorFeatureFlags.VMX))
                {
                    features[featureCount] = new ProcessorFeature(); features[featureCount].FeatureName = ("VMX"); featureCount++;
                }
                if (0 != (flags & (ulong)ProcessorFeatureFlags.SMX))
                {
                    features[featureCount] = new ProcessorFeature(); features[featureCount].FeatureName = ("SMX"); featureCount++;
                }
                if (0 != (flags & (ulong)ProcessorFeatureFlags.EST))
                {
                    features[featureCount] = new ProcessorFeature(); features[featureCount].FeatureName = ("EST"); featureCount++;
                }
                if (0 != (flags & (ulong)ProcessorFeatureFlags.TM2))
                {
                    features[featureCount] = new ProcessorFeature(); features[featureCount].FeatureName = ("TM2"); featureCount++;
                }
                if (0 != (flags & (ulong)ProcessorFeatureFlags.SSSE3))
                {
                    features[featureCount] = new ProcessorFeature(); features[featureCount].FeatureName = ("SSSE3"); featureCount++;
                }
                if (0 != (flags & (ulong)ProcessorFeatureFlags.CID))
                {
                    features[featureCount] = new ProcessorFeature(); features[featureCount].FeatureName = ("CID"); featureCount++;
                }
                if (0 != (flags & (ulong)ProcessorFeatureFlags.CX16))
                {
                    features[featureCount] = new ProcessorFeature(); features[featureCount].FeatureName = ("CX16"); featureCount++;
                }
                if (0 != (flags & (ulong)ProcessorFeatureFlags.ETPRD))
                {
                    features[featureCount] = new ProcessorFeature(); features[featureCount].FeatureName = ("ETPRD"); featureCount++;
                }
                if (0 != (flags & (ulong)ProcessorFeatureFlags.PDCM))
                {
                    features[featureCount] = new ProcessorFeature(); features[featureCount].FeatureName = ("PDCM"); featureCount++;
                }
                if (0 != (flags & (ulong)ProcessorFeatureFlags.DCA))
                {
                    features[featureCount] = new ProcessorFeature(); features[featureCount].FeatureName = ("DCA"); featureCount++;
                }
                if (0 != (flags & (ulong)ProcessorFeatureFlags.SSE4_1))
                {
                    features[featureCount] = new ProcessorFeature(); features[featureCount].FeatureName = ("SSE4.1"); featureCount++;
                }
                if (0 != (flags & (ulong)ProcessorFeatureFlags.SSE4_2))
                {
                    features[featureCount] = new ProcessorFeature(); features[featureCount].FeatureName = ("SSE4.2"); featureCount++;
                }
                if (0 != (flags & (ulong)ProcessorFeatureFlags.X2APIC))
                {
                    features[featureCount] = new ProcessorFeature(); features[featureCount].FeatureName = ("X2APIC"); featureCount++;
                }
                if (0 != (flags & (ulong)ProcessorFeatureFlags.POPCNT))
                {
                    features[featureCount] = new ProcessorFeature(); features[featureCount].FeatureName = ("POPCNT"); featureCount++;
                }
            }
            Asm.STI();
        }
Пример #8
0
 internal unsafe void SetAMD()
 {
     brandName  = GetBrandName();
     familyName = CString8.Copy("Not implemented yet");
     modelName  = CString8.Copy("Not implemented yet");
 }
Пример #9
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;
            }
        }
Пример #10
0
        internal CommandExecutionAttemptResult HandleLine(CString8 *input, bool verboseFailure, bool useHelp)
        {
            Diagnostics.Assert(input != null, "Prompter::HandleLine(CString8*): Parameter 'input' is null");
#if Prompter_DebuggingVerbosity
            Diagnostics.Message("Prompter::HandleLine(CString8*): Function started");
#endif

            if (input->Length == 0)
            {
#if Prompter_DebuggingVerbosity
                Diagnostics.Message("Prompter::HandleLine(CString8*): Raw input is blank");
#endif
                if (verboseFailure)
                {
                    HandleEmptyCommandEntry();
                }

#if Prompter_DebuggingVerbosity
                Diagnostics.Message("Prompter::HandleLine(CString8*): RET");
#endif
                return(CommandExecutionAttemptResult.BlankEntry);
            }
            CString8 *trimmedInput = input->Trim();
            if (trimmedInput->Length == 0)
            {
#if Prompter_DebuggingVerbosity
                Diagnostics.Message("Prompter::HandleLine(CString8*): Trimmed input is blank");
#endif
                CString8.DISPOSE(trimmedInput);

                if (verboseFailure)
                {
                    HandleEmptyCommandEntry();
                }

#if Prompter_DebuggingVerbosity
                Diagnostics.Message("Prompter::HandleLine(CString8*): RET");
#endif
                return(CommandExecutionAttemptResult.BlankEntry);
            }

            int       firstSpace = trimmedInput->IndexOf(" ");
            CString8 *commandName;
            CString8 *parameters;
            if (firstSpace < 0)
            {
                commandName = trimmedInput;
                parameters  = CString8.CreateEmpty();
            }
            else
            {
                commandName = trimmedInput->Substring(0, firstSpace);
                parameters  = trimmedInput->Substring(firstSpace + 1);
            }

            CommandTableEntry *command = this.FindCommand(commandName);
            if (command == null)
            {
#if Prompter_DebuggingVerbosity
                Diagnostics.Message("Prompter::HandleLine(CString8*): Command not found");
#endif
                if (verboseFailure)
                {
                    HandleUnrecognizedCommandEntry(commandName);
                }

#if Prompter_DebuggingVerbosity
                Diagnostics.Message("Prompter::HandleLine(CString8*): Freeing contextual stuff");
#endif
                //Free up what we used
                if (commandName != trimmedInput)
                {
                    CString8.DISPOSE(commandName);
                }
                CString8.DISPOSE(trimmedInput);
                CString8.DISPOSE(parameters);
#if Prompter_DebuggingVerbosity
                Diagnostics.Message("Prompter::HandleLine(CString8*): RET");
#endif
                return(CommandExecutionAttemptResult.NotFound);
            }
            CommandExecutionContext *commandExecutionContext = CommandExecutionContext.CREATE();
            commandExecutionContext->parameters = parameters;

#if Prompter_DebuggingVerbosity
            Diagnostics.Message("Prompter::HandleLine(CString8*): Getting ready to call command");
#endif
            if (!useHelp)
            {
                ADC.MemoryUtil.Call(command->func_Execute, (void *)commandExecutionContext);
            }
            else
            {
                ADC.MemoryUtil.Call(command->func_GetHelp, (void *)commandExecutionContext);
            }
#if Prompter_DebuggingVerbosity
            Diagnostics.Message("Prompter::HandleLine(CString8*): Done calling command");
#endif

            //Free up what we used
#if Prompter_DebuggingVerbosity
            Diagnostics.Message("Prompter::HandleLine(CString8*): Freeing contextual stuff");
#endif
            if (commandName != trimmedInput)
            {
                CString8.DISPOSE(commandName);
            }
            CString8.DISPOSE(trimmedInput);
            CString8.DISPOSE(parameters);
            CommandExecutionContext.DISPOSE(commandExecutionContext);
#if Prompter_DebuggingVerbosity
            Diagnostics.Message("Prompter::HandleLine(CString8*): RET");
#endif
            return(CommandExecutionAttemptResult.Success);
        }