public static unsafe void StartupStage2() { try { if (!KConfig.SingleThread) { Scheduler.CreateThread(ProcessManager.System, new ThreadStartOptions(BackgroundWorker.ThreadMain) { DebugName = "BackgroundWorker", Priority = -5 }).Start(); Scheduler.CreateThread(ProcessManager.System, new ThreadStartOptions(Thread0) { DebugName = "KernelThread0", Priority = -5 }).Start(); var userProc = ProcessManager.CreateEmptyProcess(new ProcessCreateOptions { User = false }); userProc.Path = "/buildin/testproc"; Scheduler.CreateThread(userProc, new ThreadStartOptions(Thread1) { AllowUserModeIOPort = true, DebugName = "UserThread1", Priority = -5 }); Scheduler.CreateThread(userProc, new ThreadStartOptions(Thread2) { AllowUserModeIOPort = true, DebugName = "UserThread2", Priority = -5 }); userProc.Start(); var fileProc = ProcessManager.StartProcess("Service.Basic"); FileServ = fileProc.Service; KernelMessage.WriteLine("Waiting for Service"); while (FileServ.Status != ServiceStatus.Ready) { Scheduler.Sleep(0); } KernelMessage.WriteLine("Service 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.StartProcess("App.HelloService"); Serv = proc.Service; var p2 = ProcessManager.StartProcess("App.HelloKernel"); //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.StartProcess("App.Shell"); 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); } }
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); } }