You've already forked linux-packaging-mono
Imported Upstream version 5.20.0.180
Former-commit-id: ff953ca879339fe1e1211f7220f563e1342e66cb
This commit is contained in:
parent
0e2d47d1c8
commit
0510252385
@@ -30,11 +30,19 @@
|
||||
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace System.Runtime.InteropServices
|
||||
{
|
||||
public static class RuntimeInformation
|
||||
{
|
||||
/* gets the runtime's arch from the value it uses for DllMap */
|
||||
static extern string RuntimeArchitecture
|
||||
{
|
||||
[MethodImpl (MethodImplOptions.InternalCall)]
|
||||
get;
|
||||
}
|
||||
|
||||
public static string FrameworkDescription {
|
||||
get {
|
||||
return "Mono " + Mono.Runtime.GetDisplayName ();
|
||||
@@ -75,8 +83,17 @@ namespace System.Runtime.InteropServices
|
||||
{
|
||||
get
|
||||
{
|
||||
// TODO: very barebones implementation, doesn't respect ARM
|
||||
return Environment.Is64BitOperatingSystem ? Architecture.X64 : Architecture.X86;
|
||||
switch (RuntimeArchitecture) {
|
||||
case "arm":
|
||||
case "armv8":
|
||||
return Environment.Is64BitOperatingSystem ? Architecture.Arm64 : Architecture.Arm;
|
||||
case "x86":
|
||||
case "x86-64":
|
||||
// upstream only has these values; try to pretend we're x86 if nothing matches
|
||||
// want more? bug: https://github.com/dotnet/corefx/issues/30706
|
||||
default:
|
||||
return Environment.Is64BitOperatingSystem ? Architecture.X64 : Architecture.X86;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,8 +101,22 @@ namespace System.Runtime.InteropServices
|
||||
{
|
||||
get
|
||||
{
|
||||
// TODO: very barebones implementation, doesn't respect ARM
|
||||
return Environment.Is64BitProcess ? Architecture.X64 : Architecture.X86;
|
||||
// we can use the runtime's compiled config options for DllMaps here
|
||||
// process architecure for us is runtime architecture (OS is much harder)
|
||||
// see for values: mono-config.c
|
||||
switch (RuntimeArchitecture) {
|
||||
case "x86":
|
||||
return Architecture.X86;
|
||||
case "x86-64":
|
||||
return Architecture.X64;
|
||||
case "arm":
|
||||
return Architecture.Arm;
|
||||
case "armv8":
|
||||
return Architecture.Arm64;
|
||||
// see comment in OSArchiteture default case
|
||||
default:
|
||||
return Environment.Is64BitProcess ? Architecture.X64 : Architecture.X86;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user