Add updated submodule

This commit is contained in:
de4dot 2018-04-04 19:35:11 +02:00
parent 6ca9aabb31
commit 1f6cb27af2
6 changed files with 46 additions and 34 deletions

View File

@ -28,8 +28,7 @@ namespace dnSpy.AsmEditor.Compiler {
if (module == null)
throw new ArgumentNullException(nameof(module));
switch (module.Machine) {
case Machine.I386:
if (module.Machine.IsI386()) {
// See https://github.com/dotnet/coreclr/blob/master/src/inc/corhdr.h
int c = (module.Is32BitRequired ? 2 : 0) + (module.Is32BitPreferred ? 1 : 0);
switch (c) {
@ -45,22 +44,17 @@ namespace dnSpy.AsmEditor.Compiler {
case 3: // image is platform neutral and prefers to be loaded 32-bit when possible
return TargetPlatform.AnyCpu32BitPreferred;
}
case Machine.AMD64:
return TargetPlatform.X64;
case Machine.IA64:
return TargetPlatform.Itanium;
case Machine.ARMNT:
return TargetPlatform.Arm;
case Machine.ARM64:
return TargetPlatform.Arm;
default:
return TargetPlatform.AnyCpu;
}
else if (module.Machine.IsAMD64())
return TargetPlatform.X64;
else if (module.Machine == Machine.IA64)
return TargetPlatform.Itanium;
else if (module.Machine.IsARMNT())
return TargetPlatform.Arm;
else if (module.Machine.IsARM64())
return TargetPlatform.Arm64;
else
return TargetPlatform.AnyCpu;
}
}
}

@ -1 +1 @@
Subproject commit 9dc1d09bfcc5b6ad743f182cbb35a6880a99486c
Subproject commit 28a07e9648f5d0e7efbe61889e75a4de0f3d8e04

View File

@ -34,6 +34,7 @@ namespace dnSpy.Roslyn.Compiler {
case TargetPlatform.Itanium: return Platform.Itanium;
case TargetPlatform.AnyCpu32BitPreferred: return Platform.AnyCpu32BitPreferred;
case TargetPlatform.Arm: return Platform.Arm;
case TargetPlatform.Arm64: return Platform.Arm;//TODO: Fix this when Roslyn supports ARM64
default:
Debug.Fail($"Unknown platform: {platform}");
return Platform.AnyCpu;

View File

@ -51,5 +51,10 @@ namespace dnSpy.Contracts.AsmEditor.Compiler {
/// ARM
/// </summary>
Arm,
/// <summary>
/// ARM64
/// </summary>
Arm64,
}
}

View File

@ -292,8 +292,8 @@ namespace dnSpy.Decompiler.MSBuild {
}
string GetPlatformString() {
switch (project.Module.Machine) {
case Machine.I386:
var machine = project.Module.Machine;
if (machine.IsI386()) {
int c = (project.Module.Is32BitRequired ? 2 : 0) + (project.Module.Is32BitPreferred ? 1 : 0);
switch (c) {
case 0: // no special meaning, MachineType and ILONLY flag determine image requirements
@ -308,13 +308,18 @@ namespace dnSpy.Decompiler.MSBuild {
return "AnyCPU";
}
return "AnyCPU";
case Machine.AMD64: return "x64";
case Machine.IA64: return "Itanium";
case Machine.ARMNT: return "ARM";
case Machine.ARM64: return "ARM64";
default:
}
else if (machine.IsAMD64())
return "x64";
else if (machine == Machine.IA64)
return "Itanium";
else if (machine.IsARMNT())
return "ARM";
else if (machine.IsARM64())
return "ARM64";
else {
Debug.Fail("Unknown machine");
return project.Module.Machine.ToString();
return machine.ToString();
}
}

View File

@ -17,6 +17,7 @@
along with dnSpy. If not, see <http://www.gnu.org/licenses/>.
*/
using System.Diagnostics;
using dnlib.DotNet;
using dnlib.PE;
using dnSpy.Decompiler.Properties;
@ -32,7 +33,7 @@ namespace dnSpy.Decompiler {
if (module == null)
return "???";
if (module.Machine == Machine.I386) {
if (module.Machine.IsI386()) {
// See https://github.com/dotnet/coreclr/blob/master/src/inc/corhdr.h
int c = (module.Is32BitRequired ? 2 : 0) + (module.Is32BitPreferred ? 1 : 0);
switch (c) {
@ -58,13 +59,19 @@ namespace dnSpy.Decompiler {
/// <param name="machine">Machine</param>
/// <returns></returns>
public static string GetArchString(Machine machine) {
switch (machine) {
case Machine.I386: return "x86";
case Machine.AMD64: return "x64";
case Machine.IA64: return "IA-64";
case Machine.ARMNT: return "ARM";
case Machine.ARM64: return "ARM64";
default: return machine.ToString();
if (machine.IsI386())
return "x86";
else if (machine.IsAMD64())
return "x64";
else if (machine == Machine.IA64)
return "IA-64";
else if (machine.IsARMNT())
return "ARM";
else if (machine.IsARM64())
return "ARM64";
else {
Debug.Fail("Unknown machine");
return machine.ToString();
}
}
}