Implemented ARM unmanaged exports.

This commit is contained in:
jfrijters 2013-01-12 12:07:40 +00:00
Родитель c0728228d5
Коммит b4dd8f0df8
2 изменённых файлов: 16 добавлений и 1 удалений

Просмотреть файл

@ -941,6 +941,7 @@ namespace IKVM.Reflection.Emit
switch (imageFileMachine)
{
case ImageFileMachine.I386:
case ImageFileMachine.ARM:
type = 0x05;
size = 4;
break;

Просмотреть файл

@ -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();
}