Skip to content

Commit

Permalink
Final changes that have made this stable ready for first VS2013-compa…
Browse files Browse the repository at this point in the history
…tible beta release.
  • Loading branch information
EdwardNutting_cp authored and EdwardNutting_cp committed Dec 21, 2013
1 parent bac3f98 commit 3bc5c49
Show file tree
Hide file tree
Showing 33 changed files with 80 additions and 50 deletions.
4 changes: 2 additions & 2 deletions Build/VSIP/Cosmos.targets
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@

<Target Name="CopyFilesToOutputDirectory">
<!-- copy <AssemblyName>.exe from obj\Debug to bin\Debug-->
<Copy SourceFiles="Cosmos.bxrc"
DestinationFolder="$(TargetDir)"/>
<!-- <Copy SourceFiles="Cosmos.bxrc"
DestinationFolder="$(TargetDir)"/>-->
</Target>
</Project>
Binary file modified Build/VSIP/Cosmos.zip
Binary file not shown.
Binary file modified Build/VSIP/CosmosKernel (C#).zip
Binary file not shown.
Binary file modified Build/VSIP/CosmosKernel (VB).zip
Binary file not shown.
Binary file modified Build/VSIP/CosmosProject (C#).zip
Binary file not shown.
Binary file modified Build/VSIP/CosmosProject (F#).zip
Binary file not shown.
Binary file modified Build/VSIP/CosmosProject (VB).zip
Binary file not shown.
Binary file modified Build/VSIP/ItemTemplates/Cosmos.zip
Binary file not shown.
Binary file modified Build/VSIP/ItemTemplates/CosmosKernel (C#).zip
Binary file not shown.
Binary file modified Build/VSIP/ItemTemplates/CosmosKernel (VB).zip
Binary file not shown.
Binary file modified Build/VSIP/ItemTemplates/CosmosProject (C#).zip
Binary file not shown.
Binary file modified Build/VSIP/ItemTemplates/CosmosProject (F#).zip
Binary file not shown.
Binary file modified Build/VSIP/ItemTemplates/CosmosProject (VB).zip
Binary file not shown.
Binary file modified Build/VSIP/ItemTemplates/Projects.zip
Binary file not shown.
3 changes: 2 additions & 1 deletion source2/Build/Cosmos.Build.Builder/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ public partial class MainWindow : Window {
protected List<TextBlock> mTailLines = new List<TextBlock>();
protected string mCosmosDir;
protected string mSetupPath;
protected int mReleaseNo = 7;
//Needs updating with each new release.
protected int mReleaseNo = 105304;

public MainWindow() {
InitializeComponent();
Expand Down
4 changes: 2 additions & 2 deletions source2/Build/Cosmos.Build.Common/CosmosPaths.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ static CosmosPaths() {
}
UserKit = (string)xReg.GetValue("UserKit");
if (null == UserKit) {
throw new Exception(@"HKEY_LOCAL_MACHINE\SOFTWARE\Cosmos\@UserKit was not found.");
throw new Exception(@"HKEY_LOCAL_MACHINE\SOFTWARE\Cosmos\@UserKit was not found but UserKit must be installed!");
}
}
}
Expand All @@ -48,7 +48,7 @@ static CosmosPaths() {
if (xReg != null) {
DevKit = (string)xReg.GetValue("DevKit");
if (null == DevKit) {
throw new Exception(@"HKEY_LOCAL_MACHINE\SOFTWARE\Cosmos\@DevKit was not found.");
throw new Exception(@"HKEY_CURRENT_USER\SOFTWARE\Cosmos\@DevKit was not found but DevKit is installed!");
}
try { DebugStubSrc = CheckPath(DevKit, @"source2\Compiler\Cosmos.Compiler.DebugStub"); }
// Not finding this one is not an issue. We will fallback to already retrieved stun from UserKit
Expand Down
4 changes: 2 additions & 2 deletions source2/Build/Cosmos.Build.MSBuild/Cosmos.targets
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@

<Target Name="CopyFilesToOutputDirectory">
<!-- copy <AssemblyName>.exe from obj\Debug to bin\Debug-->
<Copy SourceFiles="Cosmos.bxrc"
DestinationFolder="$(TargetDir)"/>
<!-- <Copy SourceFiles="Cosmos.bxrc"
DestinationFolder="$(TargetDir)"/>-->
</Target>
</Project>
25 changes: 17 additions & 8 deletions source2/Debug/Cosmos.Debug.Common/DebugConnector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ protected void SendCmd(byte aCmd, byte[] aData, bool aWait) {
//}
//System.Windows.Forms.MessageBox.Show(xSB.ToString());
DoDebugMsg("DC Send: " + aCmd.ToString());

if (aCmd == Vs2Ds.Noop) {
// Noops dont have any data.
// This is becuase Noops are used to clear out the
Expand Down Expand Up @@ -129,7 +129,7 @@ protected void SendCmd(byte aCmd, byte[] aData, bool aWait) {
// with an ACK. The ACK will set the event and allow us to proceed.
// This wait causes this method to wait on the ACK to be receive back from
// DebugStub.
mCmdWait.WaitOne();
mCmdWait.WaitOne(60000);
}
}
}
Expand Down Expand Up @@ -190,7 +190,9 @@ public void Continue() {
}

public byte[] GetMemoryData(uint address, uint size, int dataElementSize = 1) {
// from debugstub:
return new byte[size];

// from debugstub:
//// sends a stack value
//// Serial Params:
//// 1: x32 - offset relative to EBP
Expand All @@ -210,15 +212,18 @@ public byte[] GetMemoryData(uint address, uint size, int dataElementSize = 1) {
Array.Copy(BitConverter.GetBytes(address), 0, xData, 0, 4);
Array.Copy(BitConverter.GetBytes(size), 0, xData, 4, 4);
SendCmd(Vs2Ds.SendMemory, xData);
var xResult = mData;
mData = null;
var xResult = xData;
xData = null;
if (xResult.Length != size) {
throw new Exception("Retrieved a different size than requested!");
}
return xResult;
}

public byte[] GetStackData(int offsetToEBP, uint size) {
public byte[] GetStackData(int offsetToEBP, uint size)
{
return new byte[size];

// from debugstub:
//// sends a stack value
//// Serial Params:
Expand All @@ -243,8 +248,8 @@ public byte[] GetStackData(int offsetToEBP, uint size) {

byte[] xResult;

xResult = mData;
mData = null;
xResult = xData;
xData = null;
return xResult;
}

Expand All @@ -266,6 +271,10 @@ protected UInt16 GetUInt16(byte[] aBytes, int aOffset) {

protected void PacketMsg(byte[] aPacket) {
mCurrentMsgType = aPacket[0];

System.Diagnostics.Debug.WriteLine(String.Format("DC - PacketMsg: {0}", DebugConnectorStream.BytesToString(aPacket, 0, aPacket.Length)));
System.Diagnostics.Debug.WriteLine("DC - " + mCurrentMsgType.ToString());

// Could change to an array, but really not much benefit
switch (mCurrentMsgType) {
case Ds2Vs.TracePoint:
Expand Down
10 changes: 8 additions & 2 deletions source2/Debug/Cosmos.Debug.Common/DebugConnectorStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ protected class Incoming {
public Action<byte[]> Completed;
}

private static string BytesToString(byte[] bytes, int index, int count) {
internal static string BytesToString(byte[] bytes, int index, int count) {
if (count > 100) {
return String.Empty;
}
Expand Down Expand Up @@ -92,6 +92,9 @@ protected override void Next(int aPacketSize, Action<byte[]> aCompleted) {
}
xIncoming.Packet = new byte[aPacketSize];
xIncoming.Stream = mStream;

System.Diagnostics.Debug.WriteLine(String.Format("DC - Next: Expecting: {0}", aPacketSize));

#if TRACK_PENDING
try {
Interlocked.Increment(ref _pendingReadsCount);
Expand Down Expand Up @@ -134,7 +137,10 @@ protected void DoRead(IAsyncResult aResult) {
}
#endif
}
else {
else
{
System.Diagnostics.Debug.WriteLine(String.Format("DC - Full packet received - Received: {0}", BytesToString(xIncoming.Packet, 0, xIncoming.Packet.Length)));

// Full packet received, process it
xIncoming.Completed(xIncoming.Packet);
}
Expand Down
Binary file modified source2/Debug/Cosmos.Debug.Common/Guess.mdf
Binary file not shown.
Binary file modified source2/Debug/Cosmos.Debug.Common/Guess_log.ldf
Binary file not shown.
8 changes: 4 additions & 4 deletions source2/Demos/Guess/Guess.Cosmos
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<Deployment>ISO</Deployment>
<Launch>VMware</Launch>
<DebugEnabled>True</DebugEnabled>
<TraceAssemblies>All</TraceAssemblies>
<TraceAssemblies>User</TraceAssemblies>
<PXE_Deployment>PXE</PXE_Deployment>
<PXE_Launch>None</PXE_Launch>
<PXE_DebugEnabled>False</PXE_DebugEnabled>
Expand Down Expand Up @@ -66,7 +66,7 @@
<VMware_OutputPath>bin\Debug\</VMware_OutputPath>
<VMware_Framework>MicrosoftNET</VMware_Framework>
<VMware_UseInternalAssembler>False</VMware_UseInternalAssembler>
<VMware_TraceAssemblies>All</VMware_TraceAssemblies>
<VMware_TraceAssemblies>User</VMware_TraceAssemblies>
<VMware_EnableGDB>False</VMware_EnableGDB>
<VMware_StartCosmosGDB>False</VMware_StartCosmosGDB>
<ISO_Deployment>ISO</ISO_Deployment>
Expand Down Expand Up @@ -148,7 +148,7 @@
<Deployment>ISO</Deployment>
<Launch>VMware</Launch>
<DebugEnabled>True</DebugEnabled>
<TraceAssemblies>All</TraceAssemblies>
<TraceAssemblies>User</TraceAssemblies>
<PXE_Deployment>PXE</PXE_Deployment>
<PXE_Launch>None</PXE_Launch>
<PXE_DebugEnabled>False</PXE_DebugEnabled>
Expand Down Expand Up @@ -182,7 +182,7 @@
<VMware_OutputPath>bin\Debug\</VMware_OutputPath>
<VMware_Framework>MicrosoftNET</VMware_Framework>
<VMware_UseInternalAssembler>False</VMware_UseInternalAssembler>
<VMware_TraceAssemblies>All</VMware_TraceAssemblies>
<VMware_TraceAssemblies>User</VMware_TraceAssemblies>
<VMware_EnableGDB>False</VMware_EnableGDB>
<VMware_StartCosmosGDB>False</VMware_StartCosmosGDB>
<ISO_Deployment>ISO</ISO_Deployment>
Expand Down
6 changes: 3 additions & 3 deletions source2/IL2CPU/Cosmos.IL2CPU/AppAssembler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ protected void MethodBegin(MethodInfo aMethod) {
var xLocalsOffset = mLocals_Arguments_Infos.Count;
foreach (var xLocal in xBody.LocalVariables) {
var xInfo = new LOCAL_ARGUMENT_INFO {
METHODLABELNAME = mCurrentMethodLabel,
METHODLABELNAME = xMethodLabel,
IsArgument = false,
INDEXINMETHOD = xLocal.LocalIndex,
NAME = "Local" + xLocal.LocalIndex,
Expand Down Expand Up @@ -176,7 +176,7 @@ protected void MethodBegin(MethodInfo aMethod) {
var xIdxOffset = 0u;
if (!aMethod.MethodBase.IsStatic) {
mLocals_Arguments_Infos.Add(new LOCAL_ARGUMENT_INFO {
METHODLABELNAME = mCurrentMethodLabel,
METHODLABELNAME = xMethodLabel,
IsArgument = true,
NAME = "this:" + X86.IL.Ldarg.GetArgumentDisplacement(aMethod, 0),
INDEXINMETHOD = 0,
Expand All @@ -195,7 +195,7 @@ protected void MethodBegin(MethodInfo aMethod) {
// if last argument is 8 byte long, we need to add 4, so that debugger could read all 8 bytes from this variable in positiv direction
xOffset -= (int)Cosmos.IL2CPU.ILOp.Align(ILOp.SizeOfType(xParams[i].ParameterType), 4) - 4;
mLocals_Arguments_Infos.Add(new LOCAL_ARGUMENT_INFO {
METHODLABELNAME = mCurrentMethodLabel,
METHODLABELNAME = xMethodLabel,
IsArgument = true,
INDEXINMETHOD = (int)(i + xIdxOffset),
NAME = xParams[i].Name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</TemplateData>
<TemplateContent>
<Project File="CosmosProject.Cosmos" ReplaceParameters="true">
<ProjectItem SubType="Content" TargetFileName="Cosmos.bxrc">Cosmos.bxrc</ProjectItem>
<!--<ProjectItem SubType="Content" TargetFileName="Cosmos.bxrc">Cosmos.bxrc</ProjectItem>-->
</Project>
</TemplateContent>
</VSTemplate>
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<RootNamespace>$safeprojectname$</RootNamespace>
<AssemblyName>$safeprojectname$</AssemblyName>
<FileAlignment>512</FileAlignment>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<OptionCompare>Binary</OptionCompare>
<OptionStrict>Off</OptionStrict>
<OptionInfer>On</OptionInfer>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<RootNamespace>$safeprojectname$</RootNamespace>
<AssemblyName>$safeprojectname$</AssemblyName>
<FileAlignment>512</FileAlignment>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</TemplateData>
<TemplateContent>
<Project File="CosmosProject.Cosmos" ReplaceParameters="true">
<ProjectItem SubType="Content" TargetFileName="Cosmos.bxrc" ReplaceParameters="false">Cosmos.bxrc</ProjectItem>
<!--<ProjectItem SubType="Content" TargetFileName="Cosmos.bxrc" ReplaceParameters="false">Cosmos.bxrc</ProjectItem>-->
</Project>
</TemplateContent>
<WizardExtension>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<RootNamespace>$safeprojectname$</RootNamespace>
<AssemblyName>$safeprojectname$</AssemblyName>
<FileAlignment>512</FileAlignment>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<OptionCompare>Binary</OptionCompare>
<OptionStrict>Off</OptionStrict>
<OptionInfer>On</OptionInfer>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down
4 changes: 2 additions & 2 deletions source2/VSIP/Cosmos.VS.Wizards/CosmosProject.Cosmos
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@
<Reference Include="Cosmos.System.Plugs.System, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5ae71220097cb983"/>
<Reference Include="Cosmos.Debug.Kernel.Plugs, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5ae71220097cb983"/>
</ItemGroup>
<ItemGroup>
<!--<ItemGroup>
<Content Include="Cosmos.bxrc">
<SubType>Content</SubType>
</Content>
</ItemGroup>
</ItemGroup>-->
<Import Project="$(MSBuildExtensionsPath)\Cosmos\Cosmos.targets" />
</Project>
52 changes: 30 additions & 22 deletions source2/VSIP/Cosmos.VS.Wizards/GenerateCosmosProjectWizard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,29 +58,37 @@ public void ProjectFinishedGenerating(EnvDTE.Project project) {
File.WriteAllText(xFilename, xInputString);
var xCosmosProject = project.DTE.Solution.AddFromFile(xFilename, false);

// make .Cosmos project dependent on library project.
var xEnu = project.DTE.Solution.SolutionBuild.BuildDependencies.GetEnumerator();
dynamic xCosmosBootProjectObj = xCosmosProject.Object; // VSProjectNode
var xCosmosBootGuid = xCosmosBootProjectObj.ProjectIDGuid;
while (xEnu.MoveNext()) {
EnvDTE.BuildDependency bd = (EnvDTE.BuildDependency)xEnu.Current;

dynamic xDependencyGUID = bd.Project.Object;
if (xDependencyGUID.ProjectIDGuid == xCosmosBootGuid) {
bd.AddProject(project.UniqueName);
break;
}
}

//This throws an error - ProjectIDGuid not found on xCosmosBootProjectObj
//Also this doesn't seem to do anything... and the reference from Boot proj to Library proj makes it dependant anyway...
//try
//{ // make .Cosmos project dependent on library project.
// var xEnu = project.DTE.Solution.SolutionBuild.BuildDependencies.GetEnumerator();
// dynamic xCosmosBootProjectObj = xCosmosProject.Object; // VSProjectNode
// var xCosmosBootGuid = xCosmosBootProjectObj.ProjectIDGuid;
// while (xEnu.MoveNext())
// {
// EnvDTE.BuildDependency bd = (EnvDTE.BuildDependency)xEnu.Current;

// dynamic xDependencyGUID = bd.Project.Object;
// if (xDependencyGUID.ProjectIDGuid == xCosmosBootGuid)
// {
// bd.AddProject(project.UniqueName);
// break;
// }
// }
//}
//catch { MessageBox.Show("Failed to make Boot project dependant on Library project."); }

//Bochs file removed...
// Copy Bochs configuration file.
xInputString = GetBochsConfigurationFileTemplate();
if (xInputString == null) {
return;
}
xInputString = xInputString.Replace("$CosmosProjectName$", project.Name + "Boot");
xFilename = Path.GetDirectoryName(project.FullName);
xFilename = Path.Combine(xFilename, BochsConfigurationFileName);
File.WriteAllText(xFilename, xInputString);
//xInputString = GetBochsConfigurationFileTemplate();
//if (xInputString == null) {
// return;
//}
//xInputString = xInputString.Replace("$CosmosProjectName$", project.Name + "Boot");
//xFilename = Path.GetDirectoryName(project.FullName);
//xFilename = Path.Combine(xFilename, BochsConfigurationFileName);
//File.WriteAllText(xFilename, xInputString);

// set Cosmos Boot as startup project
project.DTE.Windows.Item(EnvDTE.Constants.vsWindowKindSolutionExplorer).Activate();
Expand Down
1 change: 1 addition & 0 deletions userkit install.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
install -USERKIT

0 comments on commit 3bc5c49

Please sign in to comment.