示例#1
0
        private static void AppMain()
        {
            KernelMessage.WriteLine("Kernel ready");

            ThreadTests.TriggerTestPassed();

            // We have nothing to do (yet). So let's stop.
            Debug.Break();
        }
示例#2
0
        private static void StartupStage2()
        {
            try
            {
                if (!KConfig.SingleThread)
                {
                    Scheduler.CreateThread(ProcessManager.System, new ThreadStartOptions(BackgroundWorker.ThreadMain)
                    {
                        DebugName = "BackgroundWorker", Priority = -5
                    }).Start();

                    ThreadTests.StartTestThreads();

                    // Start some applications

                    var fileProc = ProcessManager.CreateProcess("Service.Basic");
                    FileServ = fileProc.Service;
                    fileProc.Start();

                    KernelMessage.WriteLine("Waiting for Service");
                    while (FileServ.Status != ServiceStatus.Ready)
                    {
                        Scheduler.Sleep(0);
                    }
                    KernelMessage.WriteLine("Service Ready");

                    var conProc = ProcessManager.CreateProcess("Service.ConsoleServer");
                    conProc.Start();
                    var conServ = conProc.Service;
                    KernelMessage.WriteLine("Waiting for ConsoleServer");
                    while (conServ.Status != ServiceStatus.Ready)
                    {
                        Scheduler.Sleep(0);
                    }
                    KernelMessage.WriteLine("ConsoleServer Ready");

                    //var buf = Abanu.Runtime.SysCalls.RequestMessageBuffer(4096, FileServ.Process.ProcessID);
                    //var kb = Abanu.Runtime.SysCalls.OpenFile(buf, "/dev/keyboard");
                    //KernelMessage.Write("kb Handle: {0:X8}", kb);
                    //buf.Size = 4;
                    //Abanu.Runtime.SysCalls.WriteFile(kb, buf);
                    //Abanu.Runtime.SysCalls.ReadFile(kb, buf);

                    //var procHostCommunication = ProcessManager.StartProcess("Service.HostCommunication");
                    //ServHostCommunication = new Service(procHostCommunication);
                    //// TODO: Optimize Registration
                    //SysCallManager.SetCommandProcess(SysCallTarget.HostCommunication_CreateProcess, procHostCommunication);

                    var proc = ProcessManager.CreateProcess("App.HelloService");
                    Serv = proc.Service;
                    proc.Start();

                    var p2 = ProcessManager.CreateProcess("App.HelloKernel");
                    p2.Start();
                    //p2.Threads[0].SetArgument(0, 0x90);
                    //p2.Threads[0].SetArgument(4, 0x94);
                    //p2.Threads[0].SetArgument(8, 0x98);
                    p2.Threads[0].Debug = true;

                    var p3 = ProcessManager.CreateProcess("App.Shell");
                    p3.Start();

                    ProcessManager.System.Threads[0].Status = ThreadStatus.Terminated;
                }
                VirtualPageManager.SetTraceOptions(new PageFrameAllocatorTraceOptions {
                    Enabled = true, MinPages = 1
                });

                KernelMessage.WriteLine("Enter Main Loop");
                AppMain();
            }
            catch (Exception ex)
            {
                Panic.Error(ex.Message);
            }
        }