PageRenderTime 48ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/source2/IL2CPU/Cosmos.IL2CPU/Plugs/NEW_PLUGS/InvokeImplAssembler.cs

https://bitbucket.org/mvptracker/cosmos
C# | 303 lines | 111 code | 14 blank | 178 comment | 2 complexity | d01ea2ea0693b0bdf577988ae7c0af2c MD5 | raw file
Possible License(s): BSD-2-Clause
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Reflection;
  5. using System.Text;
  6. using Cosmos.IL2CPU.IL;
  7. using Cosmos.IL2CPU.Plugs;
  8. using CPUx86 = Cosmos.Assembler.x86;
  9. using Cosmos.IL2CPU.X86.IL;
  10. using CPU = Cosmos.Assembler;
  11. using MethodBase = System.Reflection.MethodBase;
  12. using Cosmos.Assembler;
  13. namespace Cosmos.IL2CPU.X86.Plugs.NEW_PLUGS {
  14. public class InvokeImplAssembler: AssemblerMethod {
  15. private uint GetArgumentStartOffset(MethodBase aMethod, int aArgument) {
  16. return 0;
  17. }
  18. public override void AssembleNew(Cosmos.Assembler.Assembler aAssembler, object aMethodInfo) {
  19. var xAssembler = (Cosmos.Assembler.Assembler)aAssembler;
  20. var xMethodInfo = (Cosmos.IL2CPU.MethodInfo)aMethodInfo;
  21. var xMethodBaseAsInfo = xMethodInfo.MethodBase as global::System.Reflection.MethodInfo;
  22. if (xMethodBaseAsInfo.ReturnType != typeof(void)) {
  23. throw new Exception("Events with return type not yet supported!");
  24. }
  25. new Comment("XXXXXXX");
  26. new CPUx86.Xchg { DestinationReg = CPUx86.Registers.BX, SourceReg = CPUx86.Registers.BX, Size = 16 };
  27. /*
  28. * EAX contains the GetInvocationList() array at the index at which it was last used
  29. * EDX contains the index at which the EAX is
  30. * EBX contains the number of items in the array
  31. * ECX contains the argument size
  32. */
  33. new CPUx86.ClrInterruptFlag();
  34. new CPU.Label(".DEBUG");
  35. //new CPU.Label("____DEBUG_FOR_MULTICAST___");
  36. new CPU.Comment("move address of delgate to eax");
  37. new CPUx86.Mov { DestinationReg = CPUx86.Registers.EAX, SourceReg = CPUx86.Registers.EBP, SourceIsIndirect = true, SourceDisplacement = Ldarg.GetArgumentDisplacement(xMethodInfo, 0) };
  38. var xGetInvocationListMethod = typeof(MulticastDelegate).GetMethod("GetInvocationList");
  39. new CPU.Comment("push address of delgate to stack");
  40. new CPUx86.Push { DestinationReg = CPUx86.Registers.EAX };//addrof this
  41. new CPUx86.Call { DestinationLabel = CPU.LabelName.Get(xGetInvocationListMethod) };
  42. new CPU.Comment("get address from return value -> eax");
  43. new CPUx86.Pop { DestinationReg = CPUx86.Registers.EAX };
  44. ;//list
  45. new CPU.Comment("eax+=8 is where the offset where an array's count is");
  46. new CPUx86.Add { DestinationReg = CPUx86.Registers.EAX, SourceValue = 8 };//addrof list.count??
  47. new CPU.Comment("store count in ebx");
  48. new CPUx86.Mov { DestinationReg = CPUx86.Registers.EBX, SourceReg = CPUx86.Registers.EAX, SourceIsIndirect = true };//list.count
  49. new CPU.Comment("eax+=8 is where the offset where an array's items start");
  50. new CPUx86.Add { DestinationReg = CPUx86.Registers.EAX, SourceValue = 8 };//why? -- start of list i think? MtW: the array's .Length is at +8
  51. new CPUx86.Mov { DestinationReg = CPUx86.Registers.EDI, SourceValue = 0 };
  52. new CPU.Comment("ecx = ptr to delegate object");
  53. new CPUx86.Mov { DestinationReg = CPUx86.Registers.ECX, SourceReg = CPUx86.Registers.EBP, SourceIsIndirect = true, SourceDisplacement = Ldarg.GetArgumentDisplacement(xMethodInfo, 0) };//addrof the delegate
  54. new CPU.Comment("ecx points to the size of the delegated methods arguments");
  55. new CPUx86.Mov { DestinationReg = CPUx86.Registers.ECX, SourceReg = CPUx86.Registers.ECX, SourceIsIndirect = true, SourceDisplacement = Ldfld.GetFieldOffset(xMethodInfo.MethodBase.DeclaringType, "$$ArgSize$$") };//the size of the arguments to the method? + 12??? -- 12 is the size of the current call stack.. i think
  56. new CPUx86.Xor { DestinationReg = CPUx86.Registers.EDX, SourceReg = CPUx86.Registers.EDX };
  57. ;//make sure edx is 0
  58. new CPU.Label(".BEGIN_OF_LOOP");
  59. new CPUx86.Compare { DestinationReg = CPUx86.Registers.EDX, SourceReg = CPUx86.Registers.EBX };//are we at the end of this list
  60. new CPUx86.ConditionalJump { Condition = CPUx86.ConditionalTestEnum.Equal, DestinationLabel = ".END_OF_INVOKE_" };//then we better stop
  61. new CPUx86.Pushad();
  62. new CPU.Comment("esi points to where we will copy the methods argumetns from");
  63. new CPUx86.Mov { DestinationReg = CPUx86.Registers.ESI, SourceReg = CPUx86.Registers.ESP };
  64. new CPU.Comment("edi = ptr to delegate object");
  65. new CPUx86.Mov { DestinationReg = CPUx86.Registers.EDI, SourceReg = CPUx86.Registers.EBP, SourceIsIndirect = true, SourceDisplacement = Ldarg.GetArgumentDisplacement(xMethodInfo, 0) };
  66. new CPU.Comment("edi = ptr to delegate object should be a pointer to the delgates context ie (this) for the methods ");
  67. new CPUx86.Mov { DestinationReg = CPUx86.Registers.EDI, SourceReg = CPUx86.Registers.EDI, SourceIsIndirect = true, SourceDisplacement = Ldfld.GetFieldOffset(xMethodInfo.MethodBase.DeclaringType, "System.Object System.Delegate._target") };
  68. new CPUx86.Compare { DestinationReg = CPUx86.Registers.EDI, SourceValue = 0 };
  69. new CPUx86.ConditionalJump { Condition = CPUx86.ConditionalTestEnum.Zero, DestinationLabel = ".NO_THIS" };
  70. new CPUx86.Push { DestinationReg = CPUx86.Registers.EDI };
  71. new CPU.Label(".NO_THIS");
  72. new CPU.Comment("make space for us to copy the arguments too");
  73. new CPUx86.Sub { DestinationReg = CPUx86.Registers.ESP, SourceReg = CPUx86.Registers.ECX };
  74. new CPU.Comment("move the current delegate to edi");
  75. new CPUx86.Mov { DestinationReg = CPUx86.Registers.EDI, SourceReg = CPUx86.Registers.EAX, SourceIsIndirect = true };
  76. new CPU.Comment("move the methodptr from that delegate to edi ");
  77. new CPUx86.Mov { DestinationReg = CPUx86.Registers.EDI, SourceReg = CPUx86.Registers.EDI, SourceIsIndirect = true, SourceDisplacement = Ldfld.GetFieldOffset(xMethodInfo.MethodBase.DeclaringType, "System.IntPtr System.Delegate._methodPtr") };//
  78. new CPU.Comment("save methodptr on the stack");
  79. new CPUx86.Push { DestinationReg = CPUx86.Registers.EDI };
  80. new CPU.Comment("move location to copy args to");
  81. new CPUx86.Mov { DestinationReg = CPUx86.Registers.EDI, SourceReg = CPUx86.Registers.ESP };
  82. new CPU.Comment("get above the saved methodptr");
  83. new CPUx86.Add { DestinationReg = CPUx86.Registers.EDI, SourceValue = 4 };
  84. //we allocated the argsize on the stack once, and it we need to get above the original args
  85. new CPU.Comment("we allocated argsize on the stack once");
  86. new CPU.Comment("add 32 for the Pushad + 16 for the current stack + 4 for the return value");
  87. //uint xToAdd = 32; // skip pushad data
  88. //xToAdd += 4; // method pointer
  89. new CPUx86.Mov { DestinationReg = CPUx86.Registers.ESI, SourceReg = CPUx86.Registers.EBP };
  90. new CPUx86.Add { DestinationReg = CPUx86.Registers.ESI, SourceValue = 8 }; // ebp+8 is first argument
  91. new CPUx86.Movs { Size = 8, Prefixes = CPUx86.InstructionPrefixes.Repeat };
  92. new CPUx86.Pop { DestinationReg = CPUx86.Registers.EDI };
  93. new CPUx86.Call { DestinationReg = CPUx86.Registers.EDI };
  94. new CPU.Comment("store return -- return stored into edi after popad");
  95. new CPU.Comment("edi = ptr to delegate object");
  96. new CPUx86.Mov { DestinationReg = CPUx86.Registers.EDI, SourceReg = CPUx86.Registers.EBP, SourceIsIndirect = true, SourceDisplacement = Ldarg.GetArgumentDisplacement(xMethodInfo, 0) };
  97. new CPU.Comment("edi = ptr to delegate object should be a pointer to the delgates context ie (this) for the methods ");
  98. new CPUx86.Mov { DestinationReg = CPUx86.Registers.EDI, SourceReg = CPUx86.Registers.EDI, SourceIsIndirect = true, SourceDisplacement = Ldfld.GetFieldOffset(xMethodInfo.MethodBase.DeclaringType, "System.Object System.Delegate._target") };//i really dont get the +12, MtW: that's for the object header
  99. new CPU.Label(".noTHIStoPop");
  100. new CPUx86.Popad();
  101. new CPUx86.INC { DestinationReg = CPUx86.Registers.EDX };
  102. new CPUx86.Add { DestinationReg = CPUx86.Registers.EAX, SourceValue = 4 };
  103. new CPUx86.Jump { DestinationLabel = ".BEGIN_OF_LOOP" };
  104. new CPU.Label(".END_OF_INVOKE_");
  105. new CPU.Comment("get the return value");
  106. new CPUx86.Mov { DestinationReg = CPUx86.Registers.EDX, SourceReg = CPUx86.Registers.EBP, SourceIsIndirect = true, SourceDisplacement = Ldarg.GetArgumentDisplacement(xMethodInfo, 0) };//addrof the delegate
  107. new CPUx86.Mov { DestinationReg = CPUx86.Registers.EDX, SourceReg = CPUx86.Registers.EDX, SourceIsIndirect = true, SourceDisplacement = Ldfld.GetFieldOffset(xMethodInfo.MethodBase.DeclaringType, "$$ReturnsValue$$") };
  108. new CPUx86.Compare { DestinationReg = CPUx86.Registers.EDX, SourceValue = 0 };
  109. new CPUx86.ConditionalJump { Condition = CPUx86.ConditionalTestEnum.Equal, DestinationLabel = ".noReturn" };
  110. //may have to expand the return... idk
  111. new CPUx86.Xchg { DestinationReg = CPUx86.Registers.EBP, DestinationIsIndirect = true, DestinationDisplacement = 8, SourceReg = CPUx86.Registers.EDX };
  112. new CPUx86.Xchg { DestinationReg = CPUx86.Registers.EBP, DestinationIsIndirect = true, DestinationDisplacement = 4, SourceReg = CPUx86.Registers.EDX };
  113. new CPUx86.Xchg { DestinationReg = CPUx86.Registers.EBP, DestinationIsIndirect = true, SourceReg = CPUx86.Registers.EDX };
  114. new CPUx86.Push { DestinationReg = CPUx86.Registers.EDX };//ebp
  115. new CPUx86.Mov { DestinationReg = CPUx86.Registers.ESP, DestinationIsIndirect = true, DestinationDisplacement = 12, SourceReg = CPUx86.Registers.EDI };
  116. new CPU.Label(".noReturn");
  117. new CPUx86.Sti();
  118. }
  119. #region OLD attempt
  120. // public override void AssembleNew(Cosmos.Assembler.Assembler aAssembler, object aMethodInfo) {
  121. // new CPUx86.Xchg { DestinationReg = CPUx86.Registers.BX, SourceReg = CPUx86.Registers.BX, Size = 16 };
  122. // new CPUx86.Noop();
  123. // var xAssembler = (CosmosAssembler)aAssembler;
  124. // var xMethodInfo = (Cosmos.IL2CPU.MethodInfo)aMethodInfo;
  125. // var xMethodBaseAsInfo = xMethodInfo.MethodBase as global::System.Reflection.MethodInfo;
  126. // if (xMethodBaseAsInfo.ReturnType != typeof(void)) {
  127. // throw new Exception("Events with return type not yet supported!");
  128. // }
  129. // new Comment("XXXXXXX");
  130. // //new CPUx86.Halt();
  131. // // param 0 is instance of eventhandler
  132. // // param 1 is sender
  133. // // param 2 is eventargs
  134. // //Ldarg.Ldfld(aAssembler, aMethodInfo.TypeInfo, "System.Object System.Delegate._target");
  135. // //new Label(".LoadMethodParams");
  136. // //for (int i = 1; i < aMethodInfo.Arguments.Length; i++) {
  137. // // Ldarg.Ldarg(aAssembler, aMethodInfo.Arguments[i]);
  138. // //}
  139. // //new Label(".LoadMethodPointer");
  140. // //Ldarg.Ldarg(aAssembler, aMethodInfo.Arguments[0]);
  141. // //Ldarg.Ldfld(aAssembler, aMethodInfo.TypeInfo, "System.IntPtr System.Delegate._methodPtr");
  142. // //new CPUx86.Pop("eax");
  143. // //new CPUx86.Call(CPUx86.Registers_Old.EAX);
  144. // //new CPUx86.Add("esp",
  145. // // "4");
  146. // /*
  147. // * EAX contains the GetInvocationList() array at the index at which it was last used
  148. // * EDX contains the index at which the EAX is
  149. // * EBX contains the number of items in the array
  150. // * ECX contains the argument size
  151. // */
  152. // //new CPU.Label("____DEBUG_FOR_MULTICAST___");
  153. // // new CPUx86.Cli();//DEBUG ONLY
  154. // new CPU.Comment("push address of delgate to stack");
  155. // Ldarg.DoExecute(xAssembler, xMethodInfo, 0);
  156. // var xGetInvocationListMethod = typeof(MulticastDelegate).GetMethod("GetInvocationList");
  157. // new CPUx86.Call { DestinationLabel = CPU.MethodInfoLabelGenerator.GenerateLabelName(xGetInvocationListMethod) };
  158. // new CPU.Comment("get address from return value -> eax");
  159. // new CPUx86.Pop { DestinationReg = CPUx86.Registers.EAX };
  160. // ;//list
  161. // new CPU.Comment("eax+=8 is where the offset where an array's count is");
  162. // new CPUx86.Add { DestinationReg = CPUx86.Registers.EAX, SourceValue = 8 };//addrof list.count??
  163. // new CPU.Comment("store count in ebx");
  164. // new CPUx86.Move { DestinationReg = CPUx86.Registers.EBX, SourceReg = CPUx86.Registers.EAX, SourceIsIndirect = true };//list.count
  165. // new CPU.Comment("eax+=8 is where the offset where an array's items start");
  166. // new CPUx86.Add { DestinationReg = CPUx86.Registers.EAX, SourceValue = 8 };//why? -- start of list i think? MtW: the array's .Length is at +8
  167. // new CPUx86.Move { DestinationReg = CPUx86.Registers.EDI, SourceValue = 0 };
  168. // new CPU.Comment("ecx = ptr to delegate object");
  169. //// Ldarg.DoExecute(xAssembler, xMethodInfo, 0);
  170. // new CPUx86.Push { DestinationReg = CPUx86.Registers.EAX };
  171. // // make ecx point to the size of arguments
  172. // Ldarg.DoExecute(xAssembler, xMethodInfo, 0);
  173. // Ldfld.DoExecute(xAssembler, xMethodInfo.MethodBase.DeclaringType, "$$ArgSize$$");
  174. // new CPUx86.Pop { DestinationReg = CPUx86.Registers.ECX };
  175. // new CPUx86.Pop { DestinationReg = CPUx86.Registers.EAX };
  176. // new CPU.Comment("ecx points to the size of the delegated methods arguments");
  177. // new CPUx86.Xor { DestinationReg = CPUx86.Registers.EDX, SourceReg = CPUx86.Registers.EDX };
  178. // ;//make sure edx is 0
  179. // new CPU.Label(".BEGIN_OF_LOOP");
  180. // new CPUx86.Compare { DestinationReg = CPUx86.Registers.EDX, SourceReg = CPUx86.Registers.EBX };//are we at the end of this list
  181. // new CPUx86.ConditionalJump { Condition = CPUx86.ConditionalTestEnum.Equal, DestinationLabel = ".END_OF_INVOKE_" };//then we better stop
  182. // //new CPUx86.Compare("edx", 0);
  183. // //new CPUx86.JumpIfLessOrEqual(".noreturnYet");
  184. // //new CPUx86.Add("esp", 4);
  185. // //new CPU.Label(".noreturnYet");
  186. // //new CPU.Comment("space for the return value");
  187. // //new CPUx86.Pushd("0");
  188. // new CPUx86.Pushad();
  189. // new CPU.Comment("esi points to where we will copy the methods arguments from");
  190. // new CPUx86.Move { DestinationReg = CPUx86.Registers.ESI, SourceReg = CPUx86.Registers.ESP };
  191. // new CPU.Comment("edi = ptr to delegate object");
  192. // new CPUx86.Pushad();
  193. // Ldarg.DoExecute(xAssembler, xMethodInfo, 0);
  194. // Ldfld.DoExecute(xAssembler, xMethodInfo.MethodBase.DeclaringType, "System.Object System.Delegate._target");
  195. // new CPUx86.Pop { DestinationReg = CPUx86.Registers.EDI };
  196. // new CPUx86.Popad();
  197. // new CPUx86.Compare { DestinationReg = CPUx86.Registers.EDI, SourceValue = 0 };
  198. // new CPUx86.ConditionalJump { Condition = CPUx86.ConditionalTestEnum.Zero, DestinationLabel = ".NO_THIS" };
  199. // new CPUx86.Push { DestinationReg = CPUx86.Registers.EDI };
  200. // new CPU.Label(".NO_THIS");
  201. // new CPU.Comment("make space for us to copy the arguments too");
  202. // new CPUx86.Sub { DestinationReg = CPUx86.Registers.ESP, SourceReg = CPUx86.Registers.EBX };
  203. // new CPU.Comment("move the current delegate to edi");
  204. // new CPUx86.Move { DestinationReg = CPUx86.Registers.EDI, SourceReg = CPUx86.Registers.EAX, SourceIsIndirect = true };
  205. // new CPU.Comment("move the methodptr from that delegate to the stack ");
  206. // new CPUx86.Pushad();
  207. // Ldarg.DoExecute(xAssembler, xMethodInfo, 0);
  208. // Ldfld.DoExecute(xAssembler, xMethodInfo.MethodBase.DeclaringType, "System.IntPtr System.Delegate._methodPtr");
  209. // new CPUx86.Move { DestinationReg = CPUx86.Registers.EDI, SourceReg = CPUx86.Registers.ESP };
  210. // new CPU.Comment("get above the saved methodptr");
  211. // new CPUx86.Add { DestinationReg = CPUx86.Registers.EDI, SourceValue = 4 };
  212. // //we allocated the argsize on the stack once, and it we need to get above the original args
  213. // new CPU.Comment("we allocated argsize on the stack once");
  214. // new CPU.Comment("add 32 for the Pushad + 16 for the current stack + 4 for the return value");
  215. // new CPUx86.Add { DestinationReg = CPUx86.Registers.ESI, SourceValue = 52 };
  216. // new CPUx86.Movs { Size = 8, Prefixes = CPUx86.InstructionPrefixes.Repeat };
  217. // new CPUx86.Pop { DestinationReg = CPUx86.Registers.EDI };
  218. // new CPUx86.Call { DestinationReg = CPUx86.Registers.EDI };
  219. // new CPU.Comment("store return -- return stored into edi after popad");
  220. // //new CPUx86.Move("edx", "[" + MethodInfo.Arguments[0].VirtualAddresses[0] + "]");//addrof the delegate
  221. // //new CPUx86.Move("edx", "[edx+" + (MethodInfo.Arguments[0].TypeInfo.Fields["$$ReturnsValue$$"].Offset + 12) + "]");
  222. // //new CPUx86.Compare(Registers_Old.EDX, 0);
  223. // //new CPUx86.JumpIfEqual(".getReturn");
  224. // //new CPUx86.Move(Registers_Old.EAX, "[esp]");
  225. // //new CPUx86.Move("[esp+0x20]", Registers_Old.EAX);
  226. // //new CPU.Label(".getReturn");
  227. // Ldarg.DoExecute(xAssembler, xMethodInfo, 0);
  228. // Ldfld.DoExecute(xAssembler, xMethodInfo.MethodBase.DeclaringType, "System.Object System.Delegate._target");
  229. // // edi contains $this now
  230. // new CPUx86.Pop { DestinationReg = CPUx86.Registers.EDI };
  231. // //new CPUx86.Compare ("edi", "0");
  232. // //new CPUx86.JumpIfEqual(".noTHIStoPop");
  233. // //new CPUx86.Move("edx", "[" + MethodInfo.Arguments[0].VirtualAddresses[0] + "]");//addrof the delegate
  234. // //new CPUx86.Move("edx", "[edx+" + (MethodInfo.Arguments[0].TypeInfo.Fields["$$ReturnsValue$$"].Offset + 12) + "]");
  235. // //new CPUx86.Compare(Registers_Old.EDX, 0);
  236. // //new JumpIfNotEqual(".needToPopThis");
  237. // //new CPU.Comment("ecx = ptr to delegate object");
  238. // //new CPUx86.Move("ecx", "[" + MethodInfo.Arguments[0].VirtualAddresses[0] + "]");//addrof the delegate
  239. // //new CPU.Comment("ecx points to the size of the delegated methods arguments");
  240. // //new CPUx86.Move("ecx", "[ecx + " + (MethodInfo.Arguments[0].TypeInfo.Fields["$$ArgSize$$"].Offset + 12) + "]");//the size of the arguments to the method? + 12??? -- 12 is the size of the current call stack.. i think
  241. // //new CPUx86.Compare("ecx", "0");
  242. // //new CPUx86.JumpIfLessOrEqual(".noTHIStoPop");
  243. // //new CPU.Label(".needToPopThis");
  244. // //new CPUx86.Pop("edi");
  245. // //new CPUx86.Move("[esp]", "edi");
  246. // new CPU.Label(".noTHIStoPop");
  247. // new CPUx86.Popad();
  248. // new CPUx86.Inc { DestinationReg = CPUx86.Registers.EDX };
  249. // new CPUx86.Add { DestinationReg = CPUx86.Registers.EAX, SourceValue = 4 };
  250. // new CPUx86.Jump { DestinationLabel = ".BEGIN_OF_LOOP" };
  251. // new CPU.Label(".END_OF_INVOKE_");
  252. // new CPU.Comment("get the return value");
  253. // // TEMP!!!
  254. // // new CPUx86.Add { DestinationReg = CPUx86.Registers.ESP, SourceValue = 4 };
  255. // // END OF TEMP!!
  256. // //new CPUx86.Pop("eax");
  257. // //Ldarg.DoExecute(xAssembler, xMethodInfo, 0);
  258. // //Ldfld.DoExecute(xAssembler, xMethodInfo.MethodBase.DeclaringType, "$$ReturnsValue$$");
  259. // //new CPUx86.Pop { DestinationReg = CPUx86.Registers.EDX };
  260. // //if(xMethodInfo.
  261. // //new CPUx86.Compare { DestinationReg = CPUx86.Registers.EDX, SourceValue = 0 };
  262. // //new CPUx86.ConditionalJump { Condition = CPUx86.ConditionalTestEnum.Equal, DestinationLabel = ".noReturn" };
  263. // ////may have to expand the return... idk
  264. // //new CPUx86.Xchg { DestinationReg = CPUx86.Registers.EBP, DestinationIsIndirect = true, DestinationDisplacement = 8, SourceReg = CPUx86.Registers.EDX };
  265. // //new CPUx86.Xchg { DestinationReg = CPUx86.Registers.EBP, DestinationIsIndirect = true, DestinationDisplacement = 4, SourceReg = CPUx86.Registers.EDX };
  266. // //new CPUx86.Xchg { DestinationReg = CPUx86.Registers.EBP, DestinationIsIndirect = true, SourceReg = CPUx86.Registers.EDX };
  267. // //new CPUx86.Push { DestinationReg = CPUx86.Registers.EDX };//ebp
  268. // //new CPUx86.Move { DestinationReg = CPUx86.Registers.ESP, DestinationIsIndirect = true, DestinationDisplacement = 12, SourceReg = CPUx86.Registers.EDI };
  269. // new CPU.Label(".noReturn");
  270. // // new CPUx86.Sti();
  271. // //#warning remove this ^ sti call when issue is fixed!!!
  272. // //MethodInfo.Arguments[0].
  273. // // new CPUx86.Move("ebx", "[eax + " + (MethodInfo.Arguments[0].TypeInfo.Fields["$$ArgSize$$"].Offset + 12) + "]");
  274. // //new CPUx86.Move("eax", CPUx86.Registers_Old.
  275. // //var xGetInvocationListMethod = typeof(MulticastDelegate).GetMethod("GetInvocationList");
  276. // //xGetInvocationListMethod = typeof(Delegate).GetMethod("GetInvocationList");
  277. // // new CPUx86.Pop(CPUx86.Registers_Old.EAX);
  278. // //new CPUx86.Move("esp", "ebp");
  279. // //new CPUx86.Push {
  280. // // DestinationRef = Cosmos.Assembler.ElementReference.New(LdStr.GetContentsArrayName("Events not yet implemented"))
  281. // //};
  282. // //new CPUx86.Call {
  283. // // DestinationLabel = MethodInfoLabelGenerator.GenerateLabelName(typeof(ExceptionHelper).GetMethod("ThrowNotImplemented", BindingFlags.Static | BindingFlags.Public))
  284. // //};
  285. // // throw new NotImplementedException();
  286. // }
  287. #endregion
  288. }
  289. }