示例#1
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);
 }
示例#2
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();
        }
示例#3
0
 public static void Setup()
 {
     GDT.Setup();                        // Global Descriptor Table
     PIC.Setup();                        // Programmable Interrupt Controller
     IDT.Setup();                        // Interrupt Descriptor table
     PIT.Setup();                        // Periodic Interrupt Timer
     // Disabled because it needs MemoryManager [cedrou]
     //Serial.Setup ();	// Setup serial I/O
 }
示例#4
0
        public static unsafe void Start(uint magic, uint address)
        {
            /* Setup Multiboot */
            Multiboot.Setup(magic, address);

            /* Placement Address */
            Heap.PlacementAddress = Native.EndOfKernel();

            /* Clear Interrupts */
            Native.ClearInterrupt();

            /* Setup PIC */
            PIC.Setup();

            /* Setup GDT & Enter into protected mode */
            GDT.Setup();

            /* Setup IDT */
            IDT.Setup();

            /* Enable Interrupts */
            Native.SetInterrupt();

            /* Setup Paging */
            Paging.Setup(Multiboot.RAM);

            /* Setup Multitasking */
            Multitasking.CreateTask(0, true); //This is System Update thread
            Multitasking.Init();              //Start Multitasking

            /* Call our kernel instance now */
            try
            {
                Caller.Start();
                while (true)
                {
                    Caller.Update();
                }
            }
            catch (Exception e)
            {
                //Kernel PANIC !!
                Console.WriteLine(e.Message);
            }

            while (true)  //Set CPU in Infinite loop DON'T REMOVE THIS ELSE I'll KILL YOU (^ . ^)
            {
                Native.ClearInterrupt();
                Native.Halt();
            }
            ;
        }
示例#5
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();
        }
示例#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
        /// <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();
        }
示例#8
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();
        }
示例#9
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();
            }
        }
示例#10
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();
            }
        }
示例#11
0
        internal static void Start(uint magic, uint address, uint KernelDirectory, uint InitialHeap)
        {
            /* Kernel Logger init */
            Debug.Init();

            /* Initalize Heap */
            Heap.Init(InitialHeap);

            /* Multiboot Info Parsing */
            Multiboot.Setup(magic, address);

            /* Setup Paging */
            Paging.Setup(KernelDirectory);

            /* Setup GDT */
            GDT.Setup();

            /* Remap PIC */
            PIC.Setup();

            /* Setup IDT */
            IDT.Setup();

            /* Enable Interrupt */
            Native.Sti();

            /* Setup Scheduler */
            Scheduler.Init(KernelDirectory);

            /* Setup System Timer */
            Timer.Setup();

            /* Install SHM */
            SHM.Install();

            /* Initialise VBE 2.0 Driver */
            VBE.Init();

            /* Initialise Virtual File system */
            VirtualFileSystem.Setup();

            /* Setup Syscall */
            Syscall.Setup();

            /* Initialise C library */
            Libc.Init();

            try
            {
                Boot.Init();
            }
            catch (Exception e)
            {
                Debug.Write("[@SystemThread] => [EXIT]: %s\n", e.Message);
            }

            while (true)
            {
                ;
            }
        }