mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-27 05:52:11 +00:00
Merge branch 'master'.
This commit is contained in:
commit
9c90f7eaae
20 changed files with 515 additions and 167 deletions
BIN
Build/HyperV/Filesystem.vhdx
Normal file
BIN
Build/HyperV/Filesystem.vhdx
Normal file
Binary file not shown.
|
|
@ -96,6 +96,8 @@ Source: ".\Artwork\Cosmos.ico"; DestDir: "{app}"; Flags: ignoreversion uninsremo
|
||||||
Source: ".\Artwork\XSharp\XSharp.ico"; DestDir: "{app}\XSharp\"; Flags: ignoreversion uninsremovereadonly
|
Source: ".\Artwork\XSharp\XSharp.ico"; DestDir: "{app}\XSharp\"; Flags: ignoreversion uninsremovereadonly
|
||||||
Source: ".\source\Cosmos.Debug.DebugStub\*.xs"; DestDir: "{app}\XSharp\DebugStub\"; Flags: ignoreversion uninsremovereadonly
|
Source: ".\source\Cosmos.Debug.DebugStub\*.xs"; DestDir: "{app}\XSharp\DebugStub\"; Flags: ignoreversion uninsremovereadonly
|
||||||
; VMware
|
; VMware
|
||||||
|
Source: ".\Build\HyperV\*"; DestDir: "{app}\Build\HyperV"; Flags: ignoreversion uninsremovereadonly overwritereadonly recursesubdirs
|
||||||
|
; VMware
|
||||||
Source: ".\Build\VMware\*"; DestDir: "{app}\Build\VMware"; Flags: ignoreversion uninsremovereadonly overwritereadonly recursesubdirs
|
Source: ".\Build\VMware\*"; DestDir: "{app}\Build\VMware"; Flags: ignoreversion uninsremovereadonly overwritereadonly recursesubdirs
|
||||||
; ISO
|
; ISO
|
||||||
Source: ".\Build\ISO\*"; DestDir: "{app}\Build\ISO"
|
Source: ".\Build\ISO\*"; DestDir: "{app}\Build\ISO"
|
||||||
|
|
|
||||||
|
|
@ -15,10 +15,27 @@ namespace Cosmos.Compiler.Tests.Bcl.System.Collections.Generic
|
||||||
{
|
{
|
||||||
{"echo", "ECHO"},
|
{"echo", "ECHO"},
|
||||||
{"reboot", "REBOOT" },
|
{"reboot", "REBOOT" },
|
||||||
{"shutdown", "SHUTDOWN"}
|
{"shutdown", "SHUTDOWN"},
|
||||||
|
{"integer", 500}
|
||||||
};
|
};
|
||||||
|
|
||||||
Assert.IsTrue(commands.ContainsKey("echo"), "Dictionary ContainsKey does not work");
|
Assert.IsTrue(commands.ContainsKey("echo"), "Dictionary ContainsKey does not work1");
|
||||||
|
Assert.IsFalse(commands.ContainsKey("musterror"), "Dictionary ContainsKey does not work 2");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//String test
|
||||||
|
Assert.IsTrue((string)commands["echo"] == "ECHO", "Dictionary string not work");
|
||||||
|
commands["echo"] = "notEcho";
|
||||||
|
Assert.IsTrue((string)commands["echo"] == "notEcho", "Dictionary string been reset not working");
|
||||||
|
|
||||||
|
|
||||||
|
//Integer test
|
||||||
|
Assert.IsTrue((int)commands["integer"] == 500, "Dictionary integer not working");
|
||||||
|
commands["integer"] = 321;
|
||||||
|
Assert.IsTrue((int)commands["integer"] == 321, "Dictionary integer been reset not working");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ namespace Cosmos.TestRunner.Core
|
||||||
// If you want to test only specific platforms, add them to the list, like next line. By default, all platforms are run.
|
// If you want to test only specific platforms, add them to the list, like next line. By default, all platforms are run.
|
||||||
engine.RunTargets.Add(RunTargetEnum.Bochs);
|
engine.RunTargets.Add(RunTargetEnum.Bochs);
|
||||||
//engine.RunTargets.Add(RunTargetEnum.VMware);
|
//engine.RunTargets.Add(RunTargetEnum.VMware);
|
||||||
|
//engine.RunTargets.Add(RunTargetEnum.HyperV);
|
||||||
|
|
||||||
// If you're working on the compiler (or other lower parts), you can choose to run the compiler in process
|
// If you're working on the compiler (or other lower parts), you can choose to run the compiler in process
|
||||||
// one thing to keep in mind though, is that this only works with 1 kernel at a time!
|
// one thing to keep in mind though, is that this only works with 1 kernel at a time!
|
||||||
|
|
|
||||||
36
Tests/Cosmos.TestRunner.Core/Engine.HyperV.cs
Normal file
36
Tests/Cosmos.TestRunner.Core/Engine.HyperV.cs
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
using Cosmos.Build.Common;
|
||||||
|
using Cosmos.Debug.DebugConnectors;
|
||||||
|
using Cosmos.Debug.Hosts;
|
||||||
|
|
||||||
|
namespace Cosmos.TestRunner.Core
|
||||||
|
{
|
||||||
|
partial class Engine
|
||||||
|
{
|
||||||
|
private void RunIsoInHyperV(string iso, string harddisk)
|
||||||
|
{
|
||||||
|
if (!File.Exists(harddisk))
|
||||||
|
{
|
||||||
|
throw new FileNotFoundException("Harddisk file not found!", harddisk);
|
||||||
|
}
|
||||||
|
|
||||||
|
var xParams = new Dictionary<string, string>();
|
||||||
|
|
||||||
|
xParams.Add("ISOFile", iso);
|
||||||
|
xParams.Add(BuildPropertyNames.VisualStudioDebugPortString, "Pipe: CosmosSerial");
|
||||||
|
|
||||||
|
var xDebugConnector = new DebugConnectorPipeClient(DebugConnectorPipeClient.DefaultCosmosPipeName);
|
||||||
|
InitializeDebugConnector(xDebugConnector);
|
||||||
|
|
||||||
|
var xHyperV = new HyperV(xParams, RunWithGDB, harddisk);
|
||||||
|
xHyperV.OnShutDown = (a, b) =>
|
||||||
|
{
|
||||||
|
mKernelRunning = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
HandleRunning(xDebugConnector, xHyperV);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -29,9 +29,21 @@ namespace Cosmos.TestRunner.Core
|
||||||
RunTask("Ld", () => RunLd(xTempObjectFile, xObjectFile));
|
RunTask("Ld", () => RunLd(xTempObjectFile, xObjectFile));
|
||||||
RunTask("ExtractMapFromElfFile", () => RunExtractMapFromElfFile(mBaseWorkingDirectory, xObjectFile));
|
RunTask("ExtractMapFromElfFile", () => RunExtractMapFromElfFile(mBaseWorkingDirectory, xObjectFile));
|
||||||
}
|
}
|
||||||
var xHarddiskPath = Path.Combine(mBaseWorkingDirectory, "Harddisk.vmdk");
|
|
||||||
|
string xHarddiskPath;
|
||||||
|
if (configuration.RunTarget == RunTargetEnum.HyperV)
|
||||||
|
{
|
||||||
|
xHarddiskPath = Path.Combine(mBaseWorkingDirectory, "Harddisk.vhdx");
|
||||||
|
var xOriginalHarddiskPath = Path.Combine(GetCosmosUserkitFolder(), "Build", "HyperV", "Filesystem.vhdx");
|
||||||
|
File.Copy(xOriginalHarddiskPath, xHarddiskPath);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
xHarddiskPath = Path.Combine(mBaseWorkingDirectory, "Harddisk.vmdk");
|
||||||
var xOriginalHarddiskPath = Path.Combine(GetCosmosUserkitFolder(), "Build", "VMware", "Workstation", "Filesystem.vmdk");
|
var xOriginalHarddiskPath = Path.Combine(GetCosmosUserkitFolder(), "Build", "VMware", "Workstation", "Filesystem.vmdk");
|
||||||
File.Copy(xOriginalHarddiskPath, xHarddiskPath);
|
File.Copy(xOriginalHarddiskPath, xHarddiskPath);
|
||||||
|
}
|
||||||
|
|
||||||
RunTask("MakeISO", () => MakeIso(xObjectFile, xIsoFile));
|
RunTask("MakeISO", () => MakeIso(xObjectFile, xIsoFile));
|
||||||
switch (configuration.RunTarget)
|
switch (configuration.RunTarget)
|
||||||
{
|
{
|
||||||
|
|
@ -41,6 +53,9 @@ namespace Cosmos.TestRunner.Core
|
||||||
case RunTargetEnum.VMware:
|
case RunTargetEnum.VMware:
|
||||||
RunTask("RunISO", () => RunIsoInVMware(xIsoFile, xHarddiskPath));
|
RunTask("RunISO", () => RunIsoInVMware(xIsoFile, xHarddiskPath));
|
||||||
break;
|
break;
|
||||||
|
case RunTargetEnum.HyperV:
|
||||||
|
RunTask("RunISO", () => RunIsoInHyperV(xIsoFile, xHarddiskPath));
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw new ArgumentOutOfRangeException("RunTarget " + configuration.RunTarget + " not implemented!");
|
throw new ArgumentOutOfRangeException("RunTarget " + configuration.RunTarget + " not implemented!");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
public enum RunTargetEnum
|
public enum RunTargetEnum
|
||||||
{
|
{
|
||||||
Bochs,
|
Bochs,
|
||||||
VMware
|
VMware,
|
||||||
|
HyperV
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -104,14 +104,13 @@ namespace Cosmos.Build.Common
|
||||||
Description = "Makes a USB device such as a flash drive or external hard disk bootable.";
|
Description = "Makes a USB device such as a flash drive or external hard disk bootable.";
|
||||||
Deployment = DeploymentType.USB;
|
Deployment = DeploymentType.USB;
|
||||||
Launch = LaunchType.None;
|
Launch = LaunchType.None;
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (aName == "VMware")
|
else if (aName == "VMware")
|
||||||
{
|
{
|
||||||
Description = "Use VMware Player or Workstation to deploy and debug.";
|
Description = "Use VMware Player or Workstation to deploy and debug.";
|
||||||
Deployment = DeploymentType.ISO;
|
Deployment = DeploymentType.ISO;
|
||||||
Launch = LaunchType.VMware;
|
Launch = LaunchType.VMware;
|
||||||
|
VisualStudioDebugPort = @"Pipe: Cosmos\Serial";
|
||||||
}
|
}
|
||||||
else if (aName == "PXE")
|
else if (aName == "PXE")
|
||||||
{
|
{
|
||||||
|
|
@ -126,6 +125,7 @@ namespace Cosmos.Build.Common
|
||||||
Description = "Use Bochs emulator to deploy and debug.";
|
Description = "Use Bochs emulator to deploy and debug.";
|
||||||
Deployment = DeploymentType.ISO;
|
Deployment = DeploymentType.ISO;
|
||||||
Launch = LaunchType.Bochs;
|
Launch = LaunchType.Bochs;
|
||||||
|
VisualStudioDebugPort = @"Pipe: Cosmos\Serial";
|
||||||
}
|
}
|
||||||
else if (aName == "IntelEdison")
|
else if (aName == "IntelEdison")
|
||||||
{
|
{
|
||||||
|
|
@ -133,6 +133,13 @@ namespace Cosmos.Build.Common
|
||||||
Deployment = DeploymentType.BinaryImage;
|
Deployment = DeploymentType.BinaryImage;
|
||||||
Launch = LaunchType.IntelEdison;
|
Launch = LaunchType.IntelEdison;
|
||||||
}
|
}
|
||||||
|
else if (aName == "HyperV")
|
||||||
|
{
|
||||||
|
Description = "Use Hyper-V to deploy and debug.";
|
||||||
|
Deployment = DeploymentType.ISO;
|
||||||
|
Launch = LaunchType.HyperV;
|
||||||
|
VisualStudioDebugPort = "Pipe: CosmosSerial";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DeleteProfile(string aPrefix)
|
public void DeleteProfile(string aPrefix)
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.ComponentModel;
|
|
||||||
|
|
||||||
namespace Cosmos.Build.Common
|
namespace Cosmos.Build.Common
|
||||||
{
|
{
|
||||||
|
|
@ -31,6 +31,8 @@ namespace Cosmos.Build.Common
|
||||||
Bochs,
|
Bochs,
|
||||||
[Description("Intel Edison")]
|
[Description("Intel Edison")]
|
||||||
IntelEdison,
|
IntelEdison,
|
||||||
|
[Description("Hyper-V")]
|
||||||
|
HyperV
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum VMwareEdition
|
public enum VMwareEdition
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,74 @@
|
||||||
|
using System;
|
||||||
|
using System.IO.Pipes;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
|
namespace Cosmos.Debug.DebugConnectors
|
||||||
|
{
|
||||||
|
/// <summary>Use a named pipe client to implement wire transfer protocol between a Debug Stub
|
||||||
|
/// hosted in a debugged Cosmos Kernel and our Debug Engine hosted in Visual Studio.
|
||||||
|
/// Hyper-V provides a pipe server to expose guest serial ports.</summary>
|
||||||
|
public class DebugConnectorPipeClient : DebugConnectorStreamWithoutTimeouts
|
||||||
|
{
|
||||||
|
// private AutoResetEvent mWaitConnectEvent = new AutoResetEvent(false);
|
||||||
|
private NamedPipeClientStream mPipe;
|
||||||
|
|
||||||
|
public const string DefaultCosmosPipeName = "CosmosSerial";
|
||||||
|
|
||||||
|
public DebugConnectorPipeClient(string aName)
|
||||||
|
{
|
||||||
|
mPipe = new NamedPipeClientStream(".", aName, PipeDirection.InOut, PipeOptions.WriteThrough);
|
||||||
|
Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override int TryRead(byte[] buffer, int offset, int count, int timeout)
|
||||||
|
{
|
||||||
|
var xStream = mStream;
|
||||||
|
if (xStream == null)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
uint xBytesAvailable = 0;
|
||||||
|
if (PeekNamedPipe(mPipe.SafePipeHandle.DangerousGetHandle(), null, 0, IntPtr.Zero, ref xBytesAvailable, IntPtr.Zero))
|
||||||
|
{
|
||||||
|
if (xBytesAvailable > 0)
|
||||||
|
{
|
||||||
|
return xStream.Read(buffer, offset, count);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Thread.Sleep(timeout);
|
||||||
|
if (PeekNamedPipe(mPipe.SafePipeHandle.DangerousGetHandle(), null, 0, IntPtr.Zero, ref xBytesAvailable, IntPtr.Zero))
|
||||||
|
{
|
||||||
|
if (xBytesAvailable > 0)
|
||||||
|
{
|
||||||
|
return xStream.Read(buffer, offset, count);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool IsConnected
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return base.IsConnected && mPipe.IsConnected;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void InitializeBackground()
|
||||||
|
{
|
||||||
|
mPipe.Connect();
|
||||||
|
mStream = mPipe;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool GetIsConnectedToDebugStub()
|
||||||
|
{
|
||||||
|
return mPipe.IsConnected;
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport("kernel32.dll", EntryPoint = "PeekNamedPipe", SetLastError = true)]
|
||||||
|
private static extern bool PeekNamedPipe(IntPtr handle,
|
||||||
|
byte[] buffer, uint nBufferSize, IntPtr bytesRead,
|
||||||
|
ref uint bytesAvail, IntPtr BytesLeftThisMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
109
source/Cosmos.Debug.Hosts/HyperV.cs
Normal file
109
source/Cosmos.Debug.Hosts/HyperV.cs
Normal file
|
|
@ -0,0 +1,109 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
|
#if false
|
||||||
|
using System.Management.Automation;
|
||||||
|
using System.Management.Automation.Runspaces;
|
||||||
|
#endif
|
||||||
|
using System.Security.Principal;
|
||||||
|
|
||||||
|
using Cosmos.Build.Common;
|
||||||
|
|
||||||
|
namespace Cosmos.Debug.Hosts
|
||||||
|
{
|
||||||
|
public class HyperV : Host
|
||||||
|
{
|
||||||
|
protected string mHarddiskPath;
|
||||||
|
protected Process mProcess;
|
||||||
|
|
||||||
|
#if false
|
||||||
|
private static bool IsProcessAdministrator => (new WindowsPrincipal(WindowsIdentity.GetCurrent())).IsInRole(WindowsBuiltInRole.Administrator);
|
||||||
|
#else
|
||||||
|
private static bool IsProcessAdministrator => true;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
public HyperV(Dictionary<string, string> aParams, bool aUseGDB, string harddisk = "Filesystem.vhdx") : base(aParams, aUseGDB)
|
||||||
|
{
|
||||||
|
if (!IsProcessAdministrator)
|
||||||
|
{
|
||||||
|
throw new Exception("Visual Studio must be run as administrator for Hyper-V to work");
|
||||||
|
}
|
||||||
|
|
||||||
|
mHarddiskPath = Path.Combine(CosmosPaths.Build, harddisk);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Start()
|
||||||
|
{
|
||||||
|
CreateVirtualMachine();
|
||||||
|
|
||||||
|
// Target exe or file
|
||||||
|
var info = new ProcessStartInfo(@"C:\Windows\sysnative\VmConnect.exe", @"""localhost"" ""Cosmos""")
|
||||||
|
{
|
||||||
|
UseShellExecute = true
|
||||||
|
};
|
||||||
|
|
||||||
|
mProcess = new Process();
|
||||||
|
mProcess.StartInfo = info;
|
||||||
|
mProcess.EnableRaisingEvents = true;
|
||||||
|
mProcess.Exited += (Object aSender, EventArgs e) =>
|
||||||
|
{
|
||||||
|
OnShutDown?.Invoke(aSender, e);
|
||||||
|
};
|
||||||
|
mProcess.Start();
|
||||||
|
|
||||||
|
RunPowershellScript("Start-VM -Name Cosmos");
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Stop()
|
||||||
|
{
|
||||||
|
RunPowershellScript("Stop-VM -Name Cosmos -TurnOff -ErrorAction Ignore");
|
||||||
|
mProcess.Kill();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void CreateVirtualMachine()
|
||||||
|
{
|
||||||
|
RunPowershellScript("Stop-VM -Name Cosmos -TurnOff -ErrorAction Ignore");
|
||||||
|
|
||||||
|
RunPowershellScript("Remove-VM -Name Cosmos -Force -ErrorAction Ignore");
|
||||||
|
RunPowershellScript("New-VM -Name Cosmos -MemoryStartupBytes 268435456 -BootDevice CD");
|
||||||
|
if (!File.Exists(mHarddiskPath))
|
||||||
|
{
|
||||||
|
RunPowershellScript($@"New-VHD -SizeBytes 268435456 -Dynamic -Path ""{mHarddiskPath}""");
|
||||||
|
}
|
||||||
|
|
||||||
|
RunPowershellScript($@"Add-VMHardDiskDrive -VMName Cosmos -ControllerNumber 0 -ControllerLocation 0 -Path ""{mHarddiskPath}""");
|
||||||
|
RunPowershellScript($@"Set-VMDvdDrive -VMName Cosmos -ControllerNumber 1 -ControllerLocation 0 -Path ""{mParams["ISOFile"]}""");
|
||||||
|
RunPowershellScript(@"Set-VMComPort -VMName Cosmos -Path \\.\pipe\CosmosSerial -Number 1");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void RunPowershellScript(string text)
|
||||||
|
{
|
||||||
|
// Workaround
|
||||||
|
ProcessStartInfo xStartInfo = new ProcessStartInfo("powershell");
|
||||||
|
xStartInfo.Arguments = text;
|
||||||
|
|
||||||
|
var xProcess = Process.Start(xStartInfo);
|
||||||
|
xProcess.WaitForExit();
|
||||||
|
|
||||||
|
#if false
|
||||||
|
using (Runspace runspace = RunspaceFactory.CreateRunspace())
|
||||||
|
{
|
||||||
|
runspace.Open();
|
||||||
|
|
||||||
|
Pipeline pipeline = runspace.CreatePipeline();
|
||||||
|
|
||||||
|
pipeline.Commands.AddScript(text);
|
||||||
|
pipeline.Commands.Add("Out-String");
|
||||||
|
|
||||||
|
Collection<PSObject> results = pipeline.Invoke();
|
||||||
|
foreach (PSObject obj in results)
|
||||||
|
{
|
||||||
|
System.Diagnostics.Debug.WriteLine(obj.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Reflection.Metadata;
|
using System.Reflection.Metadata;
|
||||||
|
|
@ -143,6 +143,8 @@ namespace Cosmos.IL2CPU.ILOpCodes
|
||||||
case Code.Ldelem_U1:
|
case Code.Ldelem_U1:
|
||||||
case Code.Ldelem_U2:
|
case Code.Ldelem_U2:
|
||||||
case Code.Ldelem_U4:
|
case Code.Ldelem_U4:
|
||||||
|
case Code.Ldelem_R4:
|
||||||
|
case Code.Ldelem_R8:
|
||||||
return 2;
|
return 2;
|
||||||
case Code.Ldnull:
|
case Code.Ldnull:
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -276,6 +278,8 @@ namespace Cosmos.IL2CPU.ILOpCodes
|
||||||
case Code.Ldelem_U1:
|
case Code.Ldelem_U1:
|
||||||
case Code.Ldelem_U2:
|
case Code.Ldelem_U2:
|
||||||
case Code.Ldelem_U4:
|
case Code.Ldelem_U4:
|
||||||
|
case Code.Ldelem_R4:
|
||||||
|
case Code.Ldelem_R8:
|
||||||
return 1;
|
return 1;
|
||||||
case Code.Ldnull:
|
case Code.Ldnull:
|
||||||
return 1;
|
return 1;
|
||||||
|
|
@ -470,10 +474,15 @@ namespace Cosmos.IL2CPU.ILOpCodes
|
||||||
case Code.Ldelem_U4:
|
case Code.Ldelem_U4:
|
||||||
StackPushTypes[0] = typeof(uint);
|
StackPushTypes[0] = typeof(uint);
|
||||||
return;
|
return;
|
||||||
|
case Code.Ldelem_R4:
|
||||||
|
StackPushTypes[0] = typeof(float);
|
||||||
|
return;
|
||||||
|
case Code.Ldelem_R8:
|
||||||
|
StackPushTypes[0] = typeof(double);
|
||||||
|
return;
|
||||||
case Code.Ldnull:
|
case Code.Ldnull:
|
||||||
StackPushTypes[0] = typeof(NullRef);
|
StackPushTypes[0] = typeof(NullRef);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case Code.Ldind_I:
|
case Code.Ldind_I:
|
||||||
StackPushTypes[0] = typeof(IntPtr);
|
StackPushTypes[0] = typeof(IntPtr);
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Cosmos.System
|
namespace Cosmos.System
|
||||||
{
|
{
|
||||||
|
|
@ -142,6 +142,7 @@ namespace Cosmos.System
|
||||||
case ConsoleKeyEx.Sleep:
|
case ConsoleKeyEx.Sleep:
|
||||||
return ConsoleKey.Sleep;
|
return ConsoleKey.Sleep;
|
||||||
case ConsoleKeyEx.BiggerThan:
|
case ConsoleKeyEx.BiggerThan:
|
||||||
|
case ConsoleKeyEx.ExclamationPoint:
|
||||||
case ConsoleKeyEx.Period:
|
case ConsoleKeyEx.Period:
|
||||||
return ConsoleKey.OemPeriod;
|
return ConsoleKey.OemPeriod;
|
||||||
case ConsoleKeyEx.LowerThan:
|
case ConsoleKeyEx.LowerThan:
|
||||||
|
|
@ -149,10 +150,36 @@ namespace Cosmos.System
|
||||||
return ConsoleKey.OemComma;
|
return ConsoleKey.OemComma;
|
||||||
case ConsoleKeyEx.NumPeriod:
|
case ConsoleKeyEx.NumPeriod:
|
||||||
return ConsoleKey.Decimal;
|
return ConsoleKey.Decimal;
|
||||||
case ConsoleKeyEx.NumPlus:
|
|
||||||
return ConsoleKey.Add;
|
|
||||||
case ConsoleKeyEx.NumEnter:
|
case ConsoleKeyEx.NumEnter:
|
||||||
return ConsoleKey.Enter;
|
return ConsoleKey.Enter;
|
||||||
|
case ConsoleKeyEx.Num0:
|
||||||
|
return ConsoleKey.D0;
|
||||||
|
case ConsoleKeyEx.Num1:
|
||||||
|
return ConsoleKey.D1;
|
||||||
|
case ConsoleKeyEx.Num2:
|
||||||
|
return ConsoleKey.D2;
|
||||||
|
case ConsoleKeyEx.Num3:
|
||||||
|
return ConsoleKey.D3;
|
||||||
|
case ConsoleKeyEx.Num4:
|
||||||
|
return ConsoleKey.D4;
|
||||||
|
case ConsoleKeyEx.Num5:
|
||||||
|
return ConsoleKey.D5;
|
||||||
|
case ConsoleKeyEx.Num6:
|
||||||
|
return ConsoleKey.D6;
|
||||||
|
case ConsoleKeyEx.Num7:
|
||||||
|
return ConsoleKey.D7;
|
||||||
|
case ConsoleKeyEx.Num8:
|
||||||
|
return ConsoleKey.D8;
|
||||||
|
case ConsoleKeyEx.Num9:
|
||||||
|
return ConsoleKey.D9;
|
||||||
|
case ConsoleKeyEx.NumDivide:
|
||||||
|
return ConsoleKey.Divide;
|
||||||
|
case ConsoleKeyEx.NumMultiply:
|
||||||
|
return ConsoleKey.Multiply;
|
||||||
|
case ConsoleKeyEx.NumMinus:
|
||||||
|
return ConsoleKey.OemMinus;
|
||||||
|
case ConsoleKeyEx.NumPlus:
|
||||||
|
return ConsoleKey.OemPlus;
|
||||||
case ConsoleKeyEx.Backslash:
|
case ConsoleKeyEx.Backslash:
|
||||||
return ConsoleKey.Oem5;
|
return ConsoleKey.Oem5;
|
||||||
case ConsoleKeyEx.LBracket:
|
case ConsoleKeyEx.LBracket:
|
||||||
|
|
@ -175,6 +202,10 @@ namespace Cosmos.System
|
||||||
//TODO: .Net Core
|
//TODO: .Net Core
|
||||||
//case ConsoleKeyEx.OEM102:
|
//case ConsoleKeyEx.OEM102:
|
||||||
// return ConsoleKey.Oem102;
|
// return ConsoleKey.Oem102;
|
||||||
|
//case ConsoleKeyEx.LWin:
|
||||||
|
// return ConsoleKey.LeftWindows;
|
||||||
|
//case ConsoleKeyEx.RWin:
|
||||||
|
// return ConsoleKey.RightWindows;
|
||||||
default:
|
default:
|
||||||
throw new Exception("KeyEx not implemented!");
|
throw new Exception("KeyEx not implemented!");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,13 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
using Microsoft.VisualStudio;
|
||||||
|
using Microsoft.VisualStudio.Debugger.Interop;
|
||||||
|
|
||||||
using Cosmos.Debug.Common;
|
using Cosmos.Debug.Common;
|
||||||
using Cosmos.VS.DebugEngine.AD7.Definitions;
|
using Cosmos.VS.DebugEngine.AD7.Definitions;
|
||||||
using Cosmos.VS.DebugEngine.Engine.Impl;
|
using Cosmos.VS.DebugEngine.Engine.Impl;
|
||||||
using Cosmos.VS.DebugEngine.Properties;
|
using Cosmos.VS.DebugEngine.Properties;
|
||||||
using Microsoft.VisualStudio;
|
|
||||||
using Microsoft.VisualStudio.Debugger.Interop;
|
|
||||||
|
|
||||||
namespace Cosmos.VS.DebugEngine.AD7.Impl
|
namespace Cosmos.VS.DebugEngine.AD7.Impl
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -5,18 +5,18 @@ using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Cosmos.Debug.DebugConnectors;
|
|
||||||
using Cosmos.Debug.Symbols;
|
|
||||||
using Cosmos.VS.DebugEngine.Engine.Impl;
|
|
||||||
using Cosmos.VS.DebugEngine.Utilities;
|
|
||||||
using Microsoft.Internal.VisualStudio.PlatformUI;
|
using Microsoft.Internal.VisualStudio.PlatformUI;
|
||||||
using Microsoft.VisualStudio;
|
using Microsoft.VisualStudio;
|
||||||
using Microsoft.VisualStudio.Debugger.Interop;
|
using Microsoft.VisualStudio.Debugger.Interop;
|
||||||
using Label = Cosmos.Debug.Symbols.Label;
|
|
||||||
using Cosmos.Build.Common;
|
using Cosmos.Build.Common;
|
||||||
using Cosmos.Debug.Common;
|
using Cosmos.Debug.Common;
|
||||||
|
using Cosmos.Debug.DebugConnectors;
|
||||||
using Cosmos.Debug.Hosts;
|
using Cosmos.Debug.Hosts;
|
||||||
|
using Cosmos.Debug.Symbols;
|
||||||
|
using Cosmos.VS.DebugEngine.Engine.Impl;
|
||||||
using Cosmos.VS.DebugEngine.Properties;
|
using Cosmos.VS.DebugEngine.Properties;
|
||||||
|
using Cosmos.VS.DebugEngine.Utilities;
|
||||||
|
using Label = Cosmos.Debug.Symbols.Label;
|
||||||
|
|
||||||
namespace Cosmos.VS.DebugEngine.AD7.Impl
|
namespace Cosmos.VS.DebugEngine.AD7.Impl
|
||||||
{
|
{
|
||||||
|
|
@ -316,7 +316,14 @@ namespace Cosmos.VS.DebugEngine.AD7.Impl
|
||||||
switch (xPortType)
|
switch (xPortType)
|
||||||
{
|
{
|
||||||
case "pipe:":
|
case "pipe:":
|
||||||
|
if (xLaunch == "HyperV")
|
||||||
|
{
|
||||||
|
mDbgConnector = new DebugConnectorPipeClient(xPortParam);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
mDbgConnector = new DebugConnectorPipeServer(xPortParam);
|
mDbgConnector = new DebugConnectorPipeServer(xPortParam);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
#if SERIAL_PORT
|
#if SERIAL_PORT
|
||||||
case "serial:":
|
case "serial:":
|
||||||
|
|
@ -481,6 +488,9 @@ namespace Cosmos.VS.DebugEngine.AD7.Impl
|
||||||
case LaunchType.IntelEdison:
|
case LaunchType.IntelEdison:
|
||||||
mHost = new IntelEdison(mDebugInfo, false);
|
mHost = new IntelEdison(mDebugInfo, false);
|
||||||
break;
|
break;
|
||||||
|
case LaunchType.HyperV:
|
||||||
|
mHost = new HyperV(mDebugInfo, false);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw new Exception("Invalid Launch value: '" + mLaunch + "'.");
|
throw new Exception("Invalid Launch value: '" + mLaunch + "'.");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ namespace Cosmos.VS.ProjectSystem
|
||||||
Add("Bochs", "Bochs");
|
Add("Bochs", "Bochs");
|
||||||
}
|
}
|
||||||
Add("IntelEdison", "Intel Edison Serial boot");
|
Add("IntelEdison", "Intel Edison Serial boot");
|
||||||
|
Add("HyperV", "Hyper-V");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -96,6 +96,7 @@
|
||||||
this.cmboSlavePort = new System.Windows.Forms.ComboBox();
|
this.cmboSlavePort = new System.Windows.Forms.ComboBox();
|
||||||
this.label6 = new System.Windows.Forms.Label();
|
this.label6 = new System.Windows.Forms.Label();
|
||||||
this.backgroundWorker1 = new System.ComponentModel.BackgroundWorker();
|
this.backgroundWorker1 = new System.ComponentModel.BackgroundWorker();
|
||||||
|
this.tabHyperV = new System.Windows.Forms.TabPage();
|
||||||
this.panel1.SuspendLayout();
|
this.panel1.SuspendLayout();
|
||||||
this.TabControl1.SuspendLayout();
|
this.TabControl1.SuspendLayout();
|
||||||
this.tabProfile.SuspendLayout();
|
this.tabProfile.SuspendLayout();
|
||||||
|
|
@ -155,6 +156,7 @@
|
||||||
this.TabControl1.Controls.Add(this.tabDeployment);
|
this.TabControl1.Controls.Add(this.tabDeployment);
|
||||||
this.TabControl1.Controls.Add(this.tabLaunch);
|
this.TabControl1.Controls.Add(this.tabLaunch);
|
||||||
this.TabControl1.Controls.Add(this.tabVMware);
|
this.TabControl1.Controls.Add(this.tabVMware);
|
||||||
|
this.TabControl1.Controls.Add(this.tabHyperV);
|
||||||
this.TabControl1.Controls.Add(this.tabBochs);
|
this.TabControl1.Controls.Add(this.tabBochs);
|
||||||
this.TabControl1.Controls.Add(this.tabPXE);
|
this.TabControl1.Controls.Add(this.tabPXE);
|
||||||
this.TabControl1.Controls.Add(this.tabUSB);
|
this.TabControl1.Controls.Add(this.tabUSB);
|
||||||
|
|
@ -754,7 +756,6 @@
|
||||||
//
|
//
|
||||||
// butnPxeRefresh
|
// butnPxeRefresh
|
||||||
//
|
//
|
||||||
//
|
|
||||||
this.butnPxeRefresh.AutoSize = true;
|
this.butnPxeRefresh.AutoSize = true;
|
||||||
this.butnPxeRefresh.Image = ((System.Drawing.Image)(resources.GetObject("butnPxeRefresh.Image")));
|
this.butnPxeRefresh.Image = ((System.Drawing.Image)(resources.GetObject("butnPxeRefresh.Image")));
|
||||||
this.butnPxeRefresh.Location = new System.Drawing.Point(177, 31);
|
this.butnPxeRefresh.Location = new System.Drawing.Point(177, 31);
|
||||||
|
|
@ -856,6 +857,16 @@
|
||||||
this.label6.TabIndex = 34;
|
this.label6.TabIndex = 34;
|
||||||
this.label6.Text = "Slave Port:";
|
this.label6.Text = "Slave Port:";
|
||||||
//
|
//
|
||||||
|
// tabHyperV
|
||||||
|
//
|
||||||
|
this.tabHyperV.Location = new System.Drawing.Point(4, 22);
|
||||||
|
this.tabHyperV.Name = "tabHyperV";
|
||||||
|
this.tabHyperV.Padding = new System.Windows.Forms.Padding(3);
|
||||||
|
this.tabHyperV.Size = new System.Drawing.Size(627, 486);
|
||||||
|
this.tabHyperV.TabIndex = 14;
|
||||||
|
this.tabHyperV.Text = "Hyper-V";
|
||||||
|
this.tabHyperV.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
// CosmosPage
|
// CosmosPage
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
|
|
@ -971,5 +982,6 @@
|
||||||
private System.Windows.Forms.GroupBox debugStubGroupBox;
|
private System.Windows.Forms.GroupBox debugStubGroupBox;
|
||||||
private System.ComponentModel.BackgroundWorker backgroundWorker1;
|
private System.ComponentModel.BackgroundWorker backgroundWorker1;
|
||||||
private System.Windows.Forms.Label label12;
|
private System.Windows.Forms.Label label12;
|
||||||
|
private System.Windows.Forms.TabPage tabHyperV;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,16 +48,21 @@ namespace Cosmos.VS.ProjectSystem.PropertyPages
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ProfilePresets mPresets = new ProfilePresets();
|
protected ProfilePresets mPresets = new ProfilePresets();
|
||||||
|
|
||||||
protected int mVMwareAndBochsDebugPipe;
|
protected int mVMwareAndBochsDebugPipe;
|
||||||
|
protected int mHyperVDebugPipe;
|
||||||
|
|
||||||
protected bool mShowTabBochs;
|
protected bool mShowTabBochs;
|
||||||
protected bool mShowTabDebug;
|
protected bool mShowTabDebug;
|
||||||
protected bool mShowTabDeployment;
|
protected bool mShowTabDeployment;
|
||||||
protected bool mShowTabLaunch;
|
protected bool mShowTabLaunch;
|
||||||
protected bool mShowTabVMware;
|
protected bool mShowTabVMware;
|
||||||
|
protected bool mShowTabHyperV;
|
||||||
protected bool mShowTabPXE;
|
protected bool mShowTabPXE;
|
||||||
protected bool mShowTabUSB;
|
protected bool mShowTabUSB;
|
||||||
protected bool mShowTabISO;
|
protected bool mShowTabISO;
|
||||||
protected bool mShowTabSlave;
|
protected bool mShowTabSlave;
|
||||||
|
|
||||||
protected bool FreezeEvents;
|
protected bool FreezeEvents;
|
||||||
|
|
||||||
public CosmosPage()
|
public CosmosPage()
|
||||||
|
|
@ -182,7 +187,6 @@ namespace Cosmos.VS.ProjectSystem.PropertyPages
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
#region VMware
|
#region VMware
|
||||||
|
|
||||||
cmboVMwareEdition.SelectedIndexChanged += delegate (Object sender, EventArgs e)
|
cmboVMwareEdition.SelectedIndexChanged += delegate (Object sender, EventArgs e)
|
||||||
|
|
@ -291,8 +295,6 @@ namespace Cosmos.VS.ProjectSystem.PropertyPages
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
checkEnableGDB.CheckedChanged += delegate (Object sender, EventArgs e)
|
checkEnableGDB.CheckedChanged += delegate (Object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (FreezeEvents) return;
|
if (FreezeEvents) return;
|
||||||
|
|
@ -344,6 +346,7 @@ namespace Cosmos.VS.ProjectSystem.PropertyPages
|
||||||
IsDirty = true;
|
IsDirty = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ApplyChanges()
|
public override void ApplyChanges()
|
||||||
|
|
@ -371,6 +374,7 @@ namespace Cosmos.VS.ProjectSystem.PropertyPages
|
||||||
RemoveTab(tabDeployment);
|
RemoveTab(tabDeployment);
|
||||||
RemoveTab(tabLaunch);
|
RemoveTab(tabLaunch);
|
||||||
RemoveTab(tabVMware);
|
RemoveTab(tabVMware);
|
||||||
|
RemoveTab(tabHyperV);
|
||||||
RemoveTab(tabPXE);
|
RemoveTab(tabPXE);
|
||||||
RemoveTab(tabUSB);
|
RemoveTab(tabUSB);
|
||||||
RemoveTab(tabISO);
|
RemoveTab(tabISO);
|
||||||
|
|
@ -407,6 +411,10 @@ namespace Cosmos.VS.ProjectSystem.PropertyPages
|
||||||
{
|
{
|
||||||
TabControl1.TabPages.Add(tabVMware);
|
TabControl1.TabPages.Add(tabVMware);
|
||||||
}
|
}
|
||||||
|
if (mShowTabHyperV)
|
||||||
|
{
|
||||||
|
TabControl1.TabPages.Add(tabHyperV);
|
||||||
|
}
|
||||||
if (mShowTabSlave)
|
if (mShowTabSlave)
|
||||||
{
|
{
|
||||||
TabControl1.TabPages.Add(tabSlave);
|
TabControl1.TabPages.Add(tabSlave);
|
||||||
|
|
@ -455,6 +463,15 @@ namespace Cosmos.VS.ProjectSystem.PropertyPages
|
||||||
cmboVisualStudioDebugPort.SelectedIndex = mVMwareAndBochsDebugPipe;
|
cmboVisualStudioDebugPort.SelectedIndex = mVMwareAndBochsDebugPipe;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else if (mProps.Profile == "HyperV")
|
||||||
|
{
|
||||||
|
mShowTabHyperV = true;
|
||||||
|
chckEnableDebugStub.Checked = true;
|
||||||
|
chkEnableStackCorruptionDetection.Checked = true;
|
||||||
|
cmboCosmosDebugPort.Enabled = false;
|
||||||
|
cmboVisualStudioDebugPort.Enabled = false;
|
||||||
|
cmboVisualStudioDebugPort.SelectedIndex = mHyperVDebugPipe;
|
||||||
|
}
|
||||||
else if (mProps.Profile == "PXE")
|
else if (mProps.Profile == "PXE")
|
||||||
{
|
{
|
||||||
chckEnableDebugStub.Checked = false;
|
chckEnableDebugStub.Checked = false;
|
||||||
|
|
@ -546,6 +563,7 @@ namespace Cosmos.VS.ProjectSystem.PropertyPages
|
||||||
mShowTabPXE = mProps.Deployment == DeploymentType.PXE;
|
mShowTabPXE = mProps.Deployment == DeploymentType.PXE;
|
||||||
//
|
//
|
||||||
mShowTabVMware = mProps.Launch == LaunchType.VMware;
|
mShowTabVMware = mProps.Launch == LaunchType.VMware;
|
||||||
|
mShowTabHyperV = mProps.Launch == LaunchType.HyperV;
|
||||||
mShowTabSlave = mProps.Launch == LaunchType.Slave;
|
mShowTabSlave = mProps.Launch == LaunchType.Slave;
|
||||||
mShowTabBochs = (LaunchType.Bochs == mProps.Launch);
|
mShowTabBochs = (LaunchType.Bochs == mProps.Launch);
|
||||||
//
|
//
|
||||||
|
|
@ -784,6 +802,7 @@ namespace Cosmos.VS.ProjectSystem.PropertyPages
|
||||||
cmboVisualStudioDebugPort.Items.Clear();
|
cmboVisualStudioDebugPort.Items.Clear();
|
||||||
FillComPorts(cmboVisualStudioDebugPort.Items);
|
FillComPorts(cmboVisualStudioDebugPort.Items);
|
||||||
mVMwareAndBochsDebugPipe = cmboVisualStudioDebugPort.Items.Add(@"Pipe: Cosmos\Serial");
|
mVMwareAndBochsDebugPipe = cmboVisualStudioDebugPort.Items.Add(@"Pipe: Cosmos\Serial");
|
||||||
|
mHyperVDebugPipe = cmboVisualStudioDebugPort.Items.Add(@"Pipe: CosmosSerial");
|
||||||
|
|
||||||
comboDebugMode.Items.AddRange(EnumValue.GetEnumValues(typeof(DebugMode), false));
|
comboDebugMode.Items.AddRange(EnumValue.GetEnumValues(typeof(DebugMode), false));
|
||||||
comboTraceMode.Items.AddRange(EnumValue.GetEnumValues(typeof(TraceAssemblies), false));
|
comboTraceMode.Items.AddRange(EnumValue.GetEnumValues(typeof(TraceAssemblies), false));
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ namespace Cosmos.System.Plugs.System.Collections.Generic
|
||||||
{
|
{
|
||||||
public static EqualityComparer<T> CreateComparer()
|
public static EqualityComparer<T> CreateComparer()
|
||||||
{
|
{
|
||||||
|
|
||||||
throw new Exception("Create comparer not yet implemented!");
|
throw new Exception("Create comparer not yet implemented!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue