Skip to content

Support ARM architectures again #887

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Support ARM architectures again
  • Loading branch information
filmor committed Jun 20, 2019
commit d834b655ff0f03905927a9ce44f1a62af134c95b
4 changes: 4 additions & 0 deletions src/runtime/runtime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,8 @@ public enum MachineType
{
i386,
x86_64,
armv7l,
armv8,
Other
};

Expand All @@ -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,
};

/// <summary>
Expand Down
32 changes: 32 additions & 0 deletions src/runtime/typemanager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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}");
}
Expand Down Expand Up @@ -546,6 +550,34 @@ public static NativeCode Active
/// <see cref="NativeCode.X86_64"/>
/// </summary>
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
}
};
}

/// <summary>
Expand Down