コード例 #1
0
ファイル: SerialDevice.cs プロジェクト: willvin313/SharpOS
        public bool OnInterrupt(uint irq)
        {
            ReadSerial();

            SimpleEventDispatch.OnEvent(this);

            return(true);
        }
コード例 #2
0
        public unsafe static void BootEntry(uint magic, uint pointer, uint kernelStart, uint kernelEnd)
        {
            // Initialize architecture-specific portion of the kernel
            Architecture.Setup();

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

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

            // Write the banner
            DisplayBanner();

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            //Multiboot.WriteMultibootInfo();

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

            SetKernelStage(KernelStage.Diagnostics);

            // Infinite loop used to halt the processors
            //FIXME We must know on each processor the current thread runs on.
            //      Halt all other procs, then halt the current one.
            IProcessor[] procs     = Architecture.GetProcessors();
            int          procCount = Architecture.GetProcessorCount();
            while (stayInLoop)
            {
                for (int i = 0; i < procCount; i++)
                {
                    procs[i].Halt();
                }
            }
        }