Skip to content

Commit

Permalink
g3
Browse files Browse the repository at this point in the history
  • Loading branch information
jp2masa committed Jul 30, 2017
1 parent 7ab169f commit 50938cf
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Demos/GuessG3/GuessBootGen3.Cosmos
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<TargetFramework>net462</TargetFramework>
</PropertyGroup>
<PropertyGroup>
<UseGen3Kernel>True</UseGen3Kernel>
<KernelPkg>X86G3</KernelPkg>
<BinFormat>elf</BinFormat>
<DebugEnabled>False</DebugEnabled>
<DebugMode>Source</DebugMode>
Expand Down
6 changes: 3 additions & 3 deletions source/Cosmos.Build.MSBuild/Cosmos.targets
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
<AssemblySearchPaths>$(CosmosDir)\Kernel</AssemblySearchPaths>
</PropertyGroup>

<ItemGroup Condition="$(UseGen3Kernel) != 'True'">
<ItemGroup Condition="$(KernelPkg) == ''">
<Reference Include="Cosmos.Core_Asm, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5ae71220097cb983" />
<Reference Include="Cosmos.Core_Plugs, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5ae71220097cb983" />
<Reference Include="Cosmos.Debug.Kernel.Plugs.Asm, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5ae71220097cb983" />
<Reference Include="Cosmos.System2_Plugs, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5ae71220097cb983" />
<Reference Remove="System.Core" />
</ItemGroup>
<ItemGroup Condition="$(UseGen3Kernel) == 'True'">
<ItemGroup Condition="$(KernelPkg) == 'X86G3'">
<Reference Include="Cosmos.CPU_Plugs, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5ae71220097cb983" />
<Reference Include="Cosmos.CPU_Asm, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5ae71220097cb983" />
<Reference Include="Cosmos.System_Plugs, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5ae71220097cb983" />
Expand All @@ -48,7 +48,7 @@
<CreateProperty Value="false" Condition="$(BinFormat) == 'bin'">
<Output PropertyName="IsELF" TaskParameter="Value"/>
</CreateProperty>
<Cosmos.Build.MSBuild.IL2CPU UseGen3Kernel="$(UseGen3Kernel)" DebugMode="$(DebugMode)" DebugEnabled="$(DebugEnabled)" StackCorruptionDetectionEnabled="$(StackCorruptionDetectionEnabled)" StackCorruptionDetectionLevel="$(StackCorruptionDetectionLevel)" TraceAssemblies="$(TraceAssemblies)" IgnoreDebugStubAttribute="$(IgnoreDebugStubAttribute)" DebugCom="1" UseNAsm="true" References="@(ReferencePath)" AssemblySearchDirs="$(AssemblySearchPaths)" OutputFilename="$(TargetDir)$(MSBuildProjectName).asm" EnableLogging="true" EmitDebugSymbols="$(DebugSymbols)" CosmosBuildDir="$(CosmosDir)\Build" WorkingDir="$(TargetDir)"/>
<Cosmos.Build.MSBuild.IL2CPU KernelPkg="$(KernelPkg)" DebugMode="$(DebugMode)" DebugEnabled="$(DebugEnabled)" StackCorruptionDetectionEnabled="$(StackCorruptionDetectionEnabled)" StackCorruptionDetectionLevel="$(StackCorruptionDetectionLevel)" TraceAssemblies="$(TraceAssemblies)" IgnoreDebugStubAttribute="$(IgnoreDebugStubAttribute)" DebugCom="1" UseNAsm="true" References="@(ReferencePath)" AssemblySearchDirs="$(AssemblySearchPaths)" OutputFilename="$(TargetDir)$(MSBuildProjectName).asm" EnableLogging="true" EmitDebugSymbols="$(DebugSymbols)" CosmosBuildDir="$(CosmosDir)\Build" WorkingDir="$(TargetDir)"/>
<Cosmos.Build.MSBuild.NAsm InputFile="$(TargetDir)$(MSBuildProjectName).asm" OutputFile="$(TargetDir)$(MSBuildProjectName).obj" IsELF="$(IsELF)" ExePath="$(NasmFile)"/>
<!-- ELF only -->
<!-- 16 MB 0x1000000 as per hpa (syslinux) is a good spot. For now just put some dummy values. 16 and 32 MB. Later size better. -->
Expand Down
7 changes: 2 additions & 5 deletions source/Cosmos.Build.MSBuild/IL2CPU.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ namespace Cosmos.Build.MSBuild
{
public class IL2CPU : BaseToolTask
{
// protected CompilerEngine mTask = new CompilerEngine();

public bool UseGen3Kernel { get; set; }
public string KernelPkg { get; set; }

[Required]
public string CosmosBuildDir { get; set; }
Expand Down Expand Up @@ -80,10 +78,9 @@ public override bool Execute()

try
{
//TODO: Add AdditionalReferences and AdditionalSearchDirs here and to log messages below.
Dictionary<string, string> args = new Dictionary<string, string>
{
{"UseGen3Kernel", Convert.ToString(UseGen3Kernel)},
{"KernelPkg", Convert.ToString(KernelPkg)},
{"DebugEnabled", Convert.ToString(DebugEnabled)},
{"StackCorruptionDetectionEnabled", Convert.ToString(StackCorruptionDetectionEnabled)},
{"StackCorruptionDetectionLevel", Convert.ToString(StackCorruptionDetectionLevel)},
Expand Down
9 changes: 8 additions & 1 deletion source/Cosmos.IL2CPU/CompilerEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,14 @@ public class CompilerEngine {
public Action<Exception> OnLogException;
protected static Action<string> mStaticLog = null;

public static bool UseGen3Kernel { get; set; }
public static string KernelPkg { get; set; }
public static bool UseGen3Kernel
{
get
{
return KernelPkg == "X86G3";
}
}
public string DebugMode { get; set; }
public string TraceAssemblies { get; set; }
public byte DebugCom { get; set; }
Expand Down
4 changes: 2 additions & 2 deletions source/Cosmos.IL2CPU/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ public static int Run(string[] args, Action<string> logMessage, Action<string> l
var xEngine = new CompilerEngine();

CompilerEngine.UseGen3Kernel = false;
if (CmdOptions.ContainsKey("UseGen3Kernel".ToLower())) {
CompilerEngine.UseGen3Kernel = Convert.ToBoolean(CmdOptions["UseGen3Kernel".ToLower()]);
if (CmdOptions.ContainsKey("KernelPkg".ToLower())) {
CompilerEngine.KernelPkg = Convert.ToBoolean(CmdOptions["KernelPkg".ToLower()]);
}

xEngine.DebugEnabled = Convert.ToBoolean(CmdOptions["DebugEnabled".ToLower()]);
Expand Down

0 comments on commit 50938cf

Please sign in to comment.