Skip to content

Commit

Permalink
Fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
jp2masa committed Mar 20, 2017
1 parent 6cb98d2 commit ddc3268
Show file tree
Hide file tree
Showing 20 changed files with 159 additions and 280 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
*.vsp
*.pdb
*.lock.json
*.nuget.props
*.nuget.targets
Thumbs.db
build.force

Expand Down
1 change: 1 addition & 0 deletions Tests/Cosmos.TestRunner.Core/Cosmos.TestRunner.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<ProjectReference Include="..\..\source\Cosmos.Core.Plugs\Cosmos.Core.Plugs.csproj" />
<ProjectReference Include="..\..\source\Cosmos.Core.Plugs.Asm\Cosmos.Core.Plugs.Asm.csproj" />
<ProjectReference Include="..\..\source\Cosmos.Debug.Kernel.Plugs.Asm\Cosmos.Debug.Kernel.Plugs.Asm.csproj" />
<ProjectReference Include="..\..\source\Cosmos.IL2CPU\Cosmos.IL2CPU.csproj" />
<ProjectReference Include="..\..\source\Cosmos.IL2CPU.Plugs\Cosmos.IL2CPU.Plugs.csproj" />
<ProjectReference Include="..\..\source\Cosmos.System.Plugs\Cosmos.System.Plugs.csproj" />
<ProjectReference Include="..\BoxingTests\BoxingTests.csproj" />
Expand Down
50 changes: 15 additions & 35 deletions Tests/Cosmos.TestRunner.Core/Engine.Helpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;

using Cosmos.Build.Common;
using Cosmos.IL2CPU;

namespace Cosmos.TestRunner.Core
{
Expand Down Expand Up @@ -160,29 +163,14 @@ private void RunExtractMapFromElfFile(string workingDir, string kernelFileName)

private void RunIL2CPU(string kernelFileName, string outputFile)
{
bool xUsingUserkit = false;
string xIL2CPUPath = Path.Combine(FindCosmosRoot(), "source\\IL2CPU");
if (!Directory.Exists(xIL2CPUPath))
{
xUsingUserkit = true;
xIL2CPUPath = GetCosmosUserkitFolder();
}
if (!Directory.Exists(xIL2CPUPath))
{
throw new DirectoryNotFoundException("IL2CPU not found.");
}

//if (!xUsingUserkit)
//{
// RunDotnetPublish(xIL2CPUPath, AppContext.BaseDirectory, "win7-x86");
// xIL2CPUPath = AppContext.BaseDirectory;
//}

References = new List<string>
{
kernelFileName,
"Cosmos.Core.Plugs.Asm.dll",
"Cosmos.Debug.Kernel.Plugs.Asm.dll"
Assembly.Load(new AssemblyName("Cosmos.Core.Plugs")).Location,
Assembly.Load(new AssemblyName("Cosmos.Core.Plugs.Asm")).Location,
Assembly.Load(new AssemblyName("Cosmos.Debug.Kernel.Plugs.Asm")).Location,
Assembly.Load(new AssemblyName("Cosmos.System.Plugs")).Location
};

var xArguments = new List<string>
Expand Down Expand Up @@ -210,41 +198,33 @@ private void RunIL2CPU(string kernelFileName, string outputFile)

// ensure we're using the referenced (= solution) version
Cosmos.IL2CPU.CosmosAssembler.ReadDebugStubFromDisk = false;
}

if (xUsingUserkit)
{
RunProcess("IL2CPU", xIL2CPUPath, xArguments, DebugIL2CPU);
Program.Run(xArguments.ToArray(), OutputHandler.LogMessage, OutputHandler.LogError);
}
else
{
xArguments.Insert(0, "run");
xArguments.Insert(1, " -- ");
RunProcess("dotnet", xIL2CPUPath, xArguments);
string xIL2CPUPath = GetCosmosUserkitFolder();
RunProcess("IL2CPU", xIL2CPUPath, xArguments, DebugIL2CPU);
}
}

private void RunNasm(string inputFile, string outputFile, bool isElf)
{
bool xUsingUserkit = false;
string xNasmPath = Path.Combine(FindCosmosRoot(), "Tools\\NASM");
string xNasmPath = Path.Combine(FindCosmosRoot(), "Tools", "NASM");
if (!Directory.Exists(xNasmPath))
{
xNasmPath = Path.Combine(GetCosmosUserkitFolder(), "Tools");
xUsingUserkit = true;
xNasmPath = Path.Combine(GetCosmosUserkitFolder(), "Tools", "NASM");
}
if (!Directory.Exists(xNasmPath))
{
throw new DirectoryNotFoundException("NASM path not found.");
}

//if (!xUsingUserkit)
//{
// RunDotnetPublish(xNasmPath, AppContext.BaseDirectory, "win7-x86");
// xNasmPath = AppContext.BaseDirectory;
//}

var xArgs = new List<string>
{
$"ExePath:{Path.Combine(xUsingUserkit ? GetCosmosUserkitFolder() : FindCosmosRoot(), "Build", "Tools", "NAsm", "nasm.exe")}",
$"InputFile:{inputFile}",
$"OutputFile:{outputFile}",
$"IsELF:{isElf}"
Expand All @@ -257,7 +237,7 @@ private void RunNasm(string inputFile, string outputFile, bool isElf)
else
{
xArgs.Insert(0, "run");
xArgs.Insert(1," -- ");
xArgs.Insert(1, " -- ");
RunProcess("dotnet", xNasmPath, xArgs);
}
}
Expand Down
3 changes: 3 additions & 0 deletions Tools/NASM/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ public static int Run(string[] args, Action<string> logMessage, Action<string> l
}
}

LogError = logError;
LogMessage = logMessage;

try
{
if (string.IsNullOrWhiteSpace(InputFile) || string.IsNullOrWhiteSpace(OutputFile) ||
Expand Down
1 change: 1 addition & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
version: 0.20150918.{build}
image: Visual Studio 2017
configuration: Debug
platform: AnyCPU
shallow_clone: true
Expand Down
5 changes: 3 additions & 2 deletions source/Cosmos.Assembler/LabelName.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,14 @@ public static string GetFullName(TypeInfo aTypeInfo)
{
xSB.Append(GetFullName(aTypeInfo.GetGenericTypeDefinition()));
}
else {
else
{
xSB.Append(aTypeInfo.FullName);
}
if (aTypeInfo.IsGenericType)
{
xSB.Append("<");
var xArgs = aTypeInfo.GenericTypeArguments;
var xArgs = aTypeInfo.GetGenericArguments();
for (int i = 0; i < xArgs.Length - 1; i++)
{
xSB.Append(GetFullName(xArgs[i]));
Expand Down
16 changes: 16 additions & 0 deletions source/Cosmos.Debug.DebugStub/Cosmos.Debug.DebugStub.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,22 @@
<AssemblyOriginatorKeyFile>..\..\Cosmos.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>

<ItemGroup>
<EmbeddedResource Include="AsmBreak.xs" />
<EmbeddedResource Include="CmdMisc.xs" />
<EmbeddedResource Include="CmdProcess.xs" />
<EmbeddedResource Include="CmdSend.xs" />
<EmbeddedResource Include="Consts.xs" />
<EmbeddedResource Include="DebugStub.xs" />
<EmbeddedResource Include="Init.xs" />
<EmbeddedResource Include="Screen.xs" />
<EmbeddedResource Include="Serial.xs" />
<EmbeddedResource Include="SerialHelpers.xs" />
<EmbeddedResource Include="SerialIO.xs" />
<EmbeddedResource Include="TracerEntry.xs" />
<EmbeddedResource Include="Utilities.xs" />
</ItemGroup>

<ItemGroup>
<None Update="AsmBreak.asm">
<DependentUpon>AsmBreak.xs</DependentUpon>
Expand Down
5 changes: 5 additions & 0 deletions source/Cosmos.Debug.Symbols/Cosmos.Debug.Symbols.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
<AssemblyOriginatorKeyFile>..\..\Cosmos.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>

<ItemGroup>
<EmbeddedResource Include="SQLite.sql" />
<EmbeddedResource Include="SQLiteIndexes.sql" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Dapper.StrongName" Version="1.50.2" />
<PackageReference Include="DapperExtensions.StrongName" Version="1.50.2" />
Expand Down
112 changes: 112 additions & 0 deletions source/Cosmos.IL2CPU/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
using System;
using System.Collections.Generic;

namespace Cosmos.IL2CPU
{
public class Program
{
public const string CosmosRoot = "";
private const string KernelFile = CosmosRoot + "";
private const string OutputFile = CosmosRoot + "";
private static Dictionary<string, string> CmdOptions = new Dictionary<string, string>();
private static List<string> References = new List<string>();
private static List<string> AdditionalReferences = new List<string>();
private static List<string> AdditionalSearchDirs = new List<string>();

public static int Run(string[] args, Action<string> logMessage, Action<string> logError)
{
if (args == null)
{
throw new ArgumentNullException("args");
}
if (logMessage == null)
{
throw new ArgumentNullException("logMessage");
}
if (logError == null)
{
throw new ArgumentNullException("logError");
}

try
{
var tmp = "";
foreach (var s in args)
{
tmp += s;
string[] s1 = s.Split(':');
string argID = s1[0].ToLower();
if (argID == "References".ToLower())
{
References.Add(s.Replace(s1[0] + ":", ""));
}
else if (argID == "AdditionalReferences".ToLower())
{
AdditionalReferences.Add(s.Replace(s1[0] + ":", ""));
}
else if (argID == "AdditionalSearchDirs".ToLower())
{
AdditionalSearchDirs.Add(s.Replace(s1[0] + ":", ""));
}
else
{
CmdOptions.Add(argID, s.Replace(s1[0] + ":", ""));
}
}

var xTask = new CompilerEngine();
xTask.DebugEnabled = Convert.ToBoolean(CmdOptions["DebugEnabled".ToLower()]);
logMessage("Loaded : DebugEnabled");
xTask.StackCorruptionDetectionEnabled = Convert.ToBoolean(CmdOptions["StackCorruptionDetectionEnabled".ToLower()]);
logMessage("Loaded : StackCorruptionDetectionEnabled");
xTask.DebugMode = CmdOptions["DebugMode".ToLower()];
logMessage("Loaded : DebugMode");
xTask.StackCorruptionDetectionLevel = CmdOptions["StackCorruptionDetectionLevel".ToLower()];
logMessage("Loaded : StackCorruptionDetectionLevel");
xTask.TraceAssemblies = CmdOptions["TraceAssemblies".ToLower()];
logMessage("Loaded : TraceAssemblies");
xTask.DebugCom = Convert.ToByte(CmdOptions["DebugCom".ToLower()]);
logMessage("Loaded : DebugCom");
xTask.UseNAsm = Convert.ToBoolean(CmdOptions["UseNAsm".ToLower()]);
logMessage("Loaded : UseNAsm");
xTask.OutputFilename = CmdOptions["OutputFilename".ToLower()];
logMessage("Loaded : OutputFilename");
xTask.EnableLogging = Convert.ToBoolean(CmdOptions["EnableLogging".ToLower()]);
logMessage("Loaded : EnableLogging");
xTask.EmitDebugSymbols = Convert.ToBoolean(CmdOptions["EmitDebugSymbols".ToLower()]);
logMessage("Loaded : EmitDebugSymbols");
xTask.IgnoreDebugStubAttribute = Convert.ToBoolean(CmdOptions["IgnoreDebugStubAttribute".ToLower()]);
logMessage("Loaded : IgnoreDebugStubAttribute");
xTask.References = References.ToArray();
logMessage("Loaded : References");
xTask.AdditionalSearchDirs = AdditionalSearchDirs.ToArray();
logMessage("Loaded : AdditionalSearchDirs");
xTask.AdditionalReferences = AdditionalReferences.ToArray();
logMessage("Loaded : AdditionalReferences");

xTask.OnLogError = logError;
xTask.OnLogWarning = m => logMessage(String.Format("Warning: {0}", m));
xTask.OnLogMessage = logMessage;
xTask.OnLogException = (m) => logError(String.Format("Exception: {0}", m.ToString()));
xTask.AssemblerLog = "Cosmos.Assembler.log";
if (xTask.Execute())
{
logMessage("Executed OK");
// File.WriteAllText(@"e:\compiler.log", "OK");
return 0;
}
else
{
logMessage("Errorred");
// File.WriteAllText(@"e:\compiler.log", "Errored");
return 2;
}
}
catch (Exception E)
{
logError(String.Format("Error occurred: " + E.ToString()));
return 1;
}
}
}
}
18 changes: 0 additions & 18 deletions source/Cosmos.VS.DebugEngine/Cosmos.VS.DebugEngine.nuget.props

This file was deleted.

This file was deleted.

18 changes: 0 additions & 18 deletions source/Cosmos.VS.ProjectSystem/Cosmos.VS.ProjectSystem.nuget.props

This file was deleted.

This file was deleted.

18 changes: 0 additions & 18 deletions source/Cosmos.VS.Windows/Cosmos.VS.Windows.nuget.props

This file was deleted.

9 changes: 0 additions & 9 deletions source/Cosmos.VS.Windows/Cosmos.VS.Windows.nuget.targets

This file was deleted.

Loading

0 comments on commit ddc3268

Please sign in to comment.