Skip to content

Commit

Permalink
g3
Browse files Browse the repository at this point in the history
  • Loading branch information
jp2masa committed Jul 27, 2017
1 parent 03a2a5f commit 8019003
Show file tree
Hide file tree
Showing 7 changed files with 135 additions and 25 deletions.
88 changes: 87 additions & 1 deletion Test.sln
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Compiler", "Compiler", "{C2
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Debug", "Debug", "{F7C6CA93-1D02-443C-9C8B-A1988DE0306B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Kernel", "Kernel", "{9A923E6F-FF63-4F02-A4EA-C2D44F9323FD}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Kernel G2", "Kernel G2", "{9A923E6F-FF63-4F02-A4EA-C2D44F9323FD}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{1A46752C-98F3-4DE3-B1FB-EDCE22E8AF73}"
EndProject
Expand Down Expand Up @@ -120,6 +120,32 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.Core.Memory.Test", "
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.Core_Asm", "source\Cosmos.Core_Asm\Cosmos.Core_Asm.csproj", "{B7077A34-D7F0-4422-BE7C-65DF26C65489}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Kernel G3", "Kernel G3", "{99192440-2DD7-4E71-B730-D44A73F46533}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "00 CPU", "00 CPU", "{29B893F7-6C0F-4710-A60E-7FB3498BCA63}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "10 Platform", "10 Platform", "{B4CB7BF5-CADF-4056-9C09-EAAC50BC76C0}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "20 HAL", "20 HAL", "{E4299234-8323-43F6-B684-350A1232746B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "80 System", "80 System", "{DE38917F-969B-486C-AF83-C59E5E52400A}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "90 Application", "90 Application", "{02FF94AF-6BA3-49ED-A027-A63F591C310D}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "99 Shared", "99 Shared", "{DD3367EF-D6B9-405C-AEB0-5E724C48F87D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.CPU", "source\Kernel\Cosmos.CPU\Cosmos.CPU.csproj", "{4D219A6D-4528-4622-AF29-96F830C4D076}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.Platform", "source\Kernel\Cosmos.Platform\Cosmos.Platform.csproj", "{6CBABA8D-4207-4E1E-8122-63DB51D25F18}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.HAL3", "source\Kernel\Cosmos.HAL\Cosmos.HAL3.csproj", "{16ECD6DE-6F65-4A5C-8B49-A29782D9D057}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.Shared", "source\Kernel\Cosmos.Shared\Cosmos.Shared.csproj", "{34AFAD8A-EBF0-4278-A99F-A33CA0094E7C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GuessKernelGen3", "Demos\GuessG3\GuessKernelGen3.csproj", "{9E58E949-7B71-45ED-9610-11DA287EE933}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.System3", "source\Kernel\Cosmos.System\Cosmos.System3.csproj", "{F588033A-6B7D-4ABF-96C4-73D8B2271A6B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -465,6 +491,54 @@ Global
{B7077A34-D7F0-4422-BE7C-65DF26C65489}.Release|Any CPU.Build.0 = Release|Any CPU
{B7077A34-D7F0-4422-BE7C-65DF26C65489}.Release|x86.ActiveCfg = Release|Any CPU
{B7077A34-D7F0-4422-BE7C-65DF26C65489}.Release|x86.Build.0 = Release|Any CPU
{4D219A6D-4528-4622-AF29-96F830C4D076}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4D219A6D-4528-4622-AF29-96F830C4D076}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4D219A6D-4528-4622-AF29-96F830C4D076}.Debug|x86.ActiveCfg = Debug|Any CPU
{4D219A6D-4528-4622-AF29-96F830C4D076}.Debug|x86.Build.0 = Debug|Any CPU
{4D219A6D-4528-4622-AF29-96F830C4D076}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4D219A6D-4528-4622-AF29-96F830C4D076}.Release|Any CPU.Build.0 = Release|Any CPU
{4D219A6D-4528-4622-AF29-96F830C4D076}.Release|x86.ActiveCfg = Release|Any CPU
{4D219A6D-4528-4622-AF29-96F830C4D076}.Release|x86.Build.0 = Release|Any CPU
{6CBABA8D-4207-4E1E-8122-63DB51D25F18}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6CBABA8D-4207-4E1E-8122-63DB51D25F18}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6CBABA8D-4207-4E1E-8122-63DB51D25F18}.Debug|x86.ActiveCfg = Debug|Any CPU
{6CBABA8D-4207-4E1E-8122-63DB51D25F18}.Debug|x86.Build.0 = Debug|Any CPU
{6CBABA8D-4207-4E1E-8122-63DB51D25F18}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6CBABA8D-4207-4E1E-8122-63DB51D25F18}.Release|Any CPU.Build.0 = Release|Any CPU
{6CBABA8D-4207-4E1E-8122-63DB51D25F18}.Release|x86.ActiveCfg = Release|Any CPU
{6CBABA8D-4207-4E1E-8122-63DB51D25F18}.Release|x86.Build.0 = Release|Any CPU
{16ECD6DE-6F65-4A5C-8B49-A29782D9D057}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{16ECD6DE-6F65-4A5C-8B49-A29782D9D057}.Debug|Any CPU.Build.0 = Debug|Any CPU
{16ECD6DE-6F65-4A5C-8B49-A29782D9D057}.Debug|x86.ActiveCfg = Debug|Any CPU
{16ECD6DE-6F65-4A5C-8B49-A29782D9D057}.Debug|x86.Build.0 = Debug|Any CPU
{16ECD6DE-6F65-4A5C-8B49-A29782D9D057}.Release|Any CPU.ActiveCfg = Release|Any CPU
{16ECD6DE-6F65-4A5C-8B49-A29782D9D057}.Release|Any CPU.Build.0 = Release|Any CPU
{16ECD6DE-6F65-4A5C-8B49-A29782D9D057}.Release|x86.ActiveCfg = Release|Any CPU
{16ECD6DE-6F65-4A5C-8B49-A29782D9D057}.Release|x86.Build.0 = Release|Any CPU
{34AFAD8A-EBF0-4278-A99F-A33CA0094E7C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{34AFAD8A-EBF0-4278-A99F-A33CA0094E7C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{34AFAD8A-EBF0-4278-A99F-A33CA0094E7C}.Debug|x86.ActiveCfg = Debug|Any CPU
{34AFAD8A-EBF0-4278-A99F-A33CA0094E7C}.Debug|x86.Build.0 = Debug|Any CPU
{34AFAD8A-EBF0-4278-A99F-A33CA0094E7C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{34AFAD8A-EBF0-4278-A99F-A33CA0094E7C}.Release|Any CPU.Build.0 = Release|Any CPU
{34AFAD8A-EBF0-4278-A99F-A33CA0094E7C}.Release|x86.ActiveCfg = Release|Any CPU
{34AFAD8A-EBF0-4278-A99F-A33CA0094E7C}.Release|x86.Build.0 = Release|Any CPU
{9E58E949-7B71-45ED-9610-11DA287EE933}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9E58E949-7B71-45ED-9610-11DA287EE933}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9E58E949-7B71-45ED-9610-11DA287EE933}.Debug|x86.ActiveCfg = Debug|Any CPU
{9E58E949-7B71-45ED-9610-11DA287EE933}.Debug|x86.Build.0 = Debug|Any CPU
{9E58E949-7B71-45ED-9610-11DA287EE933}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9E58E949-7B71-45ED-9610-11DA287EE933}.Release|Any CPU.Build.0 = Release|Any CPU
{9E58E949-7B71-45ED-9610-11DA287EE933}.Release|x86.ActiveCfg = Release|Any CPU
{9E58E949-7B71-45ED-9610-11DA287EE933}.Release|x86.Build.0 = Release|Any CPU
{F588033A-6B7D-4ABF-96C4-73D8B2271A6B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F588033A-6B7D-4ABF-96C4-73D8B2271A6B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F588033A-6B7D-4ABF-96C4-73D8B2271A6B}.Debug|x86.ActiveCfg = Debug|Any CPU
{F588033A-6B7D-4ABF-96C4-73D8B2271A6B}.Debug|x86.Build.0 = Debug|Any CPU
{F588033A-6B7D-4ABF-96C4-73D8B2271A6B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F588033A-6B7D-4ABF-96C4-73D8B2271A6B}.Release|Any CPU.Build.0 = Release|Any CPU
{F588033A-6B7D-4ABF-96C4-73D8B2271A6B}.Release|x86.ActiveCfg = Release|Any CPU
{F588033A-6B7D-4ABF-96C4-73D8B2271A6B}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -521,6 +595,18 @@ Global
{FB23BD72-AEC3-485E-B86C-8E7DB0B3BB9B} = {ECEA7778-E786-4317-90B9-A2D4427CB91C}
{408E5ACC-EA9A-41E8-AA95-514C5F47BD34} = {52D81759-C7CC-427F-8C96-89CA10C914B5}
{B7077A34-D7F0-4422-BE7C-65DF26C65489} = {04B18FFC-8EA0-4E9F-9E1B-478527B19AFA}
{29B893F7-6C0F-4710-A60E-7FB3498BCA63} = {99192440-2DD7-4E71-B730-D44A73F46533}
{B4CB7BF5-CADF-4056-9C09-EAAC50BC76C0} = {99192440-2DD7-4E71-B730-D44A73F46533}
{E4299234-8323-43F6-B684-350A1232746B} = {99192440-2DD7-4E71-B730-D44A73F46533}
{DE38917F-969B-486C-AF83-C59E5E52400A} = {99192440-2DD7-4E71-B730-D44A73F46533}
{02FF94AF-6BA3-49ED-A027-A63F591C310D} = {99192440-2DD7-4E71-B730-D44A73F46533}
{DD3367EF-D6B9-405C-AEB0-5E724C48F87D} = {99192440-2DD7-4E71-B730-D44A73F46533}
{4D219A6D-4528-4622-AF29-96F830C4D076} = {29B893F7-6C0F-4710-A60E-7FB3498BCA63}
{6CBABA8D-4207-4E1E-8122-63DB51D25F18} = {B4CB7BF5-CADF-4056-9C09-EAAC50BC76C0}
{16ECD6DE-6F65-4A5C-8B49-A29782D9D057} = {E4299234-8323-43F6-B684-350A1232746B}
{34AFAD8A-EBF0-4278-A99F-A33CA0094E7C} = {DD3367EF-D6B9-405C-AEB0-5E724C48F87D}
{9E58E949-7B71-45ED-9610-11DA287EE933} = {02FF94AF-6BA3-49ED-A027-A63F591C310D}
{F588033A-6B7D-4ABF-96C4-73D8B2271A6B} = {DE38917F-969B-486C-AF83-C59E5E52400A}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4418C803-277E-448F-A0A0-52788FA215AD}
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 @@ -13,6 +13,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\Demos\GuessG3\GuessKernelGen3.csproj" />
<ProjectReference Include="..\..\source\Cosmos.Assembler\Cosmos.Assembler.csproj" />
<ProjectReference Include="..\..\source\Cosmos.Build.Common\Cosmos.Build.Common.csproj" />
<ProjectReference Include="..\..\source\Cosmos.Core_Asm\Cosmos.Core_Asm.csproj" />
Expand Down
1 change: 1 addition & 0 deletions Tests/Cosmos.TestRunner.Core/DefaultEngineConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public static void Apply(Engine engine)
engine.DebugIL2CPU = false;
engine.TraceAssembliesLevel = TraceAssemblies.User;
//engine.EnableStackCorruptionChecks = false;
engine.UseG3Kernel = true;

engine.EnableStackCorruptionChecks = true;
engine.StackCorruptionChecksLevel = StackCorruptionDetectionLevel.AllInstructions;
Expand Down
27 changes: 16 additions & 11 deletions Tests/Cosmos.TestRunner.Core/Engine.Helpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,18 +165,19 @@ private void RunExtractMapFromElfFile(string workingDir, string kernelFileName)

private void RunIL2CPU(string kernelFileName, string outputFile)
{
References = new List<string>
References = new List<string>() { kernelFileName };

if (!UseG3Kernel)
{
kernelFileName,
Assembly.Load(new AssemblyName("Cosmos.Core_Plugs")).Location,
Assembly.Load(new AssemblyName("Cosmos.Core_Asm")).Location,
Assembly.Load(new AssemblyName("Cosmos.System_Plugs")).Location,
Assembly.Load(new AssemblyName("Cosmos.Debug.Kernel.Plugs.Asm")).Location
};
References.Add(Assembly.Load(new AssemblyName("Cosmos.Core_Plugs")).Location);
References.Add(Assembly.Load(new AssemblyName("Cosmos.Core_Asm")).Location);
References.Add(Assembly.Load(new AssemblyName("Cosmos.System_Plugs")).Location);
References.Add(Assembly.Load(new AssemblyName("Cosmos.Debug.Kernel.Plugs.Asm")).Location);
}

var xArgs = new List<string>
{
"DebugEnabled:true",
"DebugEnabled:True",
"StackCorruptionDetectionEnabled:" + EnableStackCorruptionChecks,
"StackCorruptionDetectionLevel:" + StackCorruptionChecksLevel,
"DebugMode:Source",
Expand All @@ -188,6 +189,12 @@ private void RunIL2CPU(string kernelFileName, string outputFile)
"EmitDebugSymbols:True",
"IgnoreDebugStubAttribute:False"
};

if (UseG3Kernel)
{
xArgs.Add("UseGen3Kernel:True");
}

xArgs.AddRange(References.Select(aReference => "References:" + aReference));

bool xUsingUserkit = false;
Expand Down Expand Up @@ -219,11 +226,9 @@ private void RunIL2CPU(string kernelFileName, string outputFile)
else
{
xArgs.Insert(0, "run");
xArgs.Insert(1, "--project");
xArgs.Insert(2, Path.Combine(xIL2CPUPath, "IL2CPU.csproj"));
xArgs.Insert(3, "--no-build");
xArgs.Insert(4, " -- ");
RunProcess("dotnet", Path.GetDirectoryName(kernelFileName), xArgs);
RunProcess("dotnet", xIL2CPUPath, xArgs, true);
}
}
}
Expand Down
1 change: 1 addition & 0 deletions Tests/Cosmos.TestRunner.Core/Engine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public partial class Engine
public bool RunWithGDB = false;
public bool StartBochsDebugGui = false;
public bool EnableStackCorruptionChecks = true;
public bool UseG3Kernel = false;
public TraceAssemblies TraceAssembliesLevel = TraceAssemblies.User;
public StackCorruptionDetectionLevel StackCorruptionChecksLevel = StackCorruptionDetectionLevel.MethodFooters;
public List<string> References = new List<string>();
Expand Down
2 changes: 2 additions & 0 deletions Tests/Cosmos.TestRunner.Core/TestKernelSets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ public static IEnumerable<Type> GetStableKernelTypes()

//yield return typeof(FrotzKernel.Kernel);

//yield return typeof(Guess.Boot);

/* Please see the notes on the kernel itself before enabling it */
//yield return typeof(GraphicTest.Kernel);
}
Expand Down
40 changes: 27 additions & 13 deletions source/Cosmos.IL2CPU/CompilerEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -229,28 +229,42 @@ private AppAssembler GetAppAssembler() {
}

private Assembly Default_Resolving(AssemblyLoadContext aContext, AssemblyName aName) {
var xRequestingAssembly = Assembly.GetEntryAssembly();
if (xRequestingAssembly != null) {
// check for path in as requested dll is stored, this makes refrenced dll project working
var xPathAsRequested = Path.Combine(Path.GetDirectoryName(xRequestingAssembly.Location), aName.Name + ".dll");
if (File.Exists(xPathAsRequested)) {
return aContext.LoadFromAssemblyPath(xPathAsRequested);
foreach (var xRef in References) {
var xName = AssemblyLoadContext.GetAssemblyName(xRef);
if (xName.Name == aName.Name) {
return aContext.LoadFromAssemblyPath(xRef);
}
}

foreach (var xRef in References)
{
var xKernelAssemblyDir = Path.GetDirectoryName(xRef);
var xAssemblyPath = Path.Combine(xKernelAssemblyDir, aName.Name);
if (File.Exists(xAssemblyPath + ".dll"))
{
return aContext.LoadFromAssemblyPath(xAssemblyPath + ".dll");
}
if (File.Exists(xAssemblyPath + ".exe"))
{
return aContext.LoadFromAssemblyPath(xAssemblyPath + ".exe");
}
}

//var xRequestingAssembly = Assembly.GetEntryAssembly();
//if (xRequestingAssembly != null) {
// // check for path in as requested dll is stored, this makes referenced dll project working
// var xPathAsRequested = Path.Combine(Path.GetDirectoryName(xRequestingAssembly.Location), aName.Name + ".dll");
// if (File.Exists(xPathAsRequested)) {
// return aContext.LoadFromAssemblyPath(xPathAsRequested);
// }
//}

// check for assembly in working directory
var xPathToCheck = Path.Combine(Directory.GetCurrentDirectory(), aName.Name + ".dll");
if (File.Exists(xPathToCheck)) {
return aContext.LoadFromAssemblyPath(xPathToCheck);
}

foreach (var xRef in References) {
var xName = AssemblyLoadContext.GetAssemblyName(xRef);
if (xName.Name == aName.Name) {
return aContext.LoadFromAssemblyPath(xRef);
}
}

foreach (var xDir in mSearchDirs) {
var xPath = Path.Combine(xDir, aName.Name + ".dll");
if (File.Exists(xPath)) {
Expand Down

0 comments on commit 8019003

Please sign in to comment.