예제 #1
0
        /// <summary>
        /// Main
        /// </summary>
        public static void Main()
        {
            Kernel.x86.Kernel.Setup();

            Console = ConsoleManager.Controller.Boot;
            Console.Clear();

            IDT.SetInterruptHandler(ProcessInterrupt);

            Serial.SetupPort(Serial.COM1);

            _hal = new Hardware();
            if (VBE.InitVBE(_hal))
            {
                Log("VBE setup OK!");

                DoGraphics();
            }
            else
            {
                Log("VBE setup ERROR!");
            }

            ForeverLoop();
        }
예제 #2
0
        /// <summary>
        /// Main
        /// </summary>
        public static void Main()
        {
            Mosa.Kernel.x86.Kernel.Setup();

            IDT.SetInterruptHandler(ProcessInterrupt);

            Setup.Initialize();
            Setup.Start();

            var textDevice = (ITextDevice)Setup.DeviceManager.GetDevices(new FindDevice.IsTypeOf <ITextDevice>()).First.Value;

            console = new TextScreen(textDevice);

            Console.ClearScreen();
            Console.SetCursor(0, 0);

            Console.SetColor(TextColor.Blue, TextColor.Green);
            Console.WriteLine("                   MOSA OS Version 1.5 - Compiler Version 1.5                   ");
            Console.SetColor(TextColor.Black, TextColor.White);
            Console.WriteLine("> System ready");
            Console.SetCursor(0, 24);
            Console.Write("          Copyright (C) 2008-2015 [Managed Operating System Alliance]           ");

            Process();
        }
예제 #3
0
        /// <summary>
        /// Setup All Neccessary Stuff
        /// </summary>
        public static void Main()
        {
            Kernel.Setup();

            IDT.SetInterruptHandler(ProcessInterrupt);

            Program.Setup();
        }
예제 #4
0
        private static void Setup()
        {
            IDT.SetInterruptHandler(null);
            Panic.Setup();
            Debugger.Setup(Serial.COM1);

            // Initialize interrupts
            PIC.Setup();
            IDT.Setup();
            GDT.Setup();

            //Runtime.Internal.Setup();
        }
예제 #5
0
        /// <summary>
        /// Main
        /// </summary>
        unsafe public static void Main()
        {
            Mosa.Kernel.x86.Kernel.Setup();

            Console = ConsoleManager.Controller.Boot;
            Console.Clear();

            IDT.SetInterruptHandler(ProcessInterrupt);

            Console.Color           = Colors.White;
            Console.BackgroundColor = Colors.Green;

            Console.Write(@"                   MOSA OS Version 1.4 - Compiler Version 1.4");
            FillLine();
            Console.Color           = Colors.White;
            Console.BackgroundColor = Colors.Black;

            if (SmbiosManager.IsAvailable)
            {
                BiosInformationStructure biosInfo = new BiosInformationStructure();
                CpuStructure             cpuInfo  = new CpuStructure();

                Console.WriteLine("> Checking BIOS...");
                BulletPoint(); Console.Write("Vendor  "); InBrackets(biosInfo.BiosVendor, Colors.White, Colors.LightBlue); Console.WriteLine();
                BulletPoint(); Console.Write("Version "); InBrackets(biosInfo.BiosVersion, Colors.White, Colors.LightBlue); Console.WriteLine();

                Console.WriteLine("> Checking CPU...");
                BulletPoint(); Console.Write("Vendor  "); InBrackets(cpuInfo.Vendor, Colors.White, Colors.LightBlue); Console.WriteLine();
                BulletPoint(); Console.Write("Version "); InBrackets(cpuInfo.Version, Colors.White, Colors.LightBlue); Console.WriteLine();
            }
            else
            {
                Console.WriteLine("> No SMBIOS available!");
            }

            Console.WriteLine("> Initializing hardware abstraction layer...");
            Setup.Initialize();

            Console.WriteLine("> Adding hardware devices...");
            Setup.Start();

            Console.WriteLine("> System ready");
            Console.WriteLine();
            Console.Goto(24, 0);
            Console.Color           = Colors.White;
            Console.BackgroundColor = Colors.Green;
            Console.Write("          Copyright (C) 2008-2015 [Managed Operating System Alliance]");
            FillLine();

            Process();
        }
예제 #6
0
        private static void Setup()
        {
            Logger.Log("Initialize Kernel");

            IDT.SetInterruptHandler(null);
            Panic.Setup();
            Debugger.Setup(Serial.COM2);

            // Initialize interrupts
            PIC.Setup();
            IDT.Setup();
            GDT.Setup();

            Logger.Log("Kernel initialized");
        }
예제 #7
0
        public static void Main()
        {
            Mosa.Kernel.x86.Kernel.Setup();

            IDT.SetInterruptHandler(ProcessInterrupt);

            Screen.Clear();
            Screen.Goto(0, 0);
            Screen.Color = ScreenColor.White;

            Program.Setup();

            while (true)
            {
                Program.Loop();
            }
        }
예제 #8
0
        /// <summary>
        /// Main
        /// </summary>
        public static void Main()
        {
            IDT.SetInterruptHandler(null);
            Panic.Setup();
            Debugger.Setup(Serial.COM1);

            // Initialize interrupts
            PIC.Setup();
            IDT.Setup();
            GDT.Setup();

            Runtime.Internal.Setup();

            IDT.SetInterruptHandler(ProcessInterrupt);

            EnterTestReadyLoop();
        }
예제 #9
0
        /// <summary>
        /// Main
        /// </summary>
        unsafe public static void Main()
        {
            Kernel.x86.Kernel.Setup();

            Console = ConsoleManager.Controller.Boot;
            Debug   = ConsoleManager.Controller.Boot;

            Console.Clear();

            Console.ScrollRow = 23;

            IDT.SetInterruptHandler(ProcessInterrupt);

            Console.Color           = Colors.White;
            Console.BackgroundColor = Colors.Green;

            Console.Write(@"                   MOSA OS Version 1.4 - Compiler Version 1.4");
            FillLine();
            Console.Color           = Colors.White;
            Console.BackgroundColor = Colors.Black;

            Console.WriteLine("> Initializing hardware abstraction layer...");
            Setup.Initialize();

            Console.WriteLine("> Adding hardware devices...");
            Setup.Start();

            Console.Color = Colors.White;
            Console.WriteLine();

            Debug = ConsoleManager.Controller.Debug;

            // setup keymap
            var keymap = new US();

            // setup keyboard (state machine)
            var keyboard = new Mosa.DeviceSystem.Keyboard(Setup.StandardKeyboard, keymap);

            // setup app manager
            var manager = new AppManager(Console, keyboard);

            IDT.SetInterruptHandler(manager.ProcessInterrupt);

            manager.Start();
        }
예제 #10
0
        /// <summary>
        /// Main
        /// </summary>
        public static void Main()
        {
            Kernel.x86.Kernel.Setup();

            Console = ConsoleManager.Controller.Boot;

            Console.Clear();
            Console.Goto(0, 0);
            Console.ScrollRow       = 23;
            Console.Color           = ScreenColor.White;
            Console.BackgroundColor = ScreenColor.Green;

            Debug = ConsoleManager.Controller.Debug;

            Console.Write("                   MOSA OS Version 2.2 - Compiler Version 2.2");
            FillLine();
            Console.Color           = ScreenColor.White;
            Console.BackgroundColor = ScreenColor.Black;

            Console.WriteLine("> Initializing services...");

            // Create Service manager and basic services
            var serviceManager = new ServiceManager();

            DeviceService = new DeviceService();

            var diskDeviceService    = new DiskDeviceService();
            var partitionService     = new PartitionService();
            var pciControllerService = new PCIControllerService();
            var pciDeviceService     = new PCIDeviceService();
            var pcService            = new PCService();

            serviceManager.AddService(DeviceService);
            serviceManager.AddService(diskDeviceService);
            serviceManager.AddService(partitionService);
            serviceManager.AddService(pciControllerService);
            serviceManager.AddService(pciDeviceService);
            serviceManager.AddService(pcService);

            Console.WriteLine("> Initializing hardware abstraction layer...");

            // Set device driver system with the hardware HAL
            var hardware = new HAL.Hardware();

            DeviceSystem.Setup.Initialize(hardware, DeviceService.ProcessInterrupt);

            Console.WriteLine("> Registering device drivers...");
            DeviceService.RegisterDeviceDriver(DeviceDriver.Setup.GetDeviceDriverRegistryEntries());

            Console.WriteLine("> Starting devices...");

            DeviceService.Initialize(new X86System(), null);

            var acpi = DeviceService.GetFirstDevice <IACPI>().DeviceDriver as IACPI;

            // Setup APIC
            var localApic = Mosa.DeviceSystem.HAL.GetPhysicalMemory((Pointer)acpi.LocalApicAddress, 0xFFFF).Address;
            var ioApic    = Mosa.DeviceSystem.HAL.GetPhysicalMemory((Pointer)acpi.IOApicAddress, 0xFFFF).Address;

            APIC.Setup(localApic, ioApic);

            Console.Write("> Probing for ISA devices...");
            var isaDevices = DeviceService.GetChildrenOf(DeviceService.GetFirstDevice <ISABus>());

            Console.WriteLine("[Completed: " + isaDevices.Count.ToString() + " found]");

            foreach (var device in isaDevices)
            {
                Console.Write("  ");
                Bullet(ScreenColor.Yellow);
                Console.Write(" ");
                InBrackets(device.Name, ScreenColor.White, ScreenColor.Green);
                Console.WriteLine();
            }

            Console.Write("> Probing for PCI devices...");
            var devices = DeviceService.GetDevices <PCIDevice>();

            Console.WriteLine("[Completed: " + devices.Count.ToString() + " found]");

            foreach (var device in devices)
            {
                Console.Write("  ");
                Bullet(ScreenColor.Yellow);
                Console.Write(" ");

                var pciDevice = device.DeviceDriver as PCIDevice;
                InBrackets(device.Name + ": " + pciDevice.VendorID.ToString("x") + ":" + pciDevice.DeviceID.ToString("x") + " " + pciDevice.SubSystemID.ToString("x") + ":" + pciDevice.SubSystemVendorID.ToString("x") + " (" + pciDevice.ClassCode.ToString("x") + ":" + pciDevice.SubClassCode.ToString("x") + ":" + pciDevice.ProgIF.ToString("x") + ":" + pciDevice.RevisionID.ToString("x") + ")", ScreenColor.White, ScreenColor.Green);

                var children = DeviceService.GetChildrenOf(device);

                if (children.Count != 0)
                {
                    var child = children[0];

                    Console.WriteLine();
                    Console.Write("    ");

                    var pciDevice2 = child.DeviceDriver as PCIDevice;
                    InBrackets(child.Name, ScreenColor.White, ScreenColor.Green);
                }

                Console.WriteLine();
            }

            Console.Write("> Probing for disk controllers...");
            var diskcontrollers = DeviceService.GetDevices <IDiskControllerDevice>();

            Console.WriteLine("[Completed: " + diskcontrollers.Count.ToString() + " found]");

            foreach (var device in diskcontrollers)
            {
                Console.Write("  ");
                Bullet(ScreenColor.Yellow);
                Console.Write(" ");
                InBrackets(device.Name, ScreenColor.White, ScreenColor.Green);
                Console.WriteLine();
            }

            Console.Write("> Probing for disks...");
            var disks = DeviceService.GetDevices <IDiskDevice>();

            Console.WriteLine("[Completed: " + disks.Count.ToString() + " found]");

            foreach (var disk in disks)
            {
                Console.Write("  ");
                Bullet(ScreenColor.Yellow);
                Console.Write(" ");
                InBrackets(disk.Name, ScreenColor.White, ScreenColor.Green);
                Console.Write(" " + (disk.DeviceDriver as IDiskDevice).TotalBlocks.ToString() + " blocks");
                Console.WriteLine();
            }

            partitionService.CreatePartitionDevices();

            Console.Write("> Finding partitions...");
            var partitions = DeviceService.GetDevices <IPartitionDevice>();

            Console.WriteLine("[Completed: " + partitions.Count.ToString() + " found]");

            //foreach (var partition in partitions)
            //{
            //	Console.Write("  ");
            //	Bullet(ScreenColor.Yellow);
            //	Console.Write(" ");
            //	InBrackets(partition.Name, ScreenColor.White, ScreenColor.Green);
            //	Console.Write(" " + (partition.DeviceDriver as IPartitionDevice).BlockCount.ToString() + " blocks");
            //	Console.WriteLine();
            //}

            Console.Write("> Finding file systems...");

            foreach (var partition in partitions)
            {
                var fat = new FatFileSystem(partition.DeviceDriver as IPartitionDevice);

                if (fat.IsValid)
                {
                    Console.WriteLine("Found a FAT file system!");

                    const string filename = "TEST.TXT";

                    var location = fat.FindEntry(filename);

                    if (location.IsValid)
                    {
                        Console.Write("Found: " + filename);

                        var fatFileStream = new FatFileStream(fat, location);

                        uint len = (uint)fatFileStream.Length;

                        Console.WriteLine(" - Length: " + len.ToString() + " bytes");

                        Console.Write("Reading File: ");

                        for (; ;)
                        {
                            int i = fatFileStream.ReadByte();

                            if (i < 0)
                            {
                                break;
                            }

                            Console.Write((char)i);
                        }

                        Console.WriteLine();
                    }

                    const string bmpname = "WALLP.BMP";

                    var bmploc = fat.FindEntry(bmpname);

                    if (bmploc.IsValid)
                    {
                        Console.Write("Found: " + bmpname);

                        var fatFileStream = new FatFileStream(fat, bmploc);

                        uint len = (uint)fatFileStream.Length;

                        Console.WriteLine(" - Length: " + len.ToString() + " bytes");
                        Console.WriteLine();
                    }
                }
            }

            // Get StandardKeyboard
            var keyboards = DeviceService.GetDevices("StandardKeyboard");

            if (keyboards.Count == 0)
            {
                Console.WriteLine("No Keyboard!");
                ForeverLoop();
            }

            var stdKeyboard = keyboards[0].DeviceDriver as IKeyboardDevice;

            // setup keymap
            var keymap = new US();

            // setup keyboard (state machine)
            var keyboard = new DeviceSystem.Keyboard(stdKeyboard, keymap);

            // setup app manager
            var manager = new AppManager(Console, keyboard, serviceManager);

            IDT.SetInterruptHandler(manager.ProcessInterrupt);

            Logger.Log("<SELFTEST:PASSED>");

            manager.Start();
        }
예제 #11
0
        public static void Start()
        {
            Screen.Color = 0x0;
            Screen.Clear();
            Screen.GotoTop();
            Screen.Color = 0x0E;
            Screen.Write('M');
            Screen.Write('O');
            Screen.Write('S');
            Screen.Write('A');
            Screen.Write(' ');
            Screen.Write('O');
            Screen.Write('S');
            Screen.Write("!");
            Screen.Write(" ");

            DebugClient.Setup(Serial.COM1);
            Screen.Write('0');
            IDT.SetInterruptHandler(null);
            Screen.Write('1');
            Multiboot.Setup();
            Screen.Write('2');
            PIC.Setup();
            Screen.Write('3');
            GDT.Setup();
            Screen.Write('4');
            IDT.Setup();
            Screen.Write('5');
            PageFrameAllocator.Setup();
            Screen.Write('6');
            PageTable.Setup();
            Screen.Write('7');
            VirtualPageAllocator.Setup();
            Screen.Write('8');
            ProcessManager.Setup();
            Screen.Write('9');
            GC.Setup();
            Screen.Write('0');

            //Runtime.Setup();
            Screen.Write('A');
            TaskManager.Setup();
            Screen.Write('B');
            IDT.SetInterruptHandler(ProcessInterrupt);
            Screen.Write('C');
            ConsoleManager.Setup();
            Screen.Write('D');
            Console = ConsoleManager.Controller.Boot;
            Screen.Write('E');
            Screen.Write('F');

            Console.Color           = 0x0E;
            Console.BackgroundColor = 1;
            Console.WriteLine();
            Console.WriteLine();
            Console.Write("!MOSA is alive!");

            Console.WriteLine();

            KernelTest.RunTests();

            Console.WriteLine();

            DumpStackTrace();

            //System.Threading.SpinLock splk = new System.Threading.SpinLock();

            //bool lockTaken = false;
            //splk.Enter(ref lockTaken);
            //if (splk.IsHeld)
            //	Console.Write("Entered...");

            //lockTaken = false;
            //splk.Enter(ref lockTaken);

            //Console.Write("Should have looped!!!");

            Console.Goto(22, 0);

            Process();
        }
예제 #12
0
        public static void Main()
        {
            Screen.Clear();
            Screen.BackgroundColor = ScreenColor.Blue;
            Screen.Color           = ScreenColor.Yellow;

            Screen.Write('M');
            Screen.Write('O');
            Screen.Write('S');
            Screen.Write('A');
            Screen.Write(' ');
            Screen.Write('O');
            Screen.Write('S');
            Screen.Write("!");
            Screen.Write(" ");

            Multiboot.Setup();
            Screen.Write('0');
            GDT.Setup();
            Screen.Write('1');

            IDT.SetInterruptHandler(null);
            Screen.Write('2');
            Debugger.Setup(Serial.COM1);

            Screen.Write('3');
            PIC.Setup();
            Screen.Write('4');
            IDT.Setup();
            Screen.Write('5');
            PageFrameAllocator.Setup();
            Screen.Write('6');
            PageTable.Setup();
            Screen.Write('7');
            VirtualPageAllocator.Setup();
            Screen.Write('8');
            GC.Setup();
            Screen.Write('9');

            Scheduler.Setup();
            Screen.Write('B');
            IDT.SetInterruptHandler(ProcessInterrupt);
            Screen.Write('C');
            ConsoleManager.Setup();
            Screen.Write('D');
            Screen.Write('E');
            Screen.WriteLine();
            Screen.WriteLine();

            KernelTest.RunTests();
            StackTrace();
            StartThreadTest();

            // should never get here
            Screen.Write("!BAD!");

            while (true)
            {
                Native.Hlt();
            }
        }
예제 #13
0
        /// <summary>
        /// Main
        /// </summary>
        public static void Main()
        {
            Mosa.Kernel.x86.Kernel.Setup();

            Console = ConsoleManager.Controller.Boot;

            Console.Clear();

            IDT.SetInterruptHandler(ProcessInterrupt);

            Console.Color = Colors.White;

            Console.Goto(0, 0);

            Console.Color           = Colors.Yellow;
            Console.BackgroundColor = Colors.Black;

            Console.Write("MOSA OS Version 1.4 '");
            Console.Color = Colors.Red;
            Console.Write("Neptune");
            Console.Color = Colors.Yellow;
            Console.Write("'                                Copyright 2008-2015");

            Console.Color = 0x0F;
            Console.Write(new String((char)205, 60));
            Console.Write((char)203);
            Console.Write(new String((char)205, 19));
            Console.WriteLine();

            Console.Goto(2, 0);
            Console.Color = Colors.Green;
            Console.Write("Multibootaddress: ");
            Console.Color = Colors.Gray;
            unsafe
            {
                Console.Write((uint)Multiboot.MultiBootInfo, 16, 8);
            }

            Console.WriteLine();
            Console.Color = Colors.Green;
            Console.Write("Multiboot-Flags:  ");
            Console.Color = Colors.Gray;
            Console.Write(Multiboot.Flags, 2, 32);
            Console.WriteLine();
            Console.WriteLine();

            Console.Color = Colors.Green;
            Console.Write("Size of Memory:   ");
            Console.Color = Colors.Gray;
            Console.Write((Multiboot.MemoryLower + Multiboot.MemoryUpper) / 1024, 10, -1);
            Console.Write(" MB (");
            Console.Write(Multiboot.MemoryLower + Multiboot.MemoryUpper, 10, -1);
            Console.Write(" KB)");
            Console.WriteLine();

            Console.Color = Colors.White;
            for (uint index = 0; index < 60; index++)
            {
                Console.Write((char)205);
            }

            Console.WriteLine();

            Console.Color = Colors.Green;
            Console.Write("Memory-Map:");
            Console.WriteLine();

            for (uint index = 0; index < Multiboot.MemoryMapCount; index++)
            {
                Console.Color = Colors.White;
                Console.Write(Multiboot.GetMemoryMapBase(index), 16, 10);
                Console.Write(" - ");
                Console.Write(Multiboot.GetMemoryMapBase(index) + Multiboot.GetMemoryMapLength(index) - 1, 16, 10);
                Console.Write(" (");
                Console.Color = Colors.Gray;
                Console.Write(Multiboot.GetMemoryMapLength(index), 16, 10);
                Console.Color = Colors.White;
                Console.Write(") ");
                Console.Color = Colors.Gray;
                Console.Write("Type: ");
                Console.Write(Multiboot.GetMemoryMapType(index), 16, 1);
                Console.WriteLine();
            }
            Console.WriteLine();
            Console.WriteLine();
            Console.Color = Colors.Green;
            Console.Write("Smbios Info: ");
            if (SmbiosManager.IsAvailable)
            {
                Console.Color = Colors.White;
                Console.Write("[");
                Console.Color = Colors.Gray;
                Console.Write("Version ");
                Console.Write(SmbiosManager.MajorVersion, 10, -1);
                Console.Write(".");
                Console.Write(SmbiosManager.MinorVersion, 10, -1);
                Console.Color = Colors.White;
                Console.Write("]");
                Console.WriteLine();

                Console.Color = Colors.Yellow;
                Console.Write("[Bios]");
                Console.Color = Colors.White;
                Console.WriteLine();

                BiosInformationStructure biosInformation = new BiosInformationStructure();
                Console.Color = Colors.White;
                Console.Write("Vendor: ");
                Console.Color = Colors.Gray;
                Console.Write(biosInformation.BiosVendor);
                Console.WriteLine();
                Console.Color = Colors.White;
                Console.Write("Version: ");
                Console.Color = Colors.Gray;
                Console.Write(biosInformation.BiosVersion);
                Console.WriteLine();
                Console.Color = Colors.White;
                Console.Write("Date: ");
                Console.Color = Colors.Gray;
                Console.Write(biosInformation.BiosDate);

                Console.Color  = Colors.Yellow;
                Console.Row    = 8;
                Console.Column = 35;
                Console.Write("[Cpu]");
                Console.Color = Colors.White;
                Console.WriteLine();
                Console.Column = 35;

                CpuStructure cpuStructure = new CpuStructure();
                Console.Color = Colors.White;
                Console.Write("Vendor: ");
                Console.Color = Colors.Gray;
                Console.Write(cpuStructure.Vendor);
                Console.WriteLine();
                Console.Column = 35;
                Console.Color  = Colors.White;
                Console.Write("Version: ");
                Console.Color = Colors.Gray;
                Console.Write(cpuStructure.Version);
                Console.WriteLine();
                Console.Column = 35;
                Console.Color  = Colors.White;
                Console.Write("Socket: ");
                Console.Color = Colors.Gray;
                Console.Write(cpuStructure.Socket);
                Console.Write(" MHz");
                Console.WriteLine();
                Console.Column = 35;
                Console.Color  = Colors.White;
                Console.Write("Cur. Speed: ");
                Console.Color = Colors.Gray;
                Console.Write(cpuStructure.MaxSpeed, 10, -1);
                Console.Write(" MHz");
                Console.WriteLine();
                Console.Column = 35;
            }
            else
            {
                Console.Color = Colors.Red;
                Console.Write("No SMBIOS available on this system!");
            }

            Console.Goto(14, 0);

            Console.Color = 0x0F;
            for (uint index = 0; index < 60; index++)
            {
                Console.Write((char)205);
            }

            Console.WriteLine();

            //CpuInfo cpuInfo = new CpuInfo();

            //#region Vendor

            //Console.Color = Colors.Green;
            //Console.Write("Vendor:   ");
            //Console.Color = Colors.White;

            //cpuInfo.PrintVendorString(Console);

            //Console.WriteLine();

            //#endregion Vendor

            //#region Brand

            //Console.Color = Colors.Green;
            //Console.Write("Brand:    ");
            //Console.Color = Colors.White;
            //cpuInfo.PrintBrandString(Console);
            //Console.WriteLine();

            //#endregion Brand

            //#region Stepping

            //Console.Color = Colors.Green;
            //Console.Write("Stepping: ");
            //Console.Color = Colors.White;
            //Console.Write(cpuInfo.Stepping, 16, 2);

            //#endregion Stepping

            //#region Model

            //Console.Color = Colors.Green;
            //Console.Write(" Model: ");
            //Console.Color = Colors.White;
            //Console.Write(cpuInfo.Model, 16, 2);

            //#endregion Model

            //#region Family

            //Console.Color = Colors.Green;
            //Console.Write(" Family: ");
            //Console.Color = Colors.White;
            //Console.Write(cpuInfo.Family, 16, 2);

            //#endregion Family

            //#region Type

            //Console.Color = Colors.Green;
            //Console.Write(" Type: ");
            //Console.Color = Colors.White;

            //Console.Write(cpuInfo.Type, 16, 2);
            //Console.WriteLine();
            //Console.Color = Colors.Green;
            //Console.Write("Cores:    ");
            //Console.Color = Colors.White;
            //Console.Write(cpuInfo.NumberOfCores, 16, 2);

            //#endregion Type

            Console.Row = 19;
            for (uint index = 0; index < 80; index++)
            {
                Console.Column = index;
                Console.Write((char)205);
            }

            Console.Row = 23;
            for (uint index = 0; index < 80; index++)
            {
                Console.Column = index;
                Console.Write((char)205);
            }

            for (uint index = 2; index < 20; index++)
            {
                Console.Column = 60;
                Console.Row    = index;

                Console.Color = Colors.White;
                if (index == 6)
                {
                    Console.Write((char)185);
                }
                else if (index == 14)
                {
                    Console.Write((char)185);
                }
                else if (index == 19)
                {
                    Console.Write((char)202);
                }
                else
                {
                    Console.Write((char)186);
                }
            }

            Console.Goto(24, 29);
            Console.Color = Colors.Yellow;

            Console.Write("www.mosa-project.org");

            Console.Goto(12, 0);

            byte last = 0;

            while (true)
            {
                DisplayCMOS();
                DisplayTime();

                byte second = CMOS.Second;

                if (second % 10 != 5 & last != second)
                {
                    last = CMOS.Second;
                    DebugClient.SendAlive();
                }

                Native.Hlt();
            }
        }
예제 #14
0
        public static void Main()
        {
            Screen.Clear();
            Screen.BackgroundColor = ScreenColor.Blue;
            Screen.Color           = ScreenColor.Yellow;

            Screen.Write('M');
            Screen.Write('O');
            Screen.Write('S');
            Screen.Write('A');
            Screen.Write(' ');
            Screen.Write('O');
            Screen.Write('S');
            Screen.Write("!");
            Screen.Write(" ");

            Multiboot.Setup();
            Screen.Write('0');
            GDT.Setup();
            Screen.Write('1');

            IDT.SetInterruptHandler(null);
            Screen.Write('2');
            Debugger.Setup(Serial.COM1);

            Screen.Write('3');
            PIC.Setup();
            Screen.Write('4');
            IDT.Setup();
            Screen.Write('5');
            PageFrameAllocator.Setup();
            Screen.Write('6');
            PageTable.Setup();
            Screen.Write('7');
            VirtualPageAllocator.Setup();
            Screen.Write('8');
            GC.Setup();
            Screen.Write('9');

            Scheduler.Setup();
            Screen.Write('B');
            IDT.SetInterruptHandler(ProcessInterrupt);
            Screen.Write('C');
            ConsoleManager.Setup();
            Screen.Write('D');
            Screen.Write('E');
            Screen.WriteLine();
            Screen.WriteLine();

            //Screen.Write("CompilerBugTests: ");

            //bool value1 = Test1();

            //if (value1)
            //	Screen.WriteLine("Ok");
            //else
            //	Screen.WriteLine("Failed");

            //Screen.Write("FindTypeOfTest: ");

            //bool value3 = Test3();

            //if (value3)
            //	Screen.WriteLine("Ok");
            //else
            //	Screen.WriteLine("Failed");

            //UnitTest();

            KernelTest.RunTests();
            StackTrace();

            TestHash();

            int value2 = CallReturn10();

            Screen.Write("Return10 Test: ");
            if (value2 == 10)
            {
                Screen.WriteLine("Ok");
            }
            else
            {
                Screen.WriteLine("Failed");
            }

            StartThreadTest();

            // should never get here
            Screen.Write("!BAD!");

            while (true)
            {
                Native.Hlt();
            }
        }
예제 #15
0
        /// <summary>
        /// Main
        /// </summary>
        public static void Main()
        {
            Kernel.x86.Kernel.Setup();

            Console = ConsoleManager.Controller.Boot;
            Console.Clear();

            Serial.SetupPort(Serial.COM1);
            IDT.SetInterruptHandler(ProcessInterrupt);

            hal = new Hardware();

            // Create Service manager and basic services
            var serviceManager = new ServiceManager();

            DeviceService = new DeviceService();

            var diskDeviceService    = new DiskDeviceService();
            var partitionService     = new PartitionService();
            var pciControllerService = new PCIControllerService();
            var pciDeviceService     = new PCIDeviceService();

            serviceManager.AddService(DeviceService);
            serviceManager.AddService(diskDeviceService);
            serviceManager.AddService(partitionService);
            serviceManager.AddService(pciControllerService);
            serviceManager.AddService(pciDeviceService);

            DeviceSystem.Setup.Initialize(hal, DeviceService.ProcessInterrupt);

            DeviceService.RegisterDeviceDriver(DeviceDriver.Setup.GetDeviceDriverRegistryEntries());
            DeviceService.Initialize(new X86System(), null);

            partitionService.CreatePartitionDevices();
            var partitions = DeviceService.GetDevices <IPartitionDevice>();

            foreach (var partition in partitions)
            {
                var fat = new FatFileSystem(partition.DeviceDriver as IPartitionDevice);
                hasFS = fat.IsValid;

                if (hasFS)
                {
                    var location = fat.FindEntry("WALLP.BMP");

                    if (location.IsValid)
                    {
                        var fatFileStream = new FatFileStream(fat, location);
                        var _wall         = new byte[(uint)fatFileStream.Length];

                        for (int k = 0; k < _wall.Length; k++)
                        {
                            _wall[k] = (byte)(char)fatFileStream.ReadByte();
                        }

                        wallpaper = new Bitmap(_wall);
                    }
                }
            }

            var standardMice = DeviceService.GetDevices("StandardMouse");

            if (standardMice.Count == 0)
            {
                hal.Pause();
                hal.Abort("Catastrophic failure, mouse and/or PIT not found.");
            }

            mouse = standardMice[0].DeviceDriver as StandardMouse;
            mouse.SetScreenResolution(VBE.ScreenWidth, VBE.ScreenHeight);

            if (VBEDisplay.InitVBE(hal))
            {
                Log("VBE setup OK!");
                DoGraphics();
            }
            else
            {
                Log("VBE setup ERROR!");
            }
        }
예제 #16
0
        /// <summary>
        /// Main
        /// </summary>
        public static void Main()
        {
            Kernel.x86.Kernel.Setup();

            Console = ConsoleManager.Controller.Boot;

            Console.Clear();
            Console.Goto(0, 0);

            IDT.SetInterruptHandler(ProcessInterrupt);

            Console.ScrollRow       = 25;
            Console.Color           = ScreenColor.Yellow;
            Console.BackgroundColor = ScreenColor.Black;

            Console.Write("MOSA OS Version 1.4 '");
            Console.Color = ScreenColor.Red;
            Console.Write("Neptune");
            Console.Color = ScreenColor.Yellow;
            Console.Write("'                                Copyright 2008-2018");

            Console.Color = ScreenColor.White;
            Console.Write(new String((char)205, 60));
            Console.Write((char)203);
            Console.Write(new String((char)205, 19));
            Console.WriteLine();

            Console.Goto(2, 0);
            Console.Color = ScreenColor.Green;
            Console.Write("Multibootaddress: ");
            Console.Color = ScreenColor.Gray;
            Console.Write(Multiboot.MultibootAddress, 16, 8);

            Console.WriteLine();
            Console.Color = ScreenColor.Green;
            Console.Write("Multiboot-Flags:  ");
            Console.Color = ScreenColor.Gray;
            Console.Write(Multiboot.Flags, 2, 32);
            Console.WriteLine();

            Console.Color = ScreenColor.Green;
            Console.Write("Size of Memory:   ");
            Console.Color = ScreenColor.Gray;
            Console.Write((Multiboot.MemoryLower + Multiboot.MemoryUpper) / 1024, 10, -1);
            Console.Write(" MB (");
            Console.Write(Multiboot.MemoryLower + Multiboot.MemoryUpper, 10, -1);
            Console.Write(" KB)");
            Console.WriteLine();
            Console.WriteLine();

            Console.WriteLine();
            Console.Color = ScreenColor.Green;
            Console.Write("Smbios Info: ");

            if (SmbiosManager.IsAvailable)
            {
                Console.Color = ScreenColor.White;
                Console.Write("[");
                Console.Color = ScreenColor.Gray;
                Console.Write("Version ");
                Console.Write(SmbiosManager.MajorVersion, 10, -1);
                Console.Write(".");
                Console.Write(SmbiosManager.MinorVersion, 10, -1);
                Console.Color = ScreenColor.White;
                Console.Write("]");
                Console.WriteLine();

                Console.Color = ScreenColor.Yellow;
                Console.Write("[Bios]");
                Console.Color = ScreenColor.White;
                Console.WriteLine();

                var biosInformation = new BiosInformationStructure();
                Console.Color = ScreenColor.White;
                Console.Write("Vendor: ");
                Console.Color = ScreenColor.Gray;
                Console.Write(biosInformation.BiosVendor);
                Console.WriteLine();
                Console.Color = ScreenColor.White;
                Console.Write("Version: ");
                Console.Color = ScreenColor.Gray;
                Console.Write(biosInformation.BiosVersion);
                Console.WriteLine();
                Console.Color = ScreenColor.White;
                Console.Write("Date: ");
                Console.Color = ScreenColor.Gray;
                Console.Write(biosInformation.BiosDate);

                Console.Color  = ScreenColor.Yellow;
                Console.Row    = 8;
                Console.Column = 35;
                Console.Write("[Cpu]");
                Console.Color = ScreenColor.White;
                Console.WriteLine();
                Console.Column = 35;

                var cpuStructure = new CpuStructure();
                Console.Color = ScreenColor.White;
                Console.Write("Vendor: ");
                Console.Color = ScreenColor.Gray;
                Console.Write(cpuStructure.Vendor);
                Console.WriteLine();
                Console.Column = 35;
                Console.Color  = ScreenColor.White;
                Console.Write("Version: ");
                Console.Color = ScreenColor.Gray;
                Console.Write(cpuStructure.Version);
                Console.WriteLine();
                Console.Column = 35;
                Console.Color  = ScreenColor.White;
                Console.Write("Socket: ");
                Console.Color = ScreenColor.Gray;
                Console.Write(cpuStructure.Socket);
                Console.Write(" MHz");
                Console.WriteLine();
                Console.Column = 35;
                Console.Color  = ScreenColor.White;
                Console.Write("Cur. Speed: ");
                Console.Color = ScreenColor.Gray;
                Console.Write(cpuStructure.MaxSpeed, 10, -1);
                Console.Write(" MHz");
                Console.WriteLine();
                Console.Column = 35;
            }
            else
            {
                Console.Color = ScreenColor.Red;
                Console.Write("No SMBIOS available on this system!");
            }

            Console.WriteLine();
            Console.WriteLine();

            Console.Color = ScreenColor.Green;
            Console.Write("Memory-Map:");
            Console.WriteLine();

            for (uint index = 0; index < Multiboot.MemoryMapCount; index++)
            {
                Console.Color = ScreenColor.White;
                Console.Write(Multiboot.GetMemoryMapBase(index), 16, 8);
                Console.Write(" - ");
                Console.Write(Multiboot.GetMemoryMapBase(index) + Multiboot.GetMemoryMapLength(index) - 1, 16, 8);
                Console.Write(" (");
                Console.Color = ScreenColor.Gray;
                Console.Write(Multiboot.GetMemoryMapLength(index), 16, 8);
                Console.Color = ScreenColor.White;
                Console.Write(") ");
                Console.Color = ScreenColor.Gray;
                Console.Write("Type: ");
                Console.Write(Multiboot.GetMemoryMapType(index), 16, 1);
                Console.WriteLine();
            }

            Console.Color = ScreenColor.Yellow;
            Console.Goto(24, 29);
            Console.Write("www.mosa-project.org");

            // Borders

            Console.Color = ScreenColor.White;

            for (uint index = 0; index < 60; index++)
            {
                Console.Goto(14, index);
                Console.Write((char)205);
            }

            for (uint index = 0; index < 60; index++)
            {
                Console.Goto(6, index);
                Console.Write((char)205);
            }

            for (uint index = 60; index < 80; index++)
            {
                Console.Goto(19, index);
                Console.Write((char)205);
            }

            for (uint index = 0; index < 80; index++)
            {
                Console.Goto(23, index);
                Console.Write((char)205);
            }

            for (uint index = 2; index < 20; index++)
            {
                Console.Goto(index, 60);
                if (index == 6)
                {
                    Console.Write((char)185);
                }
                else if (index == 14)
                {
                    Console.Write((char)185);
                }
                else if (index == 19)
                {
                    Console.Write((char)200);
                }
                else
                {
                    Console.Write((char)186);
                }
            }

            Console.Goto(12, 0);

            while (true)
            {
                DisplayCMOS();
                DisplayTime();

                Native.Hlt();
            }
        }
예제 #17
0
        /// <summary>
        /// Main
        /// </summary>
        public static void Main()
        {
            Kernel.x86.Kernel.Setup();

            Console = ConsoleManager.Controller.Boot;

            Console.Clear();
            Console.Goto(0, 0);

            //IDT.SetInterruptHandler(ProcessInterrupt);

            Console.ScrollRow       = 23;
            Console.Color           = ScreenColor.White;
            Console.BackgroundColor = ScreenColor.Green;

            Debug = ConsoleManager.Controller.Boot;

            Console.Write("                   MOSA OS Version 1.5 - Compiler Version 1.5");
            FillLine();
            Console.Color           = ScreenColor.White;
            Console.BackgroundColor = ScreenColor.Black;

            Console.WriteLine("> Initializing hardware abstraction layer...");
            var hardware = new HAL.Hardware();

            var DeviceManager = Setup.Initialize(PlatformArchitecture.X86, hardware);

            Console.WriteLine("> Registering device drivers...");
            DeviceDriver.Setup.Register(DeviceManager);

            Console.WriteLine("> Starting devices...");
            DeviceDriver.Setup.Start(DeviceManager);

            Console.Write("> Probing for ISA devices...");
            var isaDevices = DeviceManager.GetAllDevices();

            Console.WriteLine("[Completed: " + isaDevices.Count.ToString() + " found]");

            foreach (var device in isaDevices)
            {
                Console.Write("  ");
                Bullet(ScreenColor.Yellow);
                Console.Write(" ");
                InBrackets(device.Name, ScreenColor.White, ScreenColor.Green);
                Console.WriteLine();
            }

            Console.Write("> Probing for PCI devices...");

            //Setup.StartPCIDevices();
            var pciDevices = DeviceManager.GetDevices <DeviceSystem.PCI.IPCIDevice>(DeviceStatus.Available);

            Console.WriteLine("[Completed: " + pciDevices.Count.ToString() + " found]");

            foreach (var device in pciDevices)
            {
                var pciDevice = device.DeviceDriver as DeviceSystem.PCI.IPCIDevice;

                Console.Write("  ");
                Bullet(ScreenColor.Yellow);
                Console.Write(" ");
                InBrackets(device.Name + ": " + pciDevice.VendorID.ToString("x") + ":" + pciDevice.DeviceID.ToString("x") + " " + pciDevice.SubSystemID.ToString("x") + ":" + pciDevice.SubVendorID.ToString("x") + " (" + pciDevice.Function.ToString("x") + ":" + pciDevice.ClassCode.ToString("x") + ":" + pciDevice.SubClassCode.ToString("x") + ":" + pciDevice.ProgIF.ToString("x") + ":" + pciDevice.RevisionID.ToString("x") + ")", ScreenColor.White, ScreenColor.Green);
                Console.WriteLine();
            }

            Console.Write("> Probing for disk controllers...");
            var diskcontrollers = DeviceManager.GetDevices <IDiskControllerDevice>();

            Console.WriteLine("[Completed: " + diskcontrollers.Count.ToString() + " found]");

            foreach (var device in diskcontrollers)
            {
                Console.Write("  ");
                Bullet(ScreenColor.Yellow);
                Console.Write(" ");
                InBrackets(device.Name, ScreenColor.White, ScreenColor.Green);
                Console.WriteLine();
            }

            Console.Write("> Probing for disks...");
            var disks = DeviceManager.GetDevices <IDiskDevice>();

            Console.WriteLine("[Completed: " + disks.Count.ToString() + " found]");

            foreach (var disk in disks)
            {
                Console.Write("  ");
                Bullet(ScreenColor.Yellow);
                Console.Write(" ");
                InBrackets(disk.Name, ScreenColor.White, ScreenColor.Green);
                Console.Write(" " + (disk.DeviceDriver as IDiskDevice).TotalBlocks.ToString() + " blocks");
                Console.WriteLine();
            }

            var partitionManager = new PartitionManager(DeviceManager);

            partitionManager.CreatePartitionDevices();

            Console.Write("> Finding partitions...");
            var partitions = DeviceManager.GetDevices <IPartitionDevice>();

            Console.WriteLine("[Completed: " + partitions.Count.ToString() + " found]");

            foreach (var partition in partitions)
            {
                Console.Write("  ");
                Bullet(ScreenColor.Yellow);
                Console.Write(" ");
                InBrackets(partition.Name, ScreenColor.White, ScreenColor.Green);
                Console.Write(" " + (partition.DeviceDriver as IPartitionDevice).BlockCount.ToString() + " blocks");
                Console.WriteLine();
            }

            Console.Write("> Finding file systems...");

            foreach (var partition in partitions)
            {
                var fat = new FatFileSystem(partition.DeviceDriver as IPartitionDevice);

                if (fat.IsValid)
                {
                    Console.WriteLine("Found a FAT file system!");

                    const string filename = "TEST.TXT";

                    var location = fat.FindEntry(filename);

                    if (location.IsValid)
                    {
                        Console.Write("Found: " + filename);

                        var fatFileStream = new FatFileStream(fat, location);

                        uint len = (uint)fatFileStream.Length;

                        Console.WriteLine(" - Length: " + len.ToString());

                        Console.Write("Reading File: ");

                        for (; ;)
                        {
                            int i = fatFileStream.ReadByte();

                            if (i < 0)
                            {
                                break;
                            }

                            Console.Write((char)i);
                        }

                        Console.WriteLine();
                    }
                }
            }

            // Get StandardKeyboard
            var standardKeyboards = DeviceManager.GetDevices("StandardKeyboard");

            if (standardKeyboards.Count == 0)
            {
                Console.WriteLine("No Keyboard!");
                ForeverLoop();
            }

            var standardKeyboard = standardKeyboards[0].DeviceDriver as IKeyboardDevice;

            Debug = ConsoleManager.Controller.Debug;

            // setup keymap
            var keymap = new US();

            // setup keyboard (state machine)
            var keyboard = new DeviceSystem.Keyboard(standardKeyboard, keymap);

            // setup app manager
            var manager = new AppManager(Console, keyboard);

            IDT.SetInterruptHandler(manager.ProcessInterrupt);

            Logger.Log("<SELFTEST:PASSED>");

            manager.Start();
        }