mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-19 20:39:01 +00:00
73 lines
2.1 KiB
C#
73 lines
2.1 KiB
C#
using System;
|
|
using System.IO;
|
|
using Cosmos.Build.Common;
|
|
using Cosmos.Build.MSBuild;
|
|
using Cosmos.Core.Plugs;
|
|
using Cosmos.Debug.Kernel;
|
|
using Cosmos.Debug.Kernel.Plugs;
|
|
using Cosmos.System.Plugs.System;
|
|
using IL2CPU;
|
|
using Microsoft.Win32;
|
|
|
|
namespace Cosmos.TestRunner.Core
|
|
{
|
|
partial class Engine
|
|
{
|
|
private bool mIsELF = true;
|
|
private void ExecuteKernel(string assemblyFileName)
|
|
{
|
|
OutputHandler.ExecuteKernelStart(assemblyFileName);
|
|
try
|
|
{
|
|
|
|
var xAssemblyFile = Path.Combine(mBaseWorkingDirectory, "Kernel.asm");
|
|
var xObjectFile = Path.Combine(mBaseWorkingDirectory, "Kernel.obj");
|
|
var xTempObjectFile = Path.Combine(mBaseWorkingDirectory, "Kernel.o");
|
|
var xIsoFile = Path.Combine(mBaseWorkingDirectory, "Kernel.iso");
|
|
|
|
RunTask("IL2CPU", () => RunIL2CPU(assemblyFileName, xAssemblyFile));
|
|
RunTask("Nasm", () => RunNasm(xAssemblyFile, xObjectFile, mIsELF));
|
|
if (mIsELF)
|
|
{
|
|
File.Move(xObjectFile, xTempObjectFile);
|
|
|
|
RunTask("Ld", () => RunLd(xTempObjectFile, xObjectFile));
|
|
}
|
|
|
|
RunTask("MakeISO", () => MakeIso(xObjectFile, xIsoFile));
|
|
RunTask("IL2CPU", () => RunIsoInBochs(xIsoFile));
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
OutputHandler.UnhandledException(e);
|
|
}
|
|
finally
|
|
{
|
|
OutputHandler.ExecuteKernelEnd(assemblyFileName);
|
|
}
|
|
}
|
|
|
|
|
|
private void RunTask(string taskName, Action action)
|
|
{
|
|
if (action == null)
|
|
{
|
|
throw new ArgumentNullException("action");
|
|
}
|
|
|
|
OutputHandler.TaskStart(taskName);
|
|
try
|
|
{
|
|
action();
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
OutputHandler.UnhandledException(e);
|
|
}
|
|
finally
|
|
{
|
|
OutputHandler.TaskEnd(taskName);
|
|
}
|
|
}
|
|
}
|
|
}
|