Пример #1
0
 public static void GetHelp(CommandExecutionContext *context)
 {
     TextMode.WriteLine("Syntax: ");
     TextMode.WriteLine("     version");
     TextMode.WriteLine("");
     TextMode.WriteLine("Prints version and licensing information about SharpOS.");
 }
Пример #2
0
 public static void GetHelp(CommandExecutionContext *context)
 {
     TextMode.WriteLine("Syntax: ");
     TextMode.WriteLine("     panic");
     TextMode.WriteLine("");
     TextMode.WriteLine("Causes a RSOD (Red Screen Of Death).");
 }
Пример #3
0
 public static void GetHelp(CommandExecutionContext *context)
 {
     TextMode.WriteLine("Syntax: ");
     TextMode.WriteLine("     egg");
     TextMode.WriteLine("");
     TextMode.WriteLine("And we a proud of it!");
 }
Пример #4
0
 public static void GetHelp(CommandExecutionContext *context)
 {
     TextMode.WriteLine("Syntax: ");
     TextMode.WriteLine("     memdump");
     TextMode.WriteLine("");
     TextMode.WriteLine("Displays memory usage.");
 }
Пример #5
0
 public static void GetHelp(CommandExecutionContext *context)
 {
     TextMode.WriteLine("Syntax: ");
     TextMode.WriteLine("     reboot");
     TextMode.WriteLine("");
     TextMode.WriteLine("Restarts the machine.");
 }
Пример #6
0
 public static void GetHelp(CommandExecutionContext *context)
 {
     TextMode.WriteLine("Syntax: ");
     TextMode.WriteLine("     cls");
     TextMode.WriteLine("");
     TextMode.WriteLine("Clears the screen.");
 }
Пример #7
0
        public static void Execute(CommandExecutionContext *context)
        {
            try {
                TextMode.WriteLine("Reading..");

                string filename = Foundation.Convert.ToString(context->parameters);

                // for testing...
                if (string.IsNullOrEmpty(filename))
                {
                    filename = "/embedded/TEST0.TXT";
                }

                TextMode.Write("File:");
                TextMode.WriteLine(filename);

                TextMode.WriteLine("More.Execute.1");
                System.IO.Stream filestream = (System.IO.Stream)Vfs.VirtualFileSystem.Open(filename, System.IO.FileAccess.Read, System.IO.FileShare.Read);
                TextMode.WriteLine("More.Execute.2");
            }
            catch (Exception e) {
                TextMode.Write("Exception: ");
                TextMode.Write(e.ToString());
                TextMode.WriteLine();
            }
        }
Пример #8
0
 public static void GetHelp(CommandExecutionContext *context)
 {
     TextMode.WriteLine("Syntax: ");
     TextMode.WriteLine("     mount <target> <source>");
     TextMode.WriteLine();
     TextMode.WriteLine("Mounts a file system at <target> from block device at <source>.");
 }
Пример #9
0
 public static void GetHelp(CommandExecutionContext *context)
 {
     TextMode.WriteLine("Syntax: ");
     TextMode.WriteLine("     lspci");
     TextMode.WriteLine("");
     TextMode.WriteLine("Gets information about PCI.");
 }
Пример #10
0
 public static void GetHelp(CommandExecutionContext *context)
 {
     TextMode.WriteLine("Syntax: ");
     TextMode.WriteLine("     cpuid");
     TextMode.WriteLine("");
     TextMode.WriteLine("Gets information about the CPU.");
 }
Пример #11
0
 public static void GetHelp(CommandExecutionContext *context)
 {
     TextMode.WriteLine("Syntax: ");
     TextMode.WriteLine("     listresources");
     TextMode.WriteLine("");
     TextMode.WriteLine("Prints available devoce resources.");
 }
Пример #12
0
        public static void Execute(CommandExecutionContext *context)
        {
            if (context->parameters->Compare("--set", 0, 5) == 0)
            {
                CString8 *substr;
                int       result;

                if (context->parameters->Length <= 6)
                {
                    GetHelp(context);
                    return;
                }

                substr = context->parameters->Substring(6);
                result = Convert.ToInt32(substr);
                MemoryManager.Free(substr);

                TextMode.WriteLine("Setting timezone to `", result, "'");
                Clock.Timezone = (System.SByte)result;

                return;
            }

            TextMode.Write("Current timezone: ");
            TextMode.Write((int)Clock.Timezone);
            TextMode.WriteLine();
        }
Пример #13
0
 public static void GetHelp(CommandExecutionContext *context)
 {
     TextMode.WriteLine("Syntax: ");
     TextMode.WriteLine("     memview <hex-address>");
     TextMode.WriteLine("");
     TextMode.WriteLine("Displays 256 bytes of memory at the requested address.");
 }
Пример #14
0
 public static void GetHelp(CommandExecutionContext *context)
 {
     TextMode.WriteLine("Syntax: ");
     TextMode.WriteLine("     more <filename>");
     TextMode.WriteLine();
     TextMode.WriteLine("Displays the contents of a file");
 }
Пример #15
0
 public static void GetHelp(CommandExecutionContext *context)
 {
     TextMode.WriteLine("Syntax: ");
     TextMode.WriteLine("     halt");
     TextMode.WriteLine("");
     TextMode.WriteLine("Halts the system.");
 }
Пример #16
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);
            }
        }
Пример #17
0
 public static void GetHelp(CommandExecutionContext *context)
 {
     TextMode.WriteLine("Syntax: ");
     TextMode.WriteLine("     stage");
     TextMode.WriteLine("");
     TextMode.WriteLine("Prints the current kernel stage.");
 }
Пример #18
0
 public static void GetHelp(CommandExecutionContext *context)
 {
     TextMode.WriteLine("Syntax: ");
     TextMode.WriteLine("     show w : shows the warranty.");
     TextMode.WriteLine("     show c : shows the copyright.");
     TextMode.WriteLine("     show d : shows the developers.");
     TextMode.WriteLine(CommandTableHeader.inform_USE_HELP_COMMANDS);
 }
Пример #19
0
 public static void GetHelp(CommandExecutionContext *context)
 {
     TextMode.WriteLine("Syntax: ");
     TextMode.WriteLine("     keymap : shows the active keymap.");
     TextMode.WriteLine("     keymap --list : shows all the installed keymaps.");
     TextMode.WriteLine("     keymap <keymap> : sets the keymap to <keymap>.");
     TextMode.WriteLine(CommandTableHeader.inform_USE_HELP_COMMANDS);
 }
Пример #20
0
 public static void GetHelp(CommandExecutionContext *context)
 {
     TextMode.WriteLine("Syntax: ");
     TextMode.WriteLine("     help <command>");
     TextMode.WriteLine("");
     TextMode.WriteLine("Prints help information about the given command.");
     TextMode.WriteLine(CommandTableHeader.inform_USE_HELP_COMMANDS);
 }
Пример #21
0
        public static void Execute(CommandExecutionContext *context)
        {
            // ARCHDEPENDS: X86
            IProcessor[] cpus = Architecture.GetProcessors();

            TextMode.SaveAttributes();

            for (int i = 0; i < cpus.Length; i++)
            {
                ProcessorType type = cpus[i].ArchType;

                if (type == ProcessorType.IA32)
                {
                    RenderItem("Architecture: ", "IA32");
                }
                if (type == ProcessorType.IA64)
                {
                    RenderItem("Architecture: ", "IA64");
                }
                if (type == ProcessorType.Unknown)
                {
                    RenderItem("Architecture: ", "Unknown");
                }

                RenderItem("CPU Vendor: ", cpus[i].VendorName);
                RenderItem("CPU Brand: ", cpus[i].BrandName);
                RenderItem("CPU Family: ", cpus[i].FamilyName);
                RenderItem("CPU Model: ", cpus[i].ModelName);
                //RenderItem("CPU ClockSpeed: ", cpus[i].ClockSpeed);
                //RenderItem("CPU CacheSize: ", cpus[i].CacheSize);

                RenderItemTitle("CPU Flags: ");

                ProcessorFeature[] features = cpus[i].Features;
                for (int f = 0; f < features.Length; f++)
                {
                    if (features[f] == null)
                    {
                        TextMode.Write("? ");
                        continue;
                    }
                    TextMode.Write(features[f].FeatureName);
                    TextMode.Write(" ");
                }
                TextMode.WriteLine();

                TextMode.RestoreAttributes();
            }
        }
Пример #22
0
        public static void Execute(CommandExecutionContext *context)
        {
            TextMode.Write("Current kernel stage: ");

            switch (EntryModule.GetKernelStage())
            {
            case KernelStage.Init:
                TextMode.WriteLine("(0) init");
                break;

            case KernelStage.RuntimeInit:
                TextMode.WriteLine("(1) runtime-init");
                break;

            case KernelStage.UserInit:
                TextMode.WriteLine("(2) user-init");
                break;

            case KernelStage.Active:
                TextMode.WriteLine("(3) active");
                break;

            case KernelStage.SingleUser:
                TextMode.WriteLine("(4) single-user");
                break;

            case KernelStage.Stopping:
                TextMode.WriteLine("(5) stopping");
                break;

            case KernelStage.Stop:
                TextMode.WriteLine("(6) stop");
                break;

            case KernelStage.Halt:
                TextMode.WriteLine("(7) halt");
                break;

            case KernelStage.Diagnostics:
                TextMode.WriteLine("(8) diagnostics");
                break;

            case KernelStage.Unknown:
                TextMode.WriteLine("(?) unknown");
                break;
            }
        }
Пример #23
0
        public static void Execute(CommandExecutionContext *context)
        {
            byte *buffer = context->parameters->Pointer;
            int   len    = context->parameters->Length;

            // scan parameter and convert string to hex int
            int start = 0;

            while (start < len && !IsHexDigit((char)buffer [start]))
            {
                start++;
            }
            int end = start;

            while (end < len && IsHexDigit((char)buffer [end]))
            {
                end++;
            }
            len = end - start;

            int offset = 0;

            for (int index = start; index < end; index++)
            {
                offset <<= 4;

                byte current = 0;
                char digit   = (char)buffer [index];

                if (digit >= '0' && digit <= '9')
                {
                    current = (byte)(digit - '0');
                }
                else if (digit >= 'A' && digit <= 'F')
                {
                    current = (byte)(10 + digit - 'A');
                }
                else if (digit >= 'a' && digit <= 'f')
                {
                    current = (byte)(10 + digit - 'a');
                }
                offset |= current;
            }

            TextMode.Write(Diagnostics.FormatDump((byte *)offset, 256, 16));
        }
Пример #24
0
        public static void Execute(CommandExecutionContext *context)
        {
            byte *rawbuf = stackalloc byte [EntryModule.MaxKeyMapNameLength];

            if (context->parameters->Compare("--list") == 0)
            {
                ListKeyMaps();
            }
            else if (context->parameters->Compare(0, "--set ", 0, 6) == 0 &&
                     context->parameters->Length > 6)
            {
                PString8 *buf = PString8.Wrap(rawbuf,
                                              EntryModule.MaxKeyMapNameLength);
                buf->Clear();
                TextMode.Write(context->parameters->Length);
                TextMode.WriteLine();
                buf->Concat(context->parameters, 6, context->parameters->Length - 6);

                if (KeyMap.GetBuiltinKeyMap(buf) == null)
                {
                    TextMode.SaveAttributes();
                    TextMode.Foreground = TextColor.Red;
                    TextMode.Write("Unknown keymap `");
                    TextMode.Write(buf);
                    TextMode.Write("'");
                    TextMode.RestoreAttributes();
                }
                else
                {
                    TextMode.Write("Setting key map to `");
                    TextMode.Write(buf);
                    TextMode.Write("'");
                    KeyMap.SetKeyMap(buf);
                }
            }
            else if (context->parameters->Length == 0)
            {
                TextMode.Write("Current key map: ");
                TextMode.WriteLine(KeyMap.GetCurrentKeyMapName());
            }
            else
            {
                TextMode.WriteLine("Usage: keymap [--list|--set NAME]");
            }
        }
Пример #25
0
        public static void Execute(CommandExecutionContext *context)
        {
            SharpOS.Kernel.Foundation.Time time = new SharpOS.Kernel.Foundation.Time();
            byte *    rawbuf = stackalloc byte [50];
            PString8 *pstr   = PString8.Wrap(rawbuf, 50);

            if (context->parameters->Compare("--hw") == 0)
            {
                Clock.GetHardwareTime(time);
            }
            else
            {
                Clock.GetCurrentTime(time);
            }

            time.ToString(pstr);
            TextMode.WriteLine(pstr);
        }
Пример #26
0
        public static void Execute(CommandExecutionContext *context)
        {
            TextMode.WriteLine();

            TextMode.WriteLine("              .=\"\"=.");
            TextMode.WriteLine("             / _  _ \\");
            TextMode.WriteLine("            |  d  b  |");
            TextMode.WriteLine("            \\   /\\   /             ,");
            TextMode.WriteLine("           ,/'-=\\/=-'\\,    |\\   /\\/ \\/|   ,_");
            TextMode.WriteLine("          / /        \\ \\   ; \\/`     '; , \\_',");
            TextMode.WriteLine("         | /          \\ |   \\        / ");
            TextMode.WriteLine("         \\/ \\        / \\/    '.    .'    /`.");
            TextMode.WriteLine("             '.    .'          `~~` , /\\ `");
            TextMode.WriteLine("     jgs     _|`~~`|_              .  `");
            TextMode.WriteLine("             /|\\  /|\\");
            TextMode.WriteLine();
            TextMode.WriteLine("What is the egg?");
            TextMode.WriteLine("The egg has you.");
        }
Пример #27
0
 public static void Execute(CommandExecutionContext *context)
 {
     if (context->parameters->Compare("w") == 0)
     {
         ShowWarranty();
     }
     else if (context->parameters->Compare("c") == 0)
     {
         ShowCopyright();
     }
     else if (context->parameters->Compare("d") == 0)
     {
         ShowDevelopers();
     }
     else
     {
         GetHelp(context);
     }
 }
Пример #28
0
        public static void Execute(CommandExecutionContext *context)
        {
            //if (!PCIController.IsAvailable) {
            //    ADC.TextMode.WriteLine ("Pci not found");
            //}

            //StringBuilder* sb = SharpOS.Kernel.Foundation.StringBuilder.CREATE ();

            //sb->AppendNumber (PCIController.DeviceCount);
            //sb->Append (" PCI devices were detected.");
            //ADC.TextMode.WriteLine (sb->buffer);

            //for (int index = 0; index < PCIController.DeviceCount; index++)
            //{
            //    PCIDevice* pciDev = (PCIDevice*)PCIController.Devices (index);
            //    if ((int)pciDev != 0)
            //    {
            //        sb->Clear ();
            //        sb->Append ("PCI");
            //        sb->AppendNumber (index);
            //        sb->Append (":");
            //        sb->AppendNumber ((int)pciDev->Bus);
            //        sb->Append (":");
            //        sb->AppendNumber ((int)pciDev->Slot);
            //        sb->Append (".");
            //        sb->AppendNumber ((int)pciDev->Function);
            //        sb->Append (" Vendor:0x");
            //        sb->AppendNumber (pciDev->VendorID, true);
            //        sb->Append (" Device:0x");
            //        sb->AppendNumber (pciDev->DeviceID, true);
            //        sb->Append (" Rev:0x");
            //        sb->AppendNumber (pciDev->RevisionID, true);
            //        sb->Append (" Class:0x");
            //        sb->AppendNumber ((int)((uint)pciDev->ClassCode << 8 | pciDev->ProgIF), true);
            //        //[cedrou] not yet !
            //        //sb->Append (pciDev->ClassCode.ToString());
            //        ADC.TextMode.WriteLine (sb->buffer);
            //    }
            //}

            //MemoryManager.Free ((void*)sb->buffer);
            //MemoryManager.Free ((void*)sb);
        }
Пример #29
0
        public static void Execute(CommandExecutionContext *context)
        {
            try {
                TextMode.WriteLine("Mounting");

                string parameters = Foundation.Convert.ToString(context->parameters);

                // for testing...
                if (string.IsNullOrEmpty(parameters))
                {
                    parameters = "/IDE_496/Disk0/Partition1 /Disk1";
                }

                int space = parameters.IndexOf(' ');

                if (space <= 0)
                {
                    TextMode.WriteLine("Incorrect syntax");
                    return;
                }

                string source = parameters.Substring(0, space);
                string target = parameters.Substring(space + 1, parameters.Length - 1 - space);

                TextMode.Write("Source:");
                TextMode.WriteLine(source);
                TextMode.Write("Target:");
                TextMode.WriteLine(target);

                Vfs.VirtualFileSystem.Mount(source, target);
            }
            catch (Exception e) {
                TextMode.Write("Exception: ");
                TextMode.Write(e.ToString());
                TextMode.WriteLine();
            }
        }
Пример #30
0
        public static void Execute(CommandExecutionContext *context)
        {
            TextMode.WriteLine("Device Resources:");

            Device[] devices = DeviceManager.GetDevices();

            foreach (Device device in devices)
            {
                if (!(device is PCIDevice))
                {
                    continue;
                }

                TextMode.Write("Resource: ");
                TextMode.Write(device.Name);

                if (device.Parent != null)
                {
                    TextMode.Write(" - Parent: ");
                    TextMode.Write(device.Parent.Name);
                }
                TextMode.WriteLine();

                if (device is PCIDevice)
                {
                    PCIDevice pciDevice = (device as PCIDevice);

                    TextMode.Write("  Vendor:0x");
                    TextMode.Write(pciDevice.VendorID.ToString("X"));
                    TextMode.Write(" Device:0x");
                    TextMode.Write(pciDevice.DeviceID.ToString("X"));
                    TextMode.Write(" Class:0x");
                    TextMode.Write(pciDevice.ClassCode.ToString("X"));
                    TextMode.Write(" Rev:0x");
                    TextMode.Write(pciDevice.RevisionID.ToString("X"));
                    TextMode.WriteLine();

                    foreach (PCIBaseAddress address in pciDevice.BaseAddresses)
                    {
                        if (address.Address != 0)
                        {
                            TextMode.Write("    ");
                            //TextMode.WriteLine (address.ToString ());

                            if (address.Region == AddressRegion.IO)
                            {
                                TextMode.Write("I/O Port at 0x");
                            }
                            else
                            {
                                TextMode.Write("Memory at 0x");
                            }

                            TextMode.Write(address.Address.ToString("X"));

                            TextMode.Write(" [size=");

                            if ((address.Size & 0xFFFFF) == 0)
                            {
                                TextMode.Write((address.Size >> 20).ToString());
                                TextMode.Write("M");
                            }
                            else if ((address.Size & 0x3FF) == 0)
                            {
                                TextMode.Write((address.Size >> 10).ToString());
                                TextMode.Write("K");
                            }
                            else
                            {
                                TextMode.Write(address.Size.ToString());
                            }

                            TextMode.Write("]");

                            if (address.Prefetchable)
                            {
                                TextMode.Write("(prefetchable)");
                            }

                            TextMode.WriteLine();
                        }
                    }

                    if (pciDevice.IRQ != 0)
                    {
                        TextMode.Write("    ");
                        TextMode.Write("IRQ at ");
                        TextMode.Write(pciDevice.IRQ.ToString());
                        TextMode.WriteLine();
                    }
                }
            }
        }