Ejemplo n.º 1
0
        private void RunIsoInBochs(string iso, string harddisk)
        {
            if (!File.Exists(harddisk))
            {
                throw new FileNotFoundException("Harddisk file not found!", harddisk);
            }

            var xBochsConfig = Path.Combine(mBaseWorkingDirectory, "Kernel.bochsrc");
            var xParams = new NameValueCollection();

            xParams.Add("ISOFile", iso);
            xParams.Add(BuildPropertyNames.VisualStudioDebugPortString, "Pipe: Cosmos\\Serial");
            xParams.Add(BuildPropertyNames.EnableBochsDebugString, RunWithGDB.ToString());

            var xDebugConnector = new DebugConnectorPipeServer(DebugConnectorPipeServer.DefaultCosmosPipeName);
            InitializeDebugConnector(xDebugConnector);

            var xBochs = new Bochs(xParams, RunWithGDB, new FileInfo(xBochsConfig), harddisk);

            xBochs.OnShutDown = (a, b) =>
                                {
                                };

            xBochs.RedirectOutput = false;
            xBochs.LogError = s => OutputHandler.LogDebugMessage(s);
            xBochs.LogOutput = s => OutputHandler.LogDebugMessage(s);

            HandleRunning(xDebugConnector, xBochs);
        }
Ejemplo n.º 2
0
        private void RunIsoInVMware(string iso)
        {
            var xParams = new NameValueCollection();

            xParams.Add("ISOFile", iso);
            xParams.Add(BuildProperties.VisualStudioDebugPortString, "Pipe: Cosmos\\Serial");
            xParams.Add(BuildProperties.VMwareEditionString, "Workstation");

            var xDebugConnector = new DebugConnectorPipeServer(DebugConnectorPipeServer.DefaultCosmosPipeName);
            InitializeDebugConnector(xDebugConnector);

            var xVMware = new VMware(xParams, false);
            xVMware.OnShutDown = (a, b) =>
            {
            };

            HandleRunning(xDebugConnector, xVMware);
        }
Ejemplo n.º 3
0
        private void RunIsoInBochs(string iso)
        {
            var xBochsConfig = Path.Combine(mBaseWorkingDirectory, "Kernel.bochsrc");
            var xParams = new NameValueCollection();

            xParams.Add(BuildProperties.EnableBochsDebugString, "false");
            xParams.Add("ISOFile", iso);
            xParams.Add(BuildProperties.VisualStudioDebugPortString, "Pipe: Cosmos\\Serial");

            var xDebugConnector = new DebugConnectorPipeServer(DebugConnectorPipeServer.DefaultCosmosPipeName);
            InitializeDebugConnector(xDebugConnector);

            var xBochs = new Bochs(xParams, false, new FileInfo(xBochsConfig));
            xBochs.OnShutDown = (a, b) =>
                                {
                                };
            xBochs.RedirectOutput = true;
            xBochs.LogError = s => OutputHandler.LogDebugMessage(s);
            xBochs.LogOutput = s => OutputHandler.LogDebugMessage(s);

            HandleRunning(xDebugConnector, xBochs);
        }
Ejemplo n.º 4
0
        private void RunIsoInVMware(string iso, string harddisk)
        {
            if (!File.Exists(harddisk))
            {
                throw new FileNotFoundException("Harddisk file not found!", harddisk);
            }

            var xParams = new NameValueCollection();

            xParams.Add("ISOFile", iso);
            xParams.Add(BuildPropertyNames.VisualStudioDebugPortString, "Pipe: Cosmos\\Serial");
            xParams.Add(BuildPropertyNames.VMwareEditionString, "Workstation");

            var xDebugConnector = new DebugConnectorPipeServer(DebugConnectorPipeServer.DefaultCosmosPipeName);
            InitializeDebugConnector(xDebugConnector);

            var xVMware = new VMware(xParams, RunWithGDB, harddisk);
            xVMware.OnShutDown = (a, b) =>
            {
            };

            HandleRunning(xDebugConnector, xVMware);
        }
Ejemplo n.º 5
0
        private void RunIsoInBochs(string iso)
        {
            var xBochsConfig = Path.Combine(mBaseWorkingDirectory, "Kernel.bochsrc");
            var xParams = new NameValueCollection();

            xParams.Add(BuildProperties.EnableBochsDebugString, "false");
            xParams.Add("ISOFile", iso);
            xParams.Add(BuildProperties.VisualStudioDebugPortString, "Pipe: Cosmos\\Serial");

            var xDebugConnector = new DebugConnectorPipeServer("Cosmos\\Serial");

            xDebugConnector.CmdChannel = ChannelPacketReceived;
            xDebugConnector.CmdStarted = () =>
                                         {
                                             OutputHandler.LogMessage("DC: Started");
                                             xDebugConnector.SendCmd(Vs2Ds.BatchEnd);
                                         };
            xDebugConnector.Error = e =>
                                    {
                                        OutputHandler.LogMessage("DC Error: " + e.ToString());
                                        OutputHandler.SetKernelTestResult(false, "DC Error");
                                        mKernelResultSet = true;
                                        mBochsRunning = false;
                                    };
            xDebugConnector.CmdText += s =>
                                       {
                                           if (s == "SYS_TestKernel_Completed")
                                           {
                                               KernelTestCompleted();
                                               return;
                                           }
                                           else if (s == "SYS_TestKernel_Failed")
                                           {
                                               KernelTestFailed();
                                               return;
                                           }
                                           else if (s == "SYS_TestKernel_AssertionSucceeded")
                                           {
                                               KernelAssertionSucceeded();
                                               return;
                                           }
                                           OutputHandler.LogMessage("Text from kernel: " + s);
                                       };
            xDebugConnector.CmdMessageBox = s =>
                                            {
                                                //OutputHandler.LogMessage("MessageBox from kernel: " + s)
                                            };
            xDebugConnector.CmdTrace = t =>
                                       {
                                       };
            xDebugConnector.CmdBreak = t =>
                                       {
                                       };

            var xBochs = new Bochs(xParams, false, new FileInfo(xBochsConfig));
            xBochs.OnShutDown = (a, b) =>
                                {
                                };

            mBochsRunning = true;
            xBochs.Start();
            try
            {
                var xStartTime = DateTime.Now;
                mKernelResultSet = false;
                Interlocked.Exchange(ref mSucceededAssertions, 0);

                Console.WriteLine("Bochs started");
                while (mBochsRunning)
                {
                    Thread.Sleep(50);

                    if (Math.Abs(DateTime.Now.Subtract(xStartTime).TotalSeconds) > AllowedSecondsInKernel)
                    {
                        OutputHandler.SetKernelTestResult(false, "Timeout exceeded");
                        mKernelResultSet = true;
                        break;
                    }
                }
                if (!mKernelResultSet)
                {
                    OutputHandler.SetKernelTestResult(true, null);
                }
                OutputHandler.SetKernelSucceededAssertionsCount(mSucceededAssertions);
                Console.WriteLine("Stopping bochs now");
            }
            finally
            {
                xBochs.Stop();
                xDebugConnector.Dispose();
                Thread.Sleep(50);
            }
        }