All plug changes to get il2cpu to build .net5.0 bcl test

This commit is contained in:
Quajak 2020-11-23 14:24:45 +01:00
parent 5397e1a0ca
commit 7c8e1c07d5
23 changed files with 353 additions and 30 deletions

View file

@ -14,8 +14,8 @@ namespace Cosmos.TestRunner.Full
{
get
{
//yield return RunTargetEnum.Bochs;
yield return RunTargetEnum.VMware;
yield return RunTargetEnum.Bochs;
//yield return RunTargetEnum.VMware;
//yield return RunTargetEnum.HyperV;
//yield return RunTargetEnum.Qemu;
}
@ -24,7 +24,7 @@ namespace Cosmos.TestRunner.Full
public virtual bool RunWithGDB => false;
public virtual bool StartBochsDebugGUI => false;
public virtual bool DebugIL2CPU => false;
public virtual bool DebugIL2CPU => true;
public virtual string KernelPkg => String.Empty;
public virtual TraceAssemblies TraceAssembliesLevel => TraceAssemblies.User;
public virtual bool EnableStackCorruptionChecks => true;

View file

@ -2,6 +2,8 @@
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<Platform>cosmos</Platform>
<SupportsX86Intrinsics>false</SupportsX86Intrinsics>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<NoWarn>CA2242;$(NoWarn)</NoWarn>
</PropertyGroup>

View file

@ -14,4 +14,8 @@
<ProjectReference Include="$(XSharpRepoRoot)source\XSharp\XSharp\XSharp.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="System\Runtime\InteropServices\NewFolder\" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,46 @@
using System;
using IL2CPU.API.Attribs;
using System.Globalization;
namespace Cosmos.Core_Plugs.Interop
{
[Plug("Interop+Globalization, System.Private.CoreLib")]
class GlobalizationImpl
{
[PlugMethod(Signature = "System_Int32__Interop_Globalization_LoadICU__")]
public static int LoadICU()
{
throw new NotImplementedException();
}
[PlugMethod(Signature = "System_Void__Interop_Globalization_ChangeCase_System_Char___System_Int32__System_Char___System_Int32__System_Boolean_")]
public static unsafe void ChangeCase(char* aChar, int aInt, char* aChar2, int aInt2, bool Bool)
{
throw new NotImplementedException();
}
[PlugMethod(Signature = "System_Void__Interop_Globalization_ChangeCaseTurkish_System_Char___System_Int32__System_Char___System_Int32__System_Boolean_")]
public static unsafe void ChangeCaseTurkish(char* aChar, int aInt, char* aChar2, int aInt2, bool Bool)
{
throw new NotImplementedException();
}
[PlugMethod(Signature = "System_Void__Interop_Globalization_ChangeCaseInvariant_System_Char___System_Int32__System_Char___System_Int32__System_Boolean_")]
public static unsafe void ChangeCaseInvariant(char* aChar, int aInt, char* aChar2, int aInt2, bool Bool)
{
throw new NotImplementedException();
}
[PlugMethod(Signature = "System_Void__Interop_Globalization_InitOrdinalCasingPage_System_Int32__System_Char__")]
public static void InitOrdinalCasingPage()
{
throw new NotImplementedException();
}
public static void InitICUFunctions(IntPtr aPtr1, IntPtr aPtr2, string aString1, string aString2)
{
throw new NotImplementedException();
}
public static unsafe int CompareString(IntPtr aIntPtr, char* aChar, int aInt, char* aChar1, int aInt2, CompareOptions aCompareOptions)
{
throw new NotImplementedException();
}
}
}

View file

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using IL2CPU.API.Attribs;
namespace Cosmos.Core_Plugs.Interop
{
[Plug("Interop, System.Private.CoreLib")]
class InteropImpl
{
public static unsafe void GetRandomBytes(byte* aBuffer, int aLength)
{
throw new NotImplementedException();
}
}
}

View file

@ -0,0 +1,51 @@
using IL2CPU.API.Attribs;
using System;
namespace Cosmos.Core_Plugs.Interop
{
[Plug("Interop+Kernel32, System.Private.CoreLib")]
class Kernel32Impl
{
[PlugMethod(Signature = "System_Int32__Interop_Kernel32_LCMapStringEx_System_String__System_UInt32__System_Char___System_Int32__System_Void___System_Int32__System_Void___System_Void___System_IntPtr_")]
public static unsafe int LCMapStringEx(string aString, uint aUint, char* aChar, int aInt, object aObject, int aInt2, object aObject2,
object aObject3, IntPtr aIntPtr)
{
throw new NotImplementedException();
}
[PlugMethod(Signature = "System_Int32__Interop_Kernel32_CompareStringOrdinal_System_Char___System_Int32__System_Char___System_Int32__System_Boolean_")]
public static unsafe int CompareStringOrdinal(char* aStrA, int aLengthA, char* aStrB, int aLengthB, bool aIgnoreCase)
{
if (aIgnoreCase)
{
throw new NotImplementedException();
}
if (aLengthA < aLengthB)
{
return -1;
}
else if (aLengthA > aLengthB)
{
return 1;
}
for (int i = 0; i < aLengthA; i++)
{
if (aStrA[i] < aStrB[i])
{
return -1;
}
else if (aStrA[i] < aStrB[i])
{
return 1;
}
}
return 0;
}
[PlugMethod(Signature = "System_Int32__Interop_Kernel32_CompareStringEx_System_Char___System_UInt32__System_Char___System_Int32__System_Char___System_Int32__System_Void___System_Void___System_IntPtr_")]
public static unsafe int CompareStringEx(char* aChar, uint aUint, char* aChar1, int aInt, char* aChar2, int aInt2, object aObject,
object aObject1, IntPtr aIntPtr)
{
throw new NotImplementedException();
}
}
}

View file

@ -0,0 +1,13 @@
using IL2CPU.API.Attribs;
namespace Cosmos.Core_Plugs.Runtime.Intrinsics.X86
{
[Plug("System.Runtime.Intrinsics.X86.Sse2+X64", "System.Private.CoreLib")]
class X86Impl
{
public static bool get_IsSupported()
{
return false;
}
}
}

View file

@ -15,7 +15,7 @@ namespace Cosmos.Core_Plugs.System
/// <param name="dest">Destination address to copy data into.</param>
/// <param name="src">Source address from where copy data.</param>
/// <param name="count">Count of bytes to copy.</param>
[PlugMethod(IsOptional = true)]
[PlugMethod(IsOptional = true, Signature = "System_Void__System_Buffer___Memmove_System_Byte___System_Byte___System_UIntPtr_")]
public static unsafe void __Memmove(byte* dest, byte* src, uint count)
{
uint t;
@ -153,5 +153,20 @@ namespace Cosmos.Core_Plugs.System
{
Buffer.BlockCopy(src, srcOffset, dst, dstOffset, count);
}
[PlugMethod(Signature = "System_Void__System_Buffer___BulkMoveWithWriteBarrier__System_Byte___System_Byte__System_UIntPtr_")]
public static unsafe void __BulkMoveWithWriteBarrier(ref byte destination, ref byte source, uint byteCount)
{
fixed (byte* srcPtr = &source)
fixed (byte* dstPtr = &destination)
{
for (int i = 0; i < byteCount; i++)
{
dstPtr[i] = srcPtr[i];
}
}
// Unsafe.CopyBlock(ref destination, ref source, byteCount);
}
}
}

View file

@ -18,6 +18,11 @@ namespace Cosmos.Core_Plugs.System
public static int get_ProcessorCount() => 1;
public static string GetEnvironmentVariable(string variable) => null;
public static void FailFast(string aString)
{
throw new NotImplementedException();
}
}
// System.Runtime.Extensions, public

View file

@ -9,5 +9,11 @@ namespace Cosmos.Core_Plugs.System
public static void _SuppressFinalize(object o) {
// not implemented yet
}
[PlugMethod(Signature = "System_Array__System_GC_AllocateNewArray_System_IntPtr__System_Int32__System_GC_GC_ALLOC_FLAGS_")]
public static unsafe Array AllocateNewArray(int* aTypeHandle, int aLength, uint aGCFlags)
{
throw new NotImplementedException();
}
}
}

View file

@ -0,0 +1,31 @@
using IL2CPU.API.Attribs;
namespace Cosmos.Core_Plugs.System.Globalization
{
class OrdinalImpl
{
[PlugMethod(IsOptional =false, PlugRequired =true)]
public static unsafe int CompareStringIgnoreCaseNonAscii(char* aStrA, int aLengthA, char* aStrB, int aLengthB)
{
if(aLengthA < aLengthB)
{
return -1;
} else if(aLengthA > aLengthB)
{
return 1;
}
for (int i = 0; i < aLengthA; i++)
{
if(aStrA[i] < aStrB[i])
{
return -1;
}
else if(aStrA[i] < aStrB[i])
{
return 1;
}
}
return 0;
}
}
}

View file

@ -0,0 +1,16 @@
using System;
using IL2CPU.API.Attribs;
namespace Cosmos.Core_Plugs.System.Reflection
{
[Plug("System.Reflection.MetadataImport, System.Private.CoreLib")]
class MetadataImportImpl
{
[PlugMethod(Signature= "System_Void__System_Reflection_MetadataImport__GetGenericParamProps_System_IntPtr__System_Int32___System_Int32_")]
public static unsafe void __GetGenericParamProps(IntPtr aPtr1, int aInt, int* aPtr2)
{
}
}
}

View file

@ -0,0 +1,15 @@
using System;
using IL2CPU.API.Attribs;
namespace Cosmos.Core_Plugs.System.Reflection
{
[Plug("System.Reflection.RuntimeAssembly, System.Private.CoreLib")]
class RuntimeAssemblyImpl
{
[PlugMethod(Signature = "System_Void__System_Reflection_RuntimeAssembly_GetFullName_System_Runtime_CompilerServices_QCallAssembly__System_Runtime_CompilerServices_StringHandleOnStack_")]
public static void GetFullName(object aQCallAssembly, object aStringHandleOnStack)
{
throw new NotImplementedException();
}
}
}

View file

@ -0,0 +1,15 @@
using IL2CPU.API.Attribs;
using System;
namespace Cosmos.Core_Plugs.System.Runtime.InteropServices
{
[Plug("System.Runtime.InteropServices.NativeLibrary, System.Private.CoreLib")]
class NativeLibraryImpl
{
[PlugMethod(Signature = "System_IntPtr__System_Runtime_InteropServices_NativeLibrary_LoadByName_System_String__System_Runtime_CompilerServices_QCallAssembly__System_Boolean__System_UInt32__System_Boolean_")]
public static IntPtr LoadByName(string aString, object aQCallAssembly, bool aBool, uint aUint, bool aBool2)
{
throw new NotImplementedException();
}
}
}

View file

@ -1,24 +0,0 @@
using IL2CPU.API.Attribs;
namespace Cosmos.Core_Plugs.System.Runtime
{
// Not needed in .net5.0
//[Plug("System.Runtime.RuntimeImports, System.Private.CoreLib")]
//public static class RuntimeImportsImpl
//{
// public static unsafe void RhBulkMoveWithWriteBarrier(
// ref byte destination, ref byte source, uint byteCount)
// {
// fixed (byte* srcPtr = &source)
// fixed (byte* dstPtr = &destination)
// {
// for (int i = 0; i < byteCount; i++)
// {
// dstPtr[i] = srcPtr[i];
// }
// }
// // Unsafe.CopyBlock(ref destination, ref source, byteCount);
// }
//}
}

View file

@ -9,7 +9,82 @@ namespace Cosmos.Core_Plugs.System
public static unsafe void Ctor(RuntimeTypeHandle aThis, void* aValue)
{
}
[PlugMethod(Signature = "System_Boolean__System_RuntimeTypeHandle_HasInstantiation_System_RuntimeType_")]
public static bool HasInstantiation(object aRuntimeType)
{
throw new NotImplementedException();
}
[PlugMethod(Signature = "System_Boolean__System_RuntimeTypeHandle_ContainsGenericVariables_System_RuntimeType_")]
public static bool ContainsGenericVariables(object aRuntimeType)
{
throw new NotImplementedException();
}
[PlugMethod(Signature = "System_Boolean__System_RuntimeTypeHandle_IsGenericVariable_System_RuntimeType_")]
public static bool IsGenericVariable(object aRuntimeType)
{
throw new NotImplementedException();
}
[PlugMethod(Signature = "System_Boolean__System_RuntimeTypeHandle_IsGenericTypeDefinition_System_RuntimeType_")]
public static bool IsGenericTypeDefinition(object aRuntimeType)
{
throw new NotImplementedException();
}
[PlugMethod(Signature = "System_RuntimeType__System_RuntimeTypeHandle_GetElementType_System_RuntimeType_")]
public static object GetElementType(object aRuntimeType)
{
throw new NotImplementedException();
}
[PlugMethod(Signature = "System_Int32__System_RuntimeTypeHandle_GetToken_System_RuntimeType_")]
public static int GetToken(object aRuntimeType)
{
throw new NotImplementedException();
}
[PlugMethod(Signature = "System_RuntimeType__System_RuntimeTypeHandle_GetBaseType_System_RuntimeType_")]
public static object GetBaseType(object aRuntimeType)
{
throw new NotImplementedException();
}
[PlugMethod(Signature = "System_Boolean__System_RuntimeTypeHandle_IsInterface_System_RuntimeType_")]
public static bool IsInterface(object aRuntimeType)
{
throw new NotImplementedException();
}
[PlugMethod(Signature = "System_Reflection_TypeAttributes__System_RuntimeTypeHandle_GetAttributes_System_RuntimeType_")]
public static object GetAttributes(object aRuntimeType)
{
throw new NotImplementedException();
}
[PlugMethod(Signature = "System_IntPtr__System_RuntimeTypeHandle__GetMetadataImport_System_RuntimeType_")]
public static IntPtr _GetMetadataImport(object aRuntimeType)
{
throw new NotImplementedException();
}
[PlugMethod(Signature = "System_Reflection_CorElementType__System_RuntimeTypeHandle_GetCorElementType_System_RuntimeType_")]
public static object GetCorElementType(object aRuntimeType)
{
throw new NotImplementedException();
}
[PlugMethod(Signature = "System_Reflection_RuntimeAssembly__System_RuntimeTypeHandle_GetAssembly_System_RuntimeType_")]
public static object GetAssembly(object aRuntimeType)
{
throw new NotImplementedException();
}
[PlugMethod(Signature = "System_Void__System_RuntimeTypeHandle_GetConstraints_System_Runtime_CompilerServices_QCallTypeHandle__System_Runtime_CompilerServices_ObjectHandleOnStack_")]
public static void GetConstraints(object aQCallTypeHandle, object aObjectHandleOnStack)
{
throw new NotImplementedException();
}
[PlugMethod(Signature = "System_Void__System_RuntimeTypeHandle_ConstructName_System_Runtime_CompilerServices_QCallTypeHandle__System_TypeNameFormatFlags__System_Runtime_CompilerServices_StringHandleOnStack_")]
public static void GetConstraints(object aQCallTypeHandle, object aTypeNameFormatFlags, object aObjectHandleOnStack)
{
throw new NotImplementedException();
}
[PlugMethod(Signature = "System_Void__System_RuntimeTypeHandle_GetInstantiation_System_Runtime_CompilerServices_QCallTypeHandle__System_Runtime_CompilerServices_ObjectHandleOnStack__Interop_BOOL_")]
public static void GetInstantiation(object aQCallTypeHandle, object aObjectHandleOnStack, object aInteropBool)
{
throw new NotImplementedException();
}
public static void Cctor()
{
//

View file

@ -5,10 +5,10 @@ using IL2CPU.API.Attribs;
namespace Cosmos.Core_Plugs.System
{
[Plug("System.RuntimeType, System.Private.CoreLib")]
public static class RuntimeType
public static class RuntimeTypeImpl
{
[PlugMethod(Signature = "System_RuntimeType_RuntimeTypeCache__System_RuntimeType_get_Cache__")]
public static IntPtr Cache_Get(IntPtr aThis)
public static IntPtr get_Cache(object aThis)
{
throw new NotSupportedException("Reflection not supported");
}

View file

@ -35,5 +35,11 @@ namespace Cosmos.Core_Plugs.System
return aLeft.mTypeId != aRight.mTypeId;
}
[PlugMethod(Signature ="System_Type__System_Type_get_BaseType", IsOptional = false)]
public static Type get_BaseType(Type aThis)
{
return typeof(object);
}
}
}

View file

@ -60,5 +60,10 @@ namespace Cosmos.System_Plugs.System
{
return aThis.ToShortDateString() + " " + aThis.ToLongTimeString();
}
public static bool SystemSupportsLeapSeconds()
{
return false;
}
}
}

View file

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using IL2CPU.API.Attribs;
namespace Cosmos.System_Plugs.System
{
[Plug(typeof(HashCode))]
class HashCodeImpl
{
public static uint GenerateGlobalSeed()
{
return 0;
}
}
}

View file

@ -3,6 +3,8 @@
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<RuntimeIdentifier>cosmos</RuntimeIdentifier>
<Platform>cosmos</Platform>
<SupportsX86Intrinsics>false</SupportsX86Intrinsics>
<SelfContained>True</SelfContained>
</PropertyGroup>

View file

@ -3,6 +3,8 @@
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<RuntimeIdentifier>cosmos</RuntimeIdentifier>
<Platform>cosmos</Platform>
<SupportsX86Intrinsics>false</SupportsX86Intrinsics>
<SelfContained>True</SelfContained>
</PropertyGroup>

View file

@ -3,6 +3,8 @@
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<RuntimeIdentifier>cosmos</RuntimeIdentifier>
<Platform>cosmos</Platform>
<SupportsX86Intrinsics>false</SupportsX86Intrinsics>
<SelfContained>True</SelfContained>
</PropertyGroup>