mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-21 13:28:41 +00:00
commit
28f7083467
14 changed files with 403 additions and 120 deletions
36
Tests/Cosmos.Compiler.Tests.Exceptions/AssemblyInfo.cs
Normal file
36
Tests/Cosmos.Compiler.Tests.Exceptions/AssemblyInfo.cs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
using System;
|
||||
using System.Reflection;
|
||||
using System.Resources;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Package Name")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Company")]
|
||||
[assembly: AssemblyProduct("Package Name")]
|
||||
[assembly: AssemblyCopyright("")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: ComVisible(false)]
|
||||
[assembly: CLSCompliant(false)]
|
||||
[assembly: NeutralResourcesLanguage("en-US")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{9DF5C0A9-B91C-4647-B939-E47513743A0C}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Cosmos.Compiler.Tests.Exceptions</RootNamespace>
|
||||
<AssemblyName>Cosmos.Compiler.Tests.Exceptions</AssemblyName>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Cosmos.System, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5ae71220097cb983, processorArchitecture=MSIL" />
|
||||
<Reference Include="Cosmos.Debug.Kernel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5ae71220097cb983, processorArchitecture=MSIL" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Kernel.cs" />
|
||||
<Compile Include="AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Cosmos.TestRunner.TestController\Cosmos.TestRunner.TestController.csproj">
|
||||
<Project>{E6D3B644-C487-472D-A978-C1A82D0C099B}</Project>
|
||||
<Name>Cosmos.TestRunner.TestController</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{85e13410-c85a-4b0c-bee5-f9a120ecc94e}</ProjectGuid>
|
||||
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
|
||||
<Name>Cosmos.Compiler.Tests.ExceptionsBoot</Name>
|
||||
<BinFormat>elf</BinFormat>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<Profile>VMware</Profile>
|
||||
<!-- Looks like this was a mispelled attribute. Replaced by DebugEnabled below.
|
||||
<DebugEnable>true</DebugEnable>
|
||||
-->
|
||||
<DebugEnabled>true</DebugEnabled>
|
||||
<DebugMode>Source</DebugMode>
|
||||
<TraceMode>User</TraceMode>
|
||||
<EnableGDB>False</EnableGDB>
|
||||
<StartCosmosGDB>false</StartCosmosGDB>
|
||||
<VMWareEdition>Player</VMWareEdition>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<Name>Cosmos.Compiler.Tests.ExceptionsBoot</Name>
|
||||
<Description>Use VMware Player or Workstation to deploy and debug.</Description>
|
||||
<Deployment>ISO</Deployment>
|
||||
<Launch>VMware</Launch>
|
||||
<VisualStudioDebugPort>Pipe: Cosmos\Serial</VisualStudioDebugPort>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include=".\Cosmos.Compiler.Tests.Exceptions.">
|
||||
<Name>Cosmos.Compiler.Tests.Exceptions</Name>
|
||||
<Project>{9df5c0a9-b91c-4647-b939-e47513743a0c}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Cosmos.Core.Plugs, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5ae71220097cb983"/>
|
||||
<Reference Include="Cosmos.System.Plugs, 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>
|
||||
<Content Include="Cosmos.bxrc">
|
||||
<SubType>Content</SubType>
|
||||
</Content>
|
||||
</ItemGroup>-->
|
||||
<Import Project="$(MSBuildExtensionsPath)\Cosmos\Cosmos.targets" />
|
||||
</Project>
|
||||
112
Tests/Cosmos.Compiler.Tests.Exceptions/Kernel.cs
Normal file
112
Tests/Cosmos.Compiler.Tests.Exceptions/Kernel.cs
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Sys = Cosmos.System;
|
||||
|
||||
namespace Cosmos.Compiler.Tests.Exceptions
|
||||
{
|
||||
using Cosmos.TestRunner;
|
||||
|
||||
public class Kernel : Sys.Kernel
|
||||
{
|
||||
private global::Cosmos.Debug.Kernel.Debugger mDebugger = new global::Cosmos.Debug.Kernel.Debugger("User", "Test");
|
||||
|
||||
protected override void BeforeRun()
|
||||
{
|
||||
Console.WriteLine("Cosmos booted successfully, now start testing");
|
||||
}
|
||||
|
||||
protected override void Run()
|
||||
{
|
||||
mDebugger.Send("Run");
|
||||
|
||||
TestSimpleException();
|
||||
|
||||
mDebugger.Send("START: Test throw Exception() in method and catch in caller.");
|
||||
try
|
||||
{
|
||||
TestReturnSimpleException();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("Caught exception.");
|
||||
mDebugger.Send("EXCEPTION: " + ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
Console.WriteLine("Finally");
|
||||
mDebugger.Send("EXCEPTION: Finally");
|
||||
}
|
||||
mDebugger.Send("END:");
|
||||
|
||||
mDebugger.Send("START: Test throw nested Exception() in method and catch in caller.");
|
||||
try
|
||||
{
|
||||
TestThrowNestedException();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("Caught exception.");
|
||||
mDebugger.Send("EXCEPTION: " + ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
Console.WriteLine("Finally");
|
||||
mDebugger.Send("EXCEPTION: Finally");
|
||||
}
|
||||
mDebugger.Send("END:");
|
||||
|
||||
TestController.Completed();
|
||||
}
|
||||
|
||||
private void TestSimpleException()
|
||||
{
|
||||
mDebugger.Send("START: Test throw Exception() in method and catch in callee.");
|
||||
try
|
||||
{
|
||||
throw new Exception("throw new Exception()");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("Caught exception.");
|
||||
mDebugger.Send("EXCEPTION: " + ex.Message);
|
||||
}
|
||||
mDebugger.Send("END:");
|
||||
}
|
||||
|
||||
private void TestReturnSimpleException()
|
||||
{
|
||||
throw new Exception("throw new Exception()");
|
||||
}
|
||||
|
||||
private void TestThrowNestedException()
|
||||
{
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
TestArgumentNullException(null);
|
||||
}
|
||||
catch (ArgumentNullException ex)
|
||||
{
|
||||
Console.WriteLine("Caught nested exception.");
|
||||
mDebugger.Send("EXCEPTION: " + ex.Message);
|
||||
}
|
||||
TestReturnSimpleException();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("Caught exception.");
|
||||
mDebugger.Send("EXCEPTION: " + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private void TestArgumentNullException(string arg)
|
||||
{
|
||||
if (arg == null)
|
||||
{
|
||||
throw new ArgumentNullException(arg, "arg can not be null.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -9,40 +9,6 @@ using Sys = Cosmos.System;
|
|||
|
||||
namespace Cosmos.Kernel.Tests.Fat
|
||||
{
|
||||
public class TestClass
|
||||
{
|
||||
private Stream xStream;
|
||||
private static global::Cosmos.Debug.Kernel.Debugger mDebugger = new global::Cosmos.Debug.Kernel.Debugger("User", "Test");
|
||||
|
||||
public TestClass(string aTest)
|
||||
{
|
||||
// throw new Exception("Test can not be null.");
|
||||
//throw new Exception();
|
||||
|
||||
//mDebugger.Send("In TestClass::ctor(string)");
|
||||
Console.WriteLine("Before Initialize");
|
||||
xStream = Initialize(aTest);
|
||||
}
|
||||
|
||||
private Stream Initialize(string aTest)
|
||||
{
|
||||
//mDebugger.Send("In TestClass::Intialize(string)");
|
||||
if (aTest == null)
|
||||
{
|
||||
// mDebugger.Send("In TestClass::Intialize(string). aTest is null.");
|
||||
throw new ArgumentNullException("aTest", "Test can not be null.");
|
||||
}
|
||||
|
||||
//if (aTest.Length == 0)
|
||||
//{
|
||||
// mDebugger.Send("In TestClass::Intialize(string). aTest is empty.");
|
||||
// throw new ArgumentException("Test can not be empty.");
|
||||
//}
|
||||
|
||||
return Stream.Null;
|
||||
}
|
||||
}
|
||||
|
||||
public class Kernel : Sys.Kernel
|
||||
{
|
||||
private VFSBase myVFS;
|
||||
|
|
@ -50,8 +16,8 @@ namespace Cosmos.Kernel.Tests.Fat
|
|||
protected override void BeforeRun()
|
||||
{
|
||||
Console.WriteLine("Cosmos booted successfully, now start testing");
|
||||
//myVFS = new Sys.SentinelVFS();
|
||||
//VFSManager.RegisterVFS(myVFS);
|
||||
myVFS = new Sys.SentinelVFS();
|
||||
VFSManager.RegisterVFS(myVFS);
|
||||
}
|
||||
|
||||
private global::Cosmos.Debug.Kernel.Debugger mDebugger = new global::Cosmos.Debug.Kernel.Debugger("User", "Test");
|
||||
|
|
@ -62,82 +28,80 @@ namespace Cosmos.Kernel.Tests.Fat
|
|||
{
|
||||
mDebugger.Send("Run");
|
||||
|
||||
string xString = null;
|
||||
var x = new TestClass(xString);
|
||||
//var x = new TestClass();
|
||||
//string xContents;
|
||||
//Assert.IsTrue(Path.GetDirectoryName(@"0:\test") == @"0:\", @"Path.GetDirectoryName(@'0:\test') == @'0:\'");
|
||||
//Assert.IsTrue(Path.GetFileName(@"0:\test") == @"test", @"Path.GetFileName(@'0:\test') == @'test'");
|
||||
bool xTest;
|
||||
string xContents;
|
||||
Assert.IsTrue(Path.GetDirectoryName(@"0:\test") == @"0:\", @"Path.GetDirectoryName(@'0:\test') == @'0:\'");
|
||||
Assert.IsTrue(Path.GetFileName(@"0:\test") == @"test", @"Path.GetFileName(@'0:\test') == @'test'");
|
||||
|
||||
//mDebugger.Send("File exist check:");
|
||||
//xTest = File.Exists(@"0:\Kudzu.txt");
|
||||
//Assert.IsTrue(xTest, @"\Kudzu.txt not found!");
|
||||
mDebugger.Send("File exist check:");
|
||||
xTest = File.Exists(@"0:\Kudzu.txt");
|
||||
Assert.IsTrue(xTest, @"\Kudzu.txt not found!");
|
||||
|
||||
//mDebugger.Send("Directory exist check:");
|
||||
//xTest = Directory.Exists(@"0:\test");
|
||||
//Console.WriteLine("After test");
|
||||
//Assert.IsTrue(xTest, "Folder does not exist!");
|
||||
mDebugger.Send("Directory exist check:");
|
||||
xTest = Directory.Exists(@"0:\test");
|
||||
Console.WriteLine("After test");
|
||||
Assert.IsTrue(xTest, "Folder does not exist!");
|
||||
|
||||
//mDebugger.Send("File contents of Kudzu.txt: ");
|
||||
//xContents = File.ReadAllText(@"0:\Kudzu.txt");
|
||||
//mDebugger.Send("Contents retrieved");
|
||||
//mDebugger.Send(xContents);
|
||||
//Assert.IsTrue(xContents == "Hello Cosmos", "Contents of Kudzu.txt was read incorrectly!");
|
||||
mDebugger.Send("File contents of Kudzu.txt: ");
|
||||
xContents = File.ReadAllText(@"0:\Kudzu.txt");
|
||||
mDebugger.Send("Contents retrieved");
|
||||
mDebugger.Send(xContents);
|
||||
Assert.IsTrue(xContents == "Hello Cosmos", "Contents of Kudzu.txt was read incorrectly!");
|
||||
|
||||
// Test if null or empty string throws exception.
|
||||
//try
|
||||
//{
|
||||
// using (var xFS = new FileStream(null, FileMode.Open))
|
||||
// {
|
||||
// xFS.SetLength(5);
|
||||
// }
|
||||
//}
|
||||
//catch (Exception ex)
|
||||
//{
|
||||
// mDebugger.Send("Exception occurred:" + ex.Message);
|
||||
//}
|
||||
//Test if null or empty string throws exception.
|
||||
try
|
||||
{
|
||||
using (var xFS = new FileStream(null, FileMode.Open))
|
||||
{
|
||||
xFS.SetLength(5);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
mDebugger.Send("Exception occurred:" + ex.Message);
|
||||
}
|
||||
|
||||
//using (var xFS = new FileStream(@"0:\Kudzu.txt", FileMode.Open))
|
||||
//{
|
||||
// xFS.SetLength(5);
|
||||
//}
|
||||
//mDebugger.Send("File made smaller");
|
||||
//xContents = File.ReadAllText(@"0:\Kudzu.txt");
|
||||
//mDebugger.Send("Contents retrieved");
|
||||
//mDebugger.Send(xContents);
|
||||
//Assert.IsTrue(xContents == "Hello", "Contents of Kudzu.txt was read incorrectly!");
|
||||
using (var xFS = new FileStream(@"0:\Kudzu.txt", FileMode.Open))
|
||||
{
|
||||
xFS.SetLength(5);
|
||||
}
|
||||
mDebugger.Send("File made smaller");
|
||||
xContents = File.ReadAllText(@"0:\Kudzu.txt");
|
||||
mDebugger.Send("Contents retrieved");
|
||||
mDebugger.Send(xContents);
|
||||
Assert.IsTrue(xContents == "Hello", "Contents of Kudzu.txt was read incorrectly!");
|
||||
|
||||
using (var xFS = new FileStream(@"0:\Kudzu.txt", FileMode.Create))
|
||||
{
|
||||
xFS.SetLength(5);
|
||||
}
|
||||
mDebugger.Send("File made smaller");
|
||||
xContents = File.ReadAllText(@"0:\Kudzu.txt");
|
||||
mDebugger.Send("Contents retrieved");
|
||||
mDebugger.Send(xContents);
|
||||
Assert.IsTrue(xContents == "Hello", "Contents of Kudzu.txt was read incorrectly!");
|
||||
|
||||
//using (var xFS = new FileStream(@"0:\Kudzu.txt", FileMode.Create))
|
||||
//{
|
||||
// xFS.SetLength(5);
|
||||
// mDebugger.Send("Start writing");
|
||||
// var xStr = "Test FAT Write.";
|
||||
// var xBuff = xStr.GetUtf8Bytes(0, (uint) xStr.Length);
|
||||
// xFS.Write(xBuff, 0, xBuff.Length);
|
||||
// mDebugger.Send("---- Data written");
|
||||
// xFS.Position = 0;
|
||||
// xFS.Read(xBuff, 0, xBuff.Length);
|
||||
// mDebugger.Send(xBuff.GetUtf8String(0, (uint)xBuff.Length));
|
||||
//}
|
||||
//mDebugger.Send("File made smaller");
|
||||
|
||||
|
||||
//mDebugger.Send("Write to file now");
|
||||
//File.WriteAllText(@"0:\Kudzu.txt", "Test FAT write.");
|
||||
//mDebugger.Send("Text written");
|
||||
//xContents = File.ReadAllText(@"0:\Kudzu.txt");
|
||||
//mDebugger.Send("Contents retrieved");
|
||||
|
||||
//mDebugger.Send("Contents retrieved after writing");
|
||||
//mDebugger.Send(xContents);
|
||||
//Assert.IsTrue(xContents == "Hello", "Contents of Kudzu.txt was read incorrectly!");
|
||||
|
||||
////using (var xFS = new FileStream(@"0:\Kudzu.txt", FileMode.Create))
|
||||
////{
|
||||
//// mDebugger.Send("Start writing");
|
||||
//// var xStr = "Test FAT Write.";
|
||||
//// var xBuff = xStr.GetUtf8Bytes(0, (uint) xStr.Length);
|
||||
//// xFS.Write(xBuff, 0, xBuff.Length);
|
||||
//// mDebugger.Send("---- Data written");
|
||||
//// xFS.Position = 0;
|
||||
//// xFS.Read(xBuff, 0, xBuff.Length);
|
||||
//// mDebugger.Send(xBuff.GetUtf8String(0, (uint)xBuff.Length));
|
||||
////}
|
||||
|
||||
|
||||
////mDebugger.Send("Write to file now");
|
||||
////File.WriteAllText(@"0:\Kudzu.txt", "Test FAT write.");
|
||||
////mDebugger.Send("Text written");
|
||||
////xContents = File.ReadAllText(@"0:\Kudzu.txt");
|
||||
|
||||
////mDebugger.Send("Contents retrieved after writing");
|
||||
////mDebugger.Send(xContents);
|
||||
////Assert.IsTrue(xContents == "Test FAT write.", "Contents of Kudzu.txt was written incorrectly!");
|
||||
//Assert.IsTrue(xContents == "Test FAT write.", "Contents of Kudzu.txt was written incorrectly!");
|
||||
|
||||
TestController.Completed();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -130,10 +130,10 @@ namespace Cosmos.IL2CPU.X86.IL {
|
|||
{
|
||||
var xStackOffsetBefore = aCurrent.StackOffsetBeforeExecution;
|
||||
|
||||
uint xParmSize = 0;
|
||||
foreach (var parameter in aTargetMethod.GetParameters())
|
||||
uint xPopSize = 0;
|
||||
foreach (var type in aCurrent.StackPopTypes)
|
||||
{
|
||||
xParmSize += Align(SizeOfType(parameter.ParameterType), 4);
|
||||
xPopSize += Align(SizeOfType(type), 4);
|
||||
}
|
||||
|
||||
var xResultSize = xReturnSize;
|
||||
|
|
@ -142,7 +142,7 @@ namespace Cosmos.IL2CPU.X86.IL {
|
|||
xResultSize += 4 - (xResultSize % 4);
|
||||
}
|
||||
|
||||
if (xStackOffsetBefore > (xParmSize + xResultSize))
|
||||
if (xStackOffsetBefore > (xPopSize + xResultSize))
|
||||
{
|
||||
if (xResultSize > 0)
|
||||
{
|
||||
|
|
@ -154,9 +154,9 @@ namespace Cosmos.IL2CPU.X86.IL {
|
|||
}
|
||||
}
|
||||
|
||||
if (xParmSize > 0)
|
||||
if (xPopSize > 0)
|
||||
{
|
||||
var xExtraStack = aCurrent.StackOffsetBeforeExecution - xParmSize - xResultSize;
|
||||
var xExtraStack = xStackOffsetBefore - xPopSize - xResultSize;
|
||||
new Comment("Cleanup extra stack");
|
||||
// cleanup result values
|
||||
for (int i = 0; i < xExtraStack / 4; i++)
|
||||
|
|
|
|||
|
|
@ -173,14 +173,42 @@ namespace Cosmos.IL2CPU.X86.IL
|
|||
ILOp.EmitExceptionLogic(Assembler, aMethod, aOp, true,
|
||||
delegate()
|
||||
{
|
||||
var xStackOffsetBefore = aOp.StackOffsetBeforeExecution;
|
||||
|
||||
uint xPopSize = 0;
|
||||
foreach (var type in aOp.StackPopTypes)
|
||||
{
|
||||
xPopSize += Align(SizeOfType(type), 4);
|
||||
}
|
||||
|
||||
var xResultSize = xReturnSize;
|
||||
if (xResultSize % 4 != 0)
|
||||
{
|
||||
xResultSize += 4 - (xResultSize % 4);
|
||||
}
|
||||
for (int i = 0; i < xResultSize / 4; i++)
|
||||
|
||||
if (xStackOffsetBefore > (xPopSize + xResultSize))
|
||||
{
|
||||
new CPUx86.Add {DestinationReg = CPUx86.Registers.ESP, SourceValue = 4};
|
||||
if (xResultSize > 0)
|
||||
{
|
||||
new Comment("Cleanup return");
|
||||
// cleanup result values
|
||||
for (int i = 0; i < xResultSize / 4; i++)
|
||||
{
|
||||
new CPUx86.Add { DestinationReg = CPUx86.Registers.ESP, SourceValue = 4 };
|
||||
}
|
||||
}
|
||||
|
||||
if (xPopSize > 0)
|
||||
{
|
||||
var xExtraStack = xStackOffsetBefore - xPopSize - xResultSize;
|
||||
new Comment("Cleanup extra stack");
|
||||
// cleanup result values
|
||||
for (int i = 0; i < xExtraStack / 4; i++)
|
||||
{
|
||||
new CPUx86.Add { DestinationReg = CPUx86.Registers.ESP, SourceValue = 4 };
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
new Label(xCurrentMethodLabel + ".NoExceptionAfterCall");
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ using Directory = Cosmos.System.FileSystem.Listing.Directory;
|
|||
|
||||
namespace SentinelKernel.System.Plugs.System.IO
|
||||
{
|
||||
[Plug(Target=typeof(DirectoryInfo))]
|
||||
[Plug(Target = typeof(DirectoryInfo))]
|
||||
[PlugField(FieldId = "$$Storage$$", FieldType = typeof(Directory))]
|
||||
[PlugField(FieldId = "$$FullPath$$", FieldType = typeof(string))]
|
||||
public static class DirectoryInfoImpl
|
||||
|
|
@ -77,7 +77,7 @@ namespace SentinelKernel.System.Plugs.System.IO
|
|||
//}
|
||||
|
||||
//return files;
|
||||
*/
|
||||
*/
|
||||
}
|
||||
|
||||
public static string ToString([FieldAccess(Name = "$$Path$$")] ref string aPath)
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ namespace SentinelKernel.System.Plugs.System.IO
|
|||
[PlugMethod(Signature = "System_Void__System_IO_DriveInfo__ctor_System_String_")]
|
||||
public static void Ctor(DriveInfo aThis, string aDriveName)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static string get_DriveFormat(ref DriveInfo aThis)
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ namespace SentinelKernel.System.Plugs.System.IO
|
|||
{
|
||||
using (var xFS = new FileStream(aFile, FileMode.Create))
|
||||
{
|
||||
var xBuff = aText.GetUtf8Bytes(0, (uint) aText.Length);
|
||||
var xBuff = aText.GetUtf8Bytes(0, (uint)aText.Length);
|
||||
xFS.Write(xBuff, 0, xBuff.Length);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ namespace SentinelKernel.System.Plugs.System.IO
|
|||
{
|
||||
using Cosmos.System.FileSystem;
|
||||
|
||||
[Plug(Target = typeof (IO::FileStream))]
|
||||
[PlugField(FieldId = "$$InnerStream$$", FieldType = typeof (IO::Stream))]
|
||||
[Plug(Target = typeof(IO::FileStream))]
|
||||
[PlugField(FieldId = "$$InnerStream$$", FieldType = typeof(IO::Stream))]
|
||||
public class FileStreamImpl
|
||||
{
|
||||
// This plug basically forwards all calls to the $$InnerStream$$ stream, which is supplied by the file system.
|
||||
|
|
|
|||
|
|
@ -9,8 +9,9 @@ using Cosmos.System.FileSystem.VFS;
|
|||
|
||||
namespace SentinelKernel.System.Plugs.System.IO
|
||||
{
|
||||
[Plug(Target=typeof(Path))]
|
||||
public static class PathImpl {
|
||||
[Plug(Target = typeof(Path))]
|
||||
public static class PathImpl
|
||||
{
|
||||
public static void Cctor(
|
||||
[FieldAccess(Name = "System.Char System.IO.Path.AltDirectorySeparatorChar")] ref char aAltDirectorySeparatorChar,
|
||||
[FieldAccess(Name = "System.Char System.IO.Path.DirectorySeparatorChar")] ref char aDirectorySeparatorChar,
|
||||
|
|
|
|||
|
|
@ -6,14 +6,12 @@ using Cosmos.IL2CPU.Plugs;
|
|||
|
||||
namespace Cosmos.System.Plugs.System.IO
|
||||
{
|
||||
/*
|
||||
[Plug(Target = typeof(global::System.IO.StreamReader))]
|
||||
public static class StreamReaderImpl
|
||||
{
|
||||
public static void CheckAsyncTaskInProgress(global::System.IO.StreamReader aThis)
|
||||
{
|
||||
// for now do nothing
|
||||
// for now do nothing
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
|
|
|||
|
|
@ -253,6 +253,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cosmos.Kernel.Tests.Fat", "
|
|||
EndProject
|
||||
Project("{471EC4BB-E47E-4229-A789-D1F5F83B52D4}") = "Cosmos.Kernel.Tests.FatBoot", "..\Tests\Cosmos.Kernel.Tests.Fat\Cosmos.Kernel.Tests.FatBoot.Cosmos", "{C006CC79-7FFD-45F1-AD8C-57AC879CC29F}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cosmos.Compiler.Tests.Exceptions", "..\Tests\Cosmos.Compiler.Tests.Exceptions\Cosmos.Compiler.Tests.Exceptions.csproj", "{9DF5C0A9-B91C-4647-B939-E47513743A0C}"
|
||||
EndProject
|
||||
Project("{471EC4BB-E47E-4229-A789-D1F5F83B52D4}") = "Cosmos.Compiler.Tests.ExceptionsBoot", "..\Tests\Cosmos.Compiler.Tests.Exceptions\Cosmos.Compiler.Tests.ExceptionsBoot.Cosmos", "{85E13410-C85A-4B0C-BEE5-F9A120ECC94E}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
|
@ -1338,6 +1342,38 @@ Global
|
|||
{C006CC79-7FFD-45F1-AD8C-57AC879CC29F}.Release|Mixed Platforms.Build.0 = Debug|x86
|
||||
{C006CC79-7FFD-45F1-AD8C-57AC879CC29F}.Release|x86.ActiveCfg = Debug|x86
|
||||
{C006CC79-7FFD-45F1-AD8C-57AC879CC29F}.Release|x86.Build.0 = Debug|x86
|
||||
{9DF5C0A9-B91C-4647-B939-E47513743A0C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9DF5C0A9-B91C-4647-B939-E47513743A0C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9DF5C0A9-B91C-4647-B939-E47513743A0C}.Debug|Itanium.ActiveCfg = Debug|Any CPU
|
||||
{9DF5C0A9-B91C-4647-B939-E47513743A0C}.Debug|Itanium.Build.0 = Debug|Any CPU
|
||||
{9DF5C0A9-B91C-4647-B939-E47513743A0C}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{9DF5C0A9-B91C-4647-B939-E47513743A0C}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{9DF5C0A9-B91C-4647-B939-E47513743A0C}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{9DF5C0A9-B91C-4647-B939-E47513743A0C}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{9DF5C0A9-B91C-4647-B939-E47513743A0C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9DF5C0A9-B91C-4647-B939-E47513743A0C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{9DF5C0A9-B91C-4647-B939-E47513743A0C}.Release|Itanium.ActiveCfg = Release|Any CPU
|
||||
{9DF5C0A9-B91C-4647-B939-E47513743A0C}.Release|Itanium.Build.0 = Release|Any CPU
|
||||
{9DF5C0A9-B91C-4647-B939-E47513743A0C}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{9DF5C0A9-B91C-4647-B939-E47513743A0C}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{9DF5C0A9-B91C-4647-B939-E47513743A0C}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{9DF5C0A9-B91C-4647-B939-E47513743A0C}.Release|x86.Build.0 = Release|Any CPU
|
||||
{85E13410-C85A-4B0C-BEE5-F9A120ECC94E}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||
{85E13410-C85A-4B0C-BEE5-F9A120ECC94E}.Debug|Any CPU.Build.0 = Debug|x86
|
||||
{85E13410-C85A-4B0C-BEE5-F9A120ECC94E}.Debug|Itanium.ActiveCfg = Debug|x86
|
||||
{85E13410-C85A-4B0C-BEE5-F9A120ECC94E}.Debug|Itanium.Build.0 = Debug|x86
|
||||
{85E13410-C85A-4B0C-BEE5-F9A120ECC94E}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
|
||||
{85E13410-C85A-4B0C-BEE5-F9A120ECC94E}.Debug|Mixed Platforms.Build.0 = Debug|x86
|
||||
{85E13410-C85A-4B0C-BEE5-F9A120ECC94E}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{85E13410-C85A-4B0C-BEE5-F9A120ECC94E}.Debug|x86.Build.0 = Debug|x86
|
||||
{85E13410-C85A-4B0C-BEE5-F9A120ECC94E}.Release|Any CPU.ActiveCfg = Debug|x86
|
||||
{85E13410-C85A-4B0C-BEE5-F9A120ECC94E}.Release|Any CPU.Build.0 = Debug|x86
|
||||
{85E13410-C85A-4B0C-BEE5-F9A120ECC94E}.Release|Itanium.ActiveCfg = Debug|x86
|
||||
{85E13410-C85A-4B0C-BEE5-F9A120ECC94E}.Release|Itanium.Build.0 = Debug|x86
|
||||
{85E13410-C85A-4B0C-BEE5-F9A120ECC94E}.Release|Mixed Platforms.ActiveCfg = Debug|x86
|
||||
{85E13410-C85A-4B0C-BEE5-F9A120ECC94E}.Release|Mixed Platforms.Build.0 = Debug|x86
|
||||
{85E13410-C85A-4B0C-BEE5-F9A120ECC94E}.Release|x86.ActiveCfg = Debug|x86
|
||||
{85E13410-C85A-4B0C-BEE5-F9A120ECC94E}.Release|x86.Build.0 = Debug|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
@ -1439,5 +1475,7 @@ Global
|
|||
{DC374FBC-4005-472F-BBF4-CEA608B86FB2} = {A06B122A-4AB7-4090-B41A-35028A293450}
|
||||
{A0893493-D4F0-4B9F-9826-86319E143D86} = {DC374FBC-4005-472F-BBF4-CEA608B86FB2}
|
||||
{C006CC79-7FFD-45F1-AD8C-57AC879CC29F} = {DC374FBC-4005-472F-BBF4-CEA608B86FB2}
|
||||
{9DF5C0A9-B91C-4647-B939-E47513743A0C} = {F104F6BC-EF8E-4408-A786-D570D7565231}
|
||||
{85E13410-C85A-4B0C-BEE5-F9A120ECC94E} = {F104F6BC-EF8E-4408-A786-D570D7565231}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
|
|||
Loading…
Reference in a new issue