Skip to content

Commit d834b65

Browse files
committed
Support ARM architectures again
1 parent 2bc514f commit d834b65

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

src/runtime/runtime.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,8 @@ public enum MachineType
229229
{
230230
i386,
231231
x86_64,
232+
armv7l,
233+
armv8,
232234
Other
233235
};
234236

@@ -247,6 +249,8 @@ public enum MachineType
247249
["amd64"] = MachineType.x86_64,
248250
["x64"] = MachineType.x86_64,
249251
["em64t"] = MachineType.x86_64,
252+
["armv7l"] = MachineType.armv7l,
253+
["armv8"] = MachineType.armv8,
250254
};
251255

252256
/// <summary>

src/runtime/typemanager.cs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,10 @@ public static NativeCode Active
510510
return I386;
511511
case Runtime.MachineType.x86_64:
512512
return X86_64;
513+
case Runtime.MachineType.armv7l:
514+
return Armv7l;
515+
case Runtime.MachineType.armv8:
516+
return Armv8;
513517
default:
514518
throw new NotImplementedException($"No support for {Runtime.MachineName}");
515519
}
@@ -546,6 +550,34 @@ public static NativeCode Active
546550
/// <see cref="NativeCode.X86_64"/>
547551
/// </summary>
548552
public static readonly NativeCode I386 = X86_64;
553+
554+
public static readonly NativeCode Armv7l = new NativeCode()
555+
{
556+
Return0 = 0,
557+
Return1 = 0x08,
558+
Code = new byte[]
559+
{
560+
0xe3, 0xa0, 0x00, 0x00, // mov r0, #0
561+
0xe1, 0x2f, 0xff, 0x1e, // bx lr
562+
563+
0xe3, 0xa0, 0x00, 0x01, // mov r0, #1
564+
0xe1, 0x2f, 0xff, 0x1e, // bx lr
565+
}
566+
};
567+
568+
public static readonly NativeCode Armv8 = new NativeCode()
569+
{
570+
Return0 = 0,
571+
Return1 = 0x08,
572+
Code = new byte[]
573+
{
574+
0x52, 0x80, 0x00, 0x00, // mov w0, #0x0
575+
0xd6, 0x5f, 0x03, 0xc0, // ret
576+
577+
0x52, 0x80, 0x00, 0x20, // mov w0, #0x1
578+
0xd6, 0x5f, 0x03, 0xc0, // ret
579+
}
580+
};
549581
}
550582

551583
/// <summary>

0 commit comments

Comments
 (0)