From d834b655ff0f03905927a9ce44f1a62af134c95b Mon Sep 17 00:00:00 2001 From: Benedikt Reinartz Date: Thu, 20 Jun 2019 17:32:53 +0200 Subject: [PATCH] Support ARM architectures again --- src/runtime/runtime.cs | 4 ++++ src/runtime/typemanager.cs | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/src/runtime/runtime.cs b/src/runtime/runtime.cs index 7623200e0..294ecaf48 100644 --- a/src/runtime/runtime.cs +++ b/src/runtime/runtime.cs @@ -229,6 +229,8 @@ public enum MachineType { i386, x86_64, + armv7l, + armv8, Other }; @@ -247,6 +249,8 @@ public enum MachineType ["amd64"] = MachineType.x86_64, ["x64"] = MachineType.x86_64, ["em64t"] = MachineType.x86_64, + ["armv7l"] = MachineType.armv7l, + ["armv8"] = MachineType.armv8, }; /// diff --git a/src/runtime/typemanager.cs b/src/runtime/typemanager.cs index d19c8737f..a260e8dfa 100644 --- a/src/runtime/typemanager.cs +++ b/src/runtime/typemanager.cs @@ -510,6 +510,10 @@ public static NativeCode Active return I386; case Runtime.MachineType.x86_64: return X86_64; + case Runtime.MachineType.armv7l: + return Armv7l; + case Runtime.MachineType.armv8: + return Armv8; default: throw new NotImplementedException($"No support for {Runtime.MachineName}"); } @@ -546,6 +550,34 @@ public static NativeCode Active /// /// public static readonly NativeCode I386 = X86_64; + + public static readonly NativeCode Armv7l = new NativeCode() + { + Return0 = 0, + Return1 = 0x08, + Code = new byte[] + { + 0xe3, 0xa0, 0x00, 0x00, // mov r0, #0 + 0xe1, 0x2f, 0xff, 0x1e, // bx lr + + 0xe3, 0xa0, 0x00, 0x01, // mov r0, #1 + 0xe1, 0x2f, 0xff, 0x1e, // bx lr + } + }; + + public static readonly NativeCode Armv8 = new NativeCode() + { + Return0 = 0, + Return1 = 0x08, + Code = new byte[] + { + 0x52, 0x80, 0x00, 0x00, // mov w0, #0x0 + 0xd6, 0x5f, 0x03, 0xc0, // ret + + 0x52, 0x80, 0x00, 0x20, // mov w0, #0x1 + 0xd6, 0x5f, 0x03, 0xc0, // ret + } + }; } ///