diff options
author | jfrijters <jfrijters> | 2013-01-12 16:07:40 +0400 |
---|---|---|
committer | jfrijters <jfrijters> | 2013-01-12 16:07:40 +0400 |
commit | b4dd8f0df87aa75d24d0c9c509ef57b75aa99df6 (patch) | |
tree | 9a2feed241212e4c655d7f813645ff85b0961908 | |
parent | c0728228d5b2980d07fad6303ccb93047556ce78 (diff) |
Implemented ARM unmanaged exports.
-rw-r--r-- | reflect/Emit/ModuleBuilder.cs | 1 | ||||
-rw-r--r-- | reflect/Writer/TextSection.cs | 16 |
2 files changed, 16 insertions, 1 deletions
diff --git a/reflect/Emit/ModuleBuilder.cs b/reflect/Emit/ModuleBuilder.cs index 39c723d8..7e058929 100644 --- a/reflect/Emit/ModuleBuilder.cs +++ b/reflect/Emit/ModuleBuilder.cs @@ -941,6 +941,7 @@ namespace IKVM.Reflection.Emit switch (imageFileMachine) { case ImageFileMachine.I386: + case ImageFileMachine.ARM: type = 0x05; size = 4; break; diff --git a/reflect/Writer/TextSection.cs b/reflect/Writer/TextSection.cs index 0fc1f2bf..b0c0fe3e 100644 --- a/reflect/Writer/TextSection.cs +++ b/reflect/Writer/TextSection.cs @@ -516,6 +516,7 @@ namespace IKVM.Reflection.Writer stubLength = 8; break; case IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_AMD64: + case IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_ARM: stubLength = 16; break; default: @@ -569,7 +570,7 @@ namespace IKVM.Reflection.Writer { if (text.moduleBuilder.unmanagedExports[pos].ordinal == i + ordinalBase) { - mw.Write(stubsRVA + (uint)pos * stubLength); + mw.Write(text.peWriter.Thumb + stubsRVA + (uint)pos * stubLength); pos++; } else @@ -649,6 +650,15 @@ namespace IKVM.Reflection.Writer mw.Write((byte)0xE0); mw.Write(0); // alignment break; + case IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_ARM: + mw.Write((ushort)0xF8DF); + mw.Write((ushort)0xC008); + mw.Write((ushort)0xF8DC); + mw.Write((ushort)0xC000); + mw.Write((ushort)0x4760); + mw.Write((ushort)0xDEFE); + mw.Write((uint)text.peWriter.Headers.OptionalHeader.ImageBase + text.moduleBuilder.unmanagedExports[pos].rva.initializedDataOffset + sdataRVA); + break; default: throw new NotSupportedException(); } @@ -689,6 +699,10 @@ namespace IKVM.Reflection.Writer type = 0xA000; rva = stubsRVA + 2; break; + case IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_ARM: + type = 0x3000; + rva = stubsRVA + 12; + break; default: throw new NotSupportedException(); } |