Exemple #1
0
        /// <summary>
        /// Initialize the Machine
        /// </summary>
        public static void Setup()
        {
            Multiboot.Setup();

            PIC.Setup();

            IDT.Setup();

            PageFrameAllocator.Setup();

            PageTable.Setup();

            VirtualPageAllocator.Setup();

            GC.Setup();

            Scheduler.Setup();

            Serial.SetupPort(Serial.COM1);

            var _hal = new Hardware();

            if (VBEDisplay.InitVBE(_hal))
            {
                ScreenManager.Setup();
                ScreenManager.Add(new BootScreen());
                ScreenManager.Add(new TestScreen());

                ScreenManager.ChangeScreen(ScreenIds.Boot);
            }

            Native.Hlt();
        }
Exemple #2
0
 public static void Setup()
 {
     Screen.Clear();
     Screen.Color = 0x0E;
     Screen.SetCursor(24, 0);
     Screen.Write('1');
     Multiboot.Setup();
     Screen.SetCursor(24, 1);
     Screen.Write('2');
     PIC.Setup();
     Screen.SetCursor(24, 2);
     Screen.Write('3');
     GDT.Setup();
     Screen.SetCursor(24, 3);
     Screen.Write('4');
     IDT.Setup();
     Screen.SetCursor(24, 4);
     Screen.Write('5');
     PageFrameAllocator.Setup();
     Screen.SetCursor(24, 5);
     Screen.Write('6');
     PageTable.Setup();
     Screen.SetCursor(24, 6);
     Screen.Write('7');
     VirtualPageAllocator.Setup();
     Screen.SetCursor(24, 7);
     Screen.Write('8');
     Screen.SetCursor(24, 8);
     ProcessManager.Setup();
     Screen.Write('9');
     Screen.SetCursor(24, 9);
     TaskManager.Setup();
     Screen.Write('A');
     Screen.SetCursor(24, 10);
 }
Exemple #3
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();
        }
Exemple #4
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();
            }
        }
Exemple #5
0
        /// <summary>
        /// Mains this instance.
        /// </summary>
        public static void Main()
        {
            Screen.Clear();
            Screen.Color = 0x0E;

            Screen.SetCursor(24, 0);
            Screen.Write('1');
            Multiboot.SetMultibootLocation(Memory.Get32(0x200004), Memory.Get32(0x200000));
//			Screen.SetCursor(24, 1);
            Screen.Write('2');
            PageFrameAllocator.Setup();
            Screen.SetCursor(24, 2);
            Screen.Write('3');
            Screen.SetCursor(24, 3);
            Screen.Write('4');

            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('V');
            Screen.Write('e');
            Screen.Write('r');
            Screen.Write('s');
            Screen.Write('i');
            Screen.Write('o');
            Screen.Write('n');
            Screen.Write(' ');
            Screen.Write('0');
            Screen.Write('.');
            Screen.Write('6');
            Screen.Write(' ');
            Screen.Write('\'');
            Screen.Color = 0x0C;
            Screen.Write('T');
            Screen.Write('a');
            Screen.Write('n');
            Screen.Write('i');
            Screen.Write('g');
            Screen.Write('a');
            Screen.Write('w');
            Screen.Write('a');
            Screen.Color = 0x0E;
            Screen.Write('\'');
            Screen.Write(' ');
            Screen.Write(' ');
            Screen.Write(' ');
            Screen.Write(' ');
            Screen.Write(' ');
            Screen.Write(' ');
            Screen.Write(' ');
            Screen.Write(' ');
            Screen.Write(' ');
            Screen.Write(' ');
            Screen.Write(' ');
            Screen.Write(' ');
            Screen.Write(' ');
            Screen.Write(' ');
            Screen.Write(' ');
            Screen.Write(' ');
            Screen.Write(' ');
            Screen.Write(' ');
            Screen.Write(' ');
            Screen.Write(' ');
            Screen.Write(' ');
            Screen.Write(' ');
            Screen.Write(' ');
            Screen.Write(' ');
            Screen.Write(' ');
            Screen.Write(' ');
            Screen.Write(' ');
            Screen.Write(' ');
            Screen.Write(' ');
            Screen.Write(' ');
            Screen.Color = 0x0E;
            Screen.Write('C');
            Screen.Write('o');
            Screen.Write('p');
            Screen.Write('y');
            Screen.Write('r');
            Screen.Write('i');
            Screen.Write('g');
            Screen.Write('h');
            Screen.Write('t');
            Screen.Write(' ');
            Screen.Write('2');
            Screen.Write('0');
            Screen.Write('0');
            Screen.Write('8');
            Screen.Write('-');
            Screen.Write('2');
            Screen.Write('0');
            Screen.Write('0');
            Screen.Write('9');
            Screen.NextLine();

            Screen.Color = 0x0F;
            for (uint index = 0; index < 80; index++)
            {
                if (index == 60)
                {
                    Screen.Write((char)203);
                }
                else
                {
                    Screen.Write((char)205);
                }
            }
            Screen.NextLine();

            Screen.SetCursor(2, 0);
            Screen.Color = 0x0A;
            Screen.Write('M');
            Screen.Write('u');
            Screen.Write('l');
            Screen.Write('t');
            Screen.Write('i');
            Screen.Write('b');
            Screen.Write('o');
            Screen.Write('o');
            Screen.Write('t');
            Screen.Write('a');
            Screen.Write('d');
            Screen.Write('d');
            Screen.Write('r');
            Screen.Write('e');
            Screen.Write('s');
            Screen.Write('s');
            Screen.Write(':');
            Screen.Write(' ');
            Screen.Color = 0x07;
            Screen.Write(Memory.Get32(0x200004), 16, 8);

            Screen.NextLine();
            Screen.Color = 0x0A;
            Screen.Write('M');
            Screen.Write('a');
            Screen.Write('g');
            Screen.Write('i');
            Screen.Write('c');
            Screen.Write(' ');
            Screen.Write('n');
            Screen.Write('u');
            Screen.Write('m');
            Screen.Write('b');
            Screen.Write('e');
            Screen.Write('r');
            Screen.Write(':');
            Screen.Write(' ');
            Screen.Write(' ');
            Screen.Write(' ');
            Screen.Write(' ');
            Screen.Write(' ');
            Screen.Color = 0x07;
            Screen.Write(Memory.Get32(0x200000), 16, 8);

            Screen.NextLine();
            Screen.Color = 0x0A;
            Screen.Write('M');
            Screen.Write('u');
            Screen.Write('l');
            Screen.Write('t');
            Screen.Write('i');
            Screen.Write('b');
            Screen.Write('o');
            Screen.Write('o');
            Screen.Write('t');
            Screen.Write('-');
            Screen.Write('F');
            Screen.Write('l');
            Screen.Write('a');
            Screen.Write('g');
            Screen.Write('s');
            Screen.Write(':');
            Screen.Write(' ');
            Screen.Write(' ');
            Screen.Color = 0x07;
            Screen.Write(Multiboot.Flags, 2, 32);
            Screen.NextLine();
            Screen.NextLine();

            Screen.Color = 0x0A;
            Screen.Write('S');
            Screen.Write('i');
            Screen.Write('z');
            Screen.Write('e');
            Screen.Write(' ');
            Screen.Write('o');
            Screen.Write('f');
            Screen.Write(' ');
            Screen.Write('M');
            Screen.Write('e');
            Screen.Write('m');
            Screen.Write('o');
            Screen.Write('r');
            Screen.Write('y');
            Screen.Write(':');
            Screen.Write(' ');
            Screen.Write(' ');
            Screen.Write(' ');
            Screen.Color = 0x07;
            Screen.Write((Multiboot.MemoryLower + Multiboot.MemoryUpper) / 1024, 10, -1);
            Screen.Write(' ');
            Screen.Write('M');
            Screen.Write('B');
            Screen.Write(' ');
            Screen.Write('(');
            Screen.Write(Multiboot.MemoryLower + Multiboot.MemoryUpper, 10, -1);
            Screen.Write(' ');
            Screen.Write('K');
            Screen.Write('B');
            Screen.Write(')');
            Screen.NextLine();

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

            Screen.Color = 0x0A;
            Screen.Write('M');
            Screen.Write('e');
            Screen.Write('m');
            Screen.Write('o');
            Screen.Write('r');
            Screen.Write('y');
            Screen.Write('-');
            Screen.Write('M');
            Screen.Write('a');
            Screen.Write('p');
            Screen.Write(':');
            Screen.NextLine();

            for (uint index = 0; index < (Multiboot.MemoryMapCount & 7); index++)
            {
                Screen.Color = 0x0F;
                Screen.Write(Multiboot.GetMemoryMapBaseLow(index), 16, 10);
                Screen.Write(' ');
                Screen.Write('-');
                Screen.Write(' ');
                Screen.Write(Multiboot.GetMemoryMapBaseLow(index) + Multiboot.GetMemoryMapLengthLow(index), 16, 10);
                Screen.Write(' ');
                Screen.Write('(');
                Screen.Color = 0x07;
                Screen.Write(Multiboot.GetMemoryMapLengthLow(index), 16, 10);
                Screen.Color = 0x0F;
                Screen.Write(')');
                Screen.Write(' ');
                Screen.Color = 0x07;
                Screen.Write('T');
                Screen.Write('y');
                Screen.Write('p');
                Screen.Write('e');
                Screen.Write(':');
                Screen.Write(' ');
                Screen.Write(Multiboot.GetMemoryMapType(index), 16, 1);
                Screen.NextLine();
            }

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

            #region Vendor
            Screen.Color = 0x0A;
            Screen.Write('V');
            Screen.Write('e');
            Screen.Write('n');
            Screen.Write('d');
            Screen.Write('o');
            Screen.Write('r');
            Screen.Write(':');
            Screen.Write(' ');
            Screen.Write(' ');
            Screen.Write(' ');
            Screen.Color = 0x0F;

            int identifier = Platforms.x86.Native.CpuIdEbx(0);
            for (int i = 0; i < 4; ++i)
            {
                Screen.Write((char)((identifier >> (i * 8)) & 0xFF));
            }

            identifier = Platforms.x86.Native.CpuIdEdx(0);
            for (int i = 0; i < 4; ++i)
            {
                Screen.Write((char)((identifier >> (i * 8)) & 0xFF));
            }

            identifier = Platforms.x86.Native.CpuIdEcx(0);
            for (int i = 0; i < 4; ++i)
            {
                Screen.Write((char)((identifier >> (i * 8)) & 0xFF));
            }

            Screen.NextLine();
            #endregion

            #region Brand
            Screen.Color = 0x0A;
            Screen.Write('B');
            Screen.Write('r');
            Screen.Write('a');
            Screen.Write('n');
            Screen.Write('d');
            Screen.Write(':');
            Screen.Write(' ');
            Screen.Write(' ');
            Screen.Write(' ');
            Screen.Write(' ');
            Screen.Color = 0x0F;

            PrintBrand((uint)2147483650);
            PrintBrand((uint)2147483651);
            PrintBrand((uint)2147483652);
            Screen.NextLine();
            #endregion

            int info = Platforms.x86.Native.CpuIdEax(1);
            #region Stepping
            Screen.Color = 0x0A;
            Screen.Write('S');
            Screen.Write('t');
            Screen.Write('e');
            Screen.Write('p');
            Screen.Write('p');
            Screen.Write('i');
            Screen.Write('n');
            Screen.Write('g');
            Screen.Write(':');
            Screen.Write(' ');
            Screen.Color = 0x0F;
            Screen.Write((ulong)(info & 0xF), 16, 2);
            #endregion

            #region Model
            Screen.Color = 0x0A;
            Screen.Write(' ');
            Screen.Write('M');
            Screen.Write('o');
            Screen.Write('d');
            Screen.Write('e');
            Screen.Write('l');
            Screen.Write(':');
            Screen.Write(' ');
            Screen.Color = 0x0F;
            Screen.Write((ulong)((info & 0xF0) >> 4), 16, 2);
            #endregion

            #region Family
            Screen.Color = 0x0A;
            Screen.Write(' ');
            Screen.Write('F');
            Screen.Write('a');
            Screen.Write('m');
            Screen.Write('i');
            Screen.Write('l');
            Screen.Write('y');
            Screen.Write(':');
            Screen.Write(' ');
            Screen.Color = 0x0F;
            Screen.Write((ulong)((info & 0xF00) >> 8), 16, 2);
            #endregion

            #region Type
            Screen.Color = 0x0A;
            Screen.Write(' ');
            Screen.Write('T');
            Screen.Write('y');
            Screen.Write('p');
            Screen.Write('e');
            Screen.Write(':');
            Screen.Write(' ');
            Screen.Color = 0x0F;

            Screen.Write((ulong)((info & 0x3000) >> 12), 16, 2);
            Screen.NextLine();
            #endregion

            //Multiboot.Dump(4,53);

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

            for (uint index = 2; index < 24; index++)
            {
                Screen.Column = 60;
                Screen.Row    = index;

                Screen.Color = 0x0F;
                if (index == 7)
                {
                    Screen.Write((char)185);
                }
                else if (index == 15)
                {
                    Screen.Write((char)185);
                }
                else if (index == 23)
                {
                    Screen.Write((char)202);
                }
                else
                {
                    Screen.Write((char)186);
                }
            }

            Screen.SetCursor(24, 29);
            Screen.Color = 0x0E;
            Screen.Write('w');
            Screen.Write('w');
            Screen.Write('w');
            Screen.Write('.');
            Screen.Write('m');
            Screen.Write('o');
            Screen.Write('s');
            Screen.Write('a');
            Screen.Write('-');
            Screen.Write('p');
            Screen.Write('r');
            Screen.Write('o');
            Screen.Write('j');
            Screen.Write('e');
            Screen.Write('c');
            Screen.Write('t');
            Screen.Write('.');
            Screen.Write('o');
            Screen.Write('r');
            Screen.Write('g');

            while (true)
            {
                CMOS.Dump(2, 65);
                DisplayTime();
            }
        }
Exemple #6
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();
            }
        }