Skip to content
Permalink
Browse files

3rd Party Tools Updates + WIP: ARM (#672)

  • Loading branch information...
tgiphil committed Aug 8, 2019
1 parent f212542 commit a8d43c8868936cab5f02790b5eb629ff0fa60f89
Showing with 3,273 additions and 1,248 deletions.
  1. +99 −61 Source/Data/ARMv8A32-Instructions.json
  2. +16 −3 Source/Mosa.Compiler.Framework/BaseCodeEmitter.cs
  3. +1 −1 Source/Mosa.Compiler.Framework/CompilerStages/ExceptionTableStage.cs
  4. +1 −1 Source/Mosa.Compiler.Framework/CompilerStages/MetadataStage.cs
  5. +1 −1 Source/Mosa.Compiler.Framework/CompilerStages/MethodTableStage.cs
  6. +14 −3 Source/Mosa.Compiler.Framework/Linker/Elf/ElfLinker.cs
  7. +80 −13 Source/Mosa.Compiler.Framework/Linker/Elf/RelocationType.cs
  8. +2 −2 Source/Mosa.Compiler.Framework/Linker/MosaLinker.cs
  9. +18 −1 Source/Mosa.Compiler.Framework/Linker/PatchType.cs
  10. +11 −4 Source/Mosa.Compiler.Framework/OpcodeEncoder.cs
  11. +1 −1 Source/Mosa.Compiler.Framework/Stages/CILStaticAllocationResolutionStage.cs
  12. +1 −1 Source/Mosa.Compiler.Framework/Stages/CILTransformationStage.cs
  13. +2 −2 Source/Mosa.Compiler.Framework/Stages/ProtectedRegionLayoutStage.cs
  14. +2 −28 Source/Mosa.Korlib/System/String.cs
  15. +53 −0 Source/Mosa.Platform.ARMv8A32/ARMHelper.cs
  16. +4 −2 Source/Mosa.Platform.ARMv8A32/ARMv8A32.cs
  17. +4 −2 Source/Mosa.Platform.ARMv8A32/ARMv8A32Instructions.cs
  18. +3 −1 Source/Mosa.Platform.ARMv8A32/Architecture.cs
  19. +3 −3 Source/Mosa.Platform.ARMv8A32/Instructions/AdcImm.cs
  20. +3 −3 Source/Mosa.Platform.ARMv8A32/Instructions/AddImm.cs
  21. +3 −3 Source/Mosa.Platform.ARMv8A32/Instructions/AndImm.cs
  22. +38 −0 Source/Mosa.Platform.ARMv8A32/Instructions/B.cs
  23. +3 −3 Source/Mosa.Platform.ARMv8A32/Instructions/BicImm.cs
  24. +1 −1 Source/Mosa.Platform.ARMv8A32/Instructions/Bkpt.cs
  25. +13 −5 Source/Mosa.Platform.ARMv8A32/Instructions/Bl.cs
  26. +17 −5 Source/Mosa.Platform.ARMv8A32/Instructions/Bx.cs
  27. +3 −3 Source/Mosa.Platform.ARMv8A32/Instructions/CmnImm.cs
  28. +3 −3 Source/Mosa.Platform.ARMv8A32/Instructions/CmpImm.cs
  29. +3 −3 Source/Mosa.Platform.ARMv8A32/Instructions/EorImm.cs
  30. +3 −3 Source/Mosa.Platform.ARMv8A32/Instructions/MovImm.cs
  31. +6 −6 Source/Mosa.Platform.ARMv8A32/Instructions/{Blx.cs → MovtImm.cs}
  32. +30 −0 Source/Mosa.Platform.ARMv8A32/Instructions/MovwImm.cs
  33. +1 −1 Source/Mosa.Platform.ARMv8A32/Instructions/Msr.cs
  34. +3 −3 Source/Mosa.Platform.ARMv8A32/Instructions/MvnImm.cs
  35. +4 −4 Source/Mosa.Platform.ARMv8A32/Instructions/Nop.cs
  36. +3 −3 Source/Mosa.Platform.ARMv8A32/Instructions/OrrImm.cs
  37. +3 −3 Source/Mosa.Platform.ARMv8A32/Instructions/RsbImm.cs
  38. +3 −3 Source/Mosa.Platform.ARMv8A32/Instructions/RscImm.cs
  39. +3 −3 Source/Mosa.Platform.ARMv8A32/Instructions/SbcImm.cs
  40. +3 −3 Source/Mosa.Platform.ARMv8A32/Instructions/SubImm.cs
  41. +3 −3 Source/Mosa.Platform.ARMv8A32/Instructions/TeqImm.cs
  42. +3 −3 Source/Mosa.Platform.ARMv8A32/Instructions/TstImm.cs
  43. +5 −1 Source/Mosa.Platform.ARMv8A32/Mosa.Platform.ARMv8A32.csproj
  44. +57 −7 Source/Mosa.Platform.ARMv8A32/Stages/IRTransformationStage.cs
  45. +102 −0 Source/Mosa.Platform.ARMv8A32/Stages/ImmediateConstantStage.cs
  46. +1 −4 Source/Mosa.Platform.ARMv8A32/Stages/LongOperandStage.cs
  47. +2 −2 Source/Mosa.Platform.Intel/CompilerStages/MultibootV1Stage.cs
  48. +1 −1 Source/Mosa.Platform.Intel/Stages/AddressModeConversionStage.cs
  49. +1 −1 Source/Mosa.Platform.Intel/Stages/FloatingPointStage.cs
  50. +5 −6 Source/Mosa.Platform.x86/Stages/IRTransformationStage.cs
  51. +1 −1 Source/Mosa.TestWorld.x86/Boot.cs
  52. +217 −208 Source/Mosa.Utility.Launcher/Mosa.Utility.Launcher.csproj
  53. +1 −0 Source/Mosa.Utility.SourceCodeGenerator/BuildCommonInstructionFiles.cs
  54. +10 −5 Tools/Readme.md
  55. BIN Tools/nasm/nasm.exe
  56. BIN Tools/ndisasm/ndisasm.exe
  57. BIN Tools/qemu/SDL2.dll
  58. BIN Tools/qemu/bios-256k.bin
  59. BIN Tools/qemu/bios.bin
  60. BIN Tools/qemu/efi-e1000.rom
  61. BIN Tools/qemu/efi-e1000e.rom
  62. BIN Tools/qemu/efi-eepro100.rom
  63. BIN Tools/qemu/efi-ne2k_pci.rom
  64. BIN Tools/qemu/efi-pcnet.rom
  65. BIN Tools/qemu/efi-rtl8139.rom
  66. BIN Tools/qemu/efi-virtio.rom
  67. BIN Tools/qemu/efi-vmxnet3.rom
  68. BIN Tools/qemu/libasprintf-0.dll
  69. BIN Tools/qemu/libatk-1.0-0.dll
  70. BIN Tools/qemu/libcairo-2.dll
  71. BIN Tools/qemu/libcairo-gobject-2.dll
  72. BIN Tools/qemu/libcairo-script-interpreter-2.dll
  73. BIN Tools/qemu/libcurl-4.dll
  74. BIN Tools/qemu/libeay32.dll
  75. BIN Tools/qemu/libepoxy-0.dll
  76. BIN Tools/qemu/libexpat-1.dll
  77. BIN Tools/qemu/libfontconfig-1.dll
  78. BIN Tools/qemu/libformw6.dll
  79. BIN Tools/qemu/libfreetype-6.dll
  80. BIN Tools/qemu/libgailutil-3-0.dll
  81. BIN Tools/qemu/libgcc_s_seh-1.dll
  82. BIN Tools/qemu/libgdk-3-0.dll
  83. BIN Tools/qemu/libgdk_pixbuf-2.0-0.dll
  84. BIN Tools/qemu/libgio-2.0-0.dll
  85. BIN Tools/qemu/libglib-2.0-0.dll
  86. BIN Tools/qemu/libgmodule-2.0-0.dll
  87. BIN Tools/qemu/libgmp-10.dll
  88. BIN Tools/qemu/libgmpxx-4.dll
  89. BIN Tools/qemu/libgnurx-0.dll
  90. BIN Tools/qemu/libgnutls-28.dll
  91. BIN Tools/qemu/libgnutls-30.dll
  92. BIN Tools/qemu/libgnutls-openssl-27.dll
  93. BIN Tools/qemu/libgnutlsxx-28.dll
  94. BIN Tools/qemu/libgobject-2.0-0.dll
  95. BIN Tools/qemu/libgthread-2.0-0.dll
  96. BIN Tools/qemu/libgtk-3-0.dll
  97. BIN Tools/qemu/libgtkreftestprivate-0.dll
  98. BIN Tools/qemu/libharfbuzz-0.dll
  99. BIN Tools/qemu/libhogweed-2.dll
  100. BIN Tools/qemu/libhogweed-4.dll
  101. BIN Tools/qemu/libidn2-0.dll
  102. BIN Tools/qemu/libintl-8.dll
  103. BIN Tools/qemu/libjasper-1.dll
  104. BIN Tools/qemu/libjbig-2.dll
  105. BIN Tools/qemu/libjbig85-2.dll
  106. BIN Tools/qemu/libjpeg-8.dll
  107. BIN Tools/qemu/liblzma-5.dll
  108. BIN Tools/qemu/libmenuw6.dll
  109. BIN Tools/qemu/libncurses++w6.dll
  110. BIN Tools/qemu/libncursesw6.dll
  111. BIN Tools/qemu/libnettle-4.dll
  112. BIN Tools/qemu/libnettle-6.dll
  113. BIN Tools/qemu/libnghttp2-14.dll
  114. BIN Tools/qemu/libp11-kit-0.dll
  115. BIN Tools/qemu/libpanelw6.dll
  116. BIN Tools/qemu/libpango-1.0-0.dll
  117. BIN Tools/qemu/libpangocairo-1.0-0.dll
  118. BIN Tools/qemu/libpangoft2-1.0-0.dll
  119. BIN Tools/qemu/libpangowin32-1.0-0.dll
  120. BIN Tools/qemu/libpcre-1.dll
  121. BIN Tools/qemu/libpng16-16.dll
  122. BIN Tools/qemu/libstdc++-6.dll
  123. BIN Tools/qemu/libtasn1-6.dll
  124. BIN Tools/qemu/libtiff-5.dll
  125. BIN Tools/qemu/libtiffxx-5.dll
  126. BIN Tools/qemu/libturbojpeg-0.dll
  127. BIN Tools/qemu/libunistring-2.dll
  128. BIN Tools/qemu/libusb-1.0.dll
  129. BIN Tools/qemu/libwinpthread-1.dll
  130. BIN Tools/qemu/qemu-img.exe
  131. BIN Tools/qemu/qemu-system-aarch64.exe
  132. BIN Tools/qemu/qemu-system-aarch64w.exe
  133. BIN Tools/qemu/qemu-system-arm.exe
  134. BIN Tools/qemu/qemu-system-armw.exe
  135. BIN Tools/qemu/qemu-system-i386.exe
  136. BIN Tools/qemu/qemu-system-i386w.exe
  137. BIN Tools/qemu/qemu-system-x86_64.exe
  138. BIN Tools/qemu/qemu-system-x86_64w.exe
  139. BIN Tools/qemu/share/icons/Adwaita/16x16/actions/window-close-symbolic.symbolic.png
  140. BIN Tools/qemu/share/icons/Adwaita/16x16/actions/window-maximize-symbolic.symbolic.png
  141. BIN Tools/qemu/share/icons/Adwaita/16x16/actions/window-minimize-symbolic.symbolic.png
  142. +533 −0 Tools/qemu/share/icons/Adwaita/index.theme
  143. +1,836 −0 Tools/qemu/share/icons/hicolor/index.theme
  144. BIN Tools/qemu/ssleay32.dll
  145. BIN Tools/qemu/vgabios-ati.bin
  146. BIN Tools/qemu/vgabios-bochs-display.bin
  147. BIN Tools/qemu/vgabios-cirrus.bin
  148. BIN Tools/qemu/vgabios-qxl.bin
  149. BIN Tools/qemu/vgabios-ramfb.bin
  150. BIN Tools/qemu/vgabios-stdvga.bin
  151. BIN Tools/qemu/vgabios-virtio.bin
  152. BIN Tools/qemu/vgabios-vmware.bin
  153. BIN Tools/qemu/vgabios.bin
  154. BIN Tools/qemu/zlib1.dll
  155. +30 −0 Tools/raspberrypi-firmware/LICENCE.broadcom
  156. BIN Tools/raspberrypi-firmware/bootcode.bin
  157. BIN Tools/raspberrypi-firmware/fixup.dat
  158. BIN Tools/raspberrypi-firmware/start.elf
  159. BIN Tools/rufus/rufus-3.4.exe
  160. BIN Tools/rufus/rufus-3.6.exe
  161. +0 −674 Tools/wget/COPYING
  162. +0 −89 Tools/wget/README
  163. BIN Tools/wget/libeay32.dll
  164. BIN Tools/wget/libiconv2.dll
  165. BIN Tools/wget/libintl3.dll
  166. BIN Tools/wget/libssl32.dll
  167. +0 −52 Tools/wget/wget-1.11.4-1-GnuWin32.README
  168. BIN Tools/wget/wget.exe

Large diffs are not rendered by default.

@@ -231,16 +231,29 @@ public void EmitLink(int position, PatchType patchType, Operand symbolOperand, i

public void EmitForwardLink(int offset)
{
Linker.Link(LinkType.AbsoluteAddress, PatchType.I4, MethodName, CurrentPosition, MethodName, CurrentPosition + offset);
Linker.Link(LinkType.AbsoluteAddress, PatchType.I32, MethodName, CurrentPosition, MethodName, CurrentPosition + offset);
}

#endregion Emit Methods

public void EmitRelative24(Operand symbolOperand)
{
// TODO
Linker.Link(
LinkType.RelativeOffset,
PatchType.I24o8,
MethodName,
CodeStream.Position,
symbolOperand.Name,
-4
);
}

public void EmitRelative32(Operand symbolOperand)
{
Linker.Link(
LinkType.RelativeOffset,
PatchType.I4,
PatchType.I32,
MethodName,
CodeStream.Position,
symbolOperand.Name,
@@ -252,7 +265,7 @@ public void EmitRelative64(Operand symbolOperand)
{
Linker.Link(
LinkType.RelativeOffset,
PatchType.I8,
PatchType.I64,
MethodName,
CodeStream.Position,
symbolOperand.Name,
@@ -20,7 +20,7 @@ public class ExceptionTableStage : BaseCompilerStage

protected override void Initialization()
{
NativePatchType = (TypeLayout.NativePointerSize == 4) ? PatchType.I4 : NativePatchType = PatchType.I8;
NativePatchType = (TypeLayout.NativePointerSize == 4) ? PatchType.I32 : NativePatchType = PatchType.I64;
}

protected override void Finalization()
@@ -26,7 +26,7 @@ public sealed class MetadataStage : BaseCompilerStage

protected override void Initialization()
{
NativePatchType = (TypeLayout.NativePointerSize == 4) ? PatchType.I4 : NativePatchType = PatchType.I8;
NativePatchType = (TypeLayout.NativePointerSize == 4) ? PatchType.I32 : NativePatchType = PatchType.I64;
}

protected override void Finalization()
@@ -20,7 +20,7 @@ public class MethodTableStage : BaseCompilerStage

protected override void Initialization()
{
NativePatchType = (TypeLayout.NativePointerSize == 4) ? PatchType.I4 : NativePatchType = PatchType.I8;
NativePatchType = (TypeLayout.NativePointerSize == 4) ? PatchType.I32 : NativePatchType = PatchType.I64;
}

protected override void Finalization()
@@ -595,7 +595,7 @@ private void EmitRelocation(Section section, EndianAwareBinaryWriter writer)

var relocationEntry = new RelocationEntry()
{
RelocationType = ConvertType(patch.LinkType, linker.MachineType),
RelocationType = ConvertType(linker.MachineType, patch.LinkType, patch.PatchType),
Symbol = symbolTableOffset[patch.ReferenceSymbol],
Offset = (ulong)(symbol.SectionOffset + patch.PatchOffset),
};
@@ -636,7 +636,7 @@ private void EmitRelocationAddend(Section section, EndianAwareBinaryWriter write

var relocationAddendEntry = new RelocationAddendEntry()
{
RelocationType = ConvertType(patch.LinkType, linker.MachineType),
RelocationType = ConvertType(linker.MachineType, patch.LinkType, patch.PatchType),
Symbol = symbolTableOffset[patch.ReferenceSymbol],
Offset = (ulong)(symbol.SectionOffset + patch.PatchOffset),
Addend = (ulong)patch.ReferenceOffset,
@@ -651,14 +651,25 @@ private void EmitRelocationAddend(Section section, EndianAwareBinaryWriter write
section.Size = (uint)(count * RelocationAddendEntry.GetEntrySize(linkerFormatType));
}

private static RelocationType ConvertType(LinkType linkType, MachineType machineType)
private static RelocationType ConvertType(MachineType machineType, LinkType linkType, PatchType patchType)
{
if (machineType == MachineType.Intel386)
{
if (linkType == LinkType.AbsoluteAddress)
return RelocationType.R_386_32;
else if (linkType == LinkType.RelativeOffset)
return RelocationType.R_386_PC32;
else if (linkType == LinkType.Size)
return RelocationType.R_386_COPY;
}
else if (machineType == MachineType.ARM)
{
if (linkType == LinkType.AbsoluteAddress)
return RelocationType.R_ARM_ABS16;
else if (linkType == LinkType.RelativeOffset)
return RelocationType.R_ARM_PC24;
else if (linkType == LinkType.Size)
return RelocationType.R_ARM_COPY;
}

return RelocationType.R_386_NONE;
@@ -3,9 +3,9 @@
namespace Mosa.Compiler.Framework.Linker.Elf
{
/// <summary>
///
/// ELF Relocation Types
/// </summary>
public enum RelocationType : uint
public enum RelocationType : byte
{
// Notes:
//
@@ -19,16 +19,83 @@ public enum RelocationType : uint

// R_386 = x86 (32-bit)

R_386_NONE = 0,
R_386_32 = 1, // S + A
R_386_PC32 = 2, // S + A - P
R_386_GOT32 = 3, // G + A
R_386_PLT32 = 4, // L + A - P
R_386_COPY = 5, // None
R_386_GLOB_DAT = 6, // S
R_386_JMP_SLOT = 7, // S
R_386_RELATIVE = 8, // B + A
R_386_GOTOFF = 9, // S + A - GOT
R_386_GOTPC = 10, // GOT + A - P
R_386_NONE = 0, // No reloc
R_386_32 = 1, // S + A Direct 32 bit
R_386_PC32 = 2, // S + A - P PC relative 32 bit
R_386_GOT32 = 3, // G + A 32 bit GOT entry
R_386_PLT32 = 4, // L + A - P 32 bit PLT address
R_386_COPY = 5, // None Copy symbol at runtime
R_386_GLOB_DAT = 6, // S Create GOT entry
R_386_JMP_SLOT = 7, // S Create PLT entry
R_386_RELATIVE = 8, // B + A Adjust by program base
R_386_GOTOFF = 9, // S + A - GOT 32 bit offset to GOT
R_386_GOTPC = 10, // GOT + A - P 32 bit PC relative offset to GOT
R_386_TLS_TPOFF = 14, // Offset in static TLS block
R_386_TLS_IE = 15, // Address of GOT entry for static TLS block offset
R_386_TLS_GOTIE = 16, // GOT entry for static TLS block offset
R_386_TLS_LE = 17, // Offset relative to static TLS block
R_386_TLS_GD = 18, // Direct 32 bit for GNU version of general dynamic thread local data
R_386_TLS_LDM = 19, // Direct 32 bit for GNU version of local dynamic thread local data in LE code
R_386_16 = 20,
R_386_PC16 = 21,
R_386_8 = 22,
R_386_PC8 = 23,
R_386_TLS_GD_32 = 24, // Direct 32 bit for general dynamic thread local data
R_386_TLS_GD_PUSH = 25, // Tag for pushl in GD TLS code
R_386_TLS_GD_CALL = 26, // Relocation for call to __tls_get_addr()
R_386_TLS_GD_POP = 27, // Tag for popl in GD TLS code
R_386_TLS_LDM_32 = 28, // Direct 32 bit for local dynamic thread local data in LE code
R_386_TLS_LDM_PUSH = 29, // Tag for pushl in LDM TLS code
R_386_TLS_LDM_CALL = 30, // Relocation for call to __tls_get_addr() in LDM code
R_386_TLS_LDM_POP = 31, // Tag for popl in LDM TLS code
R_386_TLS_LDO_32 = 32, // Offset relative to TLS block
R_386_TLS_IE_32 = 33, // GOT entry for negated static TLS block offset
R_386_TLS_LE_32 = 34, // Negated offset relative to static TLS block
R_386_TLS_DTPMOD32 = 35, // ID of module containing symbol
R_386_TLS_DTPOFF32 = 36, // Offset in TLS block
R_386_TLS_TPOFF32 = 37, // Negated offset in static TLS block

R_ARM_NONE = 0, // No reloc
R_ARM_PC24 = 1, // PC relative 26 bit branch
R_ARM_ABS32 = 2, // Direct 32 bit
R_ARM_REL32 = 3, // PC relative 32 bit
R_ARM_PC13 = 4,
R_ARM_ABS16 = 5, // Direct 16 bit
R_ARM_ABS12 = 6, // Direct 12 bit
R_ARM_THM_ABS5 = 7,
R_ARM_ABS8 = 8, // Direct 8 bit
R_ARM_SBREL32 = 9,
R_ARM_THM_PC22 = 10,
R_ARM_THM_PC8 = 11,
R_ARM_AMP_VCALL9 = 12,
R_ARM_SWI24 = 13,
R_ARM_THM_SWI8 = 14,
R_ARM_XPC25 = 15,
R_ARM_THM_XPC22 = 16,
R_ARM_COPY = 20, // Copy symbol at runtime
R_ARM_GLOB_DAT = 21, // Create GOT entry
R_ARM_JUMP_SLOT = 22, // Create PLT entry
R_ARM_RELATIVE = 23, // Adjust by program base
R_ARM_GOTOFF = 24, // 32 bit offset to GOT
R_ARM_GOTPC = 25, // 32 bit PC relative offset to GOT
R_ARM_GOT32 = 26, // 32 bit GOT entry
R_ARM_PLT32 = 27, // 32 bit PLT address
R_ARM_ALU_PCREL_7_0 = 32,
R_ARM_ALU_PCREL_15_8 = 33,
R_ARM_ALU_PCREL_23_15 = 34,
R_ARM_LDR_SBREL_11_0 = 35,
R_ARM_ALU_SBREL_19_12 = 36,
R_ARM_ALU_SBREL_27_20 = 37,
R_ARM_GNU_VTENTRY = 100,
R_ARM_GNU_VTINHERIT = 101,
R_ARM_THM_PC11 = 102, // thumb unconditional branch
R_ARM_THM_PC9 = 103, // thumb conditional branch
R_ARM_RXPC25 = 249,
R_ARM_RSBREL32 = 250,
R_ARM_THM_RPC22 = 251,
R_ARM_RREL32 = 252,
R_ARM_RABS22 = 253,
R_ARM_RPC24 = 254,
R_ARM_RBASE = 255,
}
}
@@ -242,8 +242,8 @@ private static byte GetPatchTypeSize(PatchType patchType)
{
switch (patchType)
{
case PatchType.I4: return 32;
case PatchType.I8: return 64;
case PatchType.I32: return 32;
case PatchType.I64: return 64;
}

throw new CompilerException($"unknown patch type: {patchType}");
@@ -2,5 +2,22 @@

namespace Mosa.Compiler.Framework.Linker
{
public enum PatchType { I4, I8 }
public enum PatchType
{
I32, // 32-bit patch type
I64, // 64-bit patch type
I24o8, // 24-bit patch type (offset 8)

// Future (maybe)
I32Copy,

I64Copy,

I32Absolute,
I32Relative,
I64Absolute,
I64Relative,
I24Absolute,
I24Relative,
}
}
@@ -269,7 +269,7 @@ public void Append32BitImmediateWithOffset(Operand operand, Operand offset)
}
else
{
Emitter.EmitLink(Emitter.CurrentPosition, PatchType.I4, operand, 0, offset.ConstantSignedInteger);
Emitter.EmitLink(Emitter.CurrentPosition, PatchType.I32, operand, 0, offset.ConstantSignedInteger);
WriteZeroBytes(4);
}
}
@@ -284,7 +284,7 @@ public void Append32BitImmediate(Operand operand)
}
else
{
Emitter.EmitLink(Emitter.CurrentPosition, PatchType.I4, operand, 0, 0);
Emitter.EmitLink(Emitter.CurrentPosition, PatchType.I32, operand, 0, 0);
WriteZeroBytes(4);
}
}
@@ -300,7 +300,7 @@ public void Append64BitImmediateWithOffset(Operand operand, Operand offset)
}
else
{
Emitter.EmitLink(Emitter.CurrentPosition, PatchType.I8, operand, 0, offset.ConstantSignedInteger);
Emitter.EmitLink(Emitter.CurrentPosition, PatchType.I64, operand, 0, offset.ConstantSignedInteger);
WriteZeroBytes(8);
}
}
@@ -315,7 +315,7 @@ public void Append64BitImmediate(Operand operand)
}
else
{
Emitter.EmitLink(Emitter.CurrentPosition, PatchType.I8, operand, 0, 0);
Emitter.EmitLink(Emitter.CurrentPosition, PatchType.I64, operand, 0, 0);
WriteZeroBytes(4);
}
}
@@ -371,6 +371,13 @@ private void WriteZeroBytes(int length)
}
}

public void EmitRelative24(int label)
{
// TODO
int offset = Emitter.EmitRelative(label, 4);
AppendImmediateInteger((uint)offset);
}

public void EmitRelative32(int label)
{
int offset = Emitter.EmitRelative(label, 4);
@@ -90,7 +90,7 @@ private void PerformStaticAllocationOf(InstructionNode allocation, InstructionNo

if (typeDefinitionSymbol != null)
{
Linker.Link(LinkType.AbsoluteAddress, PatchType.I4, symbolName, 0, typeDefinitionSymbol, 0);
Linker.Link(LinkType.AbsoluteAddress, PatchType.I32, symbolName, 0, typeDefinitionSymbol, 0);
}

var staticAddress = Operand.CreateSymbol(assignmentField.FieldType, symbolName.Name);
@@ -1116,7 +1116,7 @@ private void Ldstr(InstructionNode node)
var stream = symbol.Stream;

// Type Definition and sync block
Linker.Link(LinkType.AbsoluteAddress, PatchType.I4, symbol, 0, Metadata.TypeDefinition + "System.String", 0);
Linker.Link(LinkType.AbsoluteAddress, PatchType.I32, symbol, 0, Metadata.TypeDefinition + "System.String", 0);

stream.WriteZeroBytes(NativePointerSize * 2);

@@ -20,9 +20,9 @@ public sealed class ProtectedRegionLayoutStage : BaseMethodCompilerStage
protected override void Initialize()
{
if (TypeLayout.NativePointerSize == 4)
NativePatchType = PatchType.I4;
NativePatchType = PatchType.I32;
else
NativePatchType = PatchType.I8;
NativePatchType = PatchType.I64;
}

protected override void Run()
@@ -275,38 +275,12 @@ public override string ToString()
{
return this;
}

public List<string> Split(char delimiter, string text)
{
List<string> ret = new List<string>();
string temp = "";
for (int i = 0; i < text.Length; i++)
{
if (text[i] == delimiter)
{
ret.Add(temp);
temp = "";
}
else
{
temp += text[i];
}

}
if (temp != "")
{
ret.Add(temp);
}

return ret;

}

public List<string> Split(char delimiter, string text)
{
List<string> ret = new List<string>();
int startPos = 0;
string temp = string.Empty;
string temp = Empty;

for (int i = 0; i < text.Length; i++)
{
@@ -317,7 +291,7 @@ public List<string> Split(char delimiter, string text)
startPos = i + 1;
}
}
if (temp != string.Empty)
if (temp != Empty)
{
ret.Add(temp);
}

0 comments on commit a8d43c8

Please sign in to comment.
You can’t perform that action at this time.